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

Side by Side Diff: src/bootstrapper.cc

Issue 2622833002: WIP [esnext] implement async iteration proposal (Closed)
Patch Set: Fix minor parsing bug, add some local test262 tests 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
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 = handle(
1420 isolate->builtins()->builtin(Builtins::kAsyncIteratorValueUnwrap),
1421 isolate);
1422 Handle<SharedFunctionInfo> info =
1423 factory->NewSharedFunctionInfo(factory->empty_string(), code, false);
1424 info->set_internal_formal_parameter_count(1);
1425 info->set_length(1);
1426 native_context()->set_async_iterator_value_unwrap_shared_fun(*info);
1427 }
1428
1429 { // --- A s y n c G e n e r a t o r ---
1430 Handle<JSFunction> async_generator_function(
1431 native_context()->async_generator_function_function(), isolate);
1432 Handle<JSFunction> function_fun(native_context()->function_function(),
1433 isolate);
1434 JSObject::ForceSetPrototype(async_generator_function, function_fun);
1435
1436 async_generator_function->set_prototype_or_initial_map(
1437 native_context()->async_generator_function_map());
1438 async_generator_function->shared()->SetConstructStub(
1439 *isolate->builtins()->AsyncGeneratorFunctionConstructor());
1440 native_context()->async_generator_function_map()->SetConstructor(
1441 *async_generator_function);
1442
1443 Handle<JSFunction> await_caught =
1444 SimpleCreateFunction(isolate, factory->empty_string(),
1445 Builtins::kAsyncGeneratorAwaitCaught, 2, false);
1446 InstallWithIntrinsicDefaultProto(isolate, await_caught,
1447 Context::ASYNC_GENERATOR_AWAIT_CAUGHT);
1448
1449 Handle<JSFunction> await_uncaught =
1450 SimpleCreateFunction(isolate, factory->empty_string(),
1451 Builtins::kAsyncGeneratorAwaitUncaught, 2, false);
1452 InstallWithIntrinsicDefaultProto(isolate, await_uncaught,
1453 Context::ASYNC_GENERATOR_AWAIT_UNCAUGHT);
1454
1455 Handle<JSFunction> yield =
1456 SimpleCreateFunction(isolate, factory->empty_string(),
1457 Builtins::kAsyncGeneratorYield, 2, false);
1458 InstallWithIntrinsicDefaultProto(isolate, yield,
1459 Context::ASYNC_GENERATOR_YIELD);
1460
1461 Handle<JSFunction> raw_yield =
1462 SimpleCreateFunction(isolate, factory->empty_string(),
1463 Builtins::kAsyncGeneratorRawYield, 2, false);
1464 InstallWithIntrinsicDefaultProto(isolate, raw_yield,
1465 Context::ASYNC_GENERATOR_RAW_YIELD);
1466
1467 Handle<Code> code =
1468 handle(isolate->builtins()->builtin(
1469 Builtins::kAsyncGeneratorAwaitResolveClosure),
1470 isolate);
1471 Handle<SharedFunctionInfo> info =
1472 factory->NewSharedFunctionInfo(factory->empty_string(), code, false);
1473 info->set_internal_formal_parameter_count(1);
1474 info->set_length(1);
1475 native_context()->set_async_generator_await_resolve_shared_fun(*info);
1476
1477 code = handle(isolate->builtins()->builtin(
1478 Builtins::kAsyncGeneratorAwaitRejectClosure),
1479 isolate);
1480 info = factory->NewSharedFunctionInfo(factory->empty_string(), code, false);
1481 info->set_internal_formal_parameter_count(1);
1482 info->set_length(1);
1483 native_context()->set_async_generator_await_reject_shared_fun(*info);
1484 }
1485
1294 { // --- A r r a y --- 1486 { // --- A r r a y ---
1295 Handle<JSFunction> array_function = 1487 Handle<JSFunction> array_function =
1296 InstallFunction(global, "Array", JS_ARRAY_TYPE, JSArray::kSize, 1488 InstallFunction(global, "Array", JS_ARRAY_TYPE, JSArray::kSize,
1297 isolate->initial_object_prototype(), 1489 isolate->initial_object_prototype(),
1298 Builtins::kArrayCode); 1490 Builtins::kArrayCode);
1299 array_function->shared()->DontAdaptArguments(); 1491 array_function->shared()->DontAdaptArguments();
1300 array_function->shared()->set_builtin_function_id(kArrayCode); 1492 array_function->shared()->set_builtin_function_id(kArrayCode);
1301 1493
1302 // This seems a bit hackish, but we need to make sure Array.length 1494 // This seems a bit hackish, but we need to make sure Array.length
1303 // is 1. 1495 // is 1.
(...skipping 2134 matching lines...) Expand 10 before | Expand all | Expand 10 after
3438 EMPTY_INITIALIZE_GLOBAL_FOR_FEATURE(harmony_function_sent) 3630 EMPTY_INITIALIZE_GLOBAL_FOR_FEATURE(harmony_function_sent)
3439 EMPTY_INITIALIZE_GLOBAL_FOR_FEATURE(harmony_tailcalls) 3631 EMPTY_INITIALIZE_GLOBAL_FOR_FEATURE(harmony_tailcalls)
3440 #ifdef V8_I18N_SUPPORT 3632 #ifdef V8_I18N_SUPPORT
3441 EMPTY_INITIALIZE_GLOBAL_FOR_FEATURE(datetime_format_to_parts) 3633 EMPTY_INITIALIZE_GLOBAL_FOR_FEATURE(datetime_format_to_parts)
3442 EMPTY_INITIALIZE_GLOBAL_FOR_FEATURE(icu_case_mapping) 3634 EMPTY_INITIALIZE_GLOBAL_FOR_FEATURE(icu_case_mapping)
3443 #endif 3635 #endif
3444 EMPTY_INITIALIZE_GLOBAL_FOR_FEATURE(harmony_restrictive_generators) 3636 EMPTY_INITIALIZE_GLOBAL_FOR_FEATURE(harmony_restrictive_generators)
3445 EMPTY_INITIALIZE_GLOBAL_FOR_FEATURE(harmony_trailing_commas) 3637 EMPTY_INITIALIZE_GLOBAL_FOR_FEATURE(harmony_trailing_commas)
3446 EMPTY_INITIALIZE_GLOBAL_FOR_FEATURE(harmony_class_fields) 3638 EMPTY_INITIALIZE_GLOBAL_FOR_FEATURE(harmony_class_fields)
3447 EMPTY_INITIALIZE_GLOBAL_FOR_FEATURE(harmony_object_spread) 3639 EMPTY_INITIALIZE_GLOBAL_FOR_FEATURE(harmony_object_spread)
3640 EMPTY_INITIALIZE_GLOBAL_FOR_FEATURE(harmony_async_iteration)
3448 3641
3449 void InstallPublicSymbol(Factory* factory, Handle<Context> native_context, 3642 void InstallPublicSymbol(Factory* factory, Handle<Context> native_context,
3450 const char* name, Handle<Symbol> value) { 3643 const char* name, Handle<Symbol> value) {
3451 Handle<JSGlobalObject> global( 3644 Handle<JSGlobalObject> global(
3452 JSGlobalObject::cast(native_context->global_object())); 3645 JSGlobalObject::cast(native_context->global_object()));
3453 Handle<String> symbol_string = factory->InternalizeUtf8String("Symbol"); 3646 Handle<String> symbol_string = factory->InternalizeUtf8String("Symbol");
3454 Handle<JSObject> symbol = Handle<JSObject>::cast( 3647 Handle<JSObject> symbol = Handle<JSObject>::cast(
3455 JSObject::GetProperty(global, symbol_string).ToHandleChecked()); 3648 JSObject::GetProperty(global, symbol_string).ToHandleChecked());
3456 Handle<String> name_string = factory->InternalizeUtf8String(name); 3649 Handle<String> name_string = factory->InternalizeUtf8String(name);
3457 PropertyAttributes attributes = 3650 PropertyAttributes attributes =
(...skipping 539 matching lines...) Expand 10 before | Expand all | Expand 10 after
3997 #ifdef V8_I18N_SUPPORT 4190 #ifdef V8_I18N_SUPPORT
3998 static const char* icu_case_mapping_natives[] = {"native icu-case-mapping.js", 4191 static const char* icu_case_mapping_natives[] = {"native icu-case-mapping.js",
3999 nullptr}; 4192 nullptr};
4000 static const char* datetime_format_to_parts_natives[] = { 4193 static const char* datetime_format_to_parts_natives[] = {
4001 "native datetime-format-to-parts.js", nullptr}; 4194 "native datetime-format-to-parts.js", nullptr};
4002 #endif 4195 #endif
4003 static const char* harmony_restrictive_generators_natives[] = {nullptr}; 4196 static const char* harmony_restrictive_generators_natives[] = {nullptr};
4004 static const char* harmony_trailing_commas_natives[] = {nullptr}; 4197 static const char* harmony_trailing_commas_natives[] = {nullptr};
4005 static const char* harmony_class_fields_natives[] = {nullptr}; 4198 static const char* harmony_class_fields_natives[] = {nullptr};
4006 static const char* harmony_object_spread_natives[] = {nullptr}; 4199 static const char* harmony_object_spread_natives[] = {nullptr};
4200 static const char* harmony_async_iteration_natives[] = {nullptr};
4007 4201
4008 for (int i = ExperimentalNatives::GetDebuggerCount(); 4202 for (int i = ExperimentalNatives::GetDebuggerCount();
4009 i < ExperimentalNatives::GetBuiltinsCount(); i++) { 4203 i < ExperimentalNatives::GetBuiltinsCount(); i++) {
4010 #define INSTALL_EXPERIMENTAL_NATIVES(id, desc) \ 4204 #define INSTALL_EXPERIMENTAL_NATIVES(id, desc) \
4011 if (FLAG_##id) { \ 4205 if (FLAG_##id) { \
4012 for (size_t j = 0; id##_natives[j] != NULL; j++) { \ 4206 for (size_t j = 0; id##_natives[j] != NULL; j++) { \
4013 Vector<const char> script_name = ExperimentalNatives::GetScriptName(i); \ 4207 Vector<const char> script_name = ExperimentalNatives::GetScriptName(i); \
4014 if (strncmp(script_name.start(), id##_natives[j], \ 4208 if (strncmp(script_name.start(), id##_natives[j], \
4015 script_name.length()) == 0) { \ 4209 script_name.length()) == 0) { \
4016 if (!Bootstrapper::CompileExperimentalBuiltin(isolate(), i)) { \ 4210 if (!Bootstrapper::CompileExperimentalBuiltin(isolate(), i)) { \
(...skipping 581 matching lines...) Expand 10 before | Expand all | Expand 10 after
4598 HookUpGlobalProxy(global_proxy); 4792 HookUpGlobalProxy(global_proxy);
4599 } 4793 }
4600 DCHECK(!global_proxy->IsDetachedFrom(native_context()->global_object())); 4794 DCHECK(!global_proxy->IsDetachedFrom(native_context()->global_object()));
4601 } else { 4795 } else {
4602 DCHECK_EQ(0u, context_snapshot_index); 4796 DCHECK_EQ(0u, context_snapshot_index);
4603 // We get here if there was no context snapshot. 4797 // We get here if there was no context snapshot.
4604 CreateRoots(); 4798 CreateRoots();
4605 Handle<JSFunction> empty_function = CreateEmptyFunction(isolate); 4799 Handle<JSFunction> empty_function = CreateEmptyFunction(isolate);
4606 CreateStrictModeFunctionMaps(empty_function); 4800 CreateStrictModeFunctionMaps(empty_function);
4607 CreateIteratorMaps(empty_function); 4801 CreateIteratorMaps(empty_function);
4802 CreateAsyncIteratorMaps(empty_function);
4608 CreateAsyncFunctionMaps(empty_function); 4803 CreateAsyncFunctionMaps(empty_function);
4609 Handle<JSGlobalObject> global_object = 4804 Handle<JSGlobalObject> global_object =
4610 CreateNewGlobals(global_proxy_template, global_proxy); 4805 CreateNewGlobals(global_proxy_template, global_proxy);
4611 InitializeGlobal(global_object, empty_function, context_type); 4806 InitializeGlobal(global_object, empty_function, context_type);
4612 InitializeNormalizedMapCaches(); 4807 InitializeNormalizedMapCaches();
4613 4808
4614 if (!InstallNatives(context_type)) return; 4809 if (!InstallNatives(context_type)) return;
4615 4810
4616 MakeFunctionInstancePrototypeWritable(); 4811 MakeFunctionInstancePrototypeWritable();
4617 4812
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after
4740 } 4935 }
4741 4936
4742 4937
4743 // Called when the top-level V8 mutex is destroyed. 4938 // Called when the top-level V8 mutex is destroyed.
4744 void Bootstrapper::FreeThreadResources() { 4939 void Bootstrapper::FreeThreadResources() {
4745 DCHECK(!IsActive()); 4940 DCHECK(!IsActive());
4746 } 4941 }
4747 4942
4748 } // namespace internal 4943 } // namespace internal
4749 } // namespace v8 4944 } // namespace v8
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698