| Index: src/bootstrapper.cc
|
| diff --git a/src/bootstrapper.cc b/src/bootstrapper.cc
|
| index b6e8dc5bc8faa3bf21d1f80fb5e920a29ec0f31f..8ac594c5821cb9fdbb86f61b47bdbcd9c504b26d 100644
|
| --- a/src/bootstrapper.cc
|
| +++ b/src/bootstrapper.cc
|
| @@ -300,7 +300,7 @@ class Genesis BASE_EMBEDDED {
|
| PrototypePropertyMode prototypeMode);
|
| void MakeFunctionInstancePrototypeWritable();
|
|
|
| - Handle<Map> CreateStrictModeFunctionMap(
|
| + Handle<Map> CreateStrictFunctionMap(
|
| PrototypePropertyMode prototype_mode,
|
| Handle<JSFunction> empty_function);
|
|
|
| @@ -328,8 +328,8 @@ class Genesis BASE_EMBEDDED {
|
| // prototype for the processing of JS builtins. Later the function maps are
|
| // replaced in order to make prototype writable. These are the final, writable
|
| // prototype, maps.
|
| - Handle<Map> function_map_writable_prototype_;
|
| - Handle<Map> strict_mode_function_map_writable_prototype_;
|
| + Handle<Map> sloppy_function_map_writable_prototype_;
|
| + Handle<Map> strict_function_map_writable_prototype_;
|
| Handle<JSFunction> throw_type_error_function;
|
|
|
| BootstrapperActive active_;
|
| @@ -474,18 +474,19 @@ Handle<JSFunction> Genesis::CreateEmptyFunction(Isolate* isolate) {
|
| // can not be used as constructors.
|
| Handle<Map> function_without_prototype_map =
|
| CreateFunctionMap(DONT_ADD_PROTOTYPE);
|
| - native_context()->set_function_without_prototype_map(
|
| + native_context()->set_sloppy_function_without_prototype_map(
|
| *function_without_prototype_map);
|
|
|
| // Allocate the function map. This map is temporary, used only for processing
|
| // of builtins.
|
| // Later the map is replaced with writable prototype map, allocated below.
|
| Handle<Map> function_map = CreateFunctionMap(ADD_READONLY_PROTOTYPE);
|
| - native_context()->set_function_map(*function_map);
|
| + native_context()->set_sloppy_function_map(*function_map);
|
|
|
| // The final map for functions. Writeable prototype.
|
| // This map is installed in MakeFunctionInstancePrototypeWritable.
|
| - function_map_writable_prototype_ = CreateFunctionMap(ADD_WRITEABLE_PROTOTYPE);
|
| + sloppy_function_map_writable_prototype_ =
|
| + CreateFunctionMap(ADD_WRITEABLE_PROTOTYPE);
|
|
|
| Factory* factory = isolate->factory();
|
|
|
| @@ -519,7 +520,7 @@ Handle<JSFunction> Genesis::CreateEmptyFunction(Isolate* isolate) {
|
| Handle<String> empty_string =
|
| factory->InternalizeOneByteString(STATIC_ASCII_VECTOR("Empty"));
|
| Handle<JSFunction> empty_function =
|
| - factory->NewFunctionWithoutPrototype(empty_string, CLASSIC_MODE);
|
| + factory->NewFunctionWithoutPrototype(empty_string, SLOPPY);
|
|
|
| // --- E m p t y ---
|
| Handle<Code> code =
|
| @@ -537,10 +538,10 @@ Handle<JSFunction> Genesis::CreateEmptyFunction(Isolate* isolate) {
|
| empty_function->shared()->DontAdaptArguments();
|
|
|
| // Set prototypes for the function maps.
|
| - native_context()->function_map()->set_prototype(*empty_function);
|
| - native_context()->function_without_prototype_map()->
|
| + native_context()->sloppy_function_map()->set_prototype(*empty_function);
|
| + native_context()->sloppy_function_without_prototype_map()->
|
| set_prototype(*empty_function);
|
| - function_map_writable_prototype_->set_prototype(*empty_function);
|
| + sloppy_function_map_writable_prototype_->set_prototype(*empty_function);
|
|
|
| // Allocate the function map first and then patch the prototype later
|
| Handle<Map> empty_function_map = CreateFunctionMap(DONT_ADD_PROTOTYPE);
|
| @@ -604,11 +605,10 @@ Handle<JSFunction> Genesis::GetThrowTypeErrorFunction() {
|
| Handle<String> name = factory()->InternalizeOneByteString(
|
| STATIC_ASCII_VECTOR("ThrowTypeError"));
|
| throw_type_error_function =
|
| - factory()->NewFunctionWithoutPrototype(name, CLASSIC_MODE);
|
| + factory()->NewFunctionWithoutPrototype(name, SLOPPY);
|
| Handle<Code> code(isolate()->builtins()->builtin(
|
| Builtins::kStrictModePoisonPill));
|
| - throw_type_error_function->set_map(
|
| - native_context()->function_map());
|
| + throw_type_error_function->set_map(native_context()->sloppy_function_map());
|
| throw_type_error_function->set_code(*code);
|
| throw_type_error_function->shared()->set_code(*code);
|
| throw_type_error_function->shared()->DontAdaptArguments();
|
| @@ -619,7 +619,7 @@ Handle<JSFunction> Genesis::GetThrowTypeErrorFunction() {
|
| }
|
|
|
|
|
| -Handle<Map> Genesis::CreateStrictModeFunctionMap(
|
| +Handle<Map> Genesis::CreateStrictFunctionMap(
|
| PrototypePropertyMode prototype_mode,
|
| Handle<JSFunction> empty_function) {
|
| Handle<Map> map = factory()->NewMap(JS_FUNCTION_TYPE, JSFunction::kSize);
|
| @@ -632,28 +632,27 @@ Handle<Map> Genesis::CreateStrictModeFunctionMap(
|
|
|
| void Genesis::CreateStrictModeFunctionMaps(Handle<JSFunction> empty) {
|
| // Allocate map for the prototype-less strict mode instances.
|
| - Handle<Map> strict_mode_function_without_prototype_map =
|
| - CreateStrictModeFunctionMap(DONT_ADD_PROTOTYPE, empty);
|
| - native_context()->set_strict_mode_function_without_prototype_map(
|
| - *strict_mode_function_without_prototype_map);
|
| + Handle<Map> strict_function_without_prototype_map =
|
| + CreateStrictFunctionMap(DONT_ADD_PROTOTYPE, empty);
|
| + native_context()->set_strict_function_without_prototype_map(
|
| + *strict_function_without_prototype_map);
|
|
|
| // Allocate map for the strict mode functions. This map is temporary, used
|
| // only for processing of builtins.
|
| // Later the map is replaced with writable prototype map, allocated below.
|
| - Handle<Map> strict_mode_function_map =
|
| - CreateStrictModeFunctionMap(ADD_READONLY_PROTOTYPE, empty);
|
| - native_context()->set_strict_mode_function_map(
|
| - *strict_mode_function_map);
|
| + Handle<Map> strict_function_map =
|
| + CreateStrictFunctionMap(ADD_READONLY_PROTOTYPE, empty);
|
| + native_context()->set_strict_function_map(*strict_function_map);
|
|
|
| // The final map for the strict mode functions. Writeable prototype.
|
| // This map is installed in MakeFunctionInstancePrototypeWritable.
|
| - strict_mode_function_map_writable_prototype_ =
|
| - CreateStrictModeFunctionMap(ADD_WRITEABLE_PROTOTYPE, empty);
|
| + strict_function_map_writable_prototype_ =
|
| + CreateStrictFunctionMap(ADD_WRITEABLE_PROTOTYPE, empty);
|
|
|
| // Complete the callbacks.
|
| - PoisonArgumentsAndCaller(strict_mode_function_without_prototype_map);
|
| - PoisonArgumentsAndCaller(strict_mode_function_map);
|
| - PoisonArgumentsAndCaller(strict_mode_function_map_writable_prototype_);
|
| + PoisonArgumentsAndCaller(strict_function_without_prototype_map);
|
| + PoisonArgumentsAndCaller(strict_function_map);
|
| + PoisonArgumentsAndCaller(strict_function_map_writable_prototype_);
|
| }
|
|
|
|
|
| @@ -1137,7 +1136,7 @@ void Genesis::InitializeGlobal(Handle<GlobalObject> inner_global,
|
| function->shared()->set_expected_nof_properties(2);
|
| Handle<JSObject> result = factory->NewJSObject(function);
|
|
|
| - native_context()->set_arguments_boilerplate(*result);
|
| + native_context()->set_sloppy_arguments_boilerplate(*result);
|
| // Note: length must be added as the first property and
|
| // callee must be added as the second property.
|
| CHECK_NOT_EMPTY_HANDLE(isolate,
|
| @@ -1173,22 +1172,23 @@ void Genesis::InitializeGlobal(Handle<GlobalObject> inner_global,
|
| { // --- aliased_arguments_boilerplate_
|
| // Set up a well-formed parameter map to make assertions happy.
|
| Handle<FixedArray> elements = factory->NewFixedArray(2);
|
| - elements->set_map(heap->non_strict_arguments_elements_map());
|
| + elements->set_map(heap->sloppy_arguments_elements_map());
|
| Handle<FixedArray> array;
|
| array = factory->NewFixedArray(0);
|
| elements->set(0, *array);
|
| array = factory->NewFixedArray(0);
|
| elements->set(1, *array);
|
|
|
| - Handle<Map> old_map(native_context()->arguments_boilerplate()->map());
|
| + Handle<Map> old_map(
|
| + native_context()->sloppy_arguments_boilerplate()->map());
|
| Handle<Map> new_map = factory->CopyMap(old_map);
|
| new_map->set_pre_allocated_property_fields(2);
|
| Handle<JSObject> result = factory->NewJSObjectFromMap(new_map);
|
| // Set elements kind after allocating the object because
|
| // NewJSObjectFromMap assumes a fast elements map.
|
| - new_map->set_elements_kind(NON_STRICT_ARGUMENTS_ELEMENTS);
|
| + new_map->set_elements_kind(SLOPPY_ARGUMENTS_ELEMENTS);
|
| result->set_elements(*elements);
|
| - ASSERT(result->HasNonStrictArgumentsElements());
|
| + ASSERT(result->HasSloppyArgumentsElements());
|
| native_context()->set_aliased_arguments_boilerplate(*result);
|
| }
|
|
|
| @@ -1211,7 +1211,7 @@ void Genesis::InitializeGlobal(Handle<GlobalObject> inner_global,
|
|
|
| // Create the map. Allocate one in-object field for length.
|
| Handle<Map> map = factory->NewMap(JS_OBJECT_TYPE,
|
| - Heap::kArgumentsObjectSizeStrict);
|
| + Heap::kStrictArgumentsObjectSize);
|
| // Create the descriptor array for the arguments object.
|
| Handle<DescriptorArray> descriptors = factory->NewDescriptorArray(0, 3);
|
| DescriptorArray::WhitenessWitness witness(*descriptors);
|
| @@ -1240,13 +1240,13 @@ void Genesis::InitializeGlobal(Handle<GlobalObject> inner_global,
|
| map->set_pre_allocated_property_fields(1);
|
| map->set_inobject_properties(1);
|
|
|
| - // Copy constructor from the non-strict arguments boilerplate.
|
| + // Copy constructor from the sloppy arguments boilerplate.
|
| map->set_constructor(
|
| - native_context()->arguments_boilerplate()->map()->constructor());
|
| + native_context()->sloppy_arguments_boilerplate()->map()->constructor());
|
|
|
| // Allocate the arguments boilerplate object.
|
| Handle<JSObject> result = factory->NewJSObjectFromMap(map);
|
| - native_context()->set_strict_mode_arguments_boilerplate(*result);
|
| + native_context()->set_strict_arguments_boilerplate(*result);
|
|
|
| // Add length property only for strict mode boilerplate.
|
| CHECK_NOT_EMPTY_HANDLE(isolate,
|
| @@ -1389,18 +1389,19 @@ void Genesis::InitializeExperimentalGlobal() {
|
|
|
| // Create maps for generator functions and their prototypes. Store those
|
| // maps in the native context.
|
| - Handle<Map> function_map(native_context()->function_map());
|
| + Handle<Map> function_map(native_context()->sloppy_function_map());
|
| Handle<Map> generator_function_map = factory()->CopyMap(function_map);
|
| generator_function_map->set_prototype(*generator_function_prototype);
|
| - native_context()->set_generator_function_map(*generator_function_map);
|
| + native_context()->set_sloppy_generator_function_map(
|
| + *generator_function_map);
|
|
|
| Handle<Map> strict_mode_function_map(
|
| - native_context()->strict_mode_function_map());
|
| + native_context()->strict_function_map());
|
| Handle<Map> strict_mode_generator_function_map = factory()->CopyMap(
|
| strict_mode_function_map);
|
| strict_mode_generator_function_map->set_prototype(
|
| *generator_function_prototype);
|
| - native_context()->set_strict_mode_generator_function_map(
|
| + native_context()->set_strict_generator_function_map(
|
| *strict_mode_generator_function_map);
|
|
|
| Handle<Map> object_map(native_context()->object_function()->initial_map());
|
| @@ -1520,7 +1521,6 @@ bool Genesis::CompileScriptCached(Isolate* isolate,
|
| top_context,
|
| extension,
|
| NULL,
|
| - Handle<String>::null(),
|
| use_runtime_context ? NATIVES_CODE : NOT_NATIVES_CODE);
|
| if (function_info.is_null()) return false;
|
| if (cache != NULL) cache->Add(name, function_info);
|
| @@ -1578,6 +1578,12 @@ void Genesis::InstallNativeFunctions() {
|
| INSTALL_NATIVE(JSObject, "functionCache", function_cache);
|
| INSTALL_NATIVE(JSFunction, "ToCompletePropertyDescriptor",
|
| to_complete_property_descriptor);
|
| + INSTALL_NATIVE(JSFunction, "NotifyChange", observers_notify_change);
|
| + INSTALL_NATIVE(JSFunction, "EnqueueSpliceRecord", observers_enqueue_splice);
|
| + INSTALL_NATIVE(JSFunction, "BeginPerformSplice",
|
| + observers_begin_perform_splice);
|
| + INSTALL_NATIVE(JSFunction, "EndPerformSplice",
|
| + observers_end_perform_splice);
|
| }
|
|
|
|
|
| @@ -1586,20 +1592,21 @@ void Genesis::InstallExperimentalNativeFunctions() {
|
| INSTALL_NATIVE(JSFunction, "EnqueueExternalMicrotask",
|
| enqueue_external_microtask);
|
|
|
| + if (FLAG_harmony_promises) {
|
| + INSTALL_NATIVE(JSFunction, "IsPromise", is_promise);
|
| + INSTALL_NATIVE(JSFunction, "PromiseCreate", promise_create);
|
| + INSTALL_NATIVE(JSFunction, "PromiseResolve", promise_resolve);
|
| + INSTALL_NATIVE(JSFunction, "PromiseReject", promise_reject);
|
| + INSTALL_NATIVE(JSFunction, "PromiseChain", promise_chain);
|
| + INSTALL_NATIVE(JSFunction, "PromiseCatch", promise_catch);
|
| + }
|
| +
|
| if (FLAG_harmony_proxies) {
|
| INSTALL_NATIVE(JSFunction, "DerivedHasTrap", derived_has_trap);
|
| INSTALL_NATIVE(JSFunction, "DerivedGetTrap", derived_get_trap);
|
| INSTALL_NATIVE(JSFunction, "DerivedSetTrap", derived_set_trap);
|
| INSTALL_NATIVE(JSFunction, "ProxyEnumerate", proxy_enumerate);
|
| }
|
| - if (FLAG_harmony_observation) {
|
| - INSTALL_NATIVE(JSFunction, "NotifyChange", observers_notify_change);
|
| - INSTALL_NATIVE(JSFunction, "EnqueueSpliceRecord", observers_enqueue_splice);
|
| - INSTALL_NATIVE(JSFunction, "BeginPerformSplice",
|
| - observers_begin_perform_splice);
|
| - INSTALL_NATIVE(JSFunction, "EndPerformSplice",
|
| - observers_end_perform_splice);
|
| - }
|
| }
|
|
|
| #undef INSTALL_NATIVE
|
| @@ -1755,9 +1762,6 @@ bool Genesis::InstallNatives() {
|
| STATIC_ASCII_VECTOR("column_offset")));
|
| Handle<Foreign> script_column_offset(
|
| factory()->NewForeign(&Accessors::ScriptColumnOffset));
|
| - Handle<String> data_string(factory()->InternalizeOneByteString(
|
| - STATIC_ASCII_VECTOR("data")));
|
| - Handle<Foreign> script_data(factory()->NewForeign(&Accessors::ScriptData));
|
| Handle<String> type_string(factory()->InternalizeOneByteString(
|
| STATIC_ASCII_VECTOR("type")));
|
| Handle<Foreign> script_type(factory()->NewForeign(&Accessors::ScriptType));
|
| @@ -1822,11 +1826,6 @@ bool Genesis::InstallNatives() {
|
| }
|
|
|
| {
|
| - CallbacksDescriptor d(*data_string, *script_data, attribs);
|
| - script_map->AppendDescriptor(&d, witness);
|
| - }
|
| -
|
| - {
|
| CallbacksDescriptor d(*type_string, *script_type, attribs);
|
| script_map->AppendDescriptor(&d, witness);
|
| }
|
| @@ -2051,7 +2050,6 @@ bool Genesis::InstallExperimentalNatives() {
|
| INSTALL_EXPERIMENTAL_NATIVE(i, symbols, "symbol.js")
|
| INSTALL_EXPERIMENTAL_NATIVE(i, proxies, "proxy.js")
|
| INSTALL_EXPERIMENTAL_NATIVE(i, collections, "collection.js")
|
| - INSTALL_EXPERIMENTAL_NATIVE(i, observation, "object-observe.js")
|
| INSTALL_EXPERIMENTAL_NATIVE(i, promises, "promise.js")
|
| INSTALL_EXPERIMENTAL_NATIVE(i, generators, "generator.js")
|
| INSTALL_EXPERIMENTAL_NATIVE(i, iteration, "array-iterator.js")
|
| @@ -2559,13 +2557,14 @@ void Genesis::MakeFunctionInstancePrototypeWritable() {
|
| // The maps with writable prototype are created in CreateEmptyFunction
|
| // and CreateStrictModeFunctionMaps respectively. Initially the maps are
|
| // created with read-only prototype for JS builtins processing.
|
| - ASSERT(!function_map_writable_prototype_.is_null());
|
| - ASSERT(!strict_mode_function_map_writable_prototype_.is_null());
|
| + ASSERT(!sloppy_function_map_writable_prototype_.is_null());
|
| + ASSERT(!strict_function_map_writable_prototype_.is_null());
|
|
|
| // Replace function instance maps to make prototype writable.
|
| - native_context()->set_function_map(*function_map_writable_prototype_);
|
| - native_context()->set_strict_mode_function_map(
|
| - *strict_mode_function_map_writable_prototype_);
|
| + native_context()->set_sloppy_function_map(
|
| + *sloppy_function_map_writable_prototype_);
|
| + native_context()->set_strict_function_map(
|
| + *strict_function_map_writable_prototype_);
|
| }
|
|
|
|
|
|
|