Let FastCloneShallowObjectStub work with empty literal objects.
authordcarney@chromium.org <dcarney@chromium.org>
Wed, 15 Oct 2014 08:48:44 +0000 (08:48 +0000)
committerdcarney@chromium.org <dcarney@chromium.org>
Wed, 15 Oct 2014 08:48:44 +0000 (08:48 +0000)
R=verwaest@chromium.org

LOG=N

BUG=417290

Review URL: https://codereview.chromium.org/655163002

git-svn-id: https://v8.googlecode.com/svn/branches/bleeding_edge@24618 ce2b1a6d-e550-0410-aec6-3dcde31c8c00

src/code-stubs-hydrogen.cc

index 63488dc..e3cbe7d 100644 (file)
@@ -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;