Commit Graph

784 Commits

Author SHA1 Message Date
André Bargull
4de51a90f7 Bug 928508 - Change String.prototype.@@iterator to iterate over code points. r=jorendorff. 2013-10-23 11:42:25 -05:00
Andy Wingo
dde95bc7ff Bug 919948 - Convert Array.prototype.@@iterator to use new iteration protocol. r=jorendorff 2013-10-17 12:10:02 +02:00
Andy Wingo
bad7f8b5b7 Bug 923160 - Disallow initializers in for-of statements. r=jorendorff 2013-10-15 16:43:55 +02:00
Jason Orendorff
ad3e3749f1 Bug 923836 - Set aside the first 3 reserved slots of global objects for application use. r=Waldo. 2013-10-14 15:24:11 -05:00
Jeff Walden
faaaec644a Bug 925739 - Rename cx->names().classPrototype to just cx->names().prototype, for readability/predictability. r=jorendorff 2013-10-11 15:24:44 +02:00
Dan Gohman
f147ac843f Bug 924642 - SpiderMonkey: Apply internal name linkage using static keywords. r=njn 2013-10-10 05:18:01 -07:00
Birunthan Mohanathas
2a9e2e756b Bug 784739 - Switch from NULL to nullptr in js/src/ (5/9); r=ehsan 2013-10-07 12:43:47 -04:00
Andy Wingo
4d26dec179 Bug 907077: Change for-of to conform to latest ES6 specification. r=jwalden 2013-10-03 13:37:57 +01:00
Jeff Walden
7e044e0fb3 Bug 921548 - Remove js_ValueToObjectOrNull -- people should use ToObject or explicit null/undefined tests, for readability. r=jorendorff 2013-09-27 11:19:47 -07:00
Jeff Walden
443efa2af8 Bug 921548 - Remove js_ValueToNonNullObject, which was entirely equivalent to ToObject. r=jorendorff 2013-09-27 11:19:47 -07:00
Bill McCloskey
2942d62921 Bug 918170 - Handle StopIteration in CPOWs (r=dvander) 2013-09-30 12:20:51 -07:00
Jan de Mooij
e6fbcb1ff0 Bug 915763 - Remove TypeScript::dynamicList and dynamic Monitor functions. r=bhackett 2013-09-28 11:45:21 +02:00
Andy Wingo
e72bfb550b Bug 666396 - Implemement yield*. r=jorendorff, r=Waldo 2013-09-19 15:26:26 +02:00
Dan Gohman
94cd9b8531 Bug 910823 - Constify static js::Class/JSClass instances. r=waldo 2013-09-11 05:49:05 -07:00
Nicholas Nethercote
6a09435b2e Bug 914032 (part 2) - Move a bunch of stuff out of -inl.h files. r=terrence. 2013-09-09 15:50:06 -07:00
Andy Wingo
f8074904e6 Bug 907744 - Implement iterator result boxing in ES6 generators. r=jorendorff
This patchset causes the bytecode emitter to yield boxed return values
in ES6 generators, of the form { value: foo, done: bool }.

If the generator function does not end in a return, the compiler inserts
the equivalent of a "return { value: undefined, done:true }" statement
at the end.

When an ES6 generator finishes, it does so with {done:true} instead of
throwing a StopIteration.

This patch also ports lib/asserts.js to "default version" JS, and ports
ecma_6/Generators to use it.
2013-09-04 13:20:48 -04:00
Dan Gohman
cd071e06d4 Bug 910829 - SpiderMonkey: Put cpp-private classes in anonymous namespaces. r=waldo 2013-08-31 06:19:15 -07:00
Ryan VanderMeulen
def3c6d947 Bug 908920 - Don't assume suspended generator activations have a script. r=jorendorff
This patch makes legacy (JS 1.7) and star (ES6) generators have
different classes, avoiding the need to poke through to the frame's
script to see which kind they are.  This steps around a failure to get
a frame's script after GC, when the script was thrown away, while also
preparing for bug 907744.

To detect errors in the future, also make accesses to gen->fp->script()
cause a null pointer deref in debug mode.  This caught another bug in
generator_close_impl(), in which with GGC it could be possible to
reference a return value from the recently dead frame.  This was easily
fixed because that value is always undefined.
2013-08-27 14:01:11 -04:00
Andy Wingo
66cdba52f7 Bug 904701 - Implement prototype madness for ES6 generators. r=bhackett, r=jorendorff
Add a Generator constructor, like the Function constructor.

Define the GeneratorFunctionPrototype, GeneratorFunction, and
GeneratorObjectPrototype meta-objects.

When cloning or creating a star generator, give it
GeneratorFunctionPrototype as its prototype.

Each star generator function has a ".prototype" property, which has
GeneratorObjectPrototype as its prototype.  That prototype does not have
a ".constructor" link.

If Function.prototype.toSource is called on a non-function, chain up to
Object.prototype.toSource instead.

Prototypes of generator objects are no longer made with
GeneratorObject::class_.  This allows us to elide some "null" checks
from bug 352885.  Instead calling a generator on a method now signals a
typeerror.

Make the "send" generator method a simple alias to "next".
2013-08-23 11:07:10 -04:00
Andy Wingo
c9c35ef7bb Bug 666399 - New Harmony syntax for generators. r=Waldo
Add a GeneratorKind enumeration, and use it in the parser and runtime to
indicate whether a function is a non-generator, a legacy generator, or a
star generator.

Always parse "yield" as TOK_YIELD, regardless of the version.  Add
TokenStream::currentName() to retrieve the current token's name, which
works for TOK_NAME or TOK_YIELD.  The parser should check the validity
of "yield" as a name, if needed, using checkYieldNameValidity().

Parse "function*" as the StarGenerator GeneratorKind, and allow star
generators to be lazily parsed.

Separate parsing of return statements from yield expressions.
2013-08-20 11:03:24 +02:00
Terrence Cole
b3904f1033 Bug 906940 - Exactly root the IsAcceptableThis callback; r=jonco,smaug 2013-05-28 11:23:04 -07:00
Terrence Cole
e43cffaed9 Bug 903041 - Exactly root --enable-more-deterministic builds; r=jonco 2013-08-09 13:03:43 -07:00
Nicholas Nethercote
f7d6f07d24 Bug 898914 (part 1) - Remove JSBool. 2013-08-08 15:53:04 -07:00
Nicholas Nethercote
966f6b5ff2 Bug 901750 - Change return type of |JSNative| from |JSBool| to |bool|. code=nnethercote,jandem. r=luke,bz. 2013-08-02 00:41:57 -07:00
Brian Hackett
2f7e1b21d3 Bug 898886 - Improve threadsafe assertions when accessing runtimes and zones, r=billm. 2013-08-05 08:48:34 -06:00
Andy Wingo
9abbb590a0 Bug 884794 - Rename JS1.7+ generators to "legacy generators". r=Waldo, r=jorendorff 2013-07-31 16:48:49 +02:00
Terrence Cole
58e6da3acd Bug 899696 - Fix unsafe reference hazard in SendToGenerator; r=sfink 2013-07-30 16:29:59 -07:00
Nicholas Nethercote
f8cd26b5a5 Bug 897850 - Fix order of "construct" and "hasInstance" comments. r=evilpie. DONTBUILD 2013-07-25 15:30:53 -07:00
Terrence Cole
dda068b13b Bug 887563 - Convert CallArgs::operator[] to return a Handle; r=Waldo,bz 2013-06-26 16:26:45 -07:00
Emanuel Hoogeveen
10028e6993 Bug 888088 (part 6) - Fix #include ordering in some of js/src/*.{h,cpp}. r=nnethercote. 2013-07-23 17:34:18 -07:00
Nicholas Nethercote
1a13de61a4 Bug 887558 (part 1) - Introduce ProxyObject and some sub-classes. r=jorendorff. 2013-06-20 21:27:28 -07:00
Brian Hackett
d5a61ab0f3 Bug 885758 - Add ExclusiveContext for use by threads with exclusive access to their compartment, r=billm. 2013-07-10 09:29:52 -06:00
Terrence Cole
70ac8d15ee Bug 886630 - Post barrier generator frames when they stop running; r=billm 2013-07-09 17:31:42 -07:00
Ms2ger
fac32eafc7 Bug 887009 - Pass MutableHandleValue to Invoke(); r=terrence 2013-07-01 09:03:13 +02:00
Andy Wingo
f0684ef598 Bug 648949 - Remove HAS_JS_GENERATORS #define. r=Waldo, r=jorendorff 2013-06-26 12:34:47 +02:00
Jan de Mooij
35ddf9286d Bug 885648 - Add barriers for generator stack value. r=terrence 2013-06-26 15:16:48 +02:00
Catalin Iacob
e895205c0b Bug 798914 (part 4) - Use newly introduced mozilla::MallocSizeOf in js. r=njn. 2013-06-23 13:21:01 +02:00
Brian Hackett
01a05c1b2d Bug 881102 - Propagate exceptions in object metadata callback, r=luke. 2013-06-24 10:55:28 -06:00
Jan de Mooij
39f9bb0d9f Bug 881902 - Remove ContextStack and StackSpace. r=luke,njn 2013-06-21 08:28:06 +02:00
Nicholas Nethercote
ca35558981 Bug 880041 (part 21) - Use JSObject::{is,as} for GlobalObject. r=sfink. 2013-06-17 16:23:11 -07:00
Gary Kwong
72ce00d3fe Bug 885502 - JavaScript JS_MORE_DETERMINISTIC builds are busted (again). r=sfink 2013-06-20 13:31:06 -07:00
Nicholas Nethercote
c77c71a9b4 Bug 884124 (part 3) - Add a GeneratorObject class. r=jwalden. 2013-06-18 20:03:31 -07:00
Nicholas Nethercote
d1b43ac7c3 Bug 884124 (part 2) - Add a StopIterationObject class. r=jwalden. 2013-06-18 19:56:19 -07:00
Jan de Mooij
9a7600d987 Bug 882111 - Don't push an interpreter frame when calling into the JITs. r=djvj 2013-06-19 19:10:04 +02:00
Jan de Mooij
65a46c99fd Bug 883171 - Remove JSContext::fp() and JSContext::regs(). r=luke 2013-06-19 11:33:13 +02:00
Nicholas Nethercote
b9d4dcdabe Bug 634839 (part 2b) - Remove more unnecessary headers (as found by include-what-you-use) from SpiderMonkey. r=jorendorff. 2013-06-12 22:20:27 -07:00
Nicholas Nethercote
6b798ab3a1 Bug 880041 (part 8) - Use JSObject::{is,as} for PropertyIteratorObject. r=sfink. 2013-06-16 17:34:45 -07:00
Nicholas Nethercote
d2158363c5 Bug 880041 (part 5) - Use JSObject::{is,as} for ElementIteratorObject. r=sfink. 2013-06-16 17:24:34 -07:00
Brian Hackett
c0af46133d Bug 881333 - Use accessor methods for cx->compartment and cx->runtime, r=luke. 2013-06-10 15:22:18 -06:00
Terrence Cole
998ab9977e Bug 879079 - Fix some exact rooting static analysis failures under js/src; r=bhackett 2013-06-03 16:30:00 -07:00