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

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

Issue 2430273007: [runtime] Object.create(null) creates a slow object (Closed)
Patch Set: fix GC mole issue 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
« no previous file with comments | « src/bootstrapper.cc ('k') | src/code-stub-assembler.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/builtins/builtins-object.cc
diff --git a/src/builtins/builtins-object.cc b/src/builtins/builtins-object.cc
index 4536fc9b8a23e81bafafb8ad354d3ebac68b38f6..01f5ad45863df21f67a1fbae052206e74cc150db 100644
--- a/src/builtins/builtins-object.cc
+++ b/src/builtins/builtins-object.cc
@@ -494,6 +494,7 @@ void Builtins::Generate_ObjectCreate(CodeStubAssembler* a) {
a->Bind(&no_properties);
{
Variable map(a, MachineRepresentation::kTagged);
+ Variable properties(a, MachineRepresentation::kTagged);
Label non_null_proto(a), instantiate_map(a), good(a);
a->Branch(a->WordEqual(prototype, a->NullConstant()), &good,
@@ -501,13 +502,16 @@ void Builtins::Generate_ObjectCreate(CodeStubAssembler* a) {
a->Bind(&good);
{
- map.Bind(a->LoadContextElement(context,
- Context::OBJECT_WITH_NULL_PROTOTYPE_MAP));
+ map.Bind(a->LoadContextElement(
+ context, Context::SLOW_OBJECT_WITH_NULL_PROTOTYPE_MAP));
+ properties.Bind(
+ a->AllocateNameDictionary(NameDictionary::kInitialCapacity));
a->Goto(&instantiate_map);
}
a->Bind(&non_null_proto);
{
+ properties.Bind(a->EmptyFixedArrayConstant());
Node* object_function =
a->LoadContextElement(context, Context::OBJECT_FUNCTION_INDEX);
Node* object_function_map = a->LoadObjectField(
@@ -528,7 +532,8 @@ void Builtins::Generate_ObjectCreate(CodeStubAssembler* a) {
a->Bind(&instantiate_map);
{
- Node* instance = a->AllocateJSObjectFromMap(map.value());
+ Node* instance =
+ a->AllocateJSObjectFromMap(map.value(), properties.value());
a->Return(instance);
}
}
« no previous file with comments | « src/bootstrapper.cc ('k') | src/code-stub-assembler.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698