| 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 325 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 336 RegisterAllocator* allocator() const { return allocator_; } | 336 RegisterAllocator* allocator() const { return allocator_; } |
| 337 | 337 |
| 338 CodeGenState* state() { return state_; } | 338 CodeGenState* state() { return state_; } |
| 339 void set_state(CodeGenState* state) { state_ = state; } | 339 void set_state(CodeGenState* state) { state_ = state; } |
| 340 | 340 |
| 341 void AddDeferred(DeferredCode* code) { deferred_.Add(code); } | 341 void AddDeferred(DeferredCode* code) { deferred_.Add(code); } |
| 342 | 342 |
| 343 bool in_spilled_code() const { return in_spilled_code_; } | 343 bool in_spilled_code() const { return in_spilled_code_; } |
| 344 void set_in_spilled_code(bool flag) { in_spilled_code_ = flag; } | 344 void set_in_spilled_code(bool flag) { in_spilled_code_ = flag; } |
| 345 | 345 |
| 346 // If the name is an inline runtime function call return the number of | |
| 347 // expected arguments. Otherwise return -1. | |
| 348 static int InlineRuntimeCallArgumentsCount(Handle<String> name); | |
| 349 | |
| 350 static Operand ContextOperand(Register context, int index) { | 346 static Operand ContextOperand(Register context, int index) { |
| 351 return Operand(context, Context::SlotOffset(index)); | 347 return Operand(context, Context::SlotOffset(index)); |
| 352 } | 348 } |
| 353 | 349 |
| 354 private: | 350 private: |
| 351 // Type of a member function that generates inline code for a native function. |
| 352 typedef void (CodeGenerator::*InlineFunctionGenerator) |
| 353 (ZoneList<Expression*>*); |
| 354 |
| 355 static const InlineFunctionGenerator kInlineFunctionGenerators[]; |
| 356 |
| 355 // Construction/Destruction | 357 // Construction/Destruction |
| 356 explicit CodeGenerator(MacroAssembler* masm); | 358 explicit CodeGenerator(MacroAssembler* masm); |
| 357 | 359 |
| 358 // Accessors | 360 // Accessors |
| 359 inline bool is_eval(); | 361 inline bool is_eval(); |
| 360 inline Scope* scope(); | 362 inline Scope* scope(); |
| 361 | 363 |
| 362 // Generating deferred code. | 364 // Generating deferred code. |
| 363 void ProcessDeferred(); | 365 void ProcessDeferred(); |
| 364 | 366 |
| (...skipping 212 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 577 // An optimized implementation of expressions of the form | 579 // An optimized implementation of expressions of the form |
| 578 // x.apply(y, arguments). We call x the applicand and y the receiver. | 580 // x.apply(y, arguments). We call x the applicand and y the receiver. |
| 579 // The optimization avoids allocating an arguments object if possible. | 581 // The optimization avoids allocating an arguments object if possible. |
| 580 void CallApplyLazy(Expression* applicand, | 582 void CallApplyLazy(Expression* applicand, |
| 581 Expression* receiver, | 583 Expression* receiver, |
| 582 VariableProxy* arguments, | 584 VariableProxy* arguments, |
| 583 int position); | 585 int position); |
| 584 | 586 |
| 585 void CheckStack(); | 587 void CheckStack(); |
| 586 | 588 |
| 587 struct InlineRuntimeLUT { | 589 static InlineFunctionGenerator FindInlineFunctionGenerator( |
| 588 void (CodeGenerator::*method)(ZoneList<Expression*>*); | 590 Runtime::FunctionId function_id); |
| 589 const char* name; | 591 |
| 590 int nargs; | |
| 591 }; | |
| 592 static InlineRuntimeLUT* FindInlineRuntimeLUT(Handle<String> name); | |
| 593 bool CheckForInlineRuntimeCall(CallRuntime* node); | 592 bool CheckForInlineRuntimeCall(CallRuntime* node); |
| 594 | 593 |
| 595 void ProcessDeclarations(ZoneList<Declaration*>* declarations); | 594 void ProcessDeclarations(ZoneList<Declaration*>* declarations); |
| 596 | 595 |
| 597 static Handle<Code> ComputeCallInitialize(int argc, InLoopFlag in_loop); | 596 static Handle<Code> ComputeCallInitialize(int argc, InLoopFlag in_loop); |
| 598 | 597 |
| 599 static Handle<Code> ComputeKeyedCallInitialize(int argc, InLoopFlag in_loop); | 598 static Handle<Code> ComputeKeyedCallInitialize(int argc, InLoopFlag in_loop); |
| 600 | 599 |
| 601 // Declare global variables and functions in the given array of | 600 // Declare global variables and functions in the given array of |
| 602 // name/value pairs. | 601 // name/value pairs. |
| (...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 735 // function_return_ does not jump to the true function return, but rather | 734 // function_return_ does not jump to the true function return, but rather |
| 736 // to some unlinking code). | 735 // to some unlinking code). |
| 737 bool function_return_is_shadowed_; | 736 bool function_return_is_shadowed_; |
| 738 | 737 |
| 739 // True when we are in code that expects the virtual frame to be fully | 738 // True when we are in code that expects the virtual frame to be fully |
| 740 // spilled. Some virtual frame function are disabled in DEBUG builds when | 739 // spilled. Some virtual frame function are disabled in DEBUG builds when |
| 741 // called from spilled code, because they do not leave the virtual frame | 740 // called from spilled code, because they do not leave the virtual frame |
| 742 // in a spilled state. | 741 // in a spilled state. |
| 743 bool in_spilled_code_; | 742 bool in_spilled_code_; |
| 744 | 743 |
| 745 static InlineRuntimeLUT kInlineRuntimeLUT[]; | |
| 746 | |
| 747 friend class VirtualFrame; | 744 friend class VirtualFrame; |
| 748 friend class JumpTarget; | 745 friend class JumpTarget; |
| 749 friend class Reference; | 746 friend class Reference; |
| 750 friend class Result; | 747 friend class Result; |
| 751 friend class FastCodeGenerator; | 748 friend class FastCodeGenerator; |
| 752 friend class FullCodeGenerator; | 749 friend class FullCodeGenerator; |
| 753 friend class FullCodeGenSyntaxChecker; | 750 friend class FullCodeGenSyntaxChecker; |
| 754 | 751 |
| 755 friend class CodeGeneratorPatcher; // Used in test-log-stack-tracer.cc | 752 friend class CodeGeneratorPatcher; // Used in test-log-stack-tracer.cc |
| 756 | 753 |
| 757 DISALLOW_COPY_AND_ASSIGN(CodeGenerator); | 754 DISALLOW_COPY_AND_ASSIGN(CodeGenerator); |
| 758 }; | 755 }; |
| 759 | 756 |
| 760 | 757 |
| 761 } } // namespace v8::internal | 758 } } // namespace v8::internal |
| 762 | 759 |
| 763 #endif // V8_X64_CODEGEN_X64_H_ | 760 #endif // V8_X64_CODEGEN_X64_H_ |
| OLD | NEW |