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

Side by Side Diff: src/bootstrapper.cc

Issue 2378483002: [bootstrapper] Remove some redundant calls to set_native. (Closed)
Patch Set: Created 4 years, 2 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 | « no previous file | no next file » | 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 982 matching lines...) Expand 10 before | Expand all | Expand 10 after
993 993
994 Handle<JSFunction> error_fun = 994 Handle<JSFunction> error_fun =
995 InstallFunction(global, name, JS_ERROR_TYPE, JSObject::kHeaderSize, 995 InstallFunction(global, name, JS_ERROR_TYPE, JSObject::kHeaderSize,
996 isolate->initial_object_prototype(), 996 isolate->initial_object_prototype(),
997 Builtins::kErrorConstructor, DONT_ENUM); 997 Builtins::kErrorConstructor, DONT_ENUM);
998 error_fun->shared()->set_instance_class_name(*factory->Error_string()); 998 error_fun->shared()->set_instance_class_name(*factory->Error_string());
999 error_fun->shared()->DontAdaptArguments(); 999 error_fun->shared()->DontAdaptArguments();
1000 error_fun->shared()->set_construct_stub( 1000 error_fun->shared()->set_construct_stub(
1001 *isolate->builtins()->ErrorConstructor()); 1001 *isolate->builtins()->ErrorConstructor());
1002 error_fun->shared()->set_length(1); 1002 error_fun->shared()->set_length(1);
1003 error_fun->shared()->set_native(true);
1004 1003
1005 if (context_index == Context::ERROR_FUNCTION_INDEX) { 1004 if (context_index == Context::ERROR_FUNCTION_INDEX) {
1006 Handle<JSFunction> capture_stack_trace_fun = 1005 SimpleInstallFunction(error_fun, "captureStackTrace",
1007 SimpleInstallFunction(error_fun, "captureStackTrace", 1006 Builtins::kErrorCaptureStackTrace, 2, false);
1008 Builtins::kErrorCaptureStackTrace, 2, false);
1009 capture_stack_trace_fun->shared()->set_native(true);
1010 } 1007 }
1011 1008
1012 InstallWithIntrinsicDefaultProto(isolate, error_fun, context_index); 1009 InstallWithIntrinsicDefaultProto(isolate, error_fun, context_index);
1013 1010
1014 { 1011 {
1015 Handle<JSObject> prototype = 1012 Handle<JSObject> prototype =
1016 factory->NewJSObject(isolate->object_function(), TENURED); 1013 factory->NewJSObject(isolate->object_function(), TENURED);
1017 1014
1018 JSObject::AddProperty(prototype, factory->name_string(), name, DONT_ENUM); 1015 JSObject::AddProperty(prototype, factory->name_string(), name, DONT_ENUM);
1019 JSObject::AddProperty(prototype, factory->message_string(), 1016 JSObject::AddProperty(prototype, factory->message_string(),
1020 factory->empty_string(), DONT_ENUM); 1017 factory->empty_string(), DONT_ENUM);
1021 JSObject::AddProperty(prototype, factory->constructor_string(), error_fun, 1018 JSObject::AddProperty(prototype, factory->constructor_string(), error_fun,
1022 DONT_ENUM); 1019 DONT_ENUM);
1023 1020
1024 if (context_index == Context::ERROR_FUNCTION_INDEX) { 1021 if (context_index == Context::ERROR_FUNCTION_INDEX) {
1025 Handle<JSFunction> to_string_fun = 1022 Handle<JSFunction> to_string_fun =
1026 SimpleInstallFunction(prototype, factory->toString_string(), 1023 SimpleInstallFunction(prototype, factory->toString_string(),
1027 Builtins::kErrorPrototypeToString, 0, true); 1024 Builtins::kErrorPrototypeToString, 0, true);
1028 to_string_fun->shared()->set_native(true);
1029 isolate->native_context()->set_error_to_string(*to_string_fun); 1025 isolate->native_context()->set_error_to_string(*to_string_fun);
1030 } else { 1026 } else {
1031 DCHECK(context_index != Context::ERROR_FUNCTION_INDEX); 1027 DCHECK(context_index != Context::ERROR_FUNCTION_INDEX);
1032 DCHECK(isolate->native_context()->error_to_string()->IsJSFunction()); 1028 DCHECK(isolate->native_context()->error_to_string()->IsJSFunction());
1033 1029
1034 InstallFunction(prototype, isolate->error_to_string(), 1030 InstallFunction(prototype, isolate->error_to_string(),
1035 factory->toString_string(), DONT_ENUM); 1031 factory->toString_string(), DONT_ENUM);
1036 1032
1037 Handle<JSFunction> global_error = isolate->error_function(); 1033 Handle<JSFunction> global_error = isolate->error_function();
1038 CHECK(JSReceiver::SetPrototype(error_fun, global_error, false, 1034 CHECK(JSReceiver::SetPrototype(error_fun, global_error, false,
(...skipping 1730 matching lines...) Expand 10 before | Expand all | Expand 10 after
2769 // Builtin functions for CallSite. 2765 // Builtin functions for CallSite.
2770 2766
2771 // CallSites are a special case; the constructor is for our private use 2767 // CallSites are a special case; the constructor is for our private use
2772 // only, therefore we set it up as a builtin that throws. Internally, we use 2768 // only, therefore we set it up as a builtin that throws. Internally, we use
2773 // CallSiteUtils::Construct to create CallSite objects. 2769 // CallSiteUtils::Construct to create CallSite objects.
2774 2770
2775 Handle<JSFunction> callsite_fun = InstallFunction( 2771 Handle<JSFunction> callsite_fun = InstallFunction(
2776 container, "CallSite", JS_OBJECT_TYPE, JSObject::kHeaderSize, 2772 container, "CallSite", JS_OBJECT_TYPE, JSObject::kHeaderSize,
2777 isolate->initial_object_prototype(), Builtins::kUnsupportedThrower); 2773 isolate->initial_object_prototype(), Builtins::kUnsupportedThrower);
2778 callsite_fun->shared()->DontAdaptArguments(); 2774 callsite_fun->shared()->DontAdaptArguments();
2779 callsite_fun->shared()->set_native(true);
2780
2781 isolate->native_context()->set_callsite_function(*callsite_fun); 2775 isolate->native_context()->set_callsite_function(*callsite_fun);
2782 2776
2783 { 2777 {
2784 Handle<JSObject> proto = 2778 Handle<JSObject> proto =
2785 factory->NewJSObject(isolate->object_function(), TENURED); 2779 factory->NewJSObject(isolate->object_function(), TENURED);
2786 JSObject::AddProperty(proto, factory->constructor_string(), callsite_fun, 2780 JSObject::AddProperty(proto, factory->constructor_string(), callsite_fun,
2787 DONT_ENUM); 2781 DONT_ENUM);
2788 2782
2789 struct FunctionInfo { 2783 struct FunctionInfo {
2790 const char* name; 2784 const char* name;
(...skipping 17 matching lines...) Expand all
2808 {"isEval", Builtins::kCallSitePrototypeIsEval}, 2802 {"isEval", Builtins::kCallSitePrototypeIsEval},
2809 {"isNative", Builtins::kCallSitePrototypeIsNative}, 2803 {"isNative", Builtins::kCallSitePrototypeIsNative},
2810 {"isToplevel", Builtins::kCallSitePrototypeIsToplevel}, 2804 {"isToplevel", Builtins::kCallSitePrototypeIsToplevel},
2811 {"toString", Builtins::kCallSitePrototypeToString}}; 2805 {"toString", Builtins::kCallSitePrototypeToString}};
2812 2806
2813 PropertyAttributes attrs = 2807 PropertyAttributes attrs =
2814 static_cast<PropertyAttributes>(DONT_ENUM | DONT_DELETE | READ_ONLY); 2808 static_cast<PropertyAttributes>(DONT_ENUM | DONT_DELETE | READ_ONLY);
2815 2809
2816 Handle<JSFunction> fun; 2810 Handle<JSFunction> fun;
2817 for (const FunctionInfo& info : infos) { 2811 for (const FunctionInfo& info : infos) {
2818 fun = SimpleInstallFunction(proto, info.name, info.id, 0, true, attrs); 2812 SimpleInstallFunction(proto, info.name, info.id, 0, true, attrs);
2819 fun->shared()->set_native(true);
2820 } 2813 }
2821 2814
2822 Accessors::FunctionSetPrototype(callsite_fun, proto).Assert(); 2815 Accessors::FunctionSetPrototype(callsite_fun, proto).Assert();
2823 } 2816 }
2824 } 2817 }
2825 } 2818 }
2826 2819
2827 2820
2828 void Bootstrapper::ExportExperimentalFromRuntime(Isolate* isolate, 2821 void Bootstrapper::ExportExperimentalFromRuntime(Isolate* isolate,
2829 Handle<JSObject> container) { 2822 Handle<JSObject> container) {
(...skipping 1362 matching lines...) Expand 10 before | Expand all | Expand 10 after
4192 } 4185 }
4193 4186
4194 4187
4195 // Called when the top-level V8 mutex is destroyed. 4188 // Called when the top-level V8 mutex is destroyed.
4196 void Bootstrapper::FreeThreadResources() { 4189 void Bootstrapper::FreeThreadResources() {
4197 DCHECK(!IsActive()); 4190 DCHECK(!IsActive());
4198 } 4191 }
4199 4192
4200 } // namespace internal 4193 } // namespace internal
4201 } // namespace v8 4194 } // namespace v8
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698