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 323 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
334 RegisterAllocator* allocator() const { return allocator_; } | 334 RegisterAllocator* allocator() const { return allocator_; } |
335 | 335 |
336 CodeGenState* state() { return state_; } | 336 CodeGenState* state() { return state_; } |
337 void set_state(CodeGenState* state) { state_ = state; } | 337 void set_state(CodeGenState* state) { state_ = state; } |
338 | 338 |
339 void AddDeferred(DeferredCode* code) { deferred_.Add(code); } | 339 void AddDeferred(DeferredCode* code) { deferred_.Add(code); } |
340 | 340 |
341 bool in_spilled_code() const { return in_spilled_code_; } | 341 bool in_spilled_code() const { return in_spilled_code_; } |
342 void set_in_spilled_code(bool flag) { in_spilled_code_ = flag; } | 342 void set_in_spilled_code(bool flag) { in_spilled_code_ = flag; } |
343 | 343 |
344 static Operand ContextOperand(Register context, int index) { | |
345 return Operand(context, Context::SlotOffset(index)); | |
346 } | |
347 | |
348 private: | 344 private: |
349 // Type of a member function that generates inline code for a native function. | 345 // Type of a member function that generates inline code for a native function. |
350 typedef void (CodeGenerator::*InlineFunctionGenerator) | 346 typedef void (CodeGenerator::*InlineFunctionGenerator) |
351 (ZoneList<Expression*>*); | 347 (ZoneList<Expression*>*); |
352 | 348 |
353 static const InlineFunctionGenerator kInlineFunctionGenerators[]; | 349 static const InlineFunctionGenerator kInlineFunctionGenerators[]; |
354 | 350 |
355 // Construction/Destruction | 351 // Construction/Destruction |
356 explicit CodeGenerator(MacroAssembler* masm); | 352 explicit CodeGenerator(MacroAssembler* masm); |
357 | 353 |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
410 void LoadReference(Reference* ref); | 406 void LoadReference(Reference* ref); |
411 void UnloadReference(Reference* ref); | 407 void UnloadReference(Reference* ref); |
412 | 408 |
413 Operand SlotOperand(Slot* slot, Register tmp); | 409 Operand SlotOperand(Slot* slot, Register tmp); |
414 | 410 |
415 Operand ContextSlotOperandCheckExtensions(Slot* slot, | 411 Operand ContextSlotOperandCheckExtensions(Slot* slot, |
416 Result tmp, | 412 Result tmp, |
417 JumpTarget* slow); | 413 JumpTarget* slow); |
418 | 414 |
419 // Expressions | 415 // Expressions |
420 static Operand GlobalObject() { | |
421 return ContextOperand(rsi, Context::GLOBAL_INDEX); | |
422 } | |
423 | |
424 void LoadCondition(Expression* x, | 416 void LoadCondition(Expression* x, |
425 ControlDestination* destination, | 417 ControlDestination* destination, |
426 bool force_control); | 418 bool force_control); |
427 void Load(Expression* expr); | 419 void Load(Expression* expr); |
428 void LoadGlobal(); | 420 void LoadGlobal(); |
429 void LoadGlobalReceiver(); | 421 void LoadGlobalReceiver(); |
430 | 422 |
431 // Generate code to push the value of an expression on top of the frame | 423 // Generate code to push the value of an expression on top of the frame |
432 // and then spill the frame fully to memory. This function is used | 424 // and then spill the frame fully to memory. This function is used |
433 // temporarily while the code generator is being transformed. | 425 // temporarily while the code generator is being transformed. |
(...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
581 Expression* receiver, | 573 Expression* receiver, |
582 VariableProxy* arguments, | 574 VariableProxy* arguments, |
583 int position); | 575 int position); |
584 | 576 |
585 void CheckStack(); | 577 void CheckStack(); |
586 | 578 |
587 bool CheckForInlineRuntimeCall(CallRuntime* node); | 579 bool CheckForInlineRuntimeCall(CallRuntime* node); |
588 | 580 |
589 void ProcessDeclarations(ZoneList<Declaration*>* declarations); | 581 void ProcessDeclarations(ZoneList<Declaration*>* declarations); |
590 | 582 |
591 static Handle<Code> ComputeCallInitialize(int argc, InLoopFlag in_loop); | |
592 | |
593 static Handle<Code> ComputeKeyedCallInitialize(int argc, InLoopFlag in_loop); | |
594 | |
595 // Declare global variables and functions in the given array of | 583 // Declare global variables and functions in the given array of |
596 // name/value pairs. | 584 // name/value pairs. |
597 void DeclareGlobals(Handle<FixedArray> pairs); | 585 void DeclareGlobals(Handle<FixedArray> pairs); |
598 | 586 |
599 // Instantiate the function based on the shared function info. | 587 // Instantiate the function based on the shared function info. |
600 void InstantiateFunction(Handle<SharedFunctionInfo> function_info); | 588 void InstantiateFunction(Handle<SharedFunctionInfo> function_info); |
601 | 589 |
602 // Support for type checks. | 590 // Support for type checks. |
603 void GenerateIsSmi(ZoneList<Expression*>* args); | 591 void GenerateIsSmi(ZoneList<Expression*>* args); |
604 void GenerateIsNonNegativeSmi(ZoneList<Expression*>* args); | 592 void GenerateIsNonNegativeSmi(ZoneList<Expression*>* args); |
(...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
744 | 732 |
745 friend class CodeGeneratorPatcher; // Used in test-log-stack-tracer.cc | 733 friend class CodeGeneratorPatcher; // Used in test-log-stack-tracer.cc |
746 | 734 |
747 DISALLOW_COPY_AND_ASSIGN(CodeGenerator); | 735 DISALLOW_COPY_AND_ASSIGN(CodeGenerator); |
748 }; | 736 }; |
749 | 737 |
750 | 738 |
751 } } // namespace v8::internal | 739 } } // namespace v8::internal |
752 | 740 |
753 #endif // V8_X64_CODEGEN_X64_H_ | 741 #endif // V8_X64_CODEGEN_X64_H_ |
OLD | NEW |