Revision: 4914
Author: l...@chromium.org
Date: Tue Jun 22 03:07:57 2010
Log: X64: Change strategy for spilling to match ia32. It's just better.
Align deferred code blocks to 16-byte address boundaries.
Review URL: http://codereview.chromium.org/2855018
http://code.google.com/p/v8/source/detail?r=4914
Modified:
/branches/bleeding_edge/src/arm/assembler-arm.cc
/branches/bleeding_edge/src/arm/assembler-arm.h
/branches/bleeding_edge/src/codegen.cc
/branches/bleeding_edge/src/ia32/assembler-ia32.cc
/branches/bleeding_edge/src/ia32/assembler-ia32.h
/branches/bleeding_edge/src/x64/assembler-x64.cc
/branches/bleeding_edge/src/x64/assembler-x64.h
/branches/bleeding_edge/src/x64/macro-assembler-x64.cc
/branches/bleeding_edge/src/x64/virtual-frame-x64.cc
=======================================
--- /branches/bleeding_edge/src/arm/assembler-arm.cc Tue Jun 22 01:38:32
2010
+++ /branches/bleeding_edge/src/arm/assembler-arm.cc Tue Jun 22 03:07:57
2010
@@ -392,6 +392,11 @@
nop();
}
}
+
+
+void Assembler::CodeTargetAlign() {
+ Align(16); // Tentative value.
+}
bool Assembler::IsNop(Instr instr, int type) {
=======================================
--- /branches/bleeding_edge/src/arm/assembler-arm.h Tue Jun 22 01:38:32 2010
+++ /branches/bleeding_edge/src/arm/assembler-arm.h Tue Jun 22 03:07:57 2010
@@ -703,6 +703,8 @@
// possible to align the pc offset to a multiple
// of m. m must be a power of 2 (>= 4).
void Align(int m);
+ // Aligns code to something that's optimal for a jump target for the
platform.
+ void CodeTargetAlign();
// Branch instructions
void b(int branch_offset, Condition cond = al);
=======================================
--- /branches/bleeding_edge/src/codegen.cc Tue Jun 8 05:04:49 2010
+++ /branches/bleeding_edge/src/codegen.cc Tue Jun 22 03:07:57 2010
@@ -69,6 +69,7 @@
while (!deferred_.is_empty()) {
DeferredCode* code = deferred_.RemoveLast();
ASSERT(masm_ == code->masm());
+ masm_->CodeTargetAlign();
// Record position of deferred code stub.
masm_->RecordStatementPosition(code->statement_position());
if (code->position() != RelocInfo::kNoPosition) {
=======================================
--- /branches/bleeding_edge/src/ia32/assembler-ia32.cc Wed Jun 16 05:32:34
2010
+++ /branches/bleeding_edge/src/ia32/assembler-ia32.cc Tue Jun 22 03:07:57
2010
@@ -376,6 +376,11 @@
nop();
}
}
+
+
+void Assembler::CodeTargetAlign() {
+ Align(16); // Preferred alignment of jump targets on ia32.
+}
void Assembler::cpuid() {
=======================================
--- /branches/bleeding_edge/src/ia32/assembler-ia32.h Thu Jun 17 01:41:48
2010
+++ /branches/bleeding_edge/src/ia32/assembler-ia32.h Tue Jun 22 03:07:57
2010
@@ -507,6 +507,8 @@
// possible to align the pc offset to a multiple
// of m. m must be a power of 2.
void Align(int m);
+ // Aligns code to something that's optimal for a jump target for the
platform.
+ void CodeTargetAlign();
// Stack
void pushad();
=======================================
--- /branches/bleeding_edge/src/x64/assembler-x64.cc Thu Jun 17 08:48:43
2010
+++ /branches/bleeding_edge/src/x64/assembler-x64.cc Tue Jun 22 03:07:57
2010
@@ -380,6 +380,11 @@
nop();
}
}
+
+
+void Assembler::CodeTargetAlign() {
+ Align(16); // Preferred alignment of jump targets on x64.
+}
void Assembler::bind_to(Label* L, int pos) {
=======================================
--- /branches/bleeding_edge/src/x64/assembler-x64.h Thu Jun 17 08:48:43 2010
+++ /branches/bleeding_edge/src/x64/assembler-x64.h Tue Jun 22 03:07:57 2010
@@ -499,6 +499,8 @@
// possible to align the pc offset to a multiple
// of m. m must be a power of 2.
void Align(int m);
+ // Aligns code to something that's optimal for a jump target for the
platform.
+ void CodeTargetAlign();
// Stack
void pushfq();
=======================================
--- /branches/bleeding_edge/src/x64/macro-assembler-x64.cc Mon Jun 21
01:51:44 2010
+++ /branches/bleeding_edge/src/x64/macro-assembler-x64.cc Tue Jun 22
03:07:57 2010
@@ -456,13 +456,8 @@
void MacroAssembler::Set(const Operand& dst, int64_t x) {
- if (x == 0) {
- xor_(kScratchRegister, kScratchRegister);
- movq(dst, kScratchRegister);
- } else if (is_int32(x)) {
+ if (is_int32(x)) {
movq(dst, Immediate(static_cast<int32_t>(x)));
- } else if (is_uint32(x)) {
- movl(dst, Immediate(static_cast<uint32_t>(x)));
} else {
movq(kScratchRegister, x, RelocInfo::NONE);
movq(dst, kScratchRegister);
=======================================
--- /branches/bleeding_edge/src/x64/virtual-frame-x64.cc Wed Jun 16
03:03:47 2010
+++ /branches/bleeding_edge/src/x64/virtual-frame-x64.cc Tue Jun 22
03:07:57 2010
@@ -961,16 +961,18 @@
// Sync elements below the range if they have not been materialized
// on the stack.
int start = Min(begin, stack_pointer_ + 1);
-
- // If positive we have to adjust the stack pointer.
- int delta = end - stack_pointer_;
- if (delta > 0) {
- stack_pointer_ = end;
- __ subq(rsp, Immediate(delta * kPointerSize));
- }
-
- for (int i = start; i <= end; i++) {
+ int end_or_stack_pointer = Min(stack_pointer_, end);
+ // Emit normal push instructions for elements above stack pointer
+ // and use mov instructions if we are below stack pointer.
+ int i = start;
+
+ while (i <= end_or_stack_pointer) {
if (!elements_[i].is_synced()) SyncElementBelowStackPointer(i);
+ i++;
+ }
+ while (i <= end) {
+ SyncElementByPushing(i);
+ i++;
}
}
--
v8-dev mailing list
v8-dev@googlegroups.com
http://groups.google.com/group/v8-dev