| OLD | NEW |
| 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 256 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 267 bool ConfigureGlobalObjects( | 267 bool ConfigureGlobalObjects( |
| 268 v8::Local<v8::ObjectTemplate> global_proxy_template); | 268 v8::Local<v8::ObjectTemplate> global_proxy_template); |
| 269 | 269 |
| 270 // Migrates all properties from the 'from' object to the 'to' | 270 // Migrates all properties from the 'from' object to the 'to' |
| 271 // object and overrides the prototype in 'to' with the one from | 271 // object and overrides the prototype in 'to' with the one from |
| 272 // 'from'. | 272 // 'from'. |
| 273 void TransferObject(Handle<JSObject> from, Handle<JSObject> to); | 273 void TransferObject(Handle<JSObject> from, Handle<JSObject> to); |
| 274 void TransferNamedProperties(Handle<JSObject> from, Handle<JSObject> to); | 274 void TransferNamedProperties(Handle<JSObject> from, Handle<JSObject> to); |
| 275 void TransferIndexedProperties(Handle<JSObject> from, Handle<JSObject> to); | 275 void TransferIndexedProperties(Handle<JSObject> from, Handle<JSObject> to); |
| 276 | 276 |
| 277 enum FunctionMode { | |
| 278 // With prototype. | |
| 279 FUNCTION_WITH_WRITEABLE_PROTOTYPE, | |
| 280 FUNCTION_WITH_READONLY_PROTOTYPE, | |
| 281 // Without prototype. | |
| 282 FUNCTION_WITHOUT_PROTOTYPE | |
| 283 }; | |
| 284 | |
| 285 static bool IsFunctionModeWithPrototype(FunctionMode function_mode) { | |
| 286 return (function_mode == FUNCTION_WITH_WRITEABLE_PROTOTYPE || | |
| 287 function_mode == FUNCTION_WITH_READONLY_PROTOTYPE); | |
| 288 } | |
| 289 | |
| 290 Handle<Map> CreateSloppyFunctionMap(FunctionMode function_mode); | |
| 291 | |
| 292 void SetFunctionInstanceDescriptor(Handle<Map> map, | |
| 293 FunctionMode function_mode); | |
| 294 void MakeFunctionInstancePrototypeWritable(); | 277 void MakeFunctionInstancePrototypeWritable(); |
| 295 | 278 |
| 296 Handle<Map> CreateStrictFunctionMap(FunctionMode function_mode, | |
| 297 Handle<JSFunction> empty_function); | |
| 298 | |
| 299 | |
| 300 void SetStrictFunctionInstanceDescriptor(Handle<Map> map, | 279 void SetStrictFunctionInstanceDescriptor(Handle<Map> map, |
| 301 FunctionMode function_mode); | 280 FunctionMode function_mode); |
| 302 | 281 |
| 303 static bool CallUtilsFunction(Isolate* isolate, const char* name); | 282 static bool CallUtilsFunction(Isolate* isolate, const char* name); |
| 304 | 283 |
| 305 static bool CompileExtension(Isolate* isolate, v8::Extension* extension); | 284 static bool CompileExtension(Isolate* isolate, v8::Extension* extension); |
| 306 | 285 |
| 307 Isolate* isolate_; | 286 Isolate* isolate_; |
| 308 Handle<Context> result_; | 287 Handle<Context> result_; |
| 309 Handle<Context> native_context_; | 288 Handle<Context> native_context_; |
| (...skipping 185 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 495 Handle<JSFunction> SimpleInstallGetter(Handle<JSObject> base, | 474 Handle<JSFunction> SimpleInstallGetter(Handle<JSObject> base, |
| 496 Handle<String> name, Builtins::Name call, | 475 Handle<String> name, Builtins::Name call, |
| 497 bool adapt, BuiltinFunctionId id) { | 476 bool adapt, BuiltinFunctionId id) { |
| 498 Handle<JSFunction> fun = SimpleInstallGetter(base, name, call, adapt); | 477 Handle<JSFunction> fun = SimpleInstallGetter(base, name, call, adapt); |
| 499 fun->shared()->set_builtin_function_id(id); | 478 fun->shared()->set_builtin_function_id(id); |
| 500 return fun; | 479 return fun; |
| 501 } | 480 } |
| 502 | 481 |
| 503 } // namespace | 482 } // namespace |
| 504 | 483 |
| 505 void Genesis::SetFunctionInstanceDescriptor(Handle<Map> map, | |
| 506 FunctionMode function_mode) { | |
| 507 int size = IsFunctionModeWithPrototype(function_mode) ? 5 : 4; | |
| 508 Map::EnsureDescriptorSlack(map, size); | |
| 509 | |
| 510 PropertyAttributes ro_attribs = | |
| 511 static_cast<PropertyAttributes>(DONT_ENUM | DONT_DELETE | READ_ONLY); | |
| 512 PropertyAttributes roc_attribs = | |
| 513 static_cast<PropertyAttributes>(DONT_ENUM | READ_ONLY); | |
| 514 | |
| 515 STATIC_ASSERT(JSFunction::kLengthDescriptorIndex == 0); | |
| 516 Handle<AccessorInfo> length = | |
| 517 Accessors::FunctionLengthInfo(isolate(), roc_attribs); | |
| 518 { // Add length. | |
| 519 AccessorConstantDescriptor d(Handle<Name>(Name::cast(length->name())), | |
| 520 length, roc_attribs); | |
| 521 map->AppendDescriptor(&d); | |
| 522 } | |
| 523 | |
| 524 STATIC_ASSERT(JSFunction::kNameDescriptorIndex == 1); | |
| 525 Handle<AccessorInfo> name = | |
| 526 Accessors::FunctionNameInfo(isolate(), ro_attribs); | |
| 527 { // Add name. | |
| 528 AccessorConstantDescriptor d(Handle<Name>(Name::cast(name->name())), name, | |
| 529 roc_attribs); | |
| 530 map->AppendDescriptor(&d); | |
| 531 } | |
| 532 Handle<AccessorInfo> args = | |
| 533 Accessors::FunctionArgumentsInfo(isolate(), ro_attribs); | |
| 534 { // Add arguments. | |
| 535 AccessorConstantDescriptor d(Handle<Name>(Name::cast(args->name())), args, | |
| 536 ro_attribs); | |
| 537 map->AppendDescriptor(&d); | |
| 538 } | |
| 539 Handle<AccessorInfo> caller = | |
| 540 Accessors::FunctionCallerInfo(isolate(), ro_attribs); | |
| 541 { // Add caller. | |
| 542 AccessorConstantDescriptor d(Handle<Name>(Name::cast(caller->name())), | |
| 543 caller, ro_attribs); | |
| 544 map->AppendDescriptor(&d); | |
| 545 } | |
| 546 if (IsFunctionModeWithPrototype(function_mode)) { | |
| 547 if (function_mode == FUNCTION_WITH_WRITEABLE_PROTOTYPE) { | |
| 548 ro_attribs = static_cast<PropertyAttributes>(ro_attribs & ~READ_ONLY); | |
| 549 } | |
| 550 Handle<AccessorInfo> prototype = | |
| 551 Accessors::FunctionPrototypeInfo(isolate(), ro_attribs); | |
| 552 AccessorConstantDescriptor d(Handle<Name>(Name::cast(prototype->name())), | |
| 553 prototype, ro_attribs); | |
| 554 map->AppendDescriptor(&d); | |
| 555 } | |
| 556 } | |
| 557 | |
| 558 | |
| 559 Handle<Map> Genesis::CreateSloppyFunctionMap(FunctionMode function_mode) { | |
| 560 Handle<Map> map = factory()->NewMap(JS_FUNCTION_TYPE, JSFunction::kSize); | |
| 561 SetFunctionInstanceDescriptor(map, function_mode); | |
| 562 map->set_is_constructor(IsFunctionModeWithPrototype(function_mode)); | |
| 563 map->set_is_callable(); | |
| 564 return map; | |
| 565 } | |
| 566 | |
| 567 | |
| 568 Handle<JSFunction> Genesis::CreateEmptyFunction(Isolate* isolate) { | 484 Handle<JSFunction> Genesis::CreateEmptyFunction(Isolate* isolate) { |
| 569 // Allocate the map for function instances. Maps are allocated first and their | 485 // Allocate the map for function instances. Maps are allocated first and their |
| 570 // prototypes patched later, once empty function is created. | 486 // prototypes patched later, once empty function is created. |
| 571 | 487 |
| 572 // Functions with this map will not have a 'prototype' property, and | 488 // Functions with this map will not have a 'prototype' property, and |
| 573 // can not be used as constructors. | 489 // can not be used as constructors. |
| 574 Handle<Map> function_without_prototype_map = | 490 Handle<Map> function_without_prototype_map = |
| 575 CreateSloppyFunctionMap(FUNCTION_WITHOUT_PROTOTYPE); | 491 factory()->CreateSloppyFunctionMap(FUNCTION_WITHOUT_PROTOTYPE); |
| 576 native_context()->set_sloppy_function_without_prototype_map( | 492 native_context()->set_sloppy_function_without_prototype_map( |
| 577 *function_without_prototype_map); | 493 *function_without_prototype_map); |
| 578 | 494 |
| 579 // Allocate the function map. This map is temporary, used only for processing | 495 // Allocate the function map. This map is temporary, used only for processing |
| 580 // of builtins. | 496 // of builtins. |
| 581 // Later the map is replaced with writable prototype map, allocated below. | 497 // Later the map is replaced with writable prototype map, allocated below. |
| 582 Handle<Map> function_map = | 498 Handle<Map> function_map = |
| 583 CreateSloppyFunctionMap(FUNCTION_WITH_READONLY_PROTOTYPE); | 499 factory()->CreateSloppyFunctionMap(FUNCTION_WITH_READONLY_PROTOTYPE); |
| 584 native_context()->set_sloppy_function_map(*function_map); | 500 native_context()->set_sloppy_function_map(*function_map); |
| 585 native_context()->set_sloppy_function_with_readonly_prototype_map( | 501 native_context()->set_sloppy_function_with_readonly_prototype_map( |
| 586 *function_map); | 502 *function_map); |
| 587 | 503 |
| 588 // The final map for functions. Writeable prototype. | 504 // The final map for functions. Writeable prototype. |
| 589 // This map is installed in MakeFunctionInstancePrototypeWritable. | 505 // This map is installed in MakeFunctionInstancePrototypeWritable. |
| 590 sloppy_function_map_writable_prototype_ = | 506 sloppy_function_map_writable_prototype_ = |
| 591 CreateSloppyFunctionMap(FUNCTION_WITH_WRITEABLE_PROTOTYPE); | 507 factory()->CreateSloppyFunctionMap(FUNCTION_WITH_WRITEABLE_PROTOTYPE); |
| 592 Factory* factory = isolate->factory(); | 508 Factory* factory = isolate->factory(); |
| 593 | 509 |
| 594 Handle<String> object_name = factory->Object_string(); | 510 Handle<String> object_name = factory->Object_string(); |
| 595 | 511 |
| 596 Handle<JSObject> object_function_prototype; | 512 Handle<JSObject> object_function_prototype; |
| 597 | 513 |
| 598 { // --- O b j e c t --- | 514 { // --- O b j e c t --- |
| 599 Handle<JSFunction> object_fun = factory->NewFunction(object_name); | 515 Handle<JSFunction> object_fun = factory->NewFunction(object_name); |
| 600 int unused = JSObject::kInitialGlobalObjectUnusedPropertiesCount; | 516 int unused = JSObject::kInitialGlobalObjectUnusedPropertiesCount; |
| 601 int instance_size = JSObject::kHeaderSize + kPointerSize * unused; | 517 int instance_size = JSObject::kHeaderSize + kPointerSize * unused; |
| (...skipping 25 matching lines...) Expand all Loading... |
| 627 .Assert(); | 543 .Assert(); |
| 628 } | 544 } |
| 629 | 545 |
| 630 // Allocate the empty function as the prototype for function - ES6 19.2.3 | 546 // Allocate the empty function as the prototype for function - ES6 19.2.3 |
| 631 Handle<Code> code(isolate->builtins()->EmptyFunction()); | 547 Handle<Code> code(isolate->builtins()->EmptyFunction()); |
| 632 Handle<JSFunction> empty_function = | 548 Handle<JSFunction> empty_function = |
| 633 factory->NewFunctionWithoutPrototype(factory->empty_string(), code); | 549 factory->NewFunctionWithoutPrototype(factory->empty_string(), code); |
| 634 | 550 |
| 635 // Allocate the function map first and then patch the prototype later | 551 // Allocate the function map first and then patch the prototype later |
| 636 Handle<Map> empty_function_map = | 552 Handle<Map> empty_function_map = |
| 637 CreateSloppyFunctionMap(FUNCTION_WITHOUT_PROTOTYPE); | 553 factory->CreateSloppyFunctionMap(FUNCTION_WITHOUT_PROTOTYPE); |
| 638 DCHECK(!empty_function_map->is_dictionary_map()); | 554 DCHECK(!empty_function_map->is_dictionary_map()); |
| 639 Map::SetPrototype(empty_function_map, object_function_prototype); | 555 Map::SetPrototype(empty_function_map, object_function_prototype); |
| 640 empty_function_map->set_is_prototype_map(true); | 556 empty_function_map->set_is_prototype_map(true); |
| 641 | 557 |
| 642 empty_function->set_map(*empty_function_map); | 558 empty_function->set_map(*empty_function_map); |
| 643 | 559 |
| 644 // --- E m p t y --- | 560 // --- E m p t y --- |
| 645 Handle<String> source = factory->NewStringFromStaticChars("() {}"); | 561 Handle<String> source = factory->NewStringFromStaticChars("() {}"); |
| 646 Handle<Script> script = factory->NewScript(source); | 562 Handle<Script> script = factory->NewScript(source); |
| 647 script->set_type(Script::TYPE_NATIVE); | 563 script->set_type(Script::TYPE_NATIVE); |
| 648 empty_function->shared()->set_start_position(0); | 564 empty_function->shared()->set_start_position(0); |
| 649 empty_function->shared()->set_end_position(source->length()); | 565 empty_function->shared()->set_end_position(source->length()); |
| 650 empty_function->shared()->DontAdaptArguments(); | 566 empty_function->shared()->DontAdaptArguments(); |
| 651 SharedFunctionInfo::SetScript(handle(empty_function->shared()), script); | 567 SharedFunctionInfo::SetScript(handle(empty_function->shared()), script); |
| 652 | 568 |
| 653 // Set prototypes for the function maps. | 569 // Set prototypes for the function maps. |
| 654 Handle<Map> sloppy_function_map(native_context()->sloppy_function_map(), | 570 Handle<Map> sloppy_function_map(native_context()->sloppy_function_map(), |
| 655 isolate); | 571 isolate); |
| 656 Handle<Map> sloppy_function_without_prototype_map( | 572 Handle<Map> sloppy_function_without_prototype_map( |
| 657 native_context()->sloppy_function_without_prototype_map(), isolate); | 573 native_context()->sloppy_function_without_prototype_map(), isolate); |
| 658 Map::SetPrototype(sloppy_function_map, empty_function); | 574 Map::SetPrototype(sloppy_function_map, empty_function); |
| 659 Map::SetPrototype(sloppy_function_without_prototype_map, empty_function); | 575 Map::SetPrototype(sloppy_function_without_prototype_map, empty_function); |
| 660 Map::SetPrototype(sloppy_function_map_writable_prototype_, empty_function); | 576 Map::SetPrototype(sloppy_function_map_writable_prototype_, empty_function); |
| 661 | 577 |
| 662 return empty_function; | 578 return empty_function; |
| 663 } | 579 } |
| 664 | 580 |
| 665 | 581 |
| 666 void Genesis::SetStrictFunctionInstanceDescriptor(Handle<Map> map, | |
| 667 FunctionMode function_mode) { | |
| 668 int size = IsFunctionModeWithPrototype(function_mode) ? 3 : 2; | |
| 669 Map::EnsureDescriptorSlack(map, size); | |
| 670 | |
| 671 PropertyAttributes rw_attribs = | |
| 672 static_cast<PropertyAttributes>(DONT_ENUM | DONT_DELETE); | |
| 673 PropertyAttributes ro_attribs = | |
| 674 static_cast<PropertyAttributes>(DONT_ENUM | DONT_DELETE | READ_ONLY); | |
| 675 PropertyAttributes roc_attribs = | |
| 676 static_cast<PropertyAttributes>(DONT_ENUM | READ_ONLY); | |
| 677 | |
| 678 DCHECK(function_mode == FUNCTION_WITH_WRITEABLE_PROTOTYPE || | |
| 679 function_mode == FUNCTION_WITH_READONLY_PROTOTYPE || | |
| 680 function_mode == FUNCTION_WITHOUT_PROTOTYPE); | |
| 681 STATIC_ASSERT(JSFunction::kLengthDescriptorIndex == 0); | |
| 682 { // Add length. | |
| 683 Handle<AccessorInfo> length = | |
| 684 Accessors::FunctionLengthInfo(isolate(), roc_attribs); | |
| 685 AccessorConstantDescriptor d(handle(Name::cast(length->name())), length, | |
| 686 roc_attribs); | |
| 687 map->AppendDescriptor(&d); | |
| 688 } | |
| 689 | |
| 690 STATIC_ASSERT(JSFunction::kNameDescriptorIndex == 1); | |
| 691 { // Add name. | |
| 692 Handle<AccessorInfo> name = | |
| 693 Accessors::FunctionNameInfo(isolate(), roc_attribs); | |
| 694 AccessorConstantDescriptor d(handle(Name::cast(name->name())), name, | |
| 695 roc_attribs); | |
| 696 map->AppendDescriptor(&d); | |
| 697 } | |
| 698 if (IsFunctionModeWithPrototype(function_mode)) { | |
| 699 // Add prototype. | |
| 700 PropertyAttributes attribs = | |
| 701 function_mode == FUNCTION_WITH_WRITEABLE_PROTOTYPE ? rw_attribs | |
| 702 : ro_attribs; | |
| 703 Handle<AccessorInfo> prototype = | |
| 704 Accessors::FunctionPrototypeInfo(isolate(), attribs); | |
| 705 AccessorConstantDescriptor d(Handle<Name>(Name::cast(prototype->name())), | |
| 706 prototype, attribs); | |
| 707 map->AppendDescriptor(&d); | |
| 708 } | |
| 709 } | |
| 710 | |
| 711 | |
| 712 // Creates the %ThrowTypeError% function. | 582 // Creates the %ThrowTypeError% function. |
| 713 Handle<JSFunction> Genesis::GetThrowTypeErrorIntrinsic( | 583 Handle<JSFunction> Genesis::GetThrowTypeErrorIntrinsic( |
| 714 Builtins::Name builtin_name) { | 584 Builtins::Name builtin_name) { |
| 715 Handle<String> name = | 585 Handle<String> name = |
| 716 factory()->InternalizeOneByteString(STATIC_CHAR_VECTOR("ThrowTypeError")); | 586 factory()->InternalizeOneByteString(STATIC_CHAR_VECTOR("ThrowTypeError")); |
| 717 Handle<Code> code(isolate()->builtins()->builtin(builtin_name)); | 587 Handle<Code> code(isolate()->builtins()->builtin(builtin_name)); |
| 718 Handle<JSFunction> function = | 588 Handle<JSFunction> function = |
| 719 factory()->NewFunctionWithoutPrototype(name, code, true); | 589 factory()->NewFunctionWithoutPrototype(name, code, true); |
| 720 function->shared()->DontAdaptArguments(); | 590 function->shared()->DontAdaptArguments(); |
| 721 | 591 |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 753 | 623 |
| 754 Handle<JSFunction> Genesis::GetStrictArgumentsPoisonFunction() { | 624 Handle<JSFunction> Genesis::GetStrictArgumentsPoisonFunction() { |
| 755 if (strict_poison_function_.is_null()) { | 625 if (strict_poison_function_.is_null()) { |
| 756 strict_poison_function_ = GetThrowTypeErrorIntrinsic( | 626 strict_poison_function_ = GetThrowTypeErrorIntrinsic( |
| 757 Builtins::kRestrictedStrictArgumentsPropertiesThrower); | 627 Builtins::kRestrictedStrictArgumentsPropertiesThrower); |
| 758 } | 628 } |
| 759 return strict_poison_function_; | 629 return strict_poison_function_; |
| 760 } | 630 } |
| 761 | 631 |
| 762 | 632 |
| 763 Handle<Map> Genesis::CreateStrictFunctionMap( | |
| 764 FunctionMode function_mode, Handle<JSFunction> empty_function) { | |
| 765 Handle<Map> map = factory()->NewMap(JS_FUNCTION_TYPE, JSFunction::kSize); | |
| 766 SetStrictFunctionInstanceDescriptor(map, function_mode); | |
| 767 map->set_is_constructor(IsFunctionModeWithPrototype(function_mode)); | |
| 768 map->set_is_callable(); | |
| 769 Map::SetPrototype(map, empty_function); | |
| 770 return map; | |
| 771 } | |
| 772 | |
| 773 | |
| 774 void Genesis::CreateStrictModeFunctionMaps(Handle<JSFunction> empty) { | 633 void Genesis::CreateStrictModeFunctionMaps(Handle<JSFunction> empty) { |
| 775 // Allocate map for the prototype-less strict mode instances. | 634 // Allocate map for the prototype-less strict mode instances. |
| 776 Handle<Map> strict_function_without_prototype_map = | 635 Handle<Map> strict_function_without_prototype_map = |
| 777 CreateStrictFunctionMap(FUNCTION_WITHOUT_PROTOTYPE, empty); | 636 factory()->CreateStrictFunctionMap(FUNCTION_WITHOUT_PROTOTYPE, empty); |
| 778 native_context()->set_strict_function_without_prototype_map( | 637 native_context()->set_strict_function_without_prototype_map( |
| 779 *strict_function_without_prototype_map); | 638 *strict_function_without_prototype_map); |
| 780 | 639 |
| 781 // Allocate map for the strict mode functions. This map is temporary, used | 640 // Allocate map for the strict mode functions. This map is temporary, used |
| 782 // only for processing of builtins. | 641 // only for processing of builtins. |
| 783 // Later the map is replaced with writable prototype map, allocated below. | 642 // Later the map is replaced with writable prototype map, allocated below. |
| 784 Handle<Map> strict_function_map = | 643 Handle<Map> strict_function_map = factory()->CreateStrictFunctionMap( |
| 785 CreateStrictFunctionMap(FUNCTION_WITH_READONLY_PROTOTYPE, empty); | 644 FUNCTION_WITH_READONLY_PROTOTYPE, empty); |
| 786 native_context()->set_strict_function_map(*strict_function_map); | 645 native_context()->set_strict_function_map(*strict_function_map); |
| 787 | 646 |
| 788 // The final map for the strict mode functions. Writeable prototype. | 647 // The final map for the strict mode functions. Writeable prototype. |
| 789 // This map is installed in MakeFunctionInstancePrototypeWritable. | 648 // This map is installed in MakeFunctionInstancePrototypeWritable. |
| 790 strict_function_map_writable_prototype_ = | 649 strict_function_map_writable_prototype_ = factory()->CreateStrictFunctionMap( |
| 791 CreateStrictFunctionMap(FUNCTION_WITH_WRITEABLE_PROTOTYPE, empty); | 650 FUNCTION_WITH_WRITEABLE_PROTOTYPE, empty); |
| 792 | 651 |
| 793 // Now that the strict mode function map is available, set up the | 652 // Now that the strict mode function map is available, set up the |
| 794 // restricted "arguments" and "caller" getters. | 653 // restricted "arguments" and "caller" getters. |
| 795 AddRestrictedFunctionProperties(empty); | 654 AddRestrictedFunctionProperties(empty); |
| 796 } | 655 } |
| 797 | 656 |
| 798 void Genesis::CreateIteratorMaps(Handle<JSFunction> empty) { | 657 void Genesis::CreateIteratorMaps(Handle<JSFunction> empty) { |
| 799 // Create iterator-related meta-objects. | 658 // Create iterator-related meta-objects. |
| 800 Handle<JSObject> iterator_prototype = | 659 Handle<JSObject> iterator_prototype = |
| 801 factory()->NewJSObject(isolate()->object_function(), TENURED); | 660 factory()->NewJSObject(isolate()->object_function(), TENURED); |
| (...skipping 3242 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4044 | 3903 |
| 4045 // CreateNewGlobals. | 3904 // CreateNewGlobals. |
| 4046 Handle<ObjectTemplateInfo> global_proxy_data = | 3905 Handle<ObjectTemplateInfo> global_proxy_data = |
| 4047 v8::Utils::OpenHandle(*global_proxy_template); | 3906 v8::Utils::OpenHandle(*global_proxy_template); |
| 4048 Handle<FunctionTemplateInfo> global_constructor( | 3907 Handle<FunctionTemplateInfo> global_constructor( |
| 4049 FunctionTemplateInfo::cast(global_proxy_data->constructor())); | 3908 FunctionTemplateInfo::cast(global_proxy_data->constructor())); |
| 4050 Handle<SharedFunctionInfo> shared = | 3909 Handle<SharedFunctionInfo> shared = |
| 4051 FunctionTemplateInfo::GetOrCreateSharedFunctionInfo(isolate, | 3910 FunctionTemplateInfo::GetOrCreateSharedFunctionInfo(isolate, |
| 4052 global_constructor); | 3911 global_constructor); |
| 4053 Handle<Map> initial_map = | 3912 Handle<Map> initial_map = |
| 4054 CreateSloppyFunctionMap(FUNCTION_WITH_WRITEABLE_PROTOTYPE); | 3913 factory()->CreateSloppyFunctionMap(FUNCTION_WITH_WRITEABLE_PROTOTYPE); |
| 4055 Handle<JSFunction> global_proxy_function = | 3914 Handle<JSFunction> global_proxy_function = |
| 4056 isolate->factory()->NewFunctionFromSharedFunctionInfo( | 3915 isolate->factory()->NewFunctionFromSharedFunctionInfo( |
| 4057 initial_map, shared, factory()->undefined_value()); | 3916 initial_map, shared, factory()->undefined_value()); |
| 4058 DCHECK_EQ(global_proxy_data->internal_field_count(), 0); | 3917 DCHECK_EQ(global_proxy_data->internal_field_count(), 0); |
| 4059 Handle<Map> global_proxy_map = isolate->factory()->NewMap( | 3918 Handle<Map> global_proxy_map = isolate->factory()->NewMap( |
| 4060 JS_GLOBAL_PROXY_TYPE, JSGlobalProxy::kSize, FAST_HOLEY_SMI_ELEMENTS); | 3919 JS_GLOBAL_PROXY_TYPE, JSGlobalProxy::kSize, FAST_HOLEY_SMI_ELEMENTS); |
| 4061 JSFunction::SetInitialMap(global_proxy_function, global_proxy_map, | 3920 JSFunction::SetInitialMap(global_proxy_function, global_proxy_map, |
| 4062 factory()->null_value()); | 3921 factory()->null_value()); |
| 4063 global_proxy_map->set_is_access_check_needed(true); | 3922 global_proxy_map->set_is_access_check_needed(true); |
| 4064 global_proxy_map->set_is_callable(); | 3923 global_proxy_map->set_is_callable(); |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4101 } | 3960 } |
| 4102 | 3961 |
| 4103 | 3962 |
| 4104 // Called when the top-level V8 mutex is destroyed. | 3963 // Called when the top-level V8 mutex is destroyed. |
| 4105 void Bootstrapper::FreeThreadResources() { | 3964 void Bootstrapper::FreeThreadResources() { |
| 4106 DCHECK(!IsActive()); | 3965 DCHECK(!IsActive()); |
| 4107 } | 3966 } |
| 4108 | 3967 |
| 4109 } // namespace internal | 3968 } // namespace internal |
| 4110 } // namespace v8 | 3969 } // namespace v8 |
| OLD | NEW |