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

Unified Diff: src/x87/macro-assembler-x87.cc

Issue 1899813003: [crankshaft] Fragmentation-free allocation folding. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 4 years, 7 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 | « src/x87/macro-assembler-x87.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/x87/macro-assembler-x87.cc
diff --git a/src/x87/macro-assembler-x87.cc b/src/x87/macro-assembler-x87.cc
index 068cc5f01e2f74bc07171f5d5f80258a07b3f2c8..3cee0eac5733b7fe8e24f31b8a5b5eb50a0584e7 100644
--- a/src/x87/macro-assembler-x87.cc
+++ b/src/x87/macro-assembler-x87.cc
@@ -1469,6 +1469,7 @@ void MacroAssembler::Allocate(int object_size,
AllocationFlags flags) {
DCHECK((flags & (RESULT_CONTAINS_TOP | SIZE_IN_WORDS)) == 0);
DCHECK(object_size <= Page::kMaxRegularHeapObjectSize);
+ DCHECK((flags & ALLOCATION_FOLDED) == 0);
if (!FLAG_inline_new) {
if (emit_debug_code()) {
// Trash the registers to simulate an allocation failure.
@@ -1510,6 +1511,7 @@ void MacroAssembler::Allocate(int object_size,
// Calculate new top and bail out if space is exhausted.
Register top_reg = result_end.is_valid() ? result_end : result;
+
if (!top_reg.is(result)) {
mov(top_reg, result);
}
@@ -1517,8 +1519,10 @@ void MacroAssembler::Allocate(int object_size,
cmp(top_reg, Operand::StaticVariable(allocation_limit));
j(above, gc_required);
- // Update allocation top.
- UpdateAllocationTopHelper(top_reg, scratch, flags);
+ if ((flags & ALLOCATION_FOLDING_DOMINATOR) == 0) {
+ // The top pointer is not updated for allocation folding dominators.
+ UpdateAllocationTopHelper(top_reg, scratch, flags);
+ }
if (top_reg.is(result)) {
sub(result, Immediate(object_size - kHeapObjectTag));
@@ -1540,6 +1544,8 @@ void MacroAssembler::Allocate(int header_size,
Label* gc_required,
AllocationFlags flags) {
DCHECK((flags & SIZE_IN_WORDS) == 0);
+ DCHECK((flags & ALLOCATION_FOLDING_DOMINATOR) == 0);
+ DCHECK((flags & ALLOCATION_FOLDED) == 0);
if (!FLAG_inline_new) {
if (emit_debug_code()) {
// Trash the registers to simulate an allocation failure.
@@ -1605,7 +1611,6 @@ void MacroAssembler::Allocate(int header_size,
UpdateAllocationTopHelper(result_end, scratch, flags);
}
-
void MacroAssembler::Allocate(Register object_size,
Register result,
Register result_end,
@@ -1613,6 +1618,7 @@ void MacroAssembler::Allocate(Register object_size,
Label* gc_required,
AllocationFlags flags) {
DCHECK((flags & (RESULT_CONTAINS_TOP | SIZE_IN_WORDS)) == 0);
+ DCHECK((flags & ALLOCATION_FOLDED) == 0);
if (!FLAG_inline_new) {
if (emit_debug_code()) {
// Trash the registers to simulate an allocation failure.
@@ -1656,7 +1662,6 @@ void MacroAssembler::Allocate(Register object_size,
mov(result_end, object_size);
}
add(result_end, result);
- j(carry, gc_required);
cmp(result_end, Operand::StaticVariable(allocation_limit));
j(above, gc_required);
@@ -1664,10 +1669,59 @@ void MacroAssembler::Allocate(Register object_size,
DCHECK(kHeapObjectTag == 1);
inc(result);
- // Update allocation top.
- UpdateAllocationTopHelper(result_end, scratch, flags);
+ if ((flags & ALLOCATION_FOLDING_DOMINATOR) == 0) {
+ // The top pointer is not updated for allocation folding dominators.
+ UpdateAllocationTopHelper(result_end, scratch, flags);
+ }
}
+void MacroAssembler::FastAllocate(int object_size, Register result,
+ Register result_end, AllocationFlags flags) {
+ DCHECK(!result.is(result_end));
+ // Load address of new object into result.
+ LoadAllocationTopHelper(result, no_reg, flags);
+
+ if ((flags & DOUBLE_ALIGNMENT) != 0) {
+ DCHECK(kPointerAlignment * 2 == kDoubleAlignment);
+ Label aligned;
+ test(result, Immediate(kDoubleAlignmentMask));
+ j(zero, &aligned, Label::kNear);
+ mov(Operand(result, 0),
+ Immediate(isolate()->factory()->one_pointer_filler_map()));
+ add(result, Immediate(kDoubleSize / 2));
+ bind(&aligned);
+ }
+
+ lea(result_end, Operand(result, object_size));
+ UpdateAllocationTopHelper(result_end, no_reg, flags);
+
+ DCHECK(kHeapObjectTag == 1);
+ inc(result);
+}
+
+void MacroAssembler::FastAllocate(Register object_size, Register result,
+ Register result_end, AllocationFlags flags) {
+ DCHECK(!result.is(result_end));
+ // Load address of new object into result.
+ LoadAllocationTopHelper(result, no_reg, flags);
+
+ if ((flags & DOUBLE_ALIGNMENT) != 0) {
+ DCHECK(kPointerAlignment * 2 == kDoubleAlignment);
+ Label aligned;
+ test(result, Immediate(kDoubleAlignmentMask));
+ j(zero, &aligned, Label::kNear);
+ mov(Operand(result, 0),
+ Immediate(isolate()->factory()->one_pointer_filler_map()));
+ add(result, Immediate(kDoubleSize / 2));
+ bind(&aligned);
+ }
+
+ lea(result_end, Operand(result, object_size, times_1, 0));
+ UpdateAllocationTopHelper(result_end, no_reg, flags);
+
+ DCHECK(kHeapObjectTag == 1);
+ inc(result);
+}
void MacroAssembler::AllocateHeapNumber(Register result,
Register scratch1,
« no previous file with comments | « src/x87/macro-assembler-x87.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698