Reviewers: Rico,
Description:
X64 Crnakshaft: Added GeneratePrologue implementation.
Please review this at http://codereview.chromium.org/6326003/
Affected files:
M src/lithium-allocator.h
M src/x64/lithium-codegen-x64.cc
M src/x64/lithium-x64.cc
Index: src/lithium-allocator.h
diff --git a/src/lithium-allocator.h b/src/lithium-allocator.h
index
3cb28a7be147671de213bbf15c2864e636335b2b..dfe1953df6c15b5af01de5f89a3c7866a5780510
100644
--- a/src/lithium-allocator.h
+++ b/src/lithium-allocator.h
@@ -705,6 +705,7 @@ class LiveRange: public ZoneObject {
bool HasAllocatedSpillOperand() const {
return spill_operand_ != NULL && !spill_operand_->IsUnallocated();
}
+
LOperand* GetSpillOperand() const { return spill_operand_; }
void SetSpillOperand(LOperand* operand) {
ASSERT(!operand->IsUnallocated());
@@ -722,7 +723,6 @@ class LiveRange: public ZoneObject {
bool Covers(LifetimePosition position);
LifetimePosition FirstIntersection(LiveRange* other);
-
// Add a new interval or a new use position to this live range.
void EnsureInterval(LifetimePosition start, LifetimePosition end);
void AddUseInterval(LifetimePosition start, LifetimePosition end);
Index: src/x64/lithium-codegen-x64.cc
diff --git a/src/x64/lithium-codegen-x64.cc b/src/x64/lithium-codegen-x64.cc
index
eb21b98be09fc97750c66e684523cc6de7d28ce8..82183f08b24da7db4baea49d99d60f8f9a420e91
100644
--- a/src/x64/lithium-codegen-x64.cc
+++ b/src/x64/lithium-codegen-x64.cc
@@ -91,8 +91,40 @@ void LCodeGen::Comment(const char* format, ...) {
bool LCodeGen::GeneratePrologue() {
- Abort("Unimplemented: %s", "GeneratePrologue");
- return false;
+ ASSERT(is_generating());
+
+#ifdef DEBUG
+ if (strlen(FLAG_stop_at) > 0 &&
+ info_->function()->name()->IsEqualTo(CStrVector(FLAG_stop_at))) {
+ __ int3();
+ }
+#endif
+
+ __ push(rbp); // Caller's frame pointer.
+ __ movq(rbp, rsp);
+ __ push(rsi); // Callee's context.
+ __ push(rdi); // Callee's JS function.
+
+ // Reserve space for the stack slots needed by the code.
+ int slots = StackSlotCount();
+ if (slots > 0) {
+ if (FLAG_debug_code) {
+ __ movl(rax, Immediate(slots));
+ Label loop;
+ __ bind(&loop);
+ __ push(Immediate(kSlotsZapValue));
+ __ decl(rax);
+ __ j(not_zero, &loop);
+ } else {
+ __ subq(rsp, Immediate(slots * kPointerSize));
+ }
+ }
+
+ // Trace the call.
+ if (FLAG_trace) {
+ __ CallRuntime(Runtime::kTraceEnter, 0);
+ }
+ return !is_aborted();
}
Index: src/x64/lithium-x64.cc
diff --git a/src/x64/lithium-x64.cc b/src/x64/lithium-x64.cc
index
4a7b3aa3aeb06f9f10b905030c2b17928b96e774..528dc27df387492ff164b04810ca7a63930a83d4
100644
--- a/src/x64/lithium-x64.cc
+++ b/src/x64/lithium-x64.cc
@@ -305,15 +305,17 @@ void LAccessArgumentsAt::PrintDataTo(StringStream*
stream) {
int LChunk::GetNextSpillIndex(bool is_double) {
- // Need to consider what index means: Is it 32 bit or 64 bit index?
- UNIMPLEMENTED();
- return 0;
+ return spill_slot_count_++;
}
LOperand* LChunk::GetNextSpillSlot(bool is_double) {
- UNIMPLEMENTED();
- return NULL;
+ // All stack slots are Double stack slots on x64.
+ // Alternatively, at some point, start using half-size
+ // stack slots for int32 values.
+ int index = GetNextSpillIndex(is_double);
+ if (is_double) return LDoubleStackSlot(index);
+ return LStackSlot::Create(index);
}
@@ -737,6 +739,7 @@ LInstruction* LChunkBuilder::DoArithmeticT(Token::Value
op,
return NULL;
}
+
void LChunkBuilder::DoBasicBlock(HBasicBlock* block, HBasicBlock*
next_block) {
ASSERT(is_building());
current_block_ = block;
--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev