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

Unified Diff: src/bootstrapper.cc

Issue 2161613002: Move SetObjectPrototype to JSObject (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: updates Created 4 years, 5 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | src/objects.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/bootstrapper.cc
diff --git a/src/bootstrapper.cc b/src/bootstrapper.cc
index 3c00a5e09867d442b67526e32da5b6bfea3360ed..6a9013577819ca68bce74915a3b5709534c45d36 100644
--- a/src/bootstrapper.cc
+++ b/src/bootstrapper.cc
@@ -353,15 +353,6 @@ Handle<JSGlobalProxy> Bootstrapper::NewRemoteContext(
return scope.CloseAndEscape(global_proxy);
}
-static void SetObjectPrototype(Handle<JSObject> object, Handle<Object> proto) {
- // object.__proto__ = proto;
- Handle<Map> old_map = Handle<Map>(object->map());
- Handle<Map> new_map = Map::Copy(old_map, "SetObjectPrototype");
- Map::SetPrototype(new_map, proto, FAST_PROTOTYPE);
- JSObject::MigrateToMap(object, new_map);
-}
-
-
void Bootstrapper::DetachGlobal(Handle<Context> env) {
env->GetIsolate()->counters()->errors_thrown_per_context()->AddSample(
env->GetErrorsThrown());
@@ -369,7 +360,7 @@ void Bootstrapper::DetachGlobal(Handle<Context> env) {
Factory* factory = env->GetIsolate()->factory();
Handle<JSGlobalProxy> global_proxy(JSGlobalProxy::cast(env->global_proxy()));
global_proxy->set_native_context(*factory->null_value());
- SetObjectPrototype(global_proxy, factory->null_value());
+ JSObject::ForceSetPrototype(global_proxy, factory->null_value());
global_proxy->map()->SetConstructor(*factory->null_value());
if (FLAG_track_detached_contexts) {
env->GetIsolate()->AddDetachedContext(env);
@@ -803,10 +794,10 @@ void Genesis::CreateIteratorMaps(Handle<JSFunction> empty) {
factory()->NewJSObject(isolate()->object_function(), TENURED);
native_context()->set_initial_generator_prototype(
*generator_object_prototype);
- SetObjectPrototype(generator_object_prototype, iterator_prototype);
+ JSObject::ForceSetPrototype(generator_object_prototype, iterator_prototype);
Handle<JSObject> generator_function_prototype =
factory()->NewJSObject(isolate()->object_function(), TENURED);
- SetObjectPrototype(generator_function_prototype, empty);
+ JSObject::ForceSetPrototype(generator_function_prototype, empty);
JSObject::AddProperty(
generator_function_prototype, factory()->to_string_tag_symbol(),
@@ -865,7 +856,7 @@ void Genesis::CreateAsyncFunctionMaps(Handle<JSFunction> empty) {
// %AsyncFunctionPrototype% intrinsic
Handle<JSObject> async_function_prototype =
factory()->NewJSObject(isolate()->object_function(), TENURED);
- SetObjectPrototype(async_function_prototype, empty);
+ JSObject::ForceSetPrototype(async_function_prototype, empty);
JSObject::AddProperty(async_function_prototype,
factory()->to_string_tag_symbol(),
@@ -2522,8 +2513,8 @@ void Bootstrapper::ExportFromRuntime(Isolate* isolate,
isolate, generator_function_function,
Context::GENERATOR_FUNCTION_FUNCTION_INDEX);
- SetObjectPrototype(generator_function_function,
- isolate->function_function());
+ JSObject::ForceSetPrototype(generator_function_function,
+ isolate->function_function());
JSObject::AddProperty(
generator_function_prototype, factory->constructor_string(),
generator_function_function,
@@ -2538,7 +2529,7 @@ void Bootstrapper::ExportFromRuntime(Isolate* isolate,
{ // -- S e t I t e r a t o r
Handle<JSObject> set_iterator_prototype =
isolate->factory()->NewJSObject(isolate->object_function(), TENURED);
- SetObjectPrototype(set_iterator_prototype, iterator_prototype);
+ JSObject::ForceSetPrototype(set_iterator_prototype, iterator_prototype);
Handle<JSFunction> set_iterator_function = InstallFunction(
container, "SetIterator", JS_SET_ITERATOR_TYPE, JSSetIterator::kSize,
set_iterator_prototype, Builtins::kIllegal);
@@ -2548,7 +2539,7 @@ void Bootstrapper::ExportFromRuntime(Isolate* isolate,
{ // -- M a p I t e r a t o r
Handle<JSObject> map_iterator_prototype =
isolate->factory()->NewJSObject(isolate->object_function(), TENURED);
- SetObjectPrototype(map_iterator_prototype, iterator_prototype);
+ JSObject::ForceSetPrototype(map_iterator_prototype, iterator_prototype);
Handle<JSFunction> map_iterator_function = InstallFunction(
container, "MapIterator", JS_MAP_ITERATOR_TYPE, JSMapIterator::kSize,
map_iterator_prototype, Builtins::kIllegal);
@@ -2717,8 +2708,8 @@ void Bootstrapper::ExportFromRuntime(Isolate* isolate,
async_function_constructor->shared()->set_length(1);
InstallWithIntrinsicDefaultProto(isolate, async_function_constructor,
Context::ASYNC_FUNCTION_FUNCTION_INDEX);
- SetObjectPrototype(async_function_constructor,
- isolate->function_function());
+ JSObject::ForceSetPrototype(async_function_constructor,
+ isolate->function_function());
JSObject::AddProperty(
async_function_prototype, factory->constructor_string(),
@@ -3702,7 +3693,7 @@ bool Genesis::ConfigureGlobalObjects(
}
}
- SetObjectPrototype(global_proxy, global_object);
+ JSObject::ForceSetPrototype(global_proxy, global_object);
native_context()->set_initial_array_prototype(
JSArray::cast(native_context()->array_function()->prototype()));
@@ -3856,7 +3847,7 @@ void Genesis::TransferObject(Handle<JSObject> from, Handle<JSObject> to) {
// Transfer the prototype (new map is needed).
Handle<Object> proto(from->map()->prototype(), isolate());
- SetObjectPrototype(to, proto);
+ JSObject::ForceSetPrototype(to, proto);
}
@@ -4073,7 +4064,7 @@ Genesis::Genesis(Isolate* isolate,
global_proxy->set_native_context(*factory()->null_value());
// DetachGlobal.
- SetObjectPrototype(global_proxy, factory()->null_value());
+ JSObject::ForceSetPrototype(global_proxy, factory()->null_value());
global_proxy_ = global_proxy;
}
« no previous file with comments | « no previous file | src/objects.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698