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

Side by Side Diff: src/bootstrapper.cc

Issue 253603003: Pass in the prototype to CreateApiFunction rather than setting it on the result. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 6 years, 7 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 | Annotate | Revision Log
« no previous file with comments | « src/apinatives.js ('k') | src/factory.h » ('j') | src/factory.cc » ('J')
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 "bootstrapper.h" 5 #include "bootstrapper.h"
6 6
7 #include "accessors.h" 7 #include "accessors.h"
8 #include "isolate-inl.h" 8 #include "isolate-inl.h"
9 #include "natives.h" 9 #include "natives.h"
10 #include "snapshot.h" 10 #include "snapshot.h"
(...skipping 703 matching lines...) Expand 10 before | Expand all | Expand 10 after
714 Handle<JSObject>( 714 Handle<JSObject>(
715 JSObject::cast(js_global_function->instance_prototype())); 715 JSObject::cast(js_global_function->instance_prototype()));
716 JSObject::SetLocalPropertyIgnoreAttributes( 716 JSObject::SetLocalPropertyIgnoreAttributes(
717 prototype, factory()->constructor_string(), 717 prototype, factory()->constructor_string(),
718 isolate()->object_function(), NONE).Check(); 718 isolate()->object_function(), NONE).Check();
719 } else { 719 } else {
720 Handle<FunctionTemplateInfo> js_global_constructor( 720 Handle<FunctionTemplateInfo> js_global_constructor(
721 FunctionTemplateInfo::cast(js_global_template->constructor())); 721 FunctionTemplateInfo::cast(js_global_template->constructor()));
722 js_global_function = 722 js_global_function =
723 factory()->CreateApiFunction(js_global_constructor, 723 factory()->CreateApiFunction(js_global_constructor,
724 factory()->the_hole_value(),
724 factory()->InnerGlobalObject); 725 factory()->InnerGlobalObject);
725 } 726 }
726 727
727 js_global_function->initial_map()->set_is_hidden_prototype(); 728 js_global_function->initial_map()->set_is_hidden_prototype();
728 js_global_function->initial_map()->set_dictionary_map(true); 729 js_global_function->initial_map()->set_dictionary_map(true);
729 Handle<GlobalObject> inner_global = 730 Handle<GlobalObject> inner_global =
730 factory()->NewGlobalObject(js_global_function); 731 factory()->NewGlobalObject(js_global_function);
731 if (inner_global_out != NULL) { 732 if (inner_global_out != NULL) {
732 *inner_global_out = inner_global; 733 *inner_global_out = inner_global;
733 } 734 }
734 735
735 // Step 2: create or re-initialize the global proxy object. 736 // Step 2: create or re-initialize the global proxy object.
736 Handle<JSFunction> global_proxy_function; 737 Handle<JSFunction> global_proxy_function;
737 if (global_template.IsEmpty()) { 738 if (global_template.IsEmpty()) {
738 Handle<String> name = Handle<String>(heap()->empty_string()); 739 Handle<String> name = Handle<String>(heap()->empty_string());
739 Handle<Code> code = Handle<Code>(isolate()->builtins()->builtin( 740 Handle<Code> code = Handle<Code>(isolate()->builtins()->builtin(
740 Builtins::kIllegal)); 741 Builtins::kIllegal));
741 global_proxy_function = 742 global_proxy_function =
742 factory()->NewFunction(name, JS_GLOBAL_PROXY_TYPE, 743 factory()->NewFunction(name, JS_GLOBAL_PROXY_TYPE,
743 JSGlobalProxy::kSize, code, true); 744 JSGlobalProxy::kSize, code, true);
744 } else { 745 } else {
745 Handle<ObjectTemplateInfo> data = 746 Handle<ObjectTemplateInfo> data =
746 v8::Utils::OpenHandle(*global_template); 747 v8::Utils::OpenHandle(*global_template);
747 Handle<FunctionTemplateInfo> global_constructor( 748 Handle<FunctionTemplateInfo> global_constructor(
748 FunctionTemplateInfo::cast(data->constructor())); 749 FunctionTemplateInfo::cast(data->constructor()));
749 global_proxy_function = 750 global_proxy_function =
750 factory()->CreateApiFunction(global_constructor, 751 factory()->CreateApiFunction(global_constructor,
752 factory()->the_hole_value(),
751 factory()->OuterGlobalObject); 753 factory()->OuterGlobalObject);
752 } 754 }
753 755
754 Handle<String> global_name = factory()->InternalizeOneByteString( 756 Handle<String> global_name = factory()->InternalizeOneByteString(
755 STATIC_ASCII_VECTOR("global")); 757 STATIC_ASCII_VECTOR("global"));
756 global_proxy_function->shared()->set_instance_class_name(*global_name); 758 global_proxy_function->shared()->set_instance_class_name(*global_name);
757 global_proxy_function->initial_map()->set_is_access_check_needed(true); 759 global_proxy_function->initial_map()->set_is_access_check_needed(true);
758 760
759 // Set global_proxy.__proto__ to js_global after ConfigureGlobalObjects 761 // Set global_proxy.__proto__ to js_global after ConfigureGlobalObjects
760 // Return the global proxy. 762 // Return the global proxy.
(...skipping 1918 matching lines...) Expand 10 before | Expand all | Expand 10 after
2679 return from + sizeof(NestingCounterType); 2681 return from + sizeof(NestingCounterType);
2680 } 2682 }
2681 2683
2682 2684
2683 // Called when the top-level V8 mutex is destroyed. 2685 // Called when the top-level V8 mutex is destroyed.
2684 void Bootstrapper::FreeThreadResources() { 2686 void Bootstrapper::FreeThreadResources() {
2685 ASSERT(!IsActive()); 2687 ASSERT(!IsActive());
2686 } 2688 }
2687 2689
2688 } } // namespace v8::internal 2690 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/apinatives.js ('k') | src/factory.h » ('j') | src/factory.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698