Revision: 16112
Author: [email protected]
Date: Wed Aug 7 14:54:03 2013
Log: MIPS: Refactor and improve inlined double-aligned allocations
Additionally, fix object size register clobbering in Allocate routine.
Based on 13284 (d42bf80).
BUG=
[email protected]
Review URL: https://codereview.chromium.org/22582002
Patch from Dusan Milosavljevic <[email protected]>.
http://code.google.com/p/v8/source/detail?r=16112
Modified:
/branches/bleeding_edge/src/mips/codegen-mips.cc
/branches/bleeding_edge/src/mips/macro-assembler-mips.cc
/branches/bleeding_edge/src/mips/macro-assembler-mips.h
=======================================
--- /branches/bleeding_edge/src/mips/codegen-mips.cc Fri Aug 2 02:53:11
2013
+++ /branches/bleeding_edge/src/mips/codegen-mips.cc Wed Aug 7 14:54:03
2013
@@ -205,7 +205,7 @@
// Allocate new FixedDoubleArray.
__ sll(scratch, t1, 2);
__ Addu(scratch, scratch, FixedDoubleArray::kHeaderSize);
- __ Allocate(scratch, t2, t3, t5, &gc_required, NO_ALLOCATION_FLAGS);
+ __ Allocate(scratch, t2, t3, t5, &gc_required, DOUBLE_ALIGNMENT);
// t2: destination FixedDoubleArray, not tagged as heap object
// Set destination FixedDoubleArray's length and map.
=======================================
--- /branches/bleeding_edge/src/mips/macro-assembler-mips.cc Fri Aug 2
02:53:11 2013
+++ /branches/bleeding_edge/src/mips/macro-assembler-mips.cc Wed Aug 7
14:54:03 2013
@@ -2923,9 +2923,7 @@
// Set up allocation top address and object size registers.
Register topaddr = scratch1;
- Register obj_size_reg = scratch2;
li(topaddr, Operand(allocation_top));
- li(obj_size_reg, Operand(object_size));
// This code stores a temporary value in t9.
if ((flags & RESULT_CONTAINS_TOP) == 0) {
@@ -2943,10 +2941,24 @@
// Load allocation limit into t9. Result already contains allocation
top.
lw(t9, MemOperand(topaddr, limit - top));
}
+
+ if ((flags & DOUBLE_ALIGNMENT) != 0) {
+ // Align the next allocation. Storing the filler map without checking
top is
+ // always safe because the limit of the heap is always aligned.
+ ASSERT((flags & PRETENURE_OLD_POINTER_SPACE) == 0);
+ ASSERT(kPointerAlignment * 2 == kDoubleAlignment);
+ And(scratch2, result, Operand(kDoubleAlignmentMask));
+ Label aligned;
+ Branch(&aligned, eq, scratch2, Operand(zero_reg));
+ li(scratch2, Operand(isolate()->factory()->one_pointer_filler_map()));
+ sw(scratch2, MemOperand(result));
+ Addu(result, result, Operand(kDoubleSize / 2));
+ bind(&aligned);
+ }
// Calculate new top and bail out if new space is exhausted. Use result
// to calculate the new top.
- Addu(scratch2, result, Operand(obj_size_reg));
+ Addu(scratch2, result, Operand(object_size));
Branch(gc_required, Ugreater, scratch2, Operand(t9));
sw(scratch2, MemOperand(topaddr));
@@ -3013,6 +3025,20 @@
// Load allocation limit into t9. Result already contains allocation
top.
lw(t9, MemOperand(topaddr, limit - top));
}
+
+ if ((flags & DOUBLE_ALIGNMENT) != 0) {
+ // Align the next allocation. Storing the filler map without checking
top is
+ // always safe because the limit of the heap is always aligned.
+ ASSERT((flags & PRETENURE_OLD_POINTER_SPACE) == 0);
+ ASSERT(kPointerAlignment * 2 == kDoubleAlignment);
+ And(scratch2, result, Operand(kDoubleAlignmentMask));
+ Label aligned;
+ Branch(&aligned, eq, scratch2, Operand(zero_reg));
+ li(scratch2, Operand(isolate()->factory()->one_pointer_filler_map()));
+ sw(scratch2, MemOperand(result));
+ Addu(result, result, Operand(kDoubleSize / 2));
+ bind(&aligned);
+ }
// Calculate new top and bail out if new space is exhausted. Use result
// to calculate the new top. Object size may be in words so a shift is
=======================================
--- /branches/bleeding_edge/src/mips/macro-assembler-mips.h Mon Aug 5
05:43:04 2013
+++ /branches/bleeding_edge/src/mips/macro-assembler-mips.h Wed Aug 7
14:54:03 2013
@@ -51,20 +51,6 @@
// MIPS generated code calls C code, it must be via t9 register.
-// Flags used for the AllocateInNewSpace functions.
-enum AllocationFlags {
- // No special flags.
- NO_ALLOCATION_FLAGS = 0,
- // Return the pointer to the allocated already tagged as a heap object.
- TAG_OBJECT = 1 << 0,
- // The content of the result register already contains the allocation
top in
- // new space.
- RESULT_CONTAINS_TOP = 1 << 1,
- // Specify that the requested size of the space to allocate is specified
in
- // words instead of bytes.
- SIZE_IN_WORDS = 1 << 2
-};
-
// Flags used for AllocateHeapNumber
enum TaggingMode {
// Tag the result.
--
--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev
---
You received this message because you are subscribed to the Google Groups "v8-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.