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
This commit is contained in:
kmillikin@chromium.org 2009-10-16 09:46:09 +00:00
parent dac210d3e9
commit 0f5210e9dd
4 changed files with 43 additions and 27 deletions

View File

@ -125,13 +125,20 @@ void FastCodeGenerator::VisitReturnStatement(ReturnStatement* stmt) {
}
void FastCodeGenerator::VisitSlot(Slot* expr) {
Comment cmnt(masm_, "[ Slot");
if (expr->location().is_temporary()) {
__ ldr(ip, MemOperand(fp, SlotOffset(expr)));
__ push(ip);
} else {
ASSERT(expr->location().is_nowhere());
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(slot)));
__ push(ip);
} else {
ASSERT(expr->location().is_nowhere());
}
}
}

View File

@ -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();
}

View File

@ -115,12 +115,19 @@ void FastCodeGenerator::VisitReturnStatement(ReturnStatement* stmt) {
}
void FastCodeGenerator::VisitSlot(Slot* expr) {
Comment cmnt(masm_, "[ Slot");
if (expr->location().is_temporary()) {
__ push(Operand(ebp, SlotOffset(expr)));
} else {
ASSERT(expr->location().is_nowhere());
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(slot)));
} else {
ASSERT(expr->location().is_nowhere());
}
}
}

View File

@ -132,12 +132,19 @@ void FastCodeGenerator::VisitReturnStatement(ReturnStatement* stmt) {
}
void FastCodeGenerator::VisitSlot(Slot* expr) {
Comment cmnt(masm_, "[ Slot");
if (expr->location().is_temporary()) {
__ push(Operand(rbp, SlotOffset(expr)));
} else {
ASSERT(expr->location().is_nowhere());
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(slot)));
} else {
ASSERT(expr->location().is_nowhere());
}
}
}