Index: src/code-stubs-hydrogen.cc |
diff --git a/src/code-stubs-hydrogen.cc b/src/code-stubs-hydrogen.cc |
index 63488dc2b2d9362b270588a28c340ad17ac166df..e3cbe7d588cbb19791576f0cbdd73f2c8db22885 100644 |
--- a/src/code-stubs-hydrogen.cc |
+++ b/src/code-stubs-hydrogen.cc |
@@ -416,7 +416,12 @@ HValue* CodeStubGraphBuilder<FastCloneShallowObjectStub>::BuildCodeStub() { |
HInstruction* boilerplate = Add<HLoadNamedField>( |
allocation_site, static_cast<HValue*>(NULL), access); |
- int size = JSObject::kHeaderSize + casted_stub()->length() * kPointerSize; |
+ int length = casted_stub()->length(); |
+ if (length == 0) { |
+ // Empty objects have some slack added to them. |
+ length = JSObject::kInitialGlobalObjectUnusedPropertiesCount; |
+ } |
+ int size = JSObject::kHeaderSize + length * kPointerSize; |
int object_size = size; |
if (FLAG_allocation_site_pretenuring) { |
size += AllocationMemento::kSize; |