41 Commits

Author SHA1 Message Date
brendan%mozilla.org
9c307e16dc Support generator expressions for JS1.8 (380237, r=mrbkap).
git-svn-id: svn://10.0.0.236/trunk@226595 18797224-902f-48f8-a5cc-f745e15eee43
2007-05-18 01:41:17 +00:00
brendan%mozilla.org
7991ccd56e Rename strict equality ops (cleanup pre-patch for 363536, r=igor).
git-svn-id: svn://10.0.0.236/trunk@217234 18797224-902f-48f8-a5cc-f745e15eee43
2006-12-20 08:12:18 +00:00
brendan%mozilla.org
543e5891d9 Prep patch for 'plan A' (346642, r=mrbkap).
git-svn-id: svn://10.0.0.236/trunk@211917 18797224-902f-48f8-a5cc-f745e15eee43
2006-09-18 11:04:30 +00:00
brendan%mozilla.org
ec8c177ea4 Fix decompilation to preserve braces required by let, and also fix switch body block to have scope for let at top level of case statement (349634, r=mrbkap).
git-svn-id: svn://10.0.0.236/trunk@209421 18797224-902f-48f8-a5cc-f745e15eee43
2006-09-08 05:03:54 +00:00
brendan%mozilla.org
cfcef5ecbd Fix array comprehension code gen bug that broke constant folding (349653, r=mrbkap).
git-svn-id: svn://10.0.0.236/trunk@208974 18797224-902f-48f8-a5cc-f745e15eee43
2006-09-01 06:16:14 +00:00
brendan%mozilla.org
63802ab69d Destructuring catch variables, plus TOK_LEXICALSCOPE cleanup (336379, r=mrbkap).
git-svn-id: svn://10.0.0.236/trunk@207711 18797224-902f-48f8-a5cc-f745e15eee43
2006-08-17 08:13:18 +00:00
brendan%mozilla.org
ec020514bd Change catch clauses to use lexical scope, etc. (336379, r=mrbkap).
git-svn-id: svn://10.0.0.236/trunk@207546 18797224-902f-48f8-a5cc-f745e15eee43
2006-08-16 05:01:14 +00:00
brendan%mozilla.org
01d8f43d47 Backing out yet again, another latent bug bites.
git-svn-id: svn://10.0.0.236/trunk@207426 18797224-902f-48f8-a5cc-f745e15eee43
2006-08-15 07:39:01 +00:00
brendan%mozilla.org
208e581b5d Change catch clauses to use lexical scope, etc. (336379, r=mrbkap).
git-svn-id: svn://10.0.0.236/trunk@207423 18797224-902f-48f8-a5cc-f745e15eee43
2006-08-15 07:03:14 +00:00
brendan%mozilla.org
7dd2751681 Back out last change for now, it ran into a latent block XDR bug.
git-svn-id: svn://10.0.0.236/trunk@207413 18797224-902f-48f8-a5cc-f745e15eee43
2006-08-15 03:51:23 +00:00
brendan%mozilla.org
08081ef816 Change catch clauses to use lexical scope, etc. (336379, r=mrbkap).
git-svn-id: svn://10.0.0.236/trunk@207404 18797224-902f-48f8-a5cc-f745e15eee43
2006-08-15 01:29:37 +00:00
brendan%mozilla.org
0e7750c08e Revise try/catch/finally AST to pave way for block scope and destructuring (336379, r=mrbkap).
git-svn-id: svn://10.0.0.236/trunk@207193 18797224-902f-48f8-a5cc-f745e15eee43
2006-08-11 23:26:18 +00:00
brendan%mozilla.org
0a940b7247 JS_1_7_ALPHA_BRANCH landing, mainly destructuring optimizations and let completion (336373, r=mrbkap).
git-svn-id: svn://10.0.0.236/trunk@201636 18797224-902f-48f8-a5cc-f745e15eee43
2006-07-06 01:25:44 +00:00
brendan%mozilla.org
2fb9f8c051 First big wave of js1.7 changes (326466, 336376, r=mrbkap).
git-svn-id: svn://10.0.0.236/trunk@198099 18797224-902f-48f8-a5cc-f745e15eee43
2006-05-20 22:27:28 +00:00
brendan%mozilla.org
036b7c131b E4X, configured off, code-complete.
git-svn-id: svn://10.0.0.236/trunk@165420 18797224-902f-48f8-a5cc-f745e15eee43
2004-11-17 07:43:01 +00:00
brendan%mozilla.org
e1d64a36be Initial E4X check-in, configured off (246441, rs=shaver).
git-svn-id: svn://10.0.0.236/trunk@163236 18797224-902f-48f8-a5cc-f745e15eee43
2004-10-05 10:19:07 +00:00
brendan%mozilla.org
340570a787 - Decorate PN_LIST nodes with pn_extra flags whose constant names describe
their meaning better, adding a flag for 'for (var x ... in o)'.
- Set these flags from the parser, in a future-proof way (|=, not =, given the
  zero initialized pn_extra flags member of pn_list).
- Test list flags in the code generator, including PNX_FORINVAR in conjunction
  with whether the for..in loop is of the oddball form 'for (var x = i in o)'.
- Thereby fix failure to emit a JSOP_DEFVAR in the case that a function wraps
  a for..in loop in a with statement (252892, r=shaver).
- The same fix cured another bug, not reported, where 'for (var x = i in o)'
  in a function without any 'with' statement would emit the wrong opcode
  (JSOP_FORNAME, not JSOP_FORVAR).


git-svn-id: svn://10.0.0.236/trunk@160101 18797224-902f-48f8-a5cc-f745e15eee43
2004-07-30 00:00:09 +00:00
brendan%mozilla.org
25a4d6d341 - Improve global variable performance from 3x slower to 1.2x slower than
locals (169559, r=shaver).
- Also fix longstanding bug where global regexps in precompiled scripts were
  wrongly shared among threads/contexts (165201, r=shaver).
- Also fix strict-aliasing gcc warning causes (206599, r=bryner).


git-svn-id: svn://10.0.0.236/trunk@154749 18797224-902f-48f8-a5cc-f745e15eee43
2004-04-13 01:25:17 +00:00
brendan%mozilla.org
42c8b66573 NARCISSUS ifdefs and related general fixes (r=shaver).
git-svn-id: svn://10.0.0.236/trunk@152659 18797224-902f-48f8-a5cc-f745e15eee43
2004-02-11 07:21:59 +00:00
gerv%gerv.net
123c4a9492 Bug 205418 - Relicense Spidermonkey (js/src) to MPL/LGPL/GPL. Patch by gerv; r,a=brendan.
git-svn-id: svn://10.0.0.236/trunk@149331 18797224-902f-48f8-a5cc-f745e15eee43
2003-11-15 00:11:16 +00:00
brendan%mozilla.org
2532d3d12a Big dynamic footprint win via script filename caching, plus line number fix for strict/const diags (see http://bugzilla.mozilla.org/attachment.cgi?id=127130&action=view for detailed checkin comments; 208030, r/rs=shaver, r=rginda on the jsd change, r=jst on the dom change).
git-svn-id: svn://10.0.0.236/trunk@145239 18797224-902f-48f8-a5cc-f745e15eee43
2003-07-26 22:37:11 +00:00
brendan%mozilla.org
7cc2d1c1ff Fix broken left-associativity and constant folding for + chains involving some string terms (196290, r=shaver by telepathy).
git-svn-id: svn://10.0.0.236/trunk@139787 18797224-902f-48f8-a5cc-f745e15eee43
2003-03-19 19:33:33 +00:00
brendan%mozilla.org
452ecec045 - Move left-associative binary tree flattening from the post-order position
in js_FoldConstants where it was added (suboptimally: it worked, but it ran
  so late that js_FoldConstants recursion was not reduced, only js_EmitTree
  recursion), to NewBinary, where it avoids JSParseNode allocations up front
  and reduces recursion in all parse-tree walking.
- This change enables js_FoldConstants to see a very long concatenation of
  string literals as a PN_LIST node, so it can quickly concatenate without
  running afoul of O(n^2) problems inherent in js_ConcatStrings applied to
  two atomized strings (the old way of folding string concatenations, still
  used for any pairwise string literal concatenation).
- Further optimize the first change for the second by having NewBinary set a
  new pn_strcat flag (overlaying the pn_extra field) of the PN_LIST arm of
  the JSParseNode.pn_u union, whenever it sees at least one string literal in
  a concatenation that might be folded (whose operands might all be constants
  of string or number type).
- Notes:
  - only string and number constants are folded (not boolean or null
  constants);
  - only all-constant left-associated binary expression chains are folded,
    so 2 * foo * 3 is not folded using commutativity of * over numbers, nor
    is "hi" + " there" + foo folded to "hi there" + foo.
  - gcc3.2 -O and objdump -x say I added 708 bytes of instructions with this
    change.  I tried to keep it down to what was necessary for common script;
    I don't think JS needs an optimizing-compiler-strength constant folder,
    and I don't think this 1K bloat is too high a price to pay for this fix.
    But I'll certainly work on reducing footprint elsewhere, if I can.
- Bug 174341, r=shaver.


git-svn-id: svn://10.0.0.236/trunk@138638 18797224-902f-48f8-a5cc-f745e15eee43
2003-02-27 23:04:46 +00:00
timeless%mac.com
69ae314807 Bug 106386 rid source of misspellings
r=db48x sr=blake a=asa


git-svn-id: svn://10.0.0.236/trunk@116832 18797224-902f-48f8-a5cc-f745e15eee43
2002-03-19 04:30:17 +00:00
brendan%mozilla.org
788b8d31b2 Avoid stack overflow in js_EmitTree on long left-associative operator chains (98901, r=jband, sr=shaver).
git-svn-id: svn://10.0.0.236/trunk@106489 18797224-902f-48f8-a5cc-f745e15eee43
2001-10-27 18:38:16 +00:00
gerv%gerv.net
ae1d5501a1 Oops.
git-svn-id: svn://10.0.0.236/trunk@103236 18797224-902f-48f8-a5cc-f745e15eee43
2001-09-20 00:02:59 +00:00
scc%mozilla.org
2281a4d137 bug #98089: ripped new license
git-svn-id: svn://10.0.0.236/trunk@103230 18797224-902f-48f8-a5cc-f745e15eee43
2001-09-19 22:39:41 +00:00
brendan%mozilla.org
94c7e8ce8d Fix constant folder to recycle moved node, not whole tree, when simplifying 'true ? foo() : bar()' into 'foo()' (69345, r=shaver, sr=jband).
git-svn-id: svn://10.0.0.236/trunk@87415 18797224-902f-48f8-a5cc-f745e15eee43
2001-02-20 01:25:39 +00:00
brendan%mozilla.org
88999be56e Fixes for bug 33390 (r=mccabe, sr=shaver)
- Optimize compile (parse+emit) operation to generate code for each top-level
  statement or function in turn, recycling JSParseNodes as we go for greatly
  reduced "long linear script" footprint.
- Fix O(n**2) growth problems in bytecode and srcnote generation.
- Add js_ParseTokenStream entry point to compiler, for tree-generation without
  code-generation.  Move JSOP_EVAL instruction selection from code-generator to
  parser, to match other such specializations and enable js_ParseTokenStream.
- Fix js_CompileTokenStream (and get it right in new js_ParseTokenStream) to
  respect JSOPTION_VAROBJFIX.
- Clean up bracing, multi-line conditions, and overlong lines.


git-svn-id: svn://10.0.0.236/trunk@85619 18797224-902f-48f8-a5cc-f745e15eee43
2001-01-27 08:00:45 +00:00
brendan%mozilla.org
df4a97d00e Comment change only: document TOK_TRY and TOK_CATCH nodes.
git-svn-id: svn://10.0.0.236/trunk@81588 18797224-902f-48f8-a5cc-f745e15eee43
2000-10-22 22:47:40 +00:00
brendan%mozilla.org
a1e0219a1d Spruce up a couple of comments.
git-svn-id: svn://10.0.0.236/trunk@66642 18797224-902f-48f8-a5cc-f745e15eee43
2000-04-21 01:49:49 +00:00
brendan%mozilla.org
43d1d6a141 - Eliminate ancient, bogus proxying of function object for its call objects (23346, r=jband@netscape.com).
- Tabs expanded as much as I could stand, without taking too much cvsblame.


git-svn-id: svn://10.0.0.236/trunk@59716 18797224-902f-48f8-a5cc-f745e15eee43
2000-02-04 02:01:49 +00:00
brendan%mozilla.org
b7a83ca82c JS1.5 fixes (17290, 21618, plus shaver's 22243 fix, r=shaver@mozilla.org).
git-svn-id: svn://10.0.0.236/trunk@58086 18797224-902f-48f8-a5cc-f745e15eee43
2000-01-18 11:06:05 +00:00
brendan%mozilla.org
1c2d96a428 - Add JS_HAS_FUN_EXPR_STMT jsconfig.h macro and use it to ifdef a special case explicitly specified by ECMA ed. 3 to be an error: a function expression that's a statement (not at top-level). This allows one to wrap functions in if and else statements and conditionally define them.
(More work is needed to conform to ECMA ed. 3 by removing Closure objects; also we want more efficient closure calling, soon.)

- Move mislocated call to js_FoldConstants from jsemit.c's js_EmitTree, the TOK_FUNCTION case, back to jsparse.c.  This avoids redundant fold-walks over non-top-level functions.  Folding should be done at tree-gen time, not at code-gen time.

- Eliminate dead code in if-else and ?: when folding constants.

- Release tempPool arena space before early return on error in js_FoldConstants, just to be nice (all arena space gets released eventually, when the compiler finishes).


git-svn-id: svn://10.0.0.236/trunk@53898 18797224-902f-48f8-a5cc-f745e15eee43
1999-11-18 20:19:56 +00:00
brendan%mozilla.org
1f55285563 Brutal sharing followup (15146, r=shaver@mozilla.org)
- jsinterp.c changes: 
__- JSOP_CLOSURE comment fixes.
____(NB: ECMA ed 3 seems to require that we abolish the Closure object altogether, replacing it with a new Function object where we used to make a new closure.  That says we should use JS_CloneFunctionObject or an internal form (js_).) 
__- Use obj rather than the same-valued fp->scopeChain as fourth argument to js_ConstructObject. 
__- JSOP_DEFFUN change to auto-clone when running a script in a different scope from the one the compiler used for static function scope linkage. 
__- Remove bogus assertion from JSOP_DEFVAR/CONST: case.

- jsparse.c/.h changes:
__- Restored outerFun test to FunctionDef in jsparse.c, so that we make a closure if (outerFun || lambda || !funAtom) -- i.e., if we're compiling
____- A function statement within an active function via eval;
____- We're compiling a function expression statement (not at apparent-to-compiler top-level; part of some kind of compound statement, e.g. if or with);
____- Or the function, even at top statement level and not in another function, has no name. 
__- Don't predefine local variables at compile time if they're in with statement
__- Enforce const at compile time for local consts

- Minor jsemit.[ch] cleanup.


git-svn-id: svn://10.0.0.236/trunk@53746 18797224-902f-48f8-a5cc-f745e15eee43
1999-11-17 04:13:05 +00:00
dmose%mozilla.org
ec2434440d update license boilerplate to NPL-1.1 dual-licensed with the GPL. a=brendan, r=brendan.
git-svn-id: svn://10.0.0.236/trunk@49258 18797224-902f-48f8-a5cc-f745e15eee43
1999-09-28 23:12:09 +00:00
brendan%mozilla.org
1041763b2e - Bumped default compile-time JS version from 1.4 to 1.5.
- Add JS1.5 getter/setter support in all its glory:

  * getter function SN() {return ++x} at top-level or as a closure binds an SN
    property getter than returns the incremented value of x.  Likewise for
    setter function SN(y) {return y = x}.

  * getters and setters may be defined in an object literal:
      o = {p getter:function() {return ++this.x},
           p setter:function(y){return this.x = y},
           x:42};

  * getter= and setter= operators (compound tokens) may be used to bind getter
    and setter properties dynamically:
      o = new Object;
      o.p getter= function() {return ++this.x};
      o.p setter= function(y){return this.x = y};
      o.x = 42;

    Waldemar is concerned that this form will collide semantically with JS2, so
    I am not committing to keeping it in JS1.5.  I'd like to check my code in
    ASAP so shaver can use it, and I'd also like to see this form get used (or
    not) during Mozilla betas.  Caveat emptor, and if you find this "dynamic"
    or "imperative" form necessary and hard to substitute, please let me know.
    If this proves important to users, then I think JS1.5 should keep it.

- Cleaned up property flags (in a binary-incompatible fashion -- who cares?) by
  eliminating JSPROP_ASSIGNHACK and JSPROP_TINYIDHACK.

- Added JS_DONT_PRETTY_PRINT flag to be ORed with the indent argument to the
  several JS_Decompile*() API calls.  This avoids any newlines or identation in
  the decompiled string.
 
- Improved and extended (for getter/setter non-reservation) scanner lookahead
  by using a circular (power-of-2 sized) token buffer.

- Fix ECMA Edition 3 deviation where function f(){function g(){}} bound f.g by
  mistake (it should arrange to make a closure named g in activations of f, but
  it should not bind a property of function f).


git-svn-id: svn://10.0.0.236/trunk@48436 18797224-902f-48f8-a5cc-f745e15eee43
1999-09-21 00:13:48 +00:00
fur%netscape.com
e655606d45 Checkpoint JS1.4 from JS_STABLE_10131998_BRANCH. Changes include:
+ merging of js/src and js/ref
 + elimination of most dependencies on NSPR
 + JS1.4 feature additions and accumulated bug fixes

More details are in last week's mozilla status report.


git-svn-id: svn://10.0.0.236/trunk@12797 18797224-902f-48f8-a5cc-f745e15eee43
1998-10-14 10:22:38 +00:00
fur
aea62596b0 Propagation of numerous bug fixes from 4.06 (which have been reviewed
and tested in that release):

#114564: Fix JS_Enumerate to return an empty id array instead of null
#115395: Fix JS garbage collection
#115200: Security dialog no longer blows assertion
#123211: Make sure output of sort array function is -1, 0, or 1.
#116195: Fix ImportProperty(), cope with an existing local variable
         of the same name as the imported property
         Unbusticate JS_invoke() so that closures work again
#115384,#115395: Handle bugs in toSource that strike when
         getProperty is non-idempotent.  Fix crash during JavaScript
         garbage collection after enumerating object properties.

#??????: mjudge - Win16 files to make ptrdiff_t be 32 bits on Win16


git-svn-id: svn://10.0.0.236/trunk@3573 18797224-902f-48f8-a5cc-f745e15eee43
1998-06-09 23:04:48 +00:00
fur
6e3cdaec31 Initial checkin of JavaScript 1.3, migrated from JSFUN13_BRANCH in /m/src repository
git-svn-id: svn://10.0.0.236/trunk@578 18797224-902f-48f8-a5cc-f745e15eee43
1998-04-24 00:31:11 +00:00
ltabb
8ed5afe62c Free the lizard
git-svn-id: svn://10.0.0.236/trunk@10 18797224-902f-48f8-a5cc-f745e15eee43
1998-03-28 02:44:41 +00:00