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

Side by Side Diff: src/bootstrapper.cc

Issue 1865833002: [generators] Decouple generator resume from fullcodegen. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 4 years, 8 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/code-stubs.h" 9 #include "src/code-stubs.h"
10 #include "src/extensions/externalize-string-extension.h" 10 #include "src/extensions/externalize-string-extension.h"
(...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after
150 // Creates some basic objects. Used for creating a context from scratch. 150 // Creates some basic objects. Used for creating a context from scratch.
151 void CreateRoots(); 151 void CreateRoots();
152 // Creates the empty function. Used for creating a context from scratch. 152 // Creates the empty function. Used for creating a context from scratch.
153 Handle<JSFunction> CreateEmptyFunction(Isolate* isolate); 153 Handle<JSFunction> CreateEmptyFunction(Isolate* isolate);
154 // Creates the ThrowTypeError function. ECMA 5th Ed. 13.2.3 154 // Creates the ThrowTypeError function. ECMA 5th Ed. 13.2.3
155 Handle<JSFunction> GetRestrictedFunctionPropertiesThrower(); 155 Handle<JSFunction> GetRestrictedFunctionPropertiesThrower();
156 Handle<JSFunction> GetStrictArgumentsPoisonFunction(); 156 Handle<JSFunction> GetStrictArgumentsPoisonFunction();
157 Handle<JSFunction> GetThrowTypeErrorIntrinsic(Builtins::Name builtin_name); 157 Handle<JSFunction> GetThrowTypeErrorIntrinsic(Builtins::Name builtin_name);
158 158
159 void CreateStrictModeFunctionMaps(Handle<JSFunction> empty); 159 void CreateStrictModeFunctionMaps(Handle<JSFunction> empty);
160 void CreateIteratorMaps(); 160 void CreateIteratorMaps(Handle<JSFunction> empty);
161 void CreateJSProxyMaps(); 161 void CreateJSProxyMaps();
162 162
163 // Make the "arguments" and "caller" properties throw a TypeError on access. 163 // Make the "arguments" and "caller" properties throw a TypeError on access.
164 void AddRestrictedFunctionProperties(Handle<Map> map); 164 void AddRestrictedFunctionProperties(Handle<Map> map);
165 165
166 // Creates the global objects using the global proxy and the template passed 166 // Creates the global objects using the global proxy and the template passed
167 // in through the API. We call this regardless of whether we are building a 167 // in through the API. We call this regardless of whether we are building a
168 // context from scratch or using a deserialized one from the partial snapshot 168 // context from scratch or using a deserialized one from the partial snapshot
169 // but in the latter case we don't use the objects it produces directly, as 169 // but in the latter case we don't use the objects it produces directly, as
170 // we have to used the deserialized ones that are linked together with the 170 // we have to used the deserialized ones that are linked together with the
(...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after
347 Factory* factory = env->GetIsolate()->factory(); 347 Factory* factory = env->GetIsolate()->factory();
348 Handle<JSGlobalProxy> global_proxy(JSGlobalProxy::cast(env->global_proxy())); 348 Handle<JSGlobalProxy> global_proxy(JSGlobalProxy::cast(env->global_proxy()));
349 global_proxy->set_native_context(*factory->null_value()); 349 global_proxy->set_native_context(*factory->null_value());
350 SetObjectPrototype(global_proxy, factory->null_value()); 350 SetObjectPrototype(global_proxy, factory->null_value());
351 global_proxy->map()->SetConstructor(*factory->null_value()); 351 global_proxy->map()->SetConstructor(*factory->null_value());
352 if (FLAG_track_detached_contexts) { 352 if (FLAG_track_detached_contexts) {
353 env->GetIsolate()->AddDetachedContext(env); 353 env->GetIsolate()->AddDetachedContext(env);
354 } 354 }
355 } 355 }
356 356
357
358 namespace { 357 namespace {
359 358
360 void InstallFunction(Handle<JSObject> target, Handle<Name> property_name, 359 void InstallFunction(Handle<JSObject> target, Handle<Name> property_name,
361 Handle<JSFunction> function, Handle<String> function_name, 360 Handle<JSFunction> function, Handle<String> function_name,
362 PropertyAttributes attributes = DONT_ENUM) { 361 PropertyAttributes attributes = DONT_ENUM) {
363 JSObject::AddProperty(target, property_name, function, attributes); 362 JSObject::AddProperty(target, property_name, function, attributes);
364 if (target->IsJSGlobalObject()) { 363 if (target->IsJSGlobalObject()) {
365 function->shared()->set_instance_class_name(*function_name); 364 function->shared()->set_instance_class_name(*function_name);
366 } 365 }
367 function->shared()->set_native(true); 366 function->shared()->set_native(true);
368 } 367 }
369 368
370 369 void InstallFunction(Handle<JSObject> target, Handle<JSFunction> function,
371 static void InstallFunction(Handle<JSObject> target, 370 Handle<Name> name,
372 Handle<JSFunction> function, Handle<Name> name, 371 PropertyAttributes attributes = DONT_ENUM) {
373 PropertyAttributes attributes = DONT_ENUM) {
374 Handle<String> name_string = Name::ToFunctionName(name).ToHandleChecked(); 372 Handle<String> name_string = Name::ToFunctionName(name).ToHandleChecked();
375 InstallFunction(target, name, function, name_string, attributes); 373 InstallFunction(target, name, function, name_string, attributes);
376 } 374 }
377 375
378 376 Handle<JSFunction> CreateFunction(Isolate* isolate, Handle<String> name,
379 static Handle<JSFunction> CreateFunction(Isolate* isolate, Handle<String> name, 377 InstanceType type, int instance_size,
380 InstanceType type, int instance_size, 378 MaybeHandle<JSObject> maybe_prototype,
381 MaybeHandle<JSObject> maybe_prototype, 379 Builtins::Name call,
382 Builtins::Name call, 380 bool strict_function_map = false) {
383 bool strict_function_map = false) {
384 Factory* factory = isolate->factory(); 381 Factory* factory = isolate->factory();
385 Handle<Code> call_code(isolate->builtins()->builtin(call)); 382 Handle<Code> call_code(isolate->builtins()->builtin(call));
386 Handle<JSObject> prototype; 383 Handle<JSObject> prototype;
387 static const bool kReadOnlyPrototype = false; 384 static const bool kReadOnlyPrototype = false;
388 static const bool kInstallConstructor = false; 385 static const bool kInstallConstructor = false;
389 return maybe_prototype.ToHandle(&prototype) 386 return maybe_prototype.ToHandle(&prototype)
390 ? factory->NewFunction(name, call_code, prototype, type, 387 ? factory->NewFunction(name, call_code, prototype, type,
391 instance_size, kReadOnlyPrototype, 388 instance_size, kReadOnlyPrototype,
392 kInstallConstructor, strict_function_map) 389 kInstallConstructor, strict_function_map)
393 : factory->NewFunctionWithoutPrototype(name, call_code, 390 : factory->NewFunctionWithoutPrototype(name, call_code,
394 strict_function_map); 391 strict_function_map);
395 } 392 }
396 393
397
398 Handle<JSFunction> InstallFunction(Handle<JSObject> target, Handle<Name> name, 394 Handle<JSFunction> InstallFunction(Handle<JSObject> target, Handle<Name> name,
399 InstanceType type, int instance_size, 395 InstanceType type, int instance_size,
400 MaybeHandle<JSObject> maybe_prototype, 396 MaybeHandle<JSObject> maybe_prototype,
401 Builtins::Name call, 397 Builtins::Name call,
402 PropertyAttributes attributes, 398 PropertyAttributes attributes,
403 bool strict_function_map = false) { 399 bool strict_function_map = false) {
404 Handle<String> name_string = Name::ToFunctionName(name).ToHandleChecked(); 400 Handle<String> name_string = Name::ToFunctionName(name).ToHandleChecked();
405 Handle<JSFunction> function = 401 Handle<JSFunction> function =
406 CreateFunction(target->GetIsolate(), name_string, type, instance_size, 402 CreateFunction(target->GetIsolate(), name_string, type, instance_size,
407 maybe_prototype, call, strict_function_map); 403 maybe_prototype, call, strict_function_map);
408 InstallFunction(target, name, function, name_string, attributes); 404 InstallFunction(target, name, function, name_string, attributes);
409 return function; 405 return function;
410 } 406 }
411 407
412
413 Handle<JSFunction> InstallFunction(Handle<JSObject> target, const char* name, 408 Handle<JSFunction> InstallFunction(Handle<JSObject> target, const char* name,
414 InstanceType type, int instance_size, 409 InstanceType type, int instance_size,
415 MaybeHandle<JSObject> maybe_prototype, 410 MaybeHandle<JSObject> maybe_prototype,
416 Builtins::Name call, 411 Builtins::Name call,
417 bool strict_function_map = false) { 412 bool strict_function_map = false) {
418 Factory* const factory = target->GetIsolate()->factory(); 413 Factory* const factory = target->GetIsolate()->factory();
419 PropertyAttributes attributes = DONT_ENUM; 414 PropertyAttributes attributes = DONT_ENUM;
420 return InstallFunction(target, factory->InternalizeUtf8String(name), type, 415 return InstallFunction(target, factory->InternalizeUtf8String(name), type,
421 instance_size, maybe_prototype, call, attributes, 416 instance_size, maybe_prototype, call, attributes,
422 strict_function_map); 417 strict_function_map);
423 } 418 }
424 419
420 Handle<JSFunction> SimpleCreateFunction(Isolate* isolate, Handle<String> name,
421 Builtins::Name call, int len,
422 bool adapt) {
423 Handle<JSFunction> fun =
424 CreateFunction(isolate, name, JS_OBJECT_TYPE, JSObject::kHeaderSize,
425 MaybeHandle<JSObject>(), call);
426 if (adapt) {
427 fun->shared()->set_internal_formal_parameter_count(len);
428 } else {
429 fun->shared()->DontAdaptArguments();
430 }
431 fun->shared()->set_length(len);
432 return fun;
433 }
434
435 Handle<JSFunction> SimpleInstallFunction(Handle<JSObject> base,
436 Handle<String> name,
437 Builtins::Name call, int len,
438 bool adapt) {
439 Handle<JSFunction> fun =
440 SimpleCreateFunction(base->GetIsolate(), name, call, len, adapt);
441 InstallFunction(base, fun, name, DONT_ENUM);
442 return fun;
443 }
444
445 Handle<JSFunction> SimpleInstallFunction(Handle<JSObject> base,
446 const char* name, Builtins::Name call,
447 int len, bool adapt) {
448 Factory* const factory = base->GetIsolate()->factory();
449 return SimpleInstallFunction(base, factory->InternalizeUtf8String(name), call,
450 len, adapt);
451 }
452
425 } // namespace 453 } // namespace
426 454
427
428 void Genesis::SetFunctionInstanceDescriptor(Handle<Map> map, 455 void Genesis::SetFunctionInstanceDescriptor(Handle<Map> map,
429 FunctionMode function_mode) { 456 FunctionMode function_mode) {
430 int size = IsFunctionModeWithPrototype(function_mode) ? 5 : 4; 457 int size = IsFunctionModeWithPrototype(function_mode) ? 5 : 4;
431 Map::EnsureDescriptorSlack(map, size); 458 Map::EnsureDescriptorSlack(map, size);
432 459
433 PropertyAttributes ro_attribs = 460 PropertyAttributes ro_attribs =
434 static_cast<PropertyAttributes>(DONT_ENUM | DONT_DELETE | READ_ONLY); 461 static_cast<PropertyAttributes>(DONT_ENUM | DONT_DELETE | READ_ONLY);
435 PropertyAttributes roc_attribs = 462 PropertyAttributes roc_attribs =
436 static_cast<PropertyAttributes>(DONT_ENUM | READ_ONLY); 463 static_cast<PropertyAttributes>(DONT_ENUM | READ_ONLY);
437 464
(...skipping 264 matching lines...) Expand 10 before | Expand all | Expand 10 after
702 Handle<Map> strict_function_map = 729 Handle<Map> strict_function_map =
703 CreateStrictFunctionMap(FUNCTION_WITH_READONLY_PROTOTYPE, empty); 730 CreateStrictFunctionMap(FUNCTION_WITH_READONLY_PROTOTYPE, empty);
704 native_context()->set_strict_function_map(*strict_function_map); 731 native_context()->set_strict_function_map(*strict_function_map);
705 732
706 // The final map for the strict mode functions. Writeable prototype. 733 // The final map for the strict mode functions. Writeable prototype.
707 // This map is installed in MakeFunctionInstancePrototypeWritable. 734 // This map is installed in MakeFunctionInstancePrototypeWritable.
708 strict_function_map_writable_prototype_ = 735 strict_function_map_writable_prototype_ =
709 CreateStrictFunctionMap(FUNCTION_WITH_WRITEABLE_PROTOTYPE, empty); 736 CreateStrictFunctionMap(FUNCTION_WITH_WRITEABLE_PROTOTYPE, empty);
710 } 737 }
711 738
712 739 void Genesis::CreateIteratorMaps(Handle<JSFunction> empty) {
713 void Genesis::CreateIteratorMaps() {
714 // Create iterator-related meta-objects. 740 // Create iterator-related meta-objects.
715 Handle<JSObject> iterator_prototype = 741 Handle<JSObject> iterator_prototype =
716 factory()->NewJSObject(isolate()->object_function(), TENURED); 742 factory()->NewJSObject(isolate()->object_function(), TENURED);
717 Handle<JSObject> generator_object_prototype = 743 Handle<JSObject> generator_object_prototype =
718 factory()->NewJSObject(isolate()->object_function(), TENURED); 744 factory()->NewJSObject(isolate()->object_function(), TENURED);
745 SetObjectPrototype(generator_object_prototype, iterator_prototype);
719 Handle<JSObject> generator_function_prototype = 746 Handle<JSObject> generator_function_prototype =
720 factory()->NewJSObject(isolate()->object_function(), TENURED); 747 factory()->NewJSObject(isolate()->object_function(), TENURED);
721 SetObjectPrototype(generator_object_prototype, iterator_prototype); 748 SetObjectPrototype(generator_function_prototype, empty);
722 749
750 JSObject::AddProperty(
751 generator_function_prototype, factory()->to_string_tag_symbol(),
752 factory()->NewStringFromAsciiChecked("GeneratorFunction"),
753 static_cast<PropertyAttributes>(DONT_ENUM | READ_ONLY));
723 JSObject::AddProperty(generator_function_prototype, 754 JSObject::AddProperty(generator_function_prototype,
724 factory()->InternalizeUtf8String("prototype"), 755 factory()->prototype_string(),
725 generator_object_prototype, 756 generator_object_prototype,
726 static_cast<PropertyAttributes>(DONT_ENUM | READ_ONLY)); 757 static_cast<PropertyAttributes>(DONT_ENUM | READ_ONLY));
727 758
759 JSObject::AddProperty(generator_object_prototype,
760 factory()->constructor_string(),
761 generator_function_prototype,
762 static_cast<PropertyAttributes>(DONT_ENUM | READ_ONLY));
763 JSObject::AddProperty(generator_object_prototype,
764 factory()->to_string_tag_symbol(),
765 factory()->NewStringFromAsciiChecked("Generator"),
766 static_cast<PropertyAttributes>(DONT_ENUM | READ_ONLY));
767 SimpleInstallFunction(generator_object_prototype, "next",
768 Builtins::kGeneratorPrototypeNext, 1, true);
769 SimpleInstallFunction(generator_object_prototype, "return",
770 Builtins::kGeneratorPrototypeReturn, 1, true);
771 SimpleInstallFunction(generator_object_prototype, "throw",
772 Builtins::kGeneratorPrototypeThrow, 1, true);
773
728 // Create maps for generator functions and their prototypes. Store those 774 // Create maps for generator functions and their prototypes. Store those
729 // maps in the native context. The "prototype" property descriptor is 775 // maps in the native context. The "prototype" property descriptor is
730 // writable, non-enumerable, and non-configurable (as per ES6 draft 776 // writable, non-enumerable, and non-configurable (as per ES6 draft
731 // 04-14-15, section 25.2.4.3). 777 // 04-14-15, section 25.2.4.3).
732 Handle<Map> strict_function_map(strict_function_map_writable_prototype_); 778 Handle<Map> strict_function_map(strict_function_map_writable_prototype_);
733 // Generator functions do not have "caller" or "arguments" accessors. 779 // Generator functions do not have "caller" or "arguments" accessors.
734 Handle<Map> sloppy_generator_function_map = 780 Handle<Map> sloppy_generator_function_map =
735 Map::Copy(strict_function_map, "SloppyGeneratorFunction"); 781 Map::Copy(strict_function_map, "SloppyGeneratorFunction");
736 sloppy_generator_function_map->set_is_constructor(false); 782 sloppy_generator_function_map->set_is_constructor(false);
737 Map::SetPrototype(sloppy_generator_function_map, 783 Map::SetPrototype(sloppy_generator_function_map,
(...skipping 226 matching lines...) Expand 10 before | Expand all | Expand 10 after
964 void Genesis::HookUpGlobalObject(Handle<JSGlobalObject> global_object) { 1010 void Genesis::HookUpGlobalObject(Handle<JSGlobalObject> global_object) {
965 Handle<JSGlobalObject> global_object_from_snapshot( 1011 Handle<JSGlobalObject> global_object_from_snapshot(
966 JSGlobalObject::cast(native_context()->extension())); 1012 JSGlobalObject::cast(native_context()->extension()));
967 native_context()->set_extension(*global_object); 1013 native_context()->set_extension(*global_object);
968 native_context()->set_security_token(*global_object); 1014 native_context()->set_security_token(*global_object);
969 1015
970 TransferNamedProperties(global_object_from_snapshot, global_object); 1016 TransferNamedProperties(global_object_from_snapshot, global_object);
971 TransferIndexedProperties(global_object_from_snapshot, global_object); 1017 TransferIndexedProperties(global_object_from_snapshot, global_object);
972 } 1018 }
973 1019
974
975 static Handle<JSFunction> SimpleCreateFunction(Isolate* isolate,
976 Handle<String> name,
977 Builtins::Name call, int len,
978 bool adapt) {
979 Handle<JSFunction> fun =
980 CreateFunction(isolate, name, JS_OBJECT_TYPE, JSObject::kHeaderSize,
981 MaybeHandle<JSObject>(), call);
982 if (adapt) {
983 fun->shared()->set_internal_formal_parameter_count(len);
984 } else {
985 fun->shared()->DontAdaptArguments();
986 }
987 fun->shared()->set_length(len);
988 return fun;
989 }
990
991
992 static Handle<JSFunction> SimpleInstallFunction(Handle<JSObject> base,
993 Handle<String> name,
994 Builtins::Name call, int len,
995 bool adapt) {
996 Handle<JSFunction> fun =
997 SimpleCreateFunction(base->GetIsolate(), name, call, len, adapt);
998 InstallFunction(base, fun, name, DONT_ENUM);
999 return fun;
1000 }
1001
1002
1003 static Handle<JSFunction> SimpleInstallFunction(Handle<JSObject> base,
1004 const char* name,
1005 Builtins::Name call, int len,
1006 bool adapt) {
1007 Factory* const factory = base->GetIsolate()->factory();
1008 return SimpleInstallFunction(base, factory->InternalizeUtf8String(name), call,
1009 len, adapt);
1010 }
1011
1012
1013 static void InstallWithIntrinsicDefaultProto(Isolate* isolate, 1020 static void InstallWithIntrinsicDefaultProto(Isolate* isolate,
1014 Handle<JSFunction> function, 1021 Handle<JSFunction> function,
1015 int context_index) { 1022 int context_index) {
1016 Handle<Smi> index(Smi::FromInt(context_index), isolate); 1023 Handle<Smi> index(Smi::FromInt(context_index), isolate);
1017 JSObject::AddProperty( 1024 JSObject::AddProperty(
1018 function, isolate->factory()->native_context_index_symbol(), index, NONE); 1025 function, isolate->factory()->native_context_index_symbol(), index, NONE);
1019 isolate->native_context()->set(context_index, *function); 1026 isolate->native_context()->set(context_index, *function);
1020 } 1027 }
1021 1028
1022 1029
(...skipping 1135 matching lines...) Expand 10 before | Expand all | Expand 10 after
2158 generator_function_function->set_prototype_or_initial_map( 2165 generator_function_function->set_prototype_or_initial_map(
2159 native_context->sloppy_generator_function_map()); 2166 native_context->sloppy_generator_function_map());
2160 generator_function_function->shared()->DontAdaptArguments(); 2167 generator_function_function->shared()->DontAdaptArguments();
2161 generator_function_function->shared()->set_construct_stub( 2168 generator_function_function->shared()->set_construct_stub(
2162 *isolate->builtins()->GeneratorFunctionConstructor()); 2169 *isolate->builtins()->GeneratorFunctionConstructor());
2163 generator_function_function->shared()->set_length(1); 2170 generator_function_function->shared()->set_length(1);
2164 InstallWithIntrinsicDefaultProto( 2171 InstallWithIntrinsicDefaultProto(
2165 isolate, generator_function_function, 2172 isolate, generator_function_function,
2166 Context::GENERATOR_FUNCTION_FUNCTION_INDEX); 2173 Context::GENERATOR_FUNCTION_FUNCTION_INDEX);
2167 2174
2175 SetObjectPrototype(generator_function_function,
2176 isolate->function_function());
2177 JSObject::AddProperty(
2178 generator_function_prototype, factory->constructor_string(),
2179 generator_function_function,
2180 static_cast<PropertyAttributes>(DONT_ENUM | READ_ONLY));
2181
2168 native_context->sloppy_generator_function_map()->SetConstructor( 2182 native_context->sloppy_generator_function_map()->SetConstructor(
2169 *generator_function_function); 2183 *generator_function_function);
2170 native_context->strict_generator_function_map()->SetConstructor( 2184 native_context->strict_generator_function_map()->SetConstructor(
2171 *generator_function_function); 2185 *generator_function_function);
2172 } 2186 }
2173 2187
2174 { // -- S e t I t e r a t o r 2188 { // -- S e t I t e r a t o r
2175 Handle<JSObject> set_iterator_prototype = 2189 Handle<JSObject> set_iterator_prototype =
2176 isolate->factory()->NewJSObject(isolate->object_function(), TENURED); 2190 isolate->factory()->NewJSObject(isolate->object_function(), TENURED);
2177 SetObjectPrototype(set_iterator_prototype, iterator_prototype); 2191 SetObjectPrototype(set_iterator_prototype, iterator_prototype);
(...skipping 535 matching lines...) Expand 10 before | Expand all | Expand 10 after
2713 JSFunction::EnsureHasInitialMap(function); 2727 JSFunction::EnsureHasInitialMap(function);
2714 function->initial_map()->set_instance_type(JS_PROMISE_TYPE); 2728 function->initial_map()->set_instance_type(JS_PROMISE_TYPE);
2715 function->shared()->set_construct_stub( 2729 function->shared()->set_construct_stub(
2716 *isolate()->builtins()->JSBuiltinsConstructStub()); 2730 *isolate()->builtins()->JSBuiltinsConstructStub());
2717 InstallWithIntrinsicDefaultProto(isolate(), function, 2731 InstallWithIntrinsicDefaultProto(isolate(), function,
2718 Context::PROMISE_FUNCTION_INDEX); 2732 Context::PROMISE_FUNCTION_INDEX);
2719 } 2733 }
2720 2734
2721 InstallBuiltinFunctionIds(); 2735 InstallBuiltinFunctionIds();
2722 2736
2723 // Also install builtin function ids to some generator object methods. These
2724 // three methods use the three resume operations (Runtime_GeneratorNext,
2725 // Runtime_GeneratorReturn, Runtime_GeneratorThrow) respectively. Those
2726 // operations are not supported by Crankshaft, TurboFan, nor Ignition.
2727 {
2728 Handle<JSObject> generator_object_prototype(JSObject::cast(
2729 native_context()->generator_object_prototype_map()->prototype()));
2730
2731 { // GeneratorObject.prototype.next
2732 Handle<String> key = factory()->next_string();
2733 Handle<JSFunction> function = Handle<JSFunction>::cast(
2734 JSReceiver::GetProperty(generator_object_prototype, key)
2735 .ToHandleChecked());
2736 function->shared()->set_builtin_function_id(kGeneratorObjectNext);
2737 }
2738 { // GeneratorObject.prototype.return
2739 Handle<String> key = factory()->NewStringFromAsciiChecked("return");
2740 Handle<JSFunction> function = Handle<JSFunction>::cast(
2741 JSReceiver::GetProperty(generator_object_prototype, key)
2742 .ToHandleChecked());
2743 function->shared()->set_builtin_function_id(kGeneratorObjectReturn);
2744 }
2745 { // GeneratorObject.prototype.throw
2746 Handle<String> key = factory()->throw_string();
2747 Handle<JSFunction> function = Handle<JSFunction>::cast(
2748 JSReceiver::GetProperty(generator_object_prototype, key)
2749 .ToHandleChecked());
2750 function->shared()->set_builtin_function_id(kGeneratorObjectThrow);
2751 }
2752 }
2753
2754 // Create a map for accessor property descriptors (a variant of JSObject 2737 // Create a map for accessor property descriptors (a variant of JSObject
2755 // that predefines four properties get, set, configurable and enumerable). 2738 // that predefines four properties get, set, configurable and enumerable).
2756 { 2739 {
2757 // AccessorPropertyDescriptor initial map. 2740 // AccessorPropertyDescriptor initial map.
2758 Handle<Map> map = 2741 Handle<Map> map =
2759 factory()->NewMap(JS_OBJECT_TYPE, JSAccessorPropertyDescriptor::kSize); 2742 factory()->NewMap(JS_OBJECT_TYPE, JSAccessorPropertyDescriptor::kSize);
2760 // Create the descriptor array for the property descriptor object. 2743 // Create the descriptor array for the property descriptor object.
2761 Map::EnsureDescriptorSlack(map, 4); 2744 Map::EnsureDescriptorSlack(map, 4);
2762 2745
2763 { // get 2746 { // get
(...skipping 784 matching lines...) Expand 10 before | Expand all | Expand 10 after
3548 3531
3549 HookUpGlobalProxy(global_object, global_proxy); 3532 HookUpGlobalProxy(global_object, global_proxy);
3550 HookUpGlobalObject(global_object); 3533 HookUpGlobalObject(global_object);
3551 3534
3552 if (!ConfigureGlobalObjects(global_proxy_template)) return; 3535 if (!ConfigureGlobalObjects(global_proxy_template)) return;
3553 } else { 3536 } else {
3554 // We get here if there was no context snapshot. 3537 // We get here if there was no context snapshot.
3555 CreateRoots(); 3538 CreateRoots();
3556 Handle<JSFunction> empty_function = CreateEmptyFunction(isolate); 3539 Handle<JSFunction> empty_function = CreateEmptyFunction(isolate);
3557 CreateStrictModeFunctionMaps(empty_function); 3540 CreateStrictModeFunctionMaps(empty_function);
3558 CreateIteratorMaps(); 3541 CreateIteratorMaps(empty_function);
3559 Handle<JSGlobalObject> global_object = 3542 Handle<JSGlobalObject> global_object =
3560 CreateNewGlobals(global_proxy_template, global_proxy); 3543 CreateNewGlobals(global_proxy_template, global_proxy);
3561 HookUpGlobalProxy(global_object, global_proxy); 3544 HookUpGlobalProxy(global_object, global_proxy);
3562 InitializeGlobal(global_object, empty_function, context_type); 3545 InitializeGlobal(global_object, empty_function, context_type);
3563 InitializeNormalizedMapCaches(); 3546 InitializeNormalizedMapCaches();
3564 3547
3565 if (!InstallNatives(context_type)) return; 3548 if (!InstallNatives(context_type)) return;
3566 3549
3567 MakeFunctionInstancePrototypeWritable(); 3550 MakeFunctionInstancePrototypeWritable();
3568 3551
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
3631 } 3614 }
3632 3615
3633 3616
3634 // Called when the top-level V8 mutex is destroyed. 3617 // Called when the top-level V8 mutex is destroyed.
3635 void Bootstrapper::FreeThreadResources() { 3618 void Bootstrapper::FreeThreadResources() {
3636 DCHECK(!IsActive()); 3619 DCHECK(!IsActive());
3637 } 3620 }
3638 3621
3639 } // namespace internal 3622 } // namespace internal
3640 } // namespace v8 3623 } // namespace v8
OLDNEW
« no previous file with comments | « src/bailout-reason.h ('k') | src/builtins.h » ('j') | src/deoptimizer.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698