"src/regexp.js",
"src/arraybuffer.js",
"src/typedarray.js",
+ "src/generator.js",
"src/object-observe.js",
"src/collection.js",
"src/weak-collection.js",
void Bootstrapper::TearDown() {
if (delete_these_non_arrays_on_tear_down_ != NULL) {
int len = delete_these_non_arrays_on_tear_down_->length();
- DCHECK(len < 27); // Don't use this mechanism for unbounded allocations.
+ DCHECK(len < 28); // Don't use this mechanism for unbounded allocations.
for (int i = 0; i < len; i++) {
delete delete_these_non_arrays_on_tear_down_->at(i);
delete_these_non_arrays_on_tear_down_->at(i) = NULL;
// New context initialization. Used for creating a context from scratch.
void InitializeGlobal(Handle<GlobalObject> global_object,
Handle<JSFunction> empty_function);
- void InitializeExperimentalGlobal();
// Installs the contents of the native .js files on the global objects.
// Used for creating a context from scratch.
void InstallNativeFunctions();
}
-void Genesis::InitializeExperimentalGlobal() {
- // TODO(mstarzinger): Move this into Genesis::InitializeGlobal once we no
- // longer need to live behind flags, so functions get added to the snapshot.
-
- if (FLAG_harmony_generators) {
- // Create generator meta-objects and install them on the builtins object.
- Handle<JSObject> builtins(native_context()->builtins());
- Handle<JSObject> generator_object_prototype =
- factory()->NewJSObject(isolate()->object_function(), TENURED);
- Handle<JSFunction> generator_function_prototype = InstallFunction(
- builtins, "GeneratorFunctionPrototype", JS_FUNCTION_TYPE,
- JSFunction::kHeaderSize, generator_object_prototype,
- Builtins::kIllegal);
- InstallFunction(builtins, "GeneratorFunction",
- JS_FUNCTION_TYPE, JSFunction::kSize,
- generator_function_prototype, Builtins::kIllegal);
-
- // Create maps for generator functions and their prototypes. Store those
- // maps in the native context.
- Handle<Map> sloppy_function_map(native_context()->sloppy_function_map());
- Handle<Map> generator_function_map = Map::Copy(sloppy_function_map);
- generator_function_map->set_prototype(*generator_function_prototype);
- native_context()->set_sloppy_generator_function_map(
- *generator_function_map);
-
- // The "arguments" and "caller" instance properties aren't specified, so
- // technically we could leave them out. They make even less sense for
- // generators than for functions. Still, the same argument that it makes
- // sense to keep them around but poisoned in strict mode applies to
- // generators as well. With poisoned accessors, naive callers can still
- // iterate over the properties without accessing them.
- //
- // We can't use PoisonArgumentsAndCaller because that mutates accessor pairs
- // in place, and the initial state of the generator function map shares the
- // accessor pair with sloppy functions. Also the error message should be
- // different. Also unhappily, we can't use the API accessors to implement
- // poisoning, because API accessors present themselves as data properties,
- // not accessor properties, and so getOwnPropertyDescriptor raises an
- // exception as it tries to get the values. Sadness.
- Handle<AccessorPair> poison_pair(factory()->NewAccessorPair());
- PropertyAttributes rw_attribs =
- static_cast<PropertyAttributes>(DONT_ENUM | DONT_DELETE);
- Handle<JSFunction> poison_function = GetGeneratorPoisonFunction();
- poison_pair->set_getter(*poison_function);
- poison_pair->set_setter(*poison_function);
- ReplaceAccessors(generator_function_map, factory()->arguments_string(),
- rw_attribs, poison_pair);
- ReplaceAccessors(generator_function_map, factory()->caller_string(),
- rw_attribs, poison_pair);
-
- Handle<Map> strict_function_map(native_context()->strict_function_map());
- Handle<Map> strict_generator_function_map = Map::Copy(strict_function_map);
- // "arguments" and "caller" already poisoned.
- strict_generator_function_map->set_prototype(*generator_function_prototype);
- native_context()->set_strict_generator_function_map(
- *strict_generator_function_map);
-
- Handle<JSFunction> object_function(native_context()->object_function());
- Handle<Map> generator_object_prototype_map = Map::Create(
- object_function, 0);
- generator_object_prototype_map->set_prototype(
- *generator_object_prototype);
- native_context()->set_generator_object_prototype_map(
- *generator_object_prototype_map);
- }
-}
-
-
bool Genesis::CompileBuiltin(Isolate* isolate, int index) {
Vector<const char> name = Natives::GetScriptName(index);
Handle<String> source_code =
map_iterator_function->initial_map());
}
+ {
+ // Create generator meta-objects and install them on the builtins object.
+ Handle<JSObject> builtins(native_context()->builtins());
+ Handle<JSObject> generator_object_prototype =
+ factory()->NewJSObject(isolate()->object_function(), TENURED);
+ Handle<JSFunction> generator_function_prototype =
+ InstallFunction(builtins, "GeneratorFunctionPrototype",
+ JS_FUNCTION_TYPE, JSFunction::kHeaderSize,
+ generator_object_prototype, Builtins::kIllegal);
+ InstallFunction(builtins, "GeneratorFunction", JS_FUNCTION_TYPE,
+ JSFunction::kSize, generator_function_prototype,
+ Builtins::kIllegal);
+
+ // Create maps for generator functions and their prototypes. Store those
+ // maps in the native context.
+ Handle<Map> generator_function_map =
+ Map::Copy(sloppy_function_map_writable_prototype_);
+ generator_function_map->set_prototype(*generator_function_prototype);
+ native_context()->set_sloppy_generator_function_map(
+ *generator_function_map);
+
+ // The "arguments" and "caller" instance properties aren't specified, so
+ // technically we could leave them out. They make even less sense for
+ // generators than for functions. Still, the same argument that it makes
+ // sense to keep them around but poisoned in strict mode applies to
+ // generators as well. With poisoned accessors, naive callers can still
+ // iterate over the properties without accessing them.
+ //
+ // We can't use PoisonArgumentsAndCaller because that mutates accessor pairs
+ // in place, and the initial state of the generator function map shares the
+ // accessor pair with sloppy functions. Also the error message should be
+ // different. Also unhappily, we can't use the API accessors to implement
+ // poisoning, because API accessors present themselves as data properties,
+ // not accessor properties, and so getOwnPropertyDescriptor raises an
+ // exception as it tries to get the values. Sadness.
+ Handle<AccessorPair> poison_pair(factory()->NewAccessorPair());
+ PropertyAttributes rw_attribs =
+ static_cast<PropertyAttributes>(DONT_ENUM | DONT_DELETE);
+ Handle<JSFunction> poison_function = GetGeneratorPoisonFunction();
+ poison_pair->set_getter(*poison_function);
+ poison_pair->set_setter(*poison_function);
+ ReplaceAccessors(generator_function_map, factory()->arguments_string(),
+ rw_attribs, poison_pair);
+ ReplaceAccessors(generator_function_map, factory()->caller_string(),
+ rw_attribs, poison_pair);
+
+ Handle<Map> strict_function_map(native_context()->strict_function_map());
+ Handle<Map> strict_generator_function_map = Map::Copy(strict_function_map);
+ // "arguments" and "caller" already poisoned.
+ strict_generator_function_map->set_prototype(*generator_function_prototype);
+ native_context()->set_strict_generator_function_map(
+ *strict_generator_function_map);
+
+ Handle<JSFunction> object_function(native_context()->object_function());
+ Handle<Map> generator_object_prototype_map =
+ Map::Create(object_function, 0);
+ generator_object_prototype_map->set_prototype(*generator_object_prototype);
+ native_context()->set_generator_object_prototype_map(
+ *generator_object_prototype_map);
+ }
+
if (FLAG_disable_native_files) {
PrintF("Warning: Running without installed natives!\n");
return true;
i < ExperimentalNatives::GetBuiltinsCount();
i++) {
INSTALL_EXPERIMENTAL_NATIVE(i, proxies, "proxy.js")
- INSTALL_EXPERIMENTAL_NATIVE(i, generators, "generator.js")
INSTALL_EXPERIMENTAL_NATIVE(i, strings, "harmony-string.js")
INSTALL_EXPERIMENTAL_NATIVE(i, arrays, "harmony-array.js")
INSTALL_EXPERIMENTAL_NATIVE(i, classes, "harmony-classes.js")
isolate->counters()->contexts_created_from_scratch()->Increment();
}
- // Initialize experimental globals and install experimental natives.
- InitializeExperimentalGlobal();
+ // Install experimental natives.
if (!InstallExperimentalNatives()) return;
// We can't (de-)serialize typed arrays currently, but we are lucky: The state
DEFINE_BOOL(harmony_modules, false,
"enable harmony modules (implies block scoping)")
DEFINE_BOOL(harmony_proxies, false, "enable harmony proxies")
-DEFINE_BOOL(harmony_generators, false, "enable harmony generators")
DEFINE_BOOL(harmony_numeric_literals, false,
"enable harmony numeric literals (0o77, 0b11)")
DEFINE_BOOL(harmony_strings, false, "enable harmony string")
DEFINE_IMPLICATION(harmony_modules, harmony_scoping)
DEFINE_IMPLICATION(harmony, es_staging)
-DEFINE_IMPLICATION(es_staging, harmony_generators)
// Flags for experimental implementation features.
DEFINE_BOOL(compiled_keyed_generic_loads, false,
set_allow_modules(!info->is_native() && FLAG_harmony_modules);
set_allow_natives_syntax(FLAG_allow_natives_syntax || info->is_native());
set_allow_lazy(false); // Must be explicitly enabled.
- set_allow_generators(FLAG_harmony_generators);
set_allow_arrow_functions(FLAG_harmony_arrow_functions);
set_allow_harmony_numeric_literals(FLAG_harmony_numeric_literals);
set_allow_classes(FLAG_harmony_classes);
// '{' FunctionBody '}'
Expect(Token::FUNCTION, CHECK_OK);
int pos = position();
- bool is_generator = allow_generators() && Check(Token::MUL);
+ bool is_generator = Check(Token::MUL);
bool is_strict_reserved = false;
const AstRawString* name = ParseIdentifierOrStrictReservedWord(
&is_strict_reserved, CHECK_OK);
reusable_preparser_->set_allow_modules(allow_modules());
reusable_preparser_->set_allow_natives_syntax(allow_natives_syntax());
reusable_preparser_->set_allow_lazy(true);
- reusable_preparser_->set_allow_generators(allow_generators());
reusable_preparser_->set_allow_arrow_functions(allow_arrow_functions());
reusable_preparser_->set_allow_harmony_numeric_literals(
allow_harmony_numeric_literals());
// '{' FunctionBody '}'
Expect(Token::FUNCTION, CHECK_OK);
int pos = position();
- bool is_generator = allow_generators() && Check(Token::MUL);
+ bool is_generator = Check(Token::MUL);
bool is_strict_reserved = false;
Identifier name = ParseIdentifierOrStrictReservedWord(
&is_strict_reserved, CHECK_OK);
stack_overflow_(false),
allow_lazy_(false),
allow_natives_syntax_(false),
- allow_generators_(false),
allow_arrow_functions_(false),
allow_harmony_object_literals_(false),
zone_(zone),
// allowed to be parsed by this instance of the parser.
bool allow_lazy() const { return allow_lazy_; }
bool allow_natives_syntax() const { return allow_natives_syntax_; }
- bool allow_generators() const { return allow_generators_; }
bool allow_arrow_functions() const { return allow_arrow_functions_; }
bool allow_modules() const { return scanner()->HarmonyModules(); }
bool allow_harmony_scoping() const { return scanner()->HarmonyScoping(); }
// allowed to be parsed by this instance of the parser.
void set_allow_lazy(bool allow) { allow_lazy_ = allow; }
void set_allow_natives_syntax(bool allow) { allow_natives_syntax_ = allow; }
- void set_allow_generators(bool allow) { allow_generators_ = allow; }
void set_allow_arrow_functions(bool allow) { allow_arrow_functions_ = allow; }
void set_allow_modules(bool allow) { scanner()->SetHarmonyModules(allow); }
void set_allow_harmony_scoping(bool allow) {
bool allow_lazy_;
bool allow_natives_syntax_;
- bool allow_generators_;
bool allow_arrow_functions_;
bool allow_harmony_object_literals_;
if (peek() == Token::FUNCTION) {
Consume(Token::FUNCTION);
int function_token_position = position();
- bool is_generator = allow_generators() && Check(Token::MUL);
+ bool is_generator = Check(Token::MUL);
IdentifierT name = this->EmptyIdentifier();
bool is_strict_reserved_name = false;
Scanner::Location function_name_location = Scanner::Location::invalid();
kAllowNativesSyntax,
kAllowHarmonyScoping,
kAllowModules,
- kAllowGenerators,
kAllowHarmonyNumericLiterals,
kAllowArrowFunctions,
kAllowClasses,
parser->set_allow_natives_syntax(flags.Contains(kAllowNativesSyntax));
parser->set_allow_harmony_scoping(flags.Contains(kAllowHarmonyScoping));
parser->set_allow_modules(flags.Contains(kAllowModules));
- parser->set_allow_generators(flags.Contains(kAllowGenerators));
parser->set_allow_harmony_numeric_literals(
flags.Contains(kAllowHarmonyNumericLiterals));
parser->set_allow_harmony_object_literals(
i::GetCurrentStackPosition() - 128 * 1024);
static const ParserFlag flags1[] = {
- kAllowLazy, kAllowHarmonyScoping,
- kAllowModules, kAllowGenerators,
- kAllowArrowFunctions, kAllowHarmonyNumericLiterals,
- kAllowHarmonyObjectLiterals};
+ kAllowLazy, kAllowHarmonyScoping,
+ kAllowModules, kAllowArrowFunctions,
+ kAllowHarmonyNumericLiterals, kAllowHarmonyObjectLiterals};
for (int i = 0; context_data[i][0] != NULL; ++i) {
for (int j = 0; statement_data[j] != NULL; ++j) {
for (int k = 0; termination_data[k] != NULL; ++k) {
i::GetCurrentStackPosition() - 128 * 1024);
static const ParserFlag default_flags[] = {
- kAllowArrowFunctions, kAllowClasses,
- kAllowGenerators, kAllowHarmonyNumericLiterals,
- kAllowHarmonyObjectLiterals, kAllowHarmonyScoping,
- kAllowLazy, kAllowModules,
- kAllowNativesSyntax,
+ kAllowArrowFunctions, kAllowClasses,
+ kAllowHarmonyNumericLiterals, kAllowHarmonyObjectLiterals,
+ kAllowHarmonyScoping, kAllowLazy,
+ kAllowModules, kAllowNativesSyntax,
};
ParserFlag* generated_flags = NULL;
if (flags == NULL) {
NULL
};
- // This test requires kAllowGenerators to succeed.
- static const ParserFlag always_true_flags[] = { kAllowGenerators };
- RunParserSyncTest(context_data, statement_data, kSuccess, NULL, 0,
- always_true_flags, 1);
+ RunParserSyncTest(context_data, statement_data, kSuccess);
}
NULL
};
- // This test requires kAllowGenerators to succeed.
- static const ParserFlag always_true_flags[] = {
- kAllowGenerators
- };
- RunParserSyncTest(context_data, statement_data, kSuccess, NULL, 0,
- always_true_flags, 1);
+ RunParserSyncTest(context_data, statement_data, kSuccess);
}
NULL
};
- // This test requires kAllowGenerators to succeed.
- static const ParserFlag always_true_flags[] = {
- kAllowGenerators
- };
- RunParserSyncTest(context_data, statement_data, kSuccess, NULL, 0,
- always_true_flags, 1);
+ RunParserSyncTest(context_data, statement_data, kSuccess);
}
};
// The test is quite slow, so run it with a reduced set of flags.
- static const ParserFlag flags[] = {
- kAllowLazy, kAllowHarmonyScoping, kAllowGenerators
- };
+ static const ParserFlag flags[] = {kAllowLazy, kAllowHarmonyScoping};
static const ParserFlag always_flags[] = { kAllowArrowFunctions };
RunParserSyncTest(context_data, statement_data, kError, flags,
arraysize(flags), always_flags, arraysize(always_flags));
}
// This has to be updated if the number of native scripts change.
-assertTrue(named_native_count == 25 || named_native_count == 26);
+assertTrue(named_native_count == 26 || named_native_count == 27);
// Only the 'gc' extension is loaded.
assertEquals(1, extension_count);
// This script and mjsunit.js has been loaded. If using d8, d8 loads
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-// Flags: --expose-debug-as debug --harmony-generators
+// Flags: --expose-debug-as debug
var Debug = debug.Debug;
var LiveEdit = Debug.LiveEdit;
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-// Flags: --expose-debug-as debug --harmony-generators
+// Flags: --expose-debug-as debug
var Debug = debug.Debug;
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-// Flags: --harmony-generators --expose-gc
+// Flags: --expose-gc
// Test generator iteration.
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-// Flags: --harmony-generators --harmony-scoping --allow-natives-syntax
+// Flags: --harmony-scoping --allow-natives-syntax
// Test instantations of generators.
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-// Flags: --harmony-generators
-
// Test basic generator syntax.
// Yield statements.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-// Flags: --harmony-generators
-
function assertIteratorResult(value, done, result) {
assertEquals({value: value, done: done}, result);
}
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-// Flags: --expose-debug-as debug --harmony-generators
+// Flags: --expose-debug-as debug
var Debug = debug.Debug;
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-// Flags: --harmony-generators
-
// Test aspects of the generator runtime.
// See:
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-// Flags: --harmony-generators --harmony-scoping --harmony-proxies
+// Flags: --harmony-scoping --harmony-proxies
// Test for-of semantics.
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-// Flags: --expose-gc --noincremental-marking --harmony-generators
+// Flags: --expose-gc --noincremental-marking
// Check that we are not flushing code for generators.
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-// Flags: --harmony-generators
-
// Check that yield* on non-objects raises a TypeError.
assertThrows('(function*() { yield* 10 })().next()', TypeError);
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-// Flags: --harmony-generators --expose-debug-as debug
+// Flags: --expose-debug-as debug
var Debug = debug.Debug;
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-// Flags: --expose-debug-as debug --harmony-generators
+// Flags: --expose-debug-as debug
Debug = debug.Debug
'../../src/regexp.js',
'../../src/arraybuffer.js',
'../../src/typedarray.js',
+ '../../src/generator.js',
'../../src/object-observe.js',
'../../src/collection.js',
'../../src/weak-collection.js',