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

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

Issue 8372028: Further improvements upon r9747. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: . 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') | no next file with comments »
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 37bdc23edf5e4258e6ee0e5018ba838f73d7011c..e566d402323419b8dac95c21ff0b2cd8d294891f 100644
--- a/src/arm/builtins-arm.cc
+++ b/src/arm/builtins-arm.cc
@@ -96,8 +96,8 @@ static void AllocateEmptyJSArray(MacroAssembler* masm,
Register scratch2,
Register scratch3,
Label* gc_required) {
- int initial_capacity = JSArray::kPreallocatedArrayElements;
- ASSERT(initial_capacity >= 0);
+ const int initial_capacity = JSArray::kPreallocatedArrayElements;
+ STATIC_ASSERT(initial_capacity >= 0);
// Load the initial map from the array function.
__ ldr(scratch1, FieldMemOperand(array_function,
JSFunction::kPrototypeOrInitialMapOffset));
@@ -147,11 +147,24 @@ static void AllocateEmptyJSArray(MacroAssembler* masm,
ASSERT_EQ(1 * kPointerSize, FixedArray::kLengthOffset);
__ str(scratch3, MemOperand(scratch1, kPointerSize, PostIndex));
- // Fill the FixedArray with the hole value.
+ // Fill the FixedArray with the hole value. Inline the code if short.
+ if (initial_capacity == 0) return;
ASSERT_EQ(2 * kPointerSize, FixedArray::kHeaderSize);
__ LoadRoot(scratch3, Heap::kTheHoleValueRootIndex);
- for (int i = 0; i < initial_capacity; i++) {
+ static const int kLoopUnfoldLimit = 4;
+ if (false && initial_capacity <= kLoopUnfoldLimit) {
Kevin Millikin (Chromium) 2011/10/24 11:11:50 I don't like the if (false .... Dead code is not
+ for (int i = 0; i < initial_capacity; i++) {
+ __ str(scratch3, MemOperand(scratch1, kPointerSize, PostIndex));
+ }
+ } else {
+ Label loop, entry;
+ __ add(scratch2, scratch1, Operand(initial_capacity * kPointerSize));
+ __ b(&entry);
+ __ bind(&loop);
__ str(scratch3, MemOperand(scratch1, kPointerSize, PostIndex));
+ __ bind(&entry);
+ __ cmp(scratch1, scratch2);
+ __ b(lt, &loop);
}
}
@@ -180,11 +193,8 @@ static void AllocateJSArray(MacroAssembler* masm,
JSFunction::kPrototypeOrInitialMapOffset));
if (FLAG_debug_code) { // Assert that array size is not zero.
- Label not_empty;
__ tst(array_size, array_size);
- __ b(ne, &not_empty);
- __ Abort("array size is unexpectedly 0");
- __ bind(&not_empty);
+ __ Assert(ne, "array size is unexpectedly 0");
}
// Allocate the JSArray object together with space for a FixedArray with the
« no previous file with comments | « no previous file | src/ia32/builtins-ia32.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698