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

Side by Side Diff: src/arm/fast-codegen-arm.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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | src/compiler.cc » ('j') | src/ia32/fast-codegen-ia32.cc » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2009 the V8 project authors. All rights reserved. 1 // Copyright 2009 the V8 project authors. All rights reserved.
2 // Redistribution and use in source and binary forms, with or without 2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are 3 // modification, are permitted provided that the following conditions are
4 // met: 4 // met:
5 // 5 //
6 // * Redistributions of source code must retain the above copyright 6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer. 7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above 8 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following 9 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided 10 // disclaimer in the documentation and/or other materials provided
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after
132 __ ldm(ia_w, sp, fp.bit() | lr.bit()); 132 __ ldm(ia_w, sp, fp.bit() | lr.bit());
133 int num_parameters = function_->scope()->num_parameters(); 133 int num_parameters = function_->scope()->num_parameters();
134 __ add(sp, sp, Operand((num_parameters + 1) * kPointerSize)); 134 __ add(sp, sp, Operand((num_parameters + 1) * kPointerSize));
135 __ Jump(lr); 135 __ Jump(lr);
136 } 136 }
137 137
138 138
139 void FastCodeGenerator::VisitVariableProxy(VariableProxy* expr) { 139 void FastCodeGenerator::VisitVariableProxy(VariableProxy* expr) {
140 Comment cmnt(masm_, "[ VariableProxy"); 140 Comment cmnt(masm_, "[ VariableProxy");
141 Expression* rewrite = expr->var()->rewrite(); 141 Expression* rewrite = expr->var()->rewrite();
142 ASSERT(rewrite != NULL); 142 if (rewrite == NULL) {
fschneider 2009/10/20 14:16:17 Insert a comment here: Comment cmnt(masm_, "[Load
143 // Reference to a global variable, use inline caching. Variable
144 // name is passed in r2 and the global object on the stack.
145 __ ldr(ip, CodeGenerator::GlobalObject());
146 __ push(ip);
147 __ mov(r2, Operand(expr->name()));
148 Handle<Code> ic(Builtins::builtin(Builtins::LoadIC_Initialize));
149 __ Call(ic, RelocInfo::CODE_TARGET_CONTEXT);
150 if (expr->location().is_temporary()) {
151 // Replace the global object with the result.
152 __ str(r0, MemOperand(sp));
153 } else {
154 ASSERT(expr->location().is_nowhere());
155 __ pop();
156 }
143 157
144 Slot* slot = rewrite->AsSlot(); 158 } else {
145 ASSERT(slot != NULL); 159 // Reference to a local or parameter slot.
146 { Comment cmnt(masm_, "[ Slot"); 160 Comment cmnt(masm_, "[ Slot");
161 Slot* slot = rewrite->AsSlot();
162 ASSERT(slot != NULL);
147 if (expr->location().is_temporary()) { 163 if (expr->location().is_temporary()) {
148 __ ldr(ip, MemOperand(fp, SlotOffset(slot))); 164 __ ldr(ip, MemOperand(fp, SlotOffset(slot)));
149 __ push(ip); 165 __ push(ip);
150 } else { 166 } else {
151 ASSERT(expr->location().is_nowhere()); 167 ASSERT(expr->location().is_nowhere());
152 } 168 }
153 } 169 }
154 } 170 }
155 171
156 172
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
218 if (destination.is_temporary()) { 234 if (destination.is_temporary()) {
219 // Case 'temp <- (var = constant)'. Save result. 235 // Case 'temp <- (var = constant)'. Save result.
220 __ push(ip); 236 __ push(ip);
221 } 237 }
222 } 238 }
223 } 239 }
224 } 240 }
225 241
226 242
227 } } // namespace v8::internal 243 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « no previous file | src/compiler.cc » ('j') | src/ia32/fast-codegen-ia32.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698