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

Side by Side Diff: src/bootstrapper.cc

Issue 2206573002: Move NoSideEffectToString to C++ (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Address comments Created 4 years, 4 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 | « src/api.cc ('k') | src/builtins/builtins.h » ('j') | 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 985 matching lines...) Expand 10 before | Expand all | Expand 10 after
996 { 996 {
997 Handle<JSObject> prototype = 997 Handle<JSObject> prototype =
998 factory->NewJSObject(isolate->object_function(), TENURED); 998 factory->NewJSObject(isolate->object_function(), TENURED);
999 999
1000 JSObject::AddProperty(prototype, factory->name_string(), name, DONT_ENUM); 1000 JSObject::AddProperty(prototype, factory->name_string(), name, DONT_ENUM);
1001 JSObject::AddProperty(prototype, factory->message_string(), 1001 JSObject::AddProperty(prototype, factory->message_string(),
1002 factory->empty_string(), DONT_ENUM); 1002 factory->empty_string(), DONT_ENUM);
1003 JSObject::AddProperty(prototype, factory->constructor_string(), error_fun, 1003 JSObject::AddProperty(prototype, factory->constructor_string(), error_fun,
1004 DONT_ENUM); 1004 DONT_ENUM);
1005 1005
1006 Handle<JSFunction> to_string_fun = 1006 if (context_index == Context::ERROR_FUNCTION_INDEX) {
1007 SimpleInstallFunction(prototype, factory->toString_string(), 1007 Handle<JSFunction> to_string_fun =
1008 Builtins::kErrorPrototypeToString, 0, true); 1008 SimpleInstallFunction(prototype, factory->toString_string(),
1009 to_string_fun->shared()->set_native(true); 1009 Builtins::kErrorPrototypeToString, 0, true);
1010 to_string_fun->shared()->set_native(true);
1011 isolate->native_context()->set_error_to_string(*to_string_fun);
1012 } else {
1013 DCHECK(context_index != Context::ERROR_FUNCTION_INDEX);
1014 DCHECK(isolate->native_context()->error_to_string()->IsJSFunction());
1010 1015
1011 if (context_index != Context::ERROR_FUNCTION_INDEX) { 1016 InstallFunction(prototype, isolate->error_to_string(),
1017 factory->toString_string(), DONT_ENUM);
1018
1012 Handle<JSFunction> global_error = isolate->error_function(); 1019 Handle<JSFunction> global_error = isolate->error_function();
1013 CHECK(JSReceiver::SetPrototype(error_fun, global_error, false, 1020 CHECK(JSReceiver::SetPrototype(error_fun, global_error, false,
1014 Object::THROW_ON_ERROR) 1021 Object::THROW_ON_ERROR)
1015 .FromMaybe(false)); 1022 .FromMaybe(false));
1016 CHECK(JSReceiver::SetPrototype(prototype, 1023 CHECK(JSReceiver::SetPrototype(prototype,
1017 handle(global_error->prototype(), isolate), 1024 handle(global_error->prototype(), isolate),
1018 false, Object::THROW_ON_ERROR) 1025 false, Object::THROW_ON_ERROR)
1019 .FromMaybe(false)); 1026 .FromMaybe(false));
1020 } 1027 }
1021 1028
(...skipping 1669 matching lines...) Expand 10 before | Expand all | Expand 10 after
2691 2698
2692 Handle<JSFunction> fun; 2699 Handle<JSFunction> fun;
2693 for (const FunctionInfo& info : infos) { 2700 for (const FunctionInfo& info : infos) {
2694 fun = SimpleInstallFunction(proto, info.name, info.id, 0, true, attrs); 2701 fun = SimpleInstallFunction(proto, info.name, info.id, 0, true, attrs);
2695 fun->shared()->set_native(true); 2702 fun->shared()->set_native(true);
2696 } 2703 }
2697 2704
2698 Accessors::FunctionSetPrototype(callsite_fun, proto).Assert(); 2705 Accessors::FunctionSetPrototype(callsite_fun, proto).Assert();
2699 } 2706 }
2700 } 2707 }
2708
2709 { // -- E r r o r
2710 Handle<JSFunction> make_err_fun = InstallFunction(
2711 container, "make_generic_error", JS_OBJECT_TYPE, JSObject::kHeaderSize,
2712 isolate->initial_object_prototype(), Builtins::kMakeGenericError);
2713 make_err_fun->shared()->DontAdaptArguments();
2714 }
2701 } 2715 }
2702 2716
2703 2717
2704 void Bootstrapper::ExportExperimentalFromRuntime(Isolate* isolate, 2718 void Bootstrapper::ExportExperimentalFromRuntime(Isolate* isolate,
2705 Handle<JSObject> container) { 2719 Handle<JSObject> container) {
2706 HandleScope scope(isolate); 2720 HandleScope scope(isolate);
2707 2721
2708 #define INITIALIZE_FLAG(FLAG) \ 2722 #define INITIALIZE_FLAG(FLAG) \
2709 { \ 2723 { \
2710 Handle<String> name = \ 2724 Handle<String> name = \
(...skipping 1354 matching lines...) Expand 10 before | Expand all | Expand 10 after
4065 } 4079 }
4066 4080
4067 4081
4068 // Called when the top-level V8 mutex is destroyed. 4082 // Called when the top-level V8 mutex is destroyed.
4069 void Bootstrapper::FreeThreadResources() { 4083 void Bootstrapper::FreeThreadResources() {
4070 DCHECK(!IsActive()); 4084 DCHECK(!IsActive());
4071 } 4085 }
4072 4086
4073 } // namespace internal 4087 } // namespace internal
4074 } // namespace v8 4088 } // namespace v8
OLDNEW
« no previous file with comments | « src/api.cc ('k') | src/builtins/builtins.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698