Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(71)

Side by Side Diff: src/bootstrapper.cc

Issue 2622833002: WIP [esnext] implement async iteration proposal (Closed)
Patch Set: Created 3 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright 2014 the V8 project authors. All rights reserved. 1 // Copyright 2014 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "src/bootstrapper.h" 5 #include "src/bootstrapper.h"
6 6
7 #include "src/accessors.h" 7 #include "src/accessors.h"
8 #include "src/api-natives.h" 8 #include "src/api-natives.h"
9 #include "src/base/ieee754.h" 9 #include "src/base/ieee754.h"
10 #include "src/code-stubs.h" 10 #include "src/code-stubs.h"
(...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after
162 void CreateRoots(); 162 void CreateRoots();
163 // Creates the empty function. Used for creating a context from scratch. 163 // Creates the empty function. Used for creating a context from scratch.
164 Handle<JSFunction> CreateEmptyFunction(Isolate* isolate); 164 Handle<JSFunction> CreateEmptyFunction(Isolate* isolate);
165 // Creates the ThrowTypeError function. ECMA 5th Ed. 13.2.3 165 // Creates the ThrowTypeError function. ECMA 5th Ed. 13.2.3
166 Handle<JSFunction> GetRestrictedFunctionPropertiesThrower(); 166 Handle<JSFunction> GetRestrictedFunctionPropertiesThrower();
167 Handle<JSFunction> GetStrictArgumentsPoisonFunction(); 167 Handle<JSFunction> GetStrictArgumentsPoisonFunction();
168 Handle<JSFunction> GetThrowTypeErrorIntrinsic(Builtins::Name builtin_name); 168 Handle<JSFunction> GetThrowTypeErrorIntrinsic(Builtins::Name builtin_name);
169 169
170 void CreateStrictModeFunctionMaps(Handle<JSFunction> empty); 170 void CreateStrictModeFunctionMaps(Handle<JSFunction> empty);
171 void CreateIteratorMaps(Handle<JSFunction> empty); 171 void CreateIteratorMaps(Handle<JSFunction> empty);
172 void CreateAsyncIteratorMaps(Handle<JSFunction> empty);
172 void CreateAsyncFunctionMaps(Handle<JSFunction> empty); 173 void CreateAsyncFunctionMaps(Handle<JSFunction> empty);
173 void CreateJSProxyMaps(); 174 void CreateJSProxyMaps();
174 175
175 // Make the "arguments" and "caller" properties throw a TypeError on access. 176 // Make the "arguments" and "caller" properties throw a TypeError on access.
176 void AddRestrictedFunctionProperties(Handle<JSFunction> empty); 177 void AddRestrictedFunctionProperties(Handle<JSFunction> empty);
177 178
178 // Creates the global objects using the global proxy and the template passed 179 // Creates the global objects using the global proxy and the template passed
179 // in through the API. We call this regardless of whether we are building a 180 // in through the API. We call this regardless of whether we are building a
180 // context from scratch or using a deserialized one from the partial snapshot 181 // context from scratch or using a deserialized one from the partial snapshot
181 // but in the latter case we don't use the objects it produces directly, as 182 // but in the latter case we don't use the objects it produces directly, as
(...skipping 592 matching lines...) Expand 10 before | Expand all | Expand 10 after
774 Map::SetPrototype(generator_function_map, generator_function_prototype); 775 Map::SetPrototype(generator_function_map, generator_function_prototype);
775 native_context()->set_generator_function_map(*generator_function_map); 776 native_context()->set_generator_function_map(*generator_function_map);
776 777
777 Handle<JSFunction> object_function(native_context()->object_function()); 778 Handle<JSFunction> object_function(native_context()->object_function());
778 Handle<Map> generator_object_prototype_map = Map::Create(isolate(), 0); 779 Handle<Map> generator_object_prototype_map = Map::Create(isolate(), 0);
779 Map::SetPrototype(generator_object_prototype_map, generator_object_prototype); 780 Map::SetPrototype(generator_object_prototype_map, generator_object_prototype);
780 native_context()->set_generator_object_prototype_map( 781 native_context()->set_generator_object_prototype_map(
781 *generator_object_prototype_map); 782 *generator_object_prototype_map);
782 } 783 }
783 784
785 static void InstallWithIntrinsicDefaultProto(Isolate* isolate,
786 Handle<JSFunction> function,
787 int context_index) {
788 Handle<Smi> index(Smi::FromInt(context_index), isolate);
789 JSObject::AddProperty(
790 function, isolate->factory()->native_context_index_symbol(), index, NONE);
791 isolate->native_context()->set(context_index, *function);
792 }
793
794 void Genesis::CreateAsyncIteratorMaps(Handle<JSFunction> empty) {
795 // Create iterator-related meta-objects.
796 Handle<JSObject> async_iterator_prototype =
797 factory()->NewJSObject(isolate()->object_function(), TENURED);
798
799 Handle<JSFunction> async_iterator_prototype_iterator = SimpleCreateFunction(
800 isolate(), factory()->NewStringFromAsciiChecked("[Symbol.asyncIterator]"),
801 Builtins::kReturnReceiver, 0, true);
802 async_iterator_prototype_iterator->shared()->set_native(true);
803
804 JSObject::AddProperty(async_iterator_prototype,
805 factory()->async_iterator_symbol(),
806 async_iterator_prototype_iterator, DONT_ENUM);
807 native_context()->set_initial_async_iterator_prototype(
808 *async_iterator_prototype);
809
810 Handle<JSObject> async_from_sync_iterator_prototype =
811 factory()->NewJSObject(isolate()->object_function(), TENURED);
812 SimpleInstallFunction(async_from_sync_iterator_prototype,
813 factory()->next_string(),
814 Builtins::kAsyncFromSyncIteratorPrototypeNext, 1, true);
815 SimpleInstallFunction(
816 async_from_sync_iterator_prototype, factory()->return_string(),
817 Builtins::kAsyncFromSyncIteratorPrototypeReturn, 1, true);
818 SimpleInstallFunction(
819 async_from_sync_iterator_prototype, factory()->throw_string(),
820 Builtins::kAsyncFromSyncIteratorPrototypeThrow, 1, true);
821
822 JSObject::AddProperty(
823 async_from_sync_iterator_prototype, factory()->to_string_tag_symbol(),
824 factory()->NewStringFromAsciiChecked("Async-from-Sync Iterator"),
825 static_cast<PropertyAttributes>(DONT_ENUM | READ_ONLY));
826
827 JSObject::ForceSetPrototype(async_from_sync_iterator_prototype,
828 async_iterator_prototype);
829
830 Handle<Map> async_from_sync_iterator_map = factory()->NewMap(
831 JS_ASYNC_FROM_SYNC_ITERATOR_TYPE, JSAsyncFromSyncIterator::kSize);
832 Map::SetPrototype(async_from_sync_iterator_map,
833 async_from_sync_iterator_prototype);
834 native_context()->set_initial_async_from_sync_iterator_map(
835 *async_from_sync_iterator_map);
836
837 Handle<String> AsyncGeneratorFunction_string =
838 factory()->NewStringFromAsciiChecked("AsyncGeneratorFunction", TENURED);
839
840 static const bool kUseStrictFunctionMap = true;
841 Handle<JSObject> async_generator_object_prototype =
842 factory()->NewJSObject(isolate()->object_function(), TENURED);
843 Handle<JSObject> async_generator_function_prototype =
844 factory()->NewJSObject(isolate()->object_function(), TENURED);
845
846 Handle<JSFunction> async_generator_function = SimpleCreateFunction(
847 isolate(), AsyncGeneratorFunction_string,
848 Builtins::kAsyncGeneratorFunctionConstructor, 1, false);
849 InstallWithIntrinsicDefaultProto(
850 isolate(), async_generator_function,
851 Context::ASYNC_GENERATOR_FUNCTION_FUNCTION_INDEX);
852
853 // %AsyncGenerator% / %AsyncGeneratorFunction%.prototype
854 JSObject::ForceSetPrototype(async_generator_function_prototype, empty);
855 JSObject::AddProperty(async_generator_function_prototype,
856 factory()->constructor_string(),
857 async_generator_function,
858 static_cast<PropertyAttributes>(DONT_ENUM | READ_ONLY));
859 JSObject::AddProperty(async_generator_function_prototype,
860 factory()->prototype_string(),
861 async_generator_object_prototype,
862 static_cast<PropertyAttributes>(DONT_ENUM | READ_ONLY));
863 JSObject::AddProperty(async_generator_function_prototype,
864 factory()->to_string_tag_symbol(),
865 AsyncGeneratorFunction_string,
866 static_cast<PropertyAttributes>(DONT_ENUM | READ_ONLY));
867
868 // %AsyncGeneratorPrototype%
869 JSObject::ForceSetPrototype(async_generator_object_prototype,
870 async_iterator_prototype);
871
872 JSObject::AddProperty(async_generator_object_prototype,
873 factory()->constructor_string(),
874 async_generator_function,
875 static_cast<PropertyAttributes>(DONT_ENUM | READ_ONLY));
876 JSObject::AddProperty(async_generator_object_prototype,
877 factory()->to_string_tag_symbol(),
878 factory()->NewStringFromAsciiChecked("AsyncGenerator"),
879 static_cast<PropertyAttributes>(DONT_ENUM | READ_ONLY));
880 SimpleInstallFunction(async_generator_object_prototype, "next",
881 Builtins::kAsyncGeneratorPrototypeNext, 1, true);
882 SimpleInstallFunction(async_generator_object_prototype, "return",
883 Builtins::kAsyncGeneratorPrototypeReturn, 1, true);
884 SimpleInstallFunction(async_generator_object_prototype, "throw",
885 Builtins::kAsyncGeneratorPrototypeThrow, 1, true);
886
887 // Create maps for async generator functions and their prototypes. Store those
888 // maps in the native context. The "prototype" property descriptor is
889 // writable, non-enumerable, and non-configurable.
890 Handle<Map> strict_function_map(strict_function_map_writable_prototype_);
891
892 // Async Generator functions do not have "caller" or "arguments" accessors in
893 // either sloppy mode or strict mode.
894 Handle<Map> async_generator_function_map =
895 Map::Copy(strict_function_map, "AsyncGeneratorFunction");
896 async_generator_function_map->set_is_constructor(false);
897 Map::SetPrototype(async_generator_function_map,
898 async_generator_function_prototype);
899 native_context()->set_async_generator_function_map(
900 *async_generator_function_map);
901
902 Handle<JSFunction> object_function(native_context()->object_function());
903 Handle<Map> async_generator_object_prototype_map = Map::Create(isolate(), 0);
904 Map::SetPrototype(async_generator_object_prototype_map,
905 async_generator_object_prototype);
906 native_context()->set_async_generator_object_prototype_map(
907 *async_generator_object_prototype_map);
908 }
909
784 void Genesis::CreateAsyncFunctionMaps(Handle<JSFunction> empty) { 910 void Genesis::CreateAsyncFunctionMaps(Handle<JSFunction> empty) {
785 // %AsyncFunctionPrototype% intrinsic 911 // %AsyncFunctionPrototype% intrinsic
786 Handle<JSObject> async_function_prototype = 912 Handle<JSObject> async_function_prototype =
787 factory()->NewJSObject(isolate()->object_function(), TENURED); 913 factory()->NewJSObject(isolate()->object_function(), TENURED);
788 JSObject::ForceSetPrototype(async_function_prototype, empty); 914 JSObject::ForceSetPrototype(async_function_prototype, empty);
789 915
790 JSObject::AddProperty(async_function_prototype, 916 JSObject::AddProperty(async_function_prototype,
791 factory()->to_string_tag_symbol(), 917 factory()->to_string_tag_symbol(),
792 factory()->NewStringFromAsciiChecked("AsyncFunction"), 918 factory()->NewStringFromAsciiChecked("AsyncFunction"),
793 static_cast<PropertyAttributes>(DONT_ENUM | READ_ONLY)); 919 static_cast<PropertyAttributes>(DONT_ENUM | READ_ONLY));
(...skipping 233 matching lines...) Expand 10 before | Expand all | Expand 10 after
1027 void Genesis::HookUpGlobalObject(Handle<JSGlobalObject> global_object) { 1153 void Genesis::HookUpGlobalObject(Handle<JSGlobalObject> global_object) {
1028 Handle<JSGlobalObject> global_object_from_snapshot( 1154 Handle<JSGlobalObject> global_object_from_snapshot(
1029 JSGlobalObject::cast(native_context()->extension())); 1155 JSGlobalObject::cast(native_context()->extension()));
1030 native_context()->set_extension(*global_object); 1156 native_context()->set_extension(*global_object);
1031 native_context()->set_security_token(*global_object); 1157 native_context()->set_security_token(*global_object);
1032 1158
1033 TransferNamedProperties(global_object_from_snapshot, global_object); 1159 TransferNamedProperties(global_object_from_snapshot, global_object);
1034 TransferIndexedProperties(global_object_from_snapshot, global_object); 1160 TransferIndexedProperties(global_object_from_snapshot, global_object);
1035 } 1161 }
1036 1162
1037 static void InstallWithIntrinsicDefaultProto(Isolate* isolate,
1038 Handle<JSFunction> function,
1039 int context_index) {
1040 Handle<Smi> index(Smi::FromInt(context_index), isolate);
1041 JSObject::AddProperty(
1042 function, isolate->factory()->native_context_index_symbol(), index, NONE);
1043 isolate->native_context()->set(context_index, *function);
1044 }
1045
1046 static void InstallError(Isolate* isolate, Handle<JSObject> global, 1163 static void InstallError(Isolate* isolate, Handle<JSObject> global,
1047 Handle<String> name, int context_index) { 1164 Handle<String> name, int context_index) {
1048 Factory* factory = isolate->factory(); 1165 Factory* factory = isolate->factory();
1049 1166
1050 Handle<JSFunction> error_fun = 1167 Handle<JSFunction> error_fun =
1051 InstallFunction(global, name, JS_ERROR_TYPE, JSObject::kHeaderSize, 1168 InstallFunction(global, name, JS_ERROR_TYPE, JSObject::kHeaderSize,
1052 isolate->initial_object_prototype(), 1169 isolate->initial_object_prototype(),
1053 Builtins::kErrorConstructor, DONT_ENUM); 1170 Builtins::kErrorConstructor, DONT_ENUM);
1054 error_fun->shared()->set_instance_class_name(*factory->Error_string()); 1171 error_fun->shared()->set_instance_class_name(*factory->Error_string());
1055 error_fun->shared()->DontAdaptArguments(); 1172 error_fun->shared()->DontAdaptArguments();
(...skipping 228 matching lines...) Expand 10 before | Expand all | Expand 10 after
1284 1401
1285 // Install the "constructor" property on the %FunctionPrototype%. 1402 // Install the "constructor" property on the %FunctionPrototype%.
1286 JSObject::AddProperty(prototype, factory->constructor_string(), 1403 JSObject::AddProperty(prototype, factory->constructor_string(),
1287 function_fun, DONT_ENUM); 1404 function_fun, DONT_ENUM);
1288 1405
1289 sloppy_function_map_writable_prototype_->SetConstructor(*function_fun); 1406 sloppy_function_map_writable_prototype_->SetConstructor(*function_fun);
1290 strict_function_map_writable_prototype_->SetConstructor(*function_fun); 1407 strict_function_map_writable_prototype_->SetConstructor(*function_fun);
1291 class_function_map_->SetConstructor(*function_fun); 1408 class_function_map_->SetConstructor(*function_fun);
1292 } 1409 }
1293 1410
1411 {
1412 // --- A s y n c F r o m S y n c I t e r a t o r
1413 Handle<Code> code = handle(
1414 isolate->builtins()->builtin(Builtins::kAsyncIteratorValueUnwrap),
1415 isolate);
1416 Handle<SharedFunctionInfo> info =
1417 factory->NewSharedFunctionInfo(factory->empty_string(), code, false);
1418 info->set_internal_formal_parameter_count(1);
1419 info->set_length(1);
1420 native_context()->set_async_iterator_value_unwrap_shared_fun(*info);
1421 }
1422
1423 { // --- A s y n c G e n e r a t o r ---
1424 Handle<JSFunction> async_generator_function(
1425 native_context()->async_generator_function_function(), isolate);
1426 Handle<JSFunction> function_fun(native_context()->function_function(),
1427 isolate);
1428 JSObject::ForceSetPrototype(async_generator_function, function_fun);
1429
1430 async_generator_function->set_prototype_or_initial_map(
1431 native_context()->async_generator_function_map());
1432 async_generator_function->shared()->SetConstructStub(
1433 *isolate->builtins()->AsyncGeneratorFunctionConstructor());
1434 native_context()->async_generator_function_map()->SetConstructor(
1435 *async_generator_function);
1436
1437 Handle<JSFunction> await_caught =
1438 SimpleCreateFunction(isolate, factory->empty_string(),
1439 Builtins::kAsyncGeneratorAwaitCaught, 2, false);
1440 InstallWithIntrinsicDefaultProto(isolate, await_caught,
1441 Context::ASYNC_GENERATOR_AWAIT_CAUGHT);
1442
1443 Handle<JSFunction> await_uncaught =
1444 SimpleCreateFunction(isolate, factory->empty_string(),
1445 Builtins::kAsyncGeneratorAwaitUncaught, 2, false);
1446 InstallWithIntrinsicDefaultProto(isolate, await_uncaught,
1447 Context::ASYNC_GENERATOR_AWAIT_UNCAUGHT);
1448
1449 Handle<Code> code =
1450 handle(isolate->builtins()->builtin(
1451 Builtins::kAsyncGeneratorAwaitResolveClosure),
1452 isolate);
1453 Handle<SharedFunctionInfo> info =
1454 factory->NewSharedFunctionInfo(factory->empty_string(), code, false);
1455 info->set_internal_formal_parameter_count(1);
1456 info->set_length(1);
1457 native_context()->set_async_generator_await_resolve_shared_fun(*info);
1458
1459 code = handle(isolate->builtins()->builtin(
1460 Builtins::kAsyncGeneratorAwaitRejectClosure),
1461 isolate);
1462 info = factory->NewSharedFunctionInfo(factory->empty_string(), code, false);
1463 info->set_internal_formal_parameter_count(1);
1464 info->set_length(1);
1465 native_context()->set_async_generator_await_reject_shared_fun(*info);
1466 }
1467
1294 { // --- A r r a y --- 1468 { // --- A r r a y ---
1295 Handle<JSFunction> array_function = 1469 Handle<JSFunction> array_function =
1296 InstallFunction(global, "Array", JS_ARRAY_TYPE, JSArray::kSize, 1470 InstallFunction(global, "Array", JS_ARRAY_TYPE, JSArray::kSize,
1297 isolate->initial_object_prototype(), 1471 isolate->initial_object_prototype(),
1298 Builtins::kArrayCode); 1472 Builtins::kArrayCode);
1299 array_function->shared()->DontAdaptArguments(); 1473 array_function->shared()->DontAdaptArguments();
1300 array_function->shared()->set_builtin_function_id(kArrayCode); 1474 array_function->shared()->set_builtin_function_id(kArrayCode);
1301 1475
1302 // This seems a bit hackish, but we need to make sure Array.length 1476 // This seems a bit hackish, but we need to make sure Array.length
1303 // is 1. 1477 // is 1.
(...skipping 2135 matching lines...) Expand 10 before | Expand all | Expand 10 after
3439 EMPTY_INITIALIZE_GLOBAL_FOR_FEATURE(harmony_tailcalls) 3613 EMPTY_INITIALIZE_GLOBAL_FOR_FEATURE(harmony_tailcalls)
3440 #ifdef V8_I18N_SUPPORT 3614 #ifdef V8_I18N_SUPPORT
3441 EMPTY_INITIALIZE_GLOBAL_FOR_FEATURE(datetime_format_to_parts) 3615 EMPTY_INITIALIZE_GLOBAL_FOR_FEATURE(datetime_format_to_parts)
3442 EMPTY_INITIALIZE_GLOBAL_FOR_FEATURE(icu_case_mapping) 3616 EMPTY_INITIALIZE_GLOBAL_FOR_FEATURE(icu_case_mapping)
3443 #endif 3617 #endif
3444 EMPTY_INITIALIZE_GLOBAL_FOR_FEATURE(harmony_async_await) 3618 EMPTY_INITIALIZE_GLOBAL_FOR_FEATURE(harmony_async_await)
3445 EMPTY_INITIALIZE_GLOBAL_FOR_FEATURE(harmony_restrictive_generators) 3619 EMPTY_INITIALIZE_GLOBAL_FOR_FEATURE(harmony_restrictive_generators)
3446 EMPTY_INITIALIZE_GLOBAL_FOR_FEATURE(harmony_trailing_commas) 3620 EMPTY_INITIALIZE_GLOBAL_FOR_FEATURE(harmony_trailing_commas)
3447 EMPTY_INITIALIZE_GLOBAL_FOR_FEATURE(harmony_class_fields) 3621 EMPTY_INITIALIZE_GLOBAL_FOR_FEATURE(harmony_class_fields)
3448 EMPTY_INITIALIZE_GLOBAL_FOR_FEATURE(harmony_object_spread) 3622 EMPTY_INITIALIZE_GLOBAL_FOR_FEATURE(harmony_object_spread)
3623 EMPTY_INITIALIZE_GLOBAL_FOR_FEATURE(harmony_async_iteration)
3449 3624
3450 void InstallPublicSymbol(Factory* factory, Handle<Context> native_context, 3625 void InstallPublicSymbol(Factory* factory, Handle<Context> native_context,
3451 const char* name, Handle<Symbol> value) { 3626 const char* name, Handle<Symbol> value) {
3452 Handle<JSGlobalObject> global( 3627 Handle<JSGlobalObject> global(
3453 JSGlobalObject::cast(native_context->global_object())); 3628 JSGlobalObject::cast(native_context->global_object()));
3454 Handle<String> symbol_string = factory->InternalizeUtf8String("Symbol"); 3629 Handle<String> symbol_string = factory->InternalizeUtf8String("Symbol");
3455 Handle<JSObject> symbol = Handle<JSObject>::cast( 3630 Handle<JSObject> symbol = Handle<JSObject>::cast(
3456 JSObject::GetProperty(global, symbol_string).ToHandleChecked()); 3631 JSObject::GetProperty(global, symbol_string).ToHandleChecked());
3457 Handle<String> name_string = factory->InternalizeUtf8String(name); 3632 Handle<String> name_string = factory->InternalizeUtf8String(name);
3458 PropertyAttributes attributes = 3633 PropertyAttributes attributes =
(...skipping 540 matching lines...) Expand 10 before | Expand all | Expand 10 after
3999 static const char* icu_case_mapping_natives[] = {"native icu-case-mapping.js", 4174 static const char* icu_case_mapping_natives[] = {"native icu-case-mapping.js",
4000 nullptr}; 4175 nullptr};
4001 static const char* datetime_format_to_parts_natives[] = { 4176 static const char* datetime_format_to_parts_natives[] = {
4002 "native datetime-format-to-parts.js", nullptr}; 4177 "native datetime-format-to-parts.js", nullptr};
4003 #endif 4178 #endif
4004 static const char* harmony_async_await_natives[] = {nullptr}; 4179 static const char* harmony_async_await_natives[] = {nullptr};
4005 static const char* harmony_restrictive_generators_natives[] = {nullptr}; 4180 static const char* harmony_restrictive_generators_natives[] = {nullptr};
4006 static const char* harmony_trailing_commas_natives[] = {nullptr}; 4181 static const char* harmony_trailing_commas_natives[] = {nullptr};
4007 static const char* harmony_class_fields_natives[] = {nullptr}; 4182 static const char* harmony_class_fields_natives[] = {nullptr};
4008 static const char* harmony_object_spread_natives[] = {nullptr}; 4183 static const char* harmony_object_spread_natives[] = {nullptr};
4184 static const char* harmony_async_iteration_natives[] = {nullptr};
4009 4185
4010 for (int i = ExperimentalNatives::GetDebuggerCount(); 4186 for (int i = ExperimentalNatives::GetDebuggerCount();
4011 i < ExperimentalNatives::GetBuiltinsCount(); i++) { 4187 i < ExperimentalNatives::GetBuiltinsCount(); i++) {
4012 #define INSTALL_EXPERIMENTAL_NATIVES(id, desc) \ 4188 #define INSTALL_EXPERIMENTAL_NATIVES(id, desc) \
4013 if (FLAG_##id) { \ 4189 if (FLAG_##id) { \
4014 for (size_t j = 0; id##_natives[j] != NULL; j++) { \ 4190 for (size_t j = 0; id##_natives[j] != NULL; j++) { \
4015 Vector<const char> script_name = ExperimentalNatives::GetScriptName(i); \ 4191 Vector<const char> script_name = ExperimentalNatives::GetScriptName(i); \
4016 if (strncmp(script_name.start(), id##_natives[j], \ 4192 if (strncmp(script_name.start(), id##_natives[j], \
4017 script_name.length()) == 0) { \ 4193 script_name.length()) == 0) { \
4018 if (!Bootstrapper::CompileExperimentalBuiltin(isolate(), i)) { \ 4194 if (!Bootstrapper::CompileExperimentalBuiltin(isolate(), i)) { \
(...skipping 581 matching lines...) Expand 10 before | Expand all | Expand 10 after
4600 HookUpGlobalProxy(global_proxy); 4776 HookUpGlobalProxy(global_proxy);
4601 } 4777 }
4602 DCHECK(!global_proxy->IsDetachedFrom(native_context()->global_object())); 4778 DCHECK(!global_proxy->IsDetachedFrom(native_context()->global_object()));
4603 } else { 4779 } else {
4604 DCHECK_EQ(0u, context_snapshot_index); 4780 DCHECK_EQ(0u, context_snapshot_index);
4605 // We get here if there was no context snapshot. 4781 // We get here if there was no context snapshot.
4606 CreateRoots(); 4782 CreateRoots();
4607 Handle<JSFunction> empty_function = CreateEmptyFunction(isolate); 4783 Handle<JSFunction> empty_function = CreateEmptyFunction(isolate);
4608 CreateStrictModeFunctionMaps(empty_function); 4784 CreateStrictModeFunctionMaps(empty_function);
4609 CreateIteratorMaps(empty_function); 4785 CreateIteratorMaps(empty_function);
4786 CreateAsyncIteratorMaps(empty_function);
4610 CreateAsyncFunctionMaps(empty_function); 4787 CreateAsyncFunctionMaps(empty_function);
4611 Handle<JSGlobalObject> global_object = 4788 Handle<JSGlobalObject> global_object =
4612 CreateNewGlobals(global_proxy_template, global_proxy); 4789 CreateNewGlobals(global_proxy_template, global_proxy);
4613 InitializeGlobal(global_object, empty_function, context_type); 4790 InitializeGlobal(global_object, empty_function, context_type);
4614 InitializeNormalizedMapCaches(); 4791 InitializeNormalizedMapCaches();
4615 4792
4616 if (!InstallNatives(context_type)) return; 4793 if (!InstallNatives(context_type)) return;
4617 4794
4618 MakeFunctionInstancePrototypeWritable(); 4795 MakeFunctionInstancePrototypeWritable();
4619 4796
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after
4742 } 4919 }
4743 4920
4744 4921
4745 // Called when the top-level V8 mutex is destroyed. 4922 // Called when the top-level V8 mutex is destroyed.
4746 void Bootstrapper::FreeThreadResources() { 4923 void Bootstrapper::FreeThreadResources() {
4747 DCHECK(!IsActive()); 4924 DCHECK(!IsActive());
4748 } 4925 }
4749 4926
4750 } // namespace internal 4927 } // namespace internal
4751 } // namespace v8 4928 } // namespace v8
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698