Граф коммитов

24 Коммитов

Автор SHA1 Сообщение Дата
norris%netscape.com a8d7c15011 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.
1998-09-21 17:17:26 +00:00
mccabe%netscape.com 8257eac38e Propagate mcafee compile-warning fixes from js/src. 1998-09-17 23:48:20 +00:00
rogerl%netscape.com 46f5ffb26f Fixed bug #316293; when break was very first statement in a loop it wasn't
getting patched and so looped for ever.
1998-09-14 22:33:19 +00:00
brendan%netscape.com f1dc01ae5b - Fix js_AllocTryNotes to track how much space has been allocated from tempPool
for trynotes in the current code generator, and grow that space as needed.
- Avoid dividing by a multiple of 3 (JSTryNote is 3 ptrdiff_t's) via (char *)
  arithmetic.
1998-09-11 09:25:15 +00:00
brendan%netscape.com a8df12702b Remove excessive JS_FRIEND_API uses; clean up nits. 1998-09-10 19:18:23 +00:00
shaver%netscape.com 92bca3301d clean up old assertions and remove vestigial tryLimit 1998-09-10 17:45:37 +00:00
brendan%netscape.com fa72057162 Need to prevent GC activation during compile on the compiling context, not
just when evaluating old-style switch case expressions.
1998-09-10 07:09:44 +00:00
brendan%netscape.com 9b12b81ef6 Now that SRC_COMMA has been renamed to reflect its generality (SRC_PCDELTA),
and more important, to save a byte of useless note offset, use SRC_CONTINUE
instead of SRC_PCDELTA to annotate JSOP_ENDINIT when there's an extra comma
at the end of an array literal (e.g. [1,2,,]).
1998-09-09 19:18:01 +00:00
brendan%netscape.com 0ef0c706ae Renamed SRC_COMMA to SRC_PCDELTA and fixed related comments. 1998-09-09 02:16:19 +00:00
brendan%netscape.com 89d641ff37 Don't emit two SRC_HIDDENs in a row. 1998-09-08 18:26:37 +00:00
brendan%netscape.com aeb3f1e6b9 Oops! How did that ever work on my Win32 build? 1998-09-08 05:49:12 +00:00
brendan%netscape.com 347aaac8d3 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.
1998-09-08 05:39:51 +00:00
brendan%netscape.com 310fe6513e - Use consistent spelling in the API: "Callback" not "CallBack" -- it's a one
word neologism, not two words.
- Use consistent neighboring terseness ("error" rather than "err" in intercaps
  identifiers).
- Don't leave pointers in JSErrorReport to freed memory if bailing on OOM in
  jscntxt.c:js_ExpandErrorArguments.
- Hanging indentation, code fusion via continue, and other misc. cleanups.
1998-09-06 08:07:35 +00:00
norris%netscape.com 984ac268fd Add support for ECMA switch statements. These are like LISP cond in that they
evaluate the case label each time.
Still to do is to optimize so that TABLESWITCH and LOOKUPSWITCH are created
when possible.
1998-09-04 00:45:21 +00:00
rogerl%netscape.com 6b0757f6fe New errorNumber handling 1998-09-03 20:29:37 +00:00
mccabe%netscape.com 845c56005f 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.
1998-08-29 00:38:43 +00:00
brendan%netscape.com 84f02d394d Fix typos, white-space, and layout style nits. 1998-08-25 08:22:27 +00:00
mccabe%netscape.com 7596bde975 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.
1998-07-30 23:46:29 +00:00
mccabe 0d458b9d77 Changed the definition of JSDOUBLE_IS_INT(d, i) to delay a (jsint)d
cast until after the double in question has been determined to be
finite, not NaN, etc.  This may make the code a little more XP for
platforms like BSD and Alpha Linux that don't like casting strange
values to int.  Thanks go to Uncle George <gatgul@voicenet.com> and
hankin <hankin@consultco.com> for their porting work.
1998-07-08 07:56:43 +00:00
brendan 733ea0c9f5 - 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.
1998-07-01 02:12:45 +00:00
mlm ca4706a898 - Merge with 4.06 sources: Add another byte to source numbering so that
scripts that start on lines >32K still work.
- Fix is from fur
1998-06-23 02:32:45 +00:00
norris 389e7da848 (Not part of Communicator build.)
Change C++ keyword "catch" (and Java keyword "finally" for good measure)
to other identifiers to help out embedders calling JS from C++.
1998-06-18 23:43:51 +00:00
fur 48ee6259d3 Merge several bug fixes from client 4.1 branch 1998-06-01 00:31:59 +00:00
fur 6b433caaaa (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
1998-04-24 01:35:13 +00:00