Do not visit slots in the top-level code generator's backend.

Slots appear only indirectly in the AST (through variables linked to
variable proxies).  Slots are shared among variable references, so
putting compilation-time state on them is potentially a source of
bugs.  Avoid it for now.

Review URL: http://codereview.chromium.org/284009

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@3079 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
parent dac210d3
......@@ -125,14 +125,21 @@ void FastCodeGenerator::VisitReturnStatement(ReturnStatement* stmt) {
}
void FastCodeGenerator::VisitSlot(Slot* expr) {
Comment cmnt(masm_, "[ Slot");
void FastCodeGenerator::VisitVariableProxy(VariableProxy* expr) {
Comment cmnt(masm_, "[ VariableProxy");
Expression* rewrite = expr->var()->rewrite();
ASSERT(rewrite != NULL);
Slot* slot = rewrite->AsSlot();
ASSERT(slot != NULL);
{ Comment cmnt(masm_, "[ Slot");
if (expr->location().is_temporary()) {
__ ldr(ip, MemOperand(fp, SlotOffset(expr)));
__ ldr(ip, MemOperand(fp, SlotOffset(slot)));
__ push(ip);
} else {
ASSERT(expr->location().is_nowhere());
}
}
}
......
......@@ -190,14 +190,9 @@ void FastCodeGenerator::VisitConditional(Conditional* expr) {
}
void FastCodeGenerator::VisitVariableProxy(VariableProxy* expr) {
Comment cmnt(masm_, "[ VariableProxy");
Expression* rewrite = expr->var()->rewrite();
ASSERT(rewrite != NULL);
// Forward to the proxy's rewrite.
rewrite->set_location(expr->location());
Visit(rewrite);
void FastCodeGenerator::VisitSlot(Slot* expr) {
// Slots do not appear directly in the AST.
UNREACHABLE();
}
......
......@@ -115,13 +115,20 @@ void FastCodeGenerator::VisitReturnStatement(ReturnStatement* stmt) {
}
void FastCodeGenerator::VisitSlot(Slot* expr) {
Comment cmnt(masm_, "[ Slot");
void FastCodeGenerator::VisitVariableProxy(VariableProxy* expr) {
Comment cmnt(masm_, "[ VariableProxy");
Expression* rewrite = expr->var()->rewrite();
ASSERT(rewrite != NULL);
Slot* slot = rewrite->AsSlot();
ASSERT(slot != NULL);
{ Comment cmnt(masm_, "[ Slot");
if (expr->location().is_temporary()) {
__ push(Operand(ebp, SlotOffset(expr)));
__ push(Operand(ebp, SlotOffset(slot)));
} else {
ASSERT(expr->location().is_nowhere());
}
}
}
......
......@@ -132,13 +132,20 @@ void FastCodeGenerator::VisitReturnStatement(ReturnStatement* stmt) {
}
void FastCodeGenerator::VisitSlot(Slot* expr) {
Comment cmnt(masm_, "[ Slot");
void FastCodeGenerator::VisitVariableProxy(VariableProxy* expr) {
Comment cmnt(masm_, "[ VariableProxy");
Expression* rewrite = expr->var()->rewrite();
ASSERT(rewrite != NULL);
Slot* slot = rewrite->AsSlot();
ASSERT(slot != NULL);
{ Comment cmnt(masm_, "[ Slot");
if (expr->location().is_temporary()) {
__ push(Operand(rbp, SlotOffset(expr)));
__ push(Operand(rbp, SlotOffset(slot)));
} else {
ASSERT(expr->location().is_nowhere());
}
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment