OLD | NEW |
1 // Copyright 2010 the V8 project authors. All rights reserved. | 1 // Copyright 2010 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 253 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
264 if (index != kInvalidSlotNumber) { | 264 if (index != kInvalidSlotNumber) { |
265 TypeInfo previous_value = (*type_info_)[index]; | 265 TypeInfo previous_value = (*type_info_)[index]; |
266 (*type_info_)[index] = info; | 266 (*type_info_)[index] = info; |
267 return previous_value; | 267 return previous_value; |
268 } | 268 } |
269 return TypeInfo::Unknown(); | 269 return TypeInfo::Unknown(); |
270 } | 270 } |
271 | 271 |
272 void AddDeferred(DeferredCode* code) { deferred_.Add(code); } | 272 void AddDeferred(DeferredCode* code) { deferred_.Add(code); } |
273 | 273 |
274 // If the name is an inline runtime function call return the number of | |
275 // expected arguments. Otherwise return -1. | |
276 static int InlineRuntimeCallArgumentsCount(Handle<String> name); | |
277 | |
278 // Constants related to patching of inlined load/store. | 274 // Constants related to patching of inlined load/store. |
279 static int GetInlinedKeyedLoadInstructionsAfterPatch() { | 275 static int GetInlinedKeyedLoadInstructionsAfterPatch() { |
280 return FLAG_debug_code ? 32 : 13; | 276 return FLAG_debug_code ? 32 : 13; |
281 } | 277 } |
282 static const int kInlinedKeyedStoreInstructionsAfterPatch = 5; | 278 static const int kInlinedKeyedStoreInstructionsAfterPatch = 5; |
283 static int GetInlinedNamedStoreInstructionsAfterPatch() { | 279 static int GetInlinedNamedStoreInstructionsAfterPatch() { |
284 ASSERT(inlined_write_barrier_size_ != -1); | 280 ASSERT(inlined_write_barrier_size_ != -1); |
285 return inlined_write_barrier_size_ + 4; | 281 return inlined_write_barrier_size_ + 4; |
286 } | 282 } |
287 | 283 |
288 static MemOperand ContextOperand(Register context, int index) { | 284 static MemOperand ContextOperand(Register context, int index) { |
289 return MemOperand(context, Context::SlotOffset(index)); | 285 return MemOperand(context, Context::SlotOffset(index)); |
290 } | 286 } |
291 | 287 |
292 private: | 288 private: |
| 289 // Type of a member function that generates inline code for a native function. |
| 290 typedef void (CodeGenerator::*InlineFunctionGenerator) |
| 291 (ZoneList<Expression*>*); |
| 292 |
| 293 static const InlineFunctionGenerator kInlineFunctionGenerators[]; |
| 294 |
293 // Construction/Destruction | 295 // Construction/Destruction |
294 explicit CodeGenerator(MacroAssembler* masm); | 296 explicit CodeGenerator(MacroAssembler* masm); |
295 | 297 |
296 // Accessors | 298 // Accessors |
297 inline bool is_eval(); | 299 inline bool is_eval(); |
298 inline Scope* scope(); | 300 inline Scope* scope(); |
299 | 301 |
300 // Generating deferred code. | 302 // Generating deferred code. |
301 void ProcessDeferred(); | 303 void ProcessDeferred(); |
302 | 304 |
(...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
440 // The optimization avoids allocating an arguments object if possible. | 442 // The optimization avoids allocating an arguments object if possible. |
441 void CallApplyLazy(Expression* applicand, | 443 void CallApplyLazy(Expression* applicand, |
442 Expression* receiver, | 444 Expression* receiver, |
443 VariableProxy* arguments, | 445 VariableProxy* arguments, |
444 int position); | 446 int position); |
445 | 447 |
446 // Control flow | 448 // Control flow |
447 void Branch(bool if_true, JumpTarget* target); | 449 void Branch(bool if_true, JumpTarget* target); |
448 void CheckStack(); | 450 void CheckStack(); |
449 | 451 |
450 struct InlineRuntimeLUT { | 452 static InlineFunctionGenerator FindInlineFunctionGenerator( |
451 void (CodeGenerator::*method)(ZoneList<Expression*>*); | 453 Runtime::FunctionId function_id); |
452 const char* name; | |
453 int nargs; | |
454 }; | |
455 | 454 |
456 static InlineRuntimeLUT* FindInlineRuntimeLUT(Handle<String> name); | |
457 bool CheckForInlineRuntimeCall(CallRuntime* node); | 455 bool CheckForInlineRuntimeCall(CallRuntime* node); |
458 | 456 |
459 static Handle<Code> ComputeLazyCompile(int argc); | 457 static Handle<Code> ComputeLazyCompile(int argc); |
460 void ProcessDeclarations(ZoneList<Declaration*>* declarations); | 458 void ProcessDeclarations(ZoneList<Declaration*>* declarations); |
461 | 459 |
462 static Handle<Code> ComputeCallInitialize(int argc, InLoopFlag in_loop); | 460 static Handle<Code> ComputeCallInitialize(int argc, InLoopFlag in_loop); |
463 | 461 |
464 static Handle<Code> ComputeKeyedCallInitialize(int argc, InLoopFlag in_loop); | 462 static Handle<Code> ComputeKeyedCallInitialize(int argc, InLoopFlag in_loop); |
465 | 463 |
466 // Declare global variables and functions in the given array of | 464 // Declare global variables and functions in the given array of |
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
592 BreakTarget function_return_; | 590 BreakTarget function_return_; |
593 | 591 |
594 // True if the function return is shadowed (ie, jumping to the target | 592 // True if the function return is shadowed (ie, jumping to the target |
595 // function_return_ does not jump to the true function return, but rather | 593 // function_return_ does not jump to the true function return, but rather |
596 // to some unlinking code). | 594 // to some unlinking code). |
597 bool function_return_is_shadowed_; | 595 bool function_return_is_shadowed_; |
598 | 596 |
599 // Size of inlined write barriers generated by EmitNamedStore. | 597 // Size of inlined write barriers generated by EmitNamedStore. |
600 static int inlined_write_barrier_size_; | 598 static int inlined_write_barrier_size_; |
601 | 599 |
602 static InlineRuntimeLUT kInlineRuntimeLUT[]; | |
603 | |
604 friend class VirtualFrame; | 600 friend class VirtualFrame; |
605 friend class JumpTarget; | 601 friend class JumpTarget; |
606 friend class Reference; | 602 friend class Reference; |
607 friend class FastCodeGenerator; | 603 friend class FastCodeGenerator; |
608 friend class FullCodeGenerator; | 604 friend class FullCodeGenerator; |
609 friend class FullCodeGenSyntaxChecker; | 605 friend class FullCodeGenSyntaxChecker; |
610 | 606 |
611 DISALLOW_COPY_AND_ASSIGN(CodeGenerator); | 607 DISALLOW_COPY_AND_ASSIGN(CodeGenerator); |
612 }; | 608 }; |
613 | 609 |
614 | 610 |
615 } } // namespace v8::internal | 611 } } // namespace v8::internal |
616 | 612 |
617 #endif // V8_ARM_CODEGEN_ARM_H_ | 613 #endif // V8_ARM_CODEGEN_ARM_H_ |
OLD | NEW |