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

Unified Diff: src/bootstrapper.cc

Issue 2445333002: Ensure slow properties for simple {__proto__:null} literals. (Closed)
Patch Set: addressing nits Created 3 years, 9 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
Index: src/bootstrapper.cc
diff --git a/src/bootstrapper.cc b/src/bootstrapper.cc
index f76aa35bbea0674adbc27d5b3da24a21c7fae67d..9c60a0b24a60588789827b48c8f20e033f2dc60a 100644
--- a/src/bootstrapper.cc
+++ b/src/bootstrapper.cc
@@ -597,6 +597,15 @@ Handle<JSFunction> Genesis::CreateEmptyFunction(Isolate* isolate) {
native_context()->set_initial_array_prototype(*object_function_prototype);
Accessors::FunctionSetPrototype(object_fun, object_function_prototype)
.Assert();
+
+ // Set up the map for Object.create(null) instances.
+ Handle<Map> slow_object_with_null_prototype_map =
+ Map::CopyInitialMap(handle(object_fun->initial_map(), isolate));
+ slow_object_with_null_prototype_map->set_dictionary_map(true);
+ Map::SetPrototype(slow_object_with_null_prototype_map,
+ isolate->factory()->null_value());
+ native_context()->set_slow_object_with_null_prototype_map(
+ *slow_object_with_null_prototype_map);
Toon Verwaest 2017/03/14 13:27:47 This already exists?
Camillo Bruni 2017/03/17 16:40:55 just moved to here, so it's available earlier in t
}
// Allocate the empty function as the prototype for function - ES6 19.2.3
@@ -4050,20 +4059,13 @@ bool Genesis::InstallNatives(GlobalContextType context_type) {
// Store the map for the %ObjectPrototype% after the natives has been compiled
// and the Object function has been set up.
- Handle<JSFunction> object_function(native_context()->object_function());
- DCHECK(JSObject::cast(object_function->initial_map()->prototype())
- ->HasFastProperties());
- native_context()->set_object_function_prototype_map(
- HeapObject::cast(object_function->initial_map()->prototype())->map());
-
- // Set up the map for Object.create(null) instances.
- Handle<Map> slow_object_with_null_prototype_map =
- Map::CopyInitialMap(handle(object_function->initial_map(), isolate()));
- slow_object_with_null_prototype_map->set_dictionary_map(true);
- Map::SetPrototype(slow_object_with_null_prototype_map,
- isolate()->factory()->null_value());
- native_context()->set_slow_object_with_null_prototype_map(
- *slow_object_with_null_prototype_map);
+ {
+ Handle<JSFunction> object_function(native_context()->object_function());
+ DCHECK(JSObject::cast(object_function->initial_map()->prototype())
+ ->HasFastProperties());
+ native_context()->set_object_function_prototype_map(
+ HeapObject::cast(object_function->initial_map()->prototype())->map());
+ }
// Store the map for the %StringPrototype% after the natives has been compiled
// and the String function has been set up.

Powered by Google App Engine
This is Rietveld 408576698