28 Commits

Author SHA1 Message Date
norris%netscape.com
376d6feeba Fix bug 323696 "js12: unimplemented bytecode error in switch test"
Rename js_ResetCodeGenerator to js_FinishCodeGenerator to indicate that
js_InitCodeGenerator must be called after finish before it can be reused.


git-svn-id: svn://10.0.0.236/trunk@10577 18797224-902f-48f8-a5cc-f745e15eee43
1998-09-21 17:17:26 +00:00
norris%netscape.com
8105e6a166 Fix 312954 "monkey: on HPUX, special case failure when dividing by -0"
git-svn-id: svn://10.0.0.236/trunk@9751 18797224-902f-48f8-a5cc-f745e15eee43
1998-09-10 20:27:16 +00:00
brendan%netscape.com
efc54c518a - Added commentary for TOK_DEFSHARP nodes explaining pn_kid's purpose.
- Don't over-commend nearby #endifs at the expense of legibility.


git-svn-id: svn://10.0.0.236/trunk@9750 18797224-902f-48f8-a5cc-f745e15eee43
1998-09-10 20:13:06 +00:00
brendan%netscape.com
5867a55bdc Need to prevent GC activation during compile on the compiling context, not
just when evaluating old-style switch case expressions.


git-svn-id: svn://10.0.0.236/trunk@9726 18797224-902f-48f8-a5cc-f745e15eee43
1998-09-10 07:09:44 +00:00
brendan%netscape.com
12a9d81b7f js.c jsemit.c jsemit.h jsgc.c jsinterp.c jsopcode.c jsopcode.def
- Switch improvements:
  - JSOP_CONDSWITCH is a 1 byte nop, not variable length with the same kind
    of immediate operand as JSOP_LOOKUPSWITCH (which is useless except for
    decompilation).  New scheme uses SRC_COMMA notes on each JSOP_CASE opcode,
    usually 2 bytes per note, and a typically-1-byte 2nd offset on SRC_SWITCH:
      1 + 2 * ncases
    vs. the previous JSOP_LOOKUPSWITCH immediate, which consumed:
      4 * ncases
    bytes after the switch opcode just for decompilation.
  - SRC_SWITCH has two offsets, first to end of switch as before, the second
    to first case if JSOP_CONDSWITCH, for decompilation.
  - Optimize switches with all-constant cases using JSOP_TABLESWITH, or if
    that can't be used, JSOP_LOOKUPSWITCH, before falling back on ECMAv2's
    JSOP_CONDSWITCH.
  - Use cx->gcDisabled when evaluating case exprs at compile time for old,
    pre-ECMAv2 switches, to prevent branch-callback-based GC invocations
    from ripping apart the unrooted temporary script for each case expr.
  - Fixed up stale SRC_SWITCH comments in jsemit.h.

jsemit.c jsemit.h
  - TREE_CONTEXT_INIT to match ATOM_LIST_INIT, not English word order.
  - Reorganized JSCodeGenerator to sort of match argument order to
    js_InitCodeGenerator.
  - Got rid of confusing CG_RESET* macros and used memset(cg, 0, sizeof *cg)
    and non-zero-default init in js_InitCodeGenerator.  js_ResetCodeGenerator
    just releases the code and temp arena pools and leaves the cg in a state
    where it must be re-initialized (as before, but more obvious).
  - In the same spirit, don't do partial "resets" or src and trynotes in their
    js_FinishTaking*Notes functions -- those are friends of jsscript.c and are
    not general, idempotent functions.

jsapi.c jsapi.h jsarray.c jsatom.c jsatom.h jscntxt.c jsemit.c jsmsg.def
jsnum.c jsobj.c jsopcode.c jsregexp.c jsscan.c jsstr.c jsxdrapi.
  - Use PR_snprintf rather than sprintf always, so we don't have to worry
    about systems with 64-bit longs that overflow 12-byte buffers and open
    Morris-Worm-type security holes.
  - Trim extra spaces, fix hanging indentation, and similar anal retention.
  - Renamed JSMSG_BAD_PROTO_SORT to JSMSG_BAD_SORT_ARG cuz that's what it
    is complaining about.
  - SRC_CATCHGUARD still lived in comments, but it's SRC_CATCH in code.

jscntxt.c jscntxt.h jsinterp.c
  - Packed nearby JSPackedBools and added a new one: gcDisabled, for use by
    jsemit.c's pre-ECMAv2 switch case expr eval.
  - Rip out old js_InterpreterHooks stuff from original liveconnect (moja).
  - Remove javaData and savedErrors from JSContext.  Leaving it to fur or
    shaver to remove javaData from jsscript.h.


git-svn-id: svn://10.0.0.236/trunk@9475 18797224-902f-48f8-a5cc-f745e15eee43
1998-09-08 05:39:51 +00:00
brendan%netscape.com
828b802387 Remove '(balance' comments, fix hanging indents, other nits.
git-svn-id: svn://10.0.0.236/trunk@9458 18797224-902f-48f8-a5cc-f745e15eee43
1998-09-06 19:23:06 +00:00
rogerl%netscape.com
112983b87d New errorNumber handling
git-svn-id: svn://10.0.0.236/trunk@9230 18797224-902f-48f8-a5cc-f745e15eee43
1998-09-03 20:29:37 +00:00
mccabe%netscape.com
a7b8207a95 Further runtime error work... expose many new errors as catchable
exceptions.  Mostly syntax errors, so far.  Fixed missing #if
JS_HAS_ERROR_EXCEPTIONS


git-svn-id: svn://10.0.0.236/trunk@8856 18797224-902f-48f8-a5cc-f745e15eee43
1998-08-31 09:49:43 +00:00
mccabe%netscape.com
ac4f37b0a5 Propagate lots 'o work from the development branch.
Including:

Preliminary work on internationalizing error messages

Preliminary work on exposing runtime errors as catchable exceptions

ECMA-proposed throw and try/catch/finally, with multiple catch clauses
and catchguards

ECMA-proposed in/instanceof operators

IEEE-conformant number to string conversion

Fixes and other good stuff.


git-svn-id: svn://10.0.0.236/trunk@8770 18797224-902f-48f8-a5cc-f745e15eee43
1998-08-29 00:38:43 +00:00
brendan%netscape.com
6d7164c0d9 Propagate js/src back-out of fur's incompatible closure version-check mod.
git-svn-id: svn://10.0.0.236/trunk@8436 18797224-902f-48f8-a5cc-f745e15eee43
1998-08-25 08:21:55 +00:00
brendan%netscape.com
7d61af5201 Fix nits.
git-svn-id: svn://10.0.0.236/trunk@8434 18797224-902f-48f8-a5cc-f745e15eee43
1998-08-25 07:56:42 +00:00
mccabe%netscape.com
5dce40da3b Propagating work and bug fixes from
development branch:

- Preliminary exception handling per
ECMA proposal; try, multiple
catchblocks, and finally.  Catchblocks
are of the form catch (v) or
catch(v:<guard>), where guard is an
optional boolean expression that is
evaluated to determine whether the
exception is to be caught by that block.

- ECMA-proposed 'in' operator; "'foo' in
o" or "4 in o" asks if o has property
foo or element 4.

- Added a new set of defines in
jsconfig.h for js 1.4
features-in-progress.  (in, instanceof,
exception handling.)  Default build
version is now 1.4.  Fixed a few
conditional features that had become
broken.

- Progress towards porting to FreeBSD
and Alpha; casts of NaN and friends to
int are a little more localized.  Not
there yet...

- New config files to compile on more
OSes; various fixes to improve
portability.


git-svn-id: svn://10.0.0.236/trunk@6905 18797224-902f-48f8-a5cc-f745e15eee43
1998-07-30 23:46:29 +00:00
mccabe%netscape.com
2320e36eef added some more #if JS_HAS_SHARP_VARS checks so towards compiliation
under version 120 in jsconfig.h.  Other fixes needed, though...


git-svn-id: svn://10.0.0.236/trunk@5848 18797224-902f-48f8-a5cc-f745e15eee43
1998-07-17 21:18:41 +00:00
mccabe%netscape.com
005974ff02 Fixed #ifdef to #if for various features defined in jsconfig.h -
JS_HAS_IN_OPERATOR, and JS_HAS_INITIALIZERS.


git-svn-id: svn://10.0.0.236/trunk@5839 18797224-902f-48f8-a5cc-f745e15eee43
1998-07-17 20:46:12 +00:00
mccabe%netscape.com
24714d3ec7 Modified grammar for for/in and the in operator to exclude parsing the
'in' keyword as an operator in the init clause of for loops; this
disambiguates for/in loop parsing.  (Previously, there was some
treenode examination magic going on.)  Per recent ECMA submission.


git-svn-id: svn://10.0.0.236/trunk@5784 18797224-902f-48f8-a5cc-f745e15eee43
1998-07-17 02:56:04 +00:00
brendan
cc6ce74501 - Remove duplicate error fprintf from js.c:Load.
- Revise exception handling runtime info (now called trynotes a la srcnotes)
  for more efficient loop control under JSOP_THROW.  Avoid all uses of catch
  and throw while at it, to make C++ lusers happy.
- Combine JSStackFrame.exception with rval, and rename
  JSStackFrame.exceptPending to be ...throwing.
- Optimize JS_TypeOfValue a bit.
- Name, control flow, whitespace, etc. cleanup.


git-svn-id: svn://10.0.0.236/trunk@4772 18797224-902f-48f8-a5cc-f745e15eee43
1998-07-01 02:12:45 +00:00
fur
a572d8d419 Allow closures when the JS version is JSVERSION_DEFAULT.
git-svn-id: svn://10.0.0.236/trunk@4395 18797224-902f-48f8-a5cc-f745e15eee43
1998-06-24 05:37:44 +00:00
norris
a43d7627c5 (Not part of Communicator build.)
Fix crash occurring on most tests, nits from brendan code review.


git-svn-id: svn://10.0.0.236/trunk@4228 18797224-902f-48f8-a5cc-f745e15eee43
1998-06-22 17:53:05 +00:00
norris
35c260396c (Not part of Communicator build.)
Fix 123724 hippo: problems declaring var in an eval statement
This ended up being more complex than I initially thought it would be.
See comments in jsparse.c.


git-svn-id: svn://10.0.0.236/trunk@4164 18797224-902f-48f8-a5cc-f745e15eee43
1998-06-19 21:52:14 +00:00
norris
6c4178b690 (Not part of Communicator build.)
This comment is for checkin of version 1.8: mistakenly gave wrong comment
for that version.
Fix 123724 hippo: problems declaring var in an eval statement
The problem was that Variable() in jsparse.c used the scope from calling
js_FindVariableScope to determine whether or not to convert the operator
to GETVAR, but LookupArgOrVar did not. This caused a mismatched set and
get in the code generated from the eval script due to the presence of the
var in the function frame.


git-svn-id: svn://10.0.0.236/trunk@4031 18797224-902f-48f8-a5cc-f745e15eee43
1998-06-18 00:11:51 +00:00
norris
ccc7a613b2 (Not part of Communicator build.)
More functionality for debug print functions.


git-svn-id: svn://10.0.0.236/trunk@4030 18797224-902f-48f8-a5cc-f745e15eee43
1998-06-18 00:04:38 +00:00
brendan
6a22adee5c - Fix function in with statement to form a closure with the right scope chain
on activation (120172, mlm).
- Use #ifdef CHECK_RETURN_EXPR to hide CheckFinalReturn as well as its calls.
- 80th column tyranny, typedef symmetry, other cosmetics.


git-svn-id: svn://10.0.0.236/trunk@3992 18797224-902f-48f8-a5cc-f745e15eee43
1998-06-17 19:37:53 +00:00
norris
b44d1646cf Fix bug 104191 "ECMA: multiple params w/ same name":
Decompiling "function f(a,b,a) { ... }" would only print two parameters.


git-svn-id: svn://10.0.0.236/trunk@3519 18797224-902f-48f8-a5cc-f745e15eee43
1998-06-08 23:41:54 +00:00
waldemar
24465967b0 Fixed bugs 76103 and 122787: parsing of new-expressions
git-svn-id: svn://10.0.0.236/trunk@2902 18797224-902f-48f8-a5cc-f745e15eee43
1998-06-02 01:54:31 +00:00
fur
76813139a0 Merge several bug fixes from client 4.1 branch
git-svn-id: svn://10.0.0.236/trunk@2791 18797224-902f-48f8-a5cc-f745e15eee43
1998-06-01 00:31:59 +00:00
mccabe
6c9a40d28d Fixed error message associated with trying to use a keyword as an
identifier; it was only printing the first character of the
identifier, because it expected 8-bit chars, and was being called with
a 16-bit representation of the offending keyword.


git-svn-id: svn://10.0.0.236/trunk@880 18797224-902f-48f8-a5cc-f745e15eee43
1998-04-29 23:52:40 +00:00
fur
2d2471a609 Eliminate non-ECMA warnings about lack of return value
git-svn-id: svn://10.0.0.236/trunk@605 18797224-902f-48f8-a5cc-f745e15eee43
1998-04-24 17:56:47 +00:00
fur
dffbf084ac (This code is not built by any flavor of Navigator)
Initial check-in to mozilla tree: JSRef development is migrating from
JSFUN13_BRANCH of /m/src repository to /m/pub


git-svn-id: svn://10.0.0.236/trunk@582 18797224-902f-48f8-a5cc-f745e15eee43
1998-04-24 01:35:13 +00:00