Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(178)

Unified Diff: src/x64/fast-codegen-x64.cc

Issue 294021: Add support for global variable references in toplevel code. We use... (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: Created 11 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: src/x64/fast-codegen-x64.cc
===================================================================
--- src/x64/fast-codegen-x64.cc (revision 3095)
+++ src/x64/fast-codegen-x64.cc (working copy)
@@ -146,12 +146,31 @@
void FastCodeGenerator::VisitVariableProxy(VariableProxy* expr) {
Comment cmnt(masm_, "[ VariableProxy");
Expression* rewrite = expr->var()->rewrite();
- ASSERT(rewrite != NULL);
+ if (rewrite == NULL) {
fschneider 2009/10/20 14:16:17 Insert a comment here: Comment cmnt(masm_, "[Load
+ // Reference to a global variable, use inline caching. Variable
+ // name is passed in ecx and the global object on the stack.
+ __ push(CodeGenerator::GlobalObject());
+ __ Move(rcx, expr->name());
+ Handle<Code> ic(Builtins::builtin(Builtins::LoadIC_Initialize));
+ __ Call(ic, RelocInfo::CODE_TARGET_CONTEXT);
- Slot* slot = rewrite->AsSlot();
- ASSERT(slot != NULL);
- { Comment cmnt(masm_, "[ Slot");
+ // A test rax instruction following the call is used by the IC to
+ // indicate that the inobject property case was inlined. Ensure there
+ // is no test rax instruction here.
if (expr->location().is_temporary()) {
+ // Replace the global object with the result.
+ __ movq(Operand(rsp, 0), rax);
+ } else {
+ ASSERT(expr->location().is_nowhere());
+ __ pop(rax);
+ }
+
+ } else {
+ // Reference to a local or parameter slot.
+ Comment cmnt(masm_, "[ Slot");
+ Slot* slot = rewrite->AsSlot();
+ ASSERT(slot != NULL);
+ if (expr->location().is_temporary()) {
__ push(Operand(rbp, SlotOffset(slot)));
} else {
ASSERT(expr->location().is_nowhere());

Powered by Google App Engine
This is Rietveld 408576698