OLD | NEW |
---|---|
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 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
139 for (int i = 0; i < kPadding; ++i) { | 139 for (int i = 0; i < kPadding; ++i) { |
140 masm_->int3(); | 140 masm_->int3(); |
141 } | 141 } |
142 #endif | 142 #endif |
143 } | 143 } |
144 | 144 |
145 | 145 |
146 void FastCodeGenerator::VisitVariableProxy(VariableProxy* expr) { | 146 void FastCodeGenerator::VisitVariableProxy(VariableProxy* expr) { |
147 Comment cmnt(masm_, "[ VariableProxy"); | 147 Comment cmnt(masm_, "[ VariableProxy"); |
148 Expression* rewrite = expr->var()->rewrite(); | 148 Expression* rewrite = expr->var()->rewrite(); |
149 ASSERT(rewrite != NULL); | 149 if (rewrite == NULL) { |
fschneider
2009/10/20 14:16:17
Insert a comment here:
Comment cmnt(masm_, "[Load
| |
150 // Reference to a global variable, use inline caching. Variable | |
151 // name is passed in ecx and the global object on the stack. | |
152 __ push(CodeGenerator::GlobalObject()); | |
153 __ Move(rcx, expr->name()); | |
154 Handle<Code> ic(Builtins::builtin(Builtins::LoadIC_Initialize)); | |
155 __ Call(ic, RelocInfo::CODE_TARGET_CONTEXT); | |
150 | 156 |
151 Slot* slot = rewrite->AsSlot(); | 157 // A test rax instruction following the call is used by the IC to |
152 ASSERT(slot != NULL); | 158 // indicate that the inobject property case was inlined. Ensure there |
153 { Comment cmnt(masm_, "[ Slot"); | 159 // is no test rax instruction here. |
160 if (expr->location().is_temporary()) { | |
161 // Replace the global object with the result. | |
162 __ movq(Operand(rsp, 0), rax); | |
163 } else { | |
164 ASSERT(expr->location().is_nowhere()); | |
165 __ pop(rax); | |
166 } | |
167 | |
168 } else { | |
169 // Reference to a local or parameter slot. | |
170 Comment cmnt(masm_, "[ Slot"); | |
171 Slot* slot = rewrite->AsSlot(); | |
172 ASSERT(slot != NULL); | |
154 if (expr->location().is_temporary()) { | 173 if (expr->location().is_temporary()) { |
155 __ push(Operand(rbp, SlotOffset(slot))); | 174 __ push(Operand(rbp, SlotOffset(slot))); |
156 } else { | 175 } else { |
157 ASSERT(expr->location().is_nowhere()); | 176 ASSERT(expr->location().is_nowhere()); |
158 } | 177 } |
159 } | 178 } |
160 } | 179 } |
161 | 180 |
162 | 181 |
163 void FastCodeGenerator::VisitAssignment(Assignment* expr) { | 182 void FastCodeGenerator::VisitAssignment(Assignment* expr) { |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
221 if (destination.is_temporary()) { | 240 if (destination.is_temporary()) { |
222 // Case 'temp <- (var = constant)'. Save result. | 241 // Case 'temp <- (var = constant)'. Save result. |
223 __ push(kScratchRegister); | 242 __ push(kScratchRegister); |
224 } | 243 } |
225 } | 244 } |
226 } | 245 } |
227 } | 246 } |
228 | 247 |
229 | 248 |
230 } } // namespace v8::internal | 249 } } // namespace v8::internal |
OLD | NEW |