OLD | NEW |
1 // Copyright 2006-2008 the V8 project authors. All rights reserved. | 1 // Copyright 2006-2008 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 165 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
176 | 176 |
177 void DeleteFrame(); | 177 void DeleteFrame(); |
178 | 178 |
179 RegisterAllocator* allocator() const { return allocator_; } | 179 RegisterAllocator* allocator() const { return allocator_; } |
180 | 180 |
181 CodeGenState* state() { return state_; } | 181 CodeGenState* state() { return state_; } |
182 void set_state(CodeGenState* state) { state_ = state; } | 182 void set_state(CodeGenState* state) { state_ = state; } |
183 | 183 |
184 void AddDeferred(DeferredCode* code) { deferred_.Add(code); } | 184 void AddDeferred(DeferredCode* code) { deferred_.Add(code); } |
185 | 185 |
186 bool in_spilled_code() const { return in_spilled_code_; } | |
187 void set_in_spilled_code(bool flag) { in_spilled_code_ = flag; } | |
188 | |
189 static const int kUnknownIntValue = -1; | 186 static const int kUnknownIntValue = -1; |
190 | 187 |
191 private: | 188 private: |
192 // Construction/Destruction | 189 // Construction/Destruction |
193 CodeGenerator(int buffer_size, Handle<Script> script, bool is_eval); | 190 CodeGenerator(int buffer_size, Handle<Script> script, bool is_eval); |
194 virtual ~CodeGenerator() { delete masm_; } | 191 virtual ~CodeGenerator() { delete masm_; } |
195 | 192 |
196 // Accessors | 193 // Accessors |
197 Scope* scope() const { return scope_; } | 194 Scope* scope() const { return scope_; } |
198 | 195 |
(...skipping 16 matching lines...) Expand all Loading... |
215 | 212 |
216 #define DEF_VISIT(type) \ | 213 #define DEF_VISIT(type) \ |
217 void Visit##type(type* node); | 214 void Visit##type(type* node); |
218 AST_NODE_LIST(DEF_VISIT) | 215 AST_NODE_LIST(DEF_VISIT) |
219 #undef DEF_VISIT | 216 #undef DEF_VISIT |
220 | 217 |
221 // Visit a statement and then spill the virtual frame if control flow can | 218 // Visit a statement and then spill the virtual frame if control flow can |
222 // reach the end of the statement (ie, it does not exit via break, | 219 // reach the end of the statement (ie, it does not exit via break, |
223 // continue, return, or throw). This function is used temporarily while | 220 // continue, return, or throw). This function is used temporarily while |
224 // the code generator is being transformed. | 221 // the code generator is being transformed. |
225 void VisitAndSpill(Statement* statement); | 222 inline void VisitAndSpill(Statement* statement); |
226 | 223 |
227 // Visit a list of statements and then spill the virtual frame if control | 224 // Visit a list of statements and then spill the virtual frame if control |
228 // flow can reach the end of the list. | 225 // flow can reach the end of the list. |
229 void VisitStatementsAndSpill(ZoneList<Statement*>* statements); | 226 inline void VisitStatementsAndSpill(ZoneList<Statement*>* statements); |
230 | 227 |
231 // Main code generation function | 228 // Main code generation function |
232 void GenCode(FunctionLiteral* fun); | 229 void GenCode(FunctionLiteral* fun); |
233 | 230 |
234 // The following are used by class Reference. | 231 // The following are used by class Reference. |
235 void LoadReference(Reference* ref); | 232 void LoadReference(Reference* ref); |
236 void UnloadReference(Reference* ref); | 233 void UnloadReference(Reference* ref); |
237 | 234 |
238 MemOperand ContextOperand(Register context, int index) const { | 235 MemOperand ContextOperand(Register context, int index) const { |
239 return MemOperand(context, Context::SlotOffset(index)); | 236 return MemOperand(context, Context::SlotOffset(index)); |
(...skipping 16 matching lines...) Expand all Loading... |
256 JumpTarget* true_target, | 253 JumpTarget* true_target, |
257 JumpTarget* false_target, | 254 JumpTarget* false_target, |
258 bool force_cc); | 255 bool force_cc); |
259 void Load(Expression* x, TypeofState typeof_state = NOT_INSIDE_TYPEOF); | 256 void Load(Expression* x, TypeofState typeof_state = NOT_INSIDE_TYPEOF); |
260 void LoadGlobal(); | 257 void LoadGlobal(); |
261 void LoadGlobalReceiver(Register scratch); | 258 void LoadGlobalReceiver(Register scratch); |
262 | 259 |
263 // Generate code to push the value of an expression on top of the frame | 260 // Generate code to push the value of an expression on top of the frame |
264 // and then spill the frame fully to memory. This function is used | 261 // and then spill the frame fully to memory. This function is used |
265 // temporarily while the code generator is being transformed. | 262 // temporarily while the code generator is being transformed. |
266 void LoadAndSpill(Expression* expression, | 263 inline void LoadAndSpill(Expression* expression, |
267 TypeofState typeof_state = NOT_INSIDE_TYPEOF); | 264 TypeofState typeof_state = NOT_INSIDE_TYPEOF); |
268 | 265 |
269 // Call LoadCondition and then spill the virtual frame unless control flow | 266 // Call LoadCondition and then spill the virtual frame unless control flow |
270 // cannot reach the end of the expression (ie, by emitting only | 267 // cannot reach the end of the expression (ie, by emitting only |
271 // unconditional jumps to the control targets). | 268 // unconditional jumps to the control targets). |
272 void LoadConditionAndSpill(Expression* expression, | 269 inline void LoadConditionAndSpill(Expression* expression, |
273 TypeofState typeof_state, | 270 TypeofState typeof_state, |
274 JumpTarget* true_target, | 271 JumpTarget* true_target, |
275 JumpTarget* false_target, | 272 JumpTarget* false_target, |
276 bool force_control); | 273 bool force_control); |
277 | 274 |
278 // Read a value from a slot and leave it on top of the expression stack. | 275 // Read a value from a slot and leave it on top of the expression stack. |
279 void LoadFromSlot(Slot* slot, TypeofState typeof_state); | 276 void LoadFromSlot(Slot* slot, TypeofState typeof_state); |
280 void LoadFromGlobalSlotCheckExtensions(Slot* slot, | 277 void LoadFromGlobalSlotCheckExtensions(Slot* slot, |
281 TypeofState typeof_state, | 278 TypeofState typeof_state, |
282 Register tmp, | 279 Register tmp, |
283 Register tmp2, | 280 Register tmp2, |
284 JumpTarget* slow); | 281 JumpTarget* slow); |
285 | 282 |
286 // Special code for typeof expressions: Unfortunately, we must | 283 // Special code for typeof expressions: Unfortunately, we must |
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
398 CodeGenState* state_; | 395 CodeGenState* state_; |
399 | 396 |
400 // Jump targets | 397 // Jump targets |
401 BreakTarget function_return_; | 398 BreakTarget function_return_; |
402 | 399 |
403 // True if the function return is shadowed (ie, jumping to the target | 400 // True if the function return is shadowed (ie, jumping to the target |
404 // function_return_ does not jump to the true function return, but rather | 401 // function_return_ does not jump to the true function return, but rather |
405 // to some unlinking code). | 402 // to some unlinking code). |
406 bool function_return_is_shadowed_; | 403 bool function_return_is_shadowed_; |
407 | 404 |
408 // True when we are in code that expects the virtual frame to be fully | |
409 // spilled. Some virtual frame function are disabled in DEBUG builds when | |
410 // called from spilled code, because they do not leave the virtual frame | |
411 // in a spilled state. | |
412 bool in_spilled_code_; | |
413 | |
414 static InlineRuntimeLUT kInlineRuntimeLUT[]; | 405 static InlineRuntimeLUT kInlineRuntimeLUT[]; |
415 | 406 |
416 friend class VirtualFrame; | 407 friend class VirtualFrame; |
417 friend class JumpTarget; | 408 friend class JumpTarget; |
418 friend class Reference; | 409 friend class Reference; |
419 | 410 |
420 DISALLOW_COPY_AND_ASSIGN(CodeGenerator); | 411 DISALLOW_COPY_AND_ASSIGN(CodeGenerator); |
421 }; | 412 }; |
422 | 413 |
423 | 414 |
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
507 constant_rhs_); | 498 constant_rhs_); |
508 } | 499 } |
509 } | 500 } |
510 #endif | 501 #endif |
511 }; | 502 }; |
512 | 503 |
513 | 504 |
514 } } // namespace v8::internal | 505 } } // namespace v8::internal |
515 | 506 |
516 #endif // V8_ARM_CODEGEN_ARM_H_ | 507 #endif // V8_ARM_CODEGEN_ARM_H_ |
OLD | NEW |