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

Side by Side Diff: src/bootstrapper.cc

Issue 2622833002: WIP [esnext] implement async iteration proposal (Closed)
Patch Set: simplify AsyncIteratorValueUnwrap 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
« no previous file with comments | « src/bailout-reason.h ('k') | src/builtins/builtins.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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
808 Handle<JSObject> async_from_sync_iterator_prototype =
809 factory()->NewJSObject(isolate()->object_function(), TENURED);
810 SimpleInstallFunction(async_from_sync_iterator_prototype,
811 factory()->next_string(),
812 Builtins::kAsyncFromSyncIteratorPrototypeNext, 1, true);
813 SimpleInstallFunction(
814 async_from_sync_iterator_prototype, factory()->return_string(),
815 Builtins::kAsyncFromSyncIteratorPrototypeReturn, 1, true);
816 SimpleInstallFunction(
817 async_from_sync_iterator_prototype, factory()->throw_string(),
818 Builtins::kAsyncFromSyncIteratorPrototypeThrow, 1, true);
819
820 JSObject::AddProperty(
821 async_from_sync_iterator_prototype, factory()->to_string_tag_symbol(),
822 factory()->NewStringFromAsciiChecked("Async-from-Sync Iterator"),
823 static_cast<PropertyAttributes>(DONT_ENUM | READ_ONLY));
824
825 JSObject::ForceSetPrototype(async_from_sync_iterator_prototype,
826 async_iterator_prototype);
827
828 Handle<Map> async_from_sync_iterator_map = factory()->NewMap(
829 JS_ASYNC_FROM_SYNC_ITERATOR_TYPE, JSAsyncFromSyncIterator::kSize);
830 Map::SetPrototype(async_from_sync_iterator_map,
831 async_from_sync_iterator_prototype);
832 native_context()->set_initial_async_from_sync_iterator_map(
833 *async_from_sync_iterator_map);
834
835 Handle<String> AsyncGeneratorFunction_string =
836 factory()->NewStringFromAsciiChecked("AsyncGeneratorFunction", TENURED);
837
838 static const bool kUseStrictFunctionMap = true;
839 Handle<JSObject> async_generator_object_prototype =
840 factory()->NewJSObject(isolate()->object_function(), TENURED);
841 Handle<JSObject> async_generator_function_prototype =
842 factory()->NewJSObject(isolate()->object_function(), TENURED);
843
844 Handle<JSFunction> async_generator_function = CreateFunction(
845 isolate(), AsyncGeneratorFunction_string, JS_OBJECT_TYPE,
846 JSObject::kHeaderSize, async_generator_function_prototype,
847 Builtins::kAsyncGeneratorFunctionConstructor, kUseStrictFunctionMap);
848 async_generator_function->shared()->DontAdaptArguments();
849 async_generator_function->shared()->set_length(1);
850 InstallWithIntrinsicDefaultProto(
851 isolate(), async_generator_function,
852 Context::ASYNC_GENERATOR_FUNCTION_FUNCTION_INDEX);
853
854 // %AsyncGenerator% / %AsyncGeneratorFunction%.prototype
855 JSObject::ForceSetPrototype(async_generator_function_prototype, empty);
856 JSObject::AddProperty(async_generator_function_prototype,
857 factory()->constructor_string(),
858 async_generator_function,
859 static_cast<PropertyAttributes>(DONT_ENUM | READ_ONLY));
860
861 // The value of AsyncGeneratorFunction.prototype.prototype is the
862 // %AsyncGeneratorPrototype% intrinsic object.
863 // This property has the attributes
864 // { [[Writable]]: false, [[Enumerable]]: false, [[Configurable]]: true }.
865 JSObject::AddProperty(async_generator_function_prototype,
866 factory()->prototype_string(),
867 async_generator_object_prototype,
868 static_cast<PropertyAttributes>(DONT_ENUM | READ_ONLY));
869 JSObject::AddProperty(async_generator_function_prototype,
870 factory()->to_string_tag_symbol(),
871 AsyncGeneratorFunction_string,
872 static_cast<PropertyAttributes>(DONT_ENUM | READ_ONLY));
873
874 // %AsyncGeneratorPrototype%
875 JSObject::ForceSetPrototype(async_generator_object_prototype,
876 async_iterator_prototype);
877
878 JSObject::AddProperty(async_generator_object_prototype,
879 factory()->constructor_string(),
880 async_generator_function,
881 static_cast<PropertyAttributes>(DONT_ENUM | READ_ONLY));
882 JSObject::AddProperty(async_generator_object_prototype,
883 factory()->to_string_tag_symbol(),
884 factory()->NewStringFromAsciiChecked("AsyncGenerator"),
885 static_cast<PropertyAttributes>(DONT_ENUM | READ_ONLY));
886 SimpleInstallFunction(async_generator_object_prototype, "next",
887 Builtins::kAsyncGeneratorPrototypeNext, 1, true);
888 SimpleInstallFunction(async_generator_object_prototype, "return",
889 Builtins::kAsyncGeneratorPrototypeReturn, 1, true);
890 SimpleInstallFunction(async_generator_object_prototype, "throw",
891 Builtins::kAsyncGeneratorPrototypeThrow, 1, true);
892
893 // Create maps for async generator functions and their prototypes. Store those
894 // maps in the native context. The "prototype" property descriptor is
895 // writable, non-enumerable, and non-configurable.
896 Handle<Map> strict_function_map(strict_function_map_writable_prototype_);
897
898 // Async Generator functions do not have "caller" or "arguments" accessors in
899 // either sloppy mode or strict mode.
900 Handle<Map> async_generator_function_map =
901 Map::Copy(strict_function_map, "AsyncGeneratorFunction");
902 async_generator_function_map->set_is_constructor(false);
903 Map::SetPrototype(async_generator_function_map,
904 async_generator_function_prototype);
905 native_context()->set_async_generator_function_map(
906 *async_generator_function_map);
907
908 Handle<JSFunction> object_function(native_context()->object_function());
909 Handle<Map> async_generator_object_prototype_map = Map::Create(isolate(), 0);
910 Map::SetPrototype(async_generator_object_prototype_map,
911 async_generator_object_prototype);
912 native_context()->set_async_generator_object_prototype_map(
913 *async_generator_object_prototype_map);
914 }
915
784 void Genesis::CreateAsyncFunctionMaps(Handle<JSFunction> empty) { 916 void Genesis::CreateAsyncFunctionMaps(Handle<JSFunction> empty) {
785 // %AsyncFunctionPrototype% intrinsic 917 // %AsyncFunctionPrototype% intrinsic
786 Handle<JSObject> async_function_prototype = 918 Handle<JSObject> async_function_prototype =
787 factory()->NewJSObject(isolate()->object_function(), TENURED); 919 factory()->NewJSObject(isolate()->object_function(), TENURED);
788 JSObject::ForceSetPrototype(async_function_prototype, empty); 920 JSObject::ForceSetPrototype(async_function_prototype, empty);
789 921
790 JSObject::AddProperty(async_function_prototype, 922 JSObject::AddProperty(async_function_prototype,
791 factory()->to_string_tag_symbol(), 923 factory()->to_string_tag_symbol(),
792 factory()->NewStringFromAsciiChecked("AsyncFunction"), 924 factory()->NewStringFromAsciiChecked("AsyncFunction"),
793 static_cast<PropertyAttributes>(DONT_ENUM | READ_ONLY)); 925 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) { 1159 void Genesis::HookUpGlobalObject(Handle<JSGlobalObject> global_object) {
1028 Handle<JSGlobalObject> global_object_from_snapshot( 1160 Handle<JSGlobalObject> global_object_from_snapshot(
1029 JSGlobalObject::cast(native_context()->extension())); 1161 JSGlobalObject::cast(native_context()->extension()));
1030 native_context()->set_extension(*global_object); 1162 native_context()->set_extension(*global_object);
1031 native_context()->set_security_token(*global_object); 1163 native_context()->set_security_token(*global_object);
1032 1164
1033 TransferNamedProperties(global_object_from_snapshot, global_object); 1165 TransferNamedProperties(global_object_from_snapshot, global_object);
1034 TransferIndexedProperties(global_object_from_snapshot, global_object); 1166 TransferIndexedProperties(global_object_from_snapshot, global_object);
1035 } 1167 }
1036 1168
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, 1169 static void InstallError(Isolate* isolate, Handle<JSObject> global,
1047 Handle<String> name, int context_index) { 1170 Handle<String> name, int context_index) {
1048 Factory* factory = isolate->factory(); 1171 Factory* factory = isolate->factory();
1049 1172
1050 Handle<JSFunction> error_fun = 1173 Handle<JSFunction> error_fun =
1051 InstallFunction(global, name, JS_ERROR_TYPE, JSObject::kHeaderSize, 1174 InstallFunction(global, name, JS_ERROR_TYPE, JSObject::kHeaderSize,
1052 isolate->initial_object_prototype(), 1175 isolate->initial_object_prototype(),
1053 Builtins::kErrorConstructor, DONT_ENUM); 1176 Builtins::kErrorConstructor, DONT_ENUM);
1054 error_fun->shared()->set_instance_class_name(*factory->Error_string()); 1177 error_fun->shared()->set_instance_class_name(*factory->Error_string());
1055 error_fun->shared()->DontAdaptArguments(); 1178 error_fun->shared()->DontAdaptArguments();
(...skipping 228 matching lines...) Expand 10 before | Expand all | Expand 10 after
1284 1407
1285 // Install the "constructor" property on the %FunctionPrototype%. 1408 // Install the "constructor" property on the %FunctionPrototype%.
1286 JSObject::AddProperty(prototype, factory->constructor_string(), 1409 JSObject::AddProperty(prototype, factory->constructor_string(),
1287 function_fun, DONT_ENUM); 1410 function_fun, DONT_ENUM);
1288 1411
1289 sloppy_function_map_writable_prototype_->SetConstructor(*function_fun); 1412 sloppy_function_map_writable_prototype_->SetConstructor(*function_fun);
1290 strict_function_map_writable_prototype_->SetConstructor(*function_fun); 1413 strict_function_map_writable_prototype_->SetConstructor(*function_fun);
1291 class_function_map_->SetConstructor(*function_fun); 1414 class_function_map_->SetConstructor(*function_fun);
1292 } 1415 }
1293 1416
1417 {
1418 // --- A s y n c F r o m S y n c I t e r a t o r
1419 Handle<Code> code = isolate->builtins()->AsyncIteratorValueUnwrap();
1420 Handle<SharedFunctionInfo> info =
1421 factory->NewSharedFunctionInfo(factory->empty_string(), code, false);
1422 info->set_internal_formal_parameter_count(1);
1423 info->set_length(1);
1424 native_context()->set_async_iterator_value_unwrap_shared_fun(*info);
1425 }
1426
1427 { // --- A s y n c G e n e r a t o r ---
1428 Handle<JSFunction> async_generator_function(
1429 native_context()->async_generator_function_function(), isolate);
1430 Handle<JSFunction> function_fun(native_context()->function_function(),
1431 isolate);
1432 JSObject::ForceSetPrototype(async_generator_function, function_fun);
1433
1434 async_generator_function->set_prototype_or_initial_map(
1435 native_context()->async_generator_function_map());
1436 async_generator_function->shared()->SetConstructStub(
1437 *isolate->builtins()->AsyncGeneratorFunctionConstructor());
1438 native_context()->async_generator_function_map()->SetConstructor(
1439 *async_generator_function);
1440
1441 Handle<JSFunction> await_caught =
1442 SimpleCreateFunction(isolate, factory->empty_string(),
1443 Builtins::kAsyncGeneratorAwaitCaught, 2, false);
1444 InstallWithIntrinsicDefaultProto(isolate, await_caught,
1445 Context::ASYNC_GENERATOR_AWAIT_CAUGHT);
1446
1447 Handle<JSFunction> await_uncaught =
1448 SimpleCreateFunction(isolate, factory->empty_string(),
1449 Builtins::kAsyncGeneratorAwaitUncaught, 2, false);
1450 InstallWithIntrinsicDefaultProto(isolate, await_uncaught,
1451 Context::ASYNC_GENERATOR_AWAIT_UNCAUGHT);
1452
1453 Handle<JSFunction> yield =
1454 SimpleCreateFunction(isolate, factory->empty_string(),
1455 Builtins::kAsyncGeneratorYield, 2, false);
1456 InstallWithIntrinsicDefaultProto(isolate, yield,
1457 Context::ASYNC_GENERATOR_YIELD);
1458
1459 Handle<JSFunction> raw_yield =
1460 SimpleCreateFunction(isolate, factory->empty_string(),
1461 Builtins::kAsyncGeneratorRawYield, 2, false);
1462 InstallWithIntrinsicDefaultProto(isolate, raw_yield,
1463 Context::ASYNC_GENERATOR_RAW_YIELD);
1464
1465 Handle<Code> code =
1466 isolate->builtins()->AsyncGeneratorAwaitResolveClosure();
1467 Handle<SharedFunctionInfo> info =
1468 factory->NewSharedFunctionInfo(factory->empty_string(), code, false);
1469 info->set_internal_formal_parameter_count(1);
1470 info->set_length(1);
1471 native_context()->set_async_generator_await_resolve_shared_fun(*info);
1472
1473 code = handle(isolate->builtins()->builtin(
1474 Builtins::kAsyncGeneratorAwaitRejectClosure),
1475 isolate);
1476 info = factory->NewSharedFunctionInfo(factory->empty_string(), code, false);
1477 info->set_internal_formal_parameter_count(1);
1478 info->set_length(1);
1479 native_context()->set_async_generator_await_reject_shared_fun(*info);
1480 }
1481
1294 { // --- A r r a y --- 1482 { // --- A r r a y ---
1295 Handle<JSFunction> array_function = 1483 Handle<JSFunction> array_function =
1296 InstallFunction(global, "Array", JS_ARRAY_TYPE, JSArray::kSize, 1484 InstallFunction(global, "Array", JS_ARRAY_TYPE, JSArray::kSize,
1297 isolate->initial_object_prototype(), 1485 isolate->initial_object_prototype(),
1298 Builtins::kArrayCode); 1486 Builtins::kArrayCode);
1299 array_function->shared()->DontAdaptArguments(); 1487 array_function->shared()->DontAdaptArguments();
1300 array_function->shared()->set_builtin_function_id(kArrayCode); 1488 array_function->shared()->set_builtin_function_id(kArrayCode);
1301 1489
1302 // This seems a bit hackish, but we need to make sure Array.length 1490 // This seems a bit hackish, but we need to make sure Array.length
1303 // is 1. 1491 // is 1.
(...skipping 2230 matching lines...) Expand 10 before | Expand all | Expand 10 after
3534 3722
3535 Handle<Object> unscopables = 3723 Handle<Object> unscopables =
3536 JSObject::GetProperty(array_prototype, factory()->unscopables_symbol()) 3724 JSObject::GetProperty(array_prototype, factory()->unscopables_symbol())
3537 .ToHandleChecked(); 3725 .ToHandleChecked();
3538 DCHECK(unscopables->IsJSObject()); 3726 DCHECK(unscopables->IsJSObject());
3539 JSObject::AddProperty(Handle<JSObject>::cast(unscopables), 3727 JSObject::AddProperty(Handle<JSObject>::cast(unscopables),
3540 factory()->values_string(), factory()->true_value(), 3728 factory()->values_string(), factory()->true_value(),
3541 NONE); 3729 NONE);
3542 } 3730 }
3543 3731
3732 void Genesis::InitializeGlobal_harmony_async_iteration() {
3733 if (!FLAG_harmony_async_iteration) return;
3734 Handle<JSFunction> symbol_fun(native_context()->symbol_function());
3735 InstallConstant(isolate(), symbol_fun, "asyncIterator",
3736 factory()->async_iterator_symbol());
3737 }
3738
3544 Handle<JSFunction> Genesis::InstallArrayBuffer(Handle<JSObject> target, 3739 Handle<JSFunction> Genesis::InstallArrayBuffer(Handle<JSObject> target,
3545 const char* name, 3740 const char* name,
3546 Builtins::Name call, 3741 Builtins::Name call,
3547 BuiltinFunctionId id) { 3742 BuiltinFunctionId id) {
3548 // Create the %ArrayBufferPrototype% 3743 // Create the %ArrayBufferPrototype%
3549 // Setup the {prototype} with the given {name} for @@toStringTag. 3744 // Setup the {prototype} with the given {name} for @@toStringTag.
3550 Handle<JSObject> prototype = 3745 Handle<JSObject> prototype =
3551 factory()->NewJSObject(isolate()->object_function(), TENURED); 3746 factory()->NewJSObject(isolate()->object_function(), TENURED);
3552 JSObject::AddProperty(prototype, factory()->to_string_tag_symbol(), 3747 JSObject::AddProperty(prototype, factory()->to_string_tag_symbol(),
3553 factory()->NewStringFromAsciiChecked(name), 3748 factory()->NewStringFromAsciiChecked(name),
(...skipping 443 matching lines...) Expand 10 before | Expand all | Expand 10 after
3997 #ifdef V8_I18N_SUPPORT 4192 #ifdef V8_I18N_SUPPORT
3998 static const char* icu_case_mapping_natives[] = {"native icu-case-mapping.js", 4193 static const char* icu_case_mapping_natives[] = {"native icu-case-mapping.js",
3999 nullptr}; 4194 nullptr};
4000 static const char* datetime_format_to_parts_natives[] = { 4195 static const char* datetime_format_to_parts_natives[] = {
4001 "native datetime-format-to-parts.js", nullptr}; 4196 "native datetime-format-to-parts.js", nullptr};
4002 #endif 4197 #endif
4003 static const char* harmony_restrictive_generators_natives[] = {nullptr}; 4198 static const char* harmony_restrictive_generators_natives[] = {nullptr};
4004 static const char* harmony_trailing_commas_natives[] = {nullptr}; 4199 static const char* harmony_trailing_commas_natives[] = {nullptr};
4005 static const char* harmony_class_fields_natives[] = {nullptr}; 4200 static const char* harmony_class_fields_natives[] = {nullptr};
4006 static const char* harmony_object_spread_natives[] = {nullptr}; 4201 static const char* harmony_object_spread_natives[] = {nullptr};
4202 static const char* harmony_async_iteration_natives[] = {nullptr};
4007 4203
4008 for (int i = ExperimentalNatives::GetDebuggerCount(); 4204 for (int i = ExperimentalNatives::GetDebuggerCount();
4009 i < ExperimentalNatives::GetBuiltinsCount(); i++) { 4205 i < ExperimentalNatives::GetBuiltinsCount(); i++) {
4010 #define INSTALL_EXPERIMENTAL_NATIVES(id, desc) \ 4206 #define INSTALL_EXPERIMENTAL_NATIVES(id, desc) \
4011 if (FLAG_##id) { \ 4207 if (FLAG_##id) { \
4012 for (size_t j = 0; id##_natives[j] != NULL; j++) { \ 4208 for (size_t j = 0; id##_natives[j] != NULL; j++) { \
4013 Vector<const char> script_name = ExperimentalNatives::GetScriptName(i); \ 4209 Vector<const char> script_name = ExperimentalNatives::GetScriptName(i); \
4014 if (strncmp(script_name.start(), id##_natives[j], \ 4210 if (strncmp(script_name.start(), id##_natives[j], \
4015 script_name.length()) == 0) { \ 4211 script_name.length()) == 0) { \
4016 if (!Bootstrapper::CompileExperimentalBuiltin(isolate(), i)) { \ 4212 if (!Bootstrapper::CompileExperimentalBuiltin(isolate(), i)) { \
(...skipping 581 matching lines...) Expand 10 before | Expand all | Expand 10 after
4598 HookUpGlobalProxy(global_proxy); 4794 HookUpGlobalProxy(global_proxy);
4599 } 4795 }
4600 DCHECK(!global_proxy->IsDetachedFrom(native_context()->global_object())); 4796 DCHECK(!global_proxy->IsDetachedFrom(native_context()->global_object()));
4601 } else { 4797 } else {
4602 DCHECK_EQ(0u, context_snapshot_index); 4798 DCHECK_EQ(0u, context_snapshot_index);
4603 // We get here if there was no context snapshot. 4799 // We get here if there was no context snapshot.
4604 CreateRoots(); 4800 CreateRoots();
4605 Handle<JSFunction> empty_function = CreateEmptyFunction(isolate); 4801 Handle<JSFunction> empty_function = CreateEmptyFunction(isolate);
4606 CreateStrictModeFunctionMaps(empty_function); 4802 CreateStrictModeFunctionMaps(empty_function);
4607 CreateIteratorMaps(empty_function); 4803 CreateIteratorMaps(empty_function);
4804 CreateAsyncIteratorMaps(empty_function);
4608 CreateAsyncFunctionMaps(empty_function); 4805 CreateAsyncFunctionMaps(empty_function);
4609 Handle<JSGlobalObject> global_object = 4806 Handle<JSGlobalObject> global_object =
4610 CreateNewGlobals(global_proxy_template, global_proxy); 4807 CreateNewGlobals(global_proxy_template, global_proxy);
4611 InitializeGlobal(global_object, empty_function, context_type); 4808 InitializeGlobal(global_object, empty_function, context_type);
4612 InitializeNormalizedMapCaches(); 4809 InitializeNormalizedMapCaches();
4613 4810
4614 if (!InstallNatives(context_type)) return; 4811 if (!InstallNatives(context_type)) return;
4615 4812
4616 MakeFunctionInstancePrototypeWritable(); 4813 MakeFunctionInstancePrototypeWritable();
4617 4814
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after
4740 } 4937 }
4741 4938
4742 4939
4743 // Called when the top-level V8 mutex is destroyed. 4940 // Called when the top-level V8 mutex is destroyed.
4744 void Bootstrapper::FreeThreadResources() { 4941 void Bootstrapper::FreeThreadResources() {
4745 DCHECK(!IsActive()); 4942 DCHECK(!IsActive());
4746 } 4943 }
4747 4944
4748 } // namespace internal 4945 } // namespace internal
4749 } // namespace v8 4946 } // namespace v8
OLDNEW
« no previous file with comments | « src/bailout-reason.h ('k') | src/builtins/builtins.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698