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

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

Issue 8381014: Fixing dead code in empty array init. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Ported change to MIPS. Created 9 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 | « no previous file | src/ia32/builtins-ia32.cc » ('j') | src/ia32/builtins-ia32.cc » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/arm/builtins-arm.cc
diff --git a/src/arm/builtins-arm.cc b/src/arm/builtins-arm.cc
index 29bf19028cb7770963c8e1e76a530ffae05baf08..0422a8a070ea98c002b566d7094c3390d575eb05 100644
--- a/src/arm/builtins-arm.cc
+++ b/src/arm/builtins-arm.cc
@@ -104,7 +104,10 @@ static void AllocateEmptyJSArray(MacroAssembler* masm,
// Allocate the JSArray object together with space for a fixed array with the
// requested elements.
- int size = JSArray::kSize + FixedArray::SizeFor(initial_capacity);
+ int size = JSArray::kSize;
+ if (initial_capacity > 0) {
+ size += FixedArray::SizeFor(initial_capacity);
+ }
__ AllocateInNewSpace(size,
result,
scratch2,
@@ -124,6 +127,11 @@ static void AllocateEmptyJSArray(MacroAssembler* masm,
__ mov(scratch3, Operand(0, RelocInfo::NONE));
__ str(scratch3, FieldMemOperand(result, JSArray::kLengthOffset));
+ if (initial_capacity == 0) {
+ __ str(scratch1, FieldMemOperand(result, JSArray::kElementsOffset));
+ return;
+ }
+
// Calculate the location of the elements array and set elements array member
// of the JSArray.
// result: JSObject
@@ -148,7 +156,6 @@ static void AllocateEmptyJSArray(MacroAssembler* masm,
__ str(scratch3, MemOperand(scratch1, kPointerSize, PostIndex));
// Fill the FixedArray with the hole value. Inline the code if short.
- if (initial_capacity == 0) return;
ASSERT_EQ(2 * kPointerSize, FixedArray::kHeaderSize);
Kevin Millikin (Chromium) 2011/10/27 10:35:54 This can be a static assert.
__ LoadRoot(scratch3, Heap::kTheHoleValueRootIndex);
static const int kLoopUnfoldLimit = 4;
« no previous file with comments | « no previous file | src/ia32/builtins-ia32.cc » ('j') | src/ia32/builtins-ia32.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698