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