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,13 +125,20 @@ void FastCodeGenerator::VisitReturnStatement(ReturnStatement* stmt) { ...@@ -125,13 +125,20 @@ void FastCodeGenerator::VisitReturnStatement(ReturnStatement* stmt) {
} }
void FastCodeGenerator::VisitSlot(Slot* expr) { void FastCodeGenerator::VisitVariableProxy(VariableProxy* expr) {
Comment cmnt(masm_, "[ Slot"); Comment cmnt(masm_, "[ VariableProxy");
if (expr->location().is_temporary()) { Expression* rewrite = expr->var()->rewrite();
__ ldr(ip, MemOperand(fp, SlotOffset(expr))); ASSERT(rewrite != NULL);
__ push(ip);
} else { Slot* slot = rewrite->AsSlot();
ASSERT(expr->location().is_nowhere()); ASSERT(slot != NULL);
{ Comment cmnt(masm_, "[ Slot");
if (expr->location().is_temporary()) {
__ ldr(ip, MemOperand(fp, SlotOffset(slot)));
__ push(ip);
} else {
ASSERT(expr->location().is_nowhere());
}
} }
} }
......
...@@ -190,14 +190,9 @@ void FastCodeGenerator::VisitConditional(Conditional* expr) { ...@@ -190,14 +190,9 @@ void FastCodeGenerator::VisitConditional(Conditional* expr) {
} }
void FastCodeGenerator::VisitVariableProxy(VariableProxy* expr) { void FastCodeGenerator::VisitSlot(Slot* expr) {
Comment cmnt(masm_, "[ VariableProxy"); // Slots do not appear directly in the AST.
Expression* rewrite = expr->var()->rewrite(); UNREACHABLE();
ASSERT(rewrite != NULL);
// Forward to the proxy's rewrite.
rewrite->set_location(expr->location());
Visit(rewrite);
} }
......
...@@ -115,12 +115,19 @@ void FastCodeGenerator::VisitReturnStatement(ReturnStatement* stmt) { ...@@ -115,12 +115,19 @@ void FastCodeGenerator::VisitReturnStatement(ReturnStatement* stmt) {
} }
void FastCodeGenerator::VisitSlot(Slot* expr) { void FastCodeGenerator::VisitVariableProxy(VariableProxy* expr) {
Comment cmnt(masm_, "[ Slot"); Comment cmnt(masm_, "[ VariableProxy");
if (expr->location().is_temporary()) { Expression* rewrite = expr->var()->rewrite();
__ push(Operand(ebp, SlotOffset(expr))); ASSERT(rewrite != NULL);
} else {
ASSERT(expr->location().is_nowhere()); Slot* slot = rewrite->AsSlot();
ASSERT(slot != NULL);
{ Comment cmnt(masm_, "[ Slot");
if (expr->location().is_temporary()) {
__ push(Operand(ebp, SlotOffset(slot)));
} else {
ASSERT(expr->location().is_nowhere());
}
} }
} }
......
...@@ -132,12 +132,19 @@ void FastCodeGenerator::VisitReturnStatement(ReturnStatement* stmt) { ...@@ -132,12 +132,19 @@ void FastCodeGenerator::VisitReturnStatement(ReturnStatement* stmt) {
} }
void FastCodeGenerator::VisitSlot(Slot* expr) { void FastCodeGenerator::VisitVariableProxy(VariableProxy* expr) {
Comment cmnt(masm_, "[ Slot"); Comment cmnt(masm_, "[ VariableProxy");
if (expr->location().is_temporary()) { Expression* rewrite = expr->var()->rewrite();
__ push(Operand(rbp, SlotOffset(expr))); ASSERT(rewrite != NULL);
} else {
ASSERT(expr->location().is_nowhere()); Slot* slot = rewrite->AsSlot();
ASSERT(slot != NULL);
{ Comment cmnt(masm_, "[ Slot");
if (expr->location().is_temporary()) {
__ 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