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

Unified Diff: src/runtime/runtime-object.cc

Issue 2430273007: [runtime] Object.create(null) creates a slow object (Closed)
Patch Set: adding tests 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 side-by-side diff with in-line comments
Download patch
Index: src/runtime/runtime-object.cc
diff --git a/src/runtime/runtime-object.cc b/src/runtime/runtime-object.cc
index cbb1665fed5e6c461bc51352bf5d82b63bc06553..0eed006f82490186a9807404ce9ba60b04e8cbc2 100644
--- a/src/runtime/runtime-object.cc
+++ b/src/runtime/runtime-object.cc
@@ -226,7 +226,7 @@ RUNTIME_FUNCTION(Runtime_ObjectCreate) {
isolate);
if (map->prototype() != *prototype) {
if (prototype->IsNull(isolate)) {
- map = isolate->object_with_null_prototype_map();
+ map = isolate->slow_object_with_null_prototype_map();
} else if (prototype->IsJSObject()) {
Handle<JSObject> js_prototype = Handle<JSObject>::cast(prototype);
if (!js_prototype->map()->is_prototype_map()) {
@@ -250,6 +250,11 @@ RUNTIME_FUNCTION(Runtime_ObjectCreate) {
// Actually allocate the object.
Handle<JSObject> object = isolate->factory()->NewJSObjectFromMap(map);
+ if (map->is_dictionary_map()) {
+ object->set_properties(
+ *NameDictionary::New(isolate, NameDictionary::kInitialCapacity));
+ }
+
// Define the properties if properties was specified and is not undefined.
Handle<Object> properties = args.at<Object>(1);
if (!properties->IsUndefined(isolate)) {
« src/objects.cc ('K') | « src/objects-inl.h ('k') | test/cctest/test-code-stub-assembler.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698