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 334 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
345 | 345 |
346 // Return a position of the element at |index_as_smi| + |additional_offset| | 346 // Return a position of the element at |index_as_smi| + |additional_offset| |
347 // in FixedArray pointer to which is held in |array|. |index_as_smi| is Smi. | 347 // in FixedArray pointer to which is held in |array|. |index_as_smi| is Smi. |
348 static Operand FixedArrayElementOperand(Register array, | 348 static Operand FixedArrayElementOperand(Register array, |
349 Register index_as_smi, | 349 Register index_as_smi, |
350 int additional_offset = 0) { | 350 int additional_offset = 0) { |
351 int offset = FixedArray::kHeaderSize + additional_offset * kPointerSize; | 351 int offset = FixedArray::kHeaderSize + additional_offset * kPointerSize; |
352 return FieldOperand(array, index_as_smi, times_half_pointer_size, offset); | 352 return FieldOperand(array, index_as_smi, times_half_pointer_size, offset); |
353 } | 353 } |
354 | 354 |
355 static Operand ContextOperand(Register context, int index) { | |
356 return Operand(context, Context::SlotOffset(index)); | |
357 } | |
358 | |
359 private: | 355 private: |
360 // Type of a member function that generates inline code for a native function. | 356 // Type of a member function that generates inline code for a native function. |
361 typedef void (CodeGenerator::*InlineFunctionGenerator) | 357 typedef void (CodeGenerator::*InlineFunctionGenerator) |
362 (ZoneList<Expression*>*); | 358 (ZoneList<Expression*>*); |
363 | 359 |
364 static const InlineFunctionGenerator kInlineFunctionGenerators[]; | 360 static const InlineFunctionGenerator kInlineFunctionGenerators[]; |
365 | 361 |
366 // Construction/Destruction | 362 // Construction/Destruction |
367 explicit CodeGenerator(MacroAssembler* masm); | 363 explicit CodeGenerator(MacroAssembler* masm); |
368 | 364 |
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
434 // The following are used by class Reference. | 430 // The following are used by class Reference. |
435 void LoadReference(Reference* ref); | 431 void LoadReference(Reference* ref); |
436 | 432 |
437 Operand SlotOperand(Slot* slot, Register tmp); | 433 Operand SlotOperand(Slot* slot, Register tmp); |
438 | 434 |
439 Operand ContextSlotOperandCheckExtensions(Slot* slot, | 435 Operand ContextSlotOperandCheckExtensions(Slot* slot, |
440 Result tmp, | 436 Result tmp, |
441 JumpTarget* slow); | 437 JumpTarget* slow); |
442 | 438 |
443 // Expressions | 439 // Expressions |
444 static Operand GlobalObject() { | |
445 return ContextOperand(esi, Context::GLOBAL_INDEX); | |
446 } | |
447 | |
448 void LoadCondition(Expression* expr, | 440 void LoadCondition(Expression* expr, |
449 ControlDestination* destination, | 441 ControlDestination* destination, |
450 bool force_control); | 442 bool force_control); |
451 void Load(Expression* expr); | 443 void Load(Expression* expr); |
452 void LoadGlobal(); | 444 void LoadGlobal(); |
453 void LoadGlobalReceiver(); | 445 void LoadGlobalReceiver(); |
454 | 446 |
455 // Generate code to push the value of an expression on top of the frame | 447 // Generate code to push the value of an expression on top of the frame |
456 // and then spill the frame fully to memory. This function is used | 448 // and then spill the frame fully to memory. This function is used |
457 // temporarily while the code generator is being transformed. | 449 // temporarily while the code generator is being transformed. |
(...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
621 Expression* receiver, | 613 Expression* receiver, |
622 VariableProxy* arguments, | 614 VariableProxy* arguments, |
623 int position); | 615 int position); |
624 | 616 |
625 void CheckStack(); | 617 void CheckStack(); |
626 | 618 |
627 bool CheckForInlineRuntimeCall(CallRuntime* node); | 619 bool CheckForInlineRuntimeCall(CallRuntime* node); |
628 | 620 |
629 void ProcessDeclarations(ZoneList<Declaration*>* declarations); | 621 void ProcessDeclarations(ZoneList<Declaration*>* declarations); |
630 | 622 |
631 static Handle<Code> ComputeCallInitialize(int argc, InLoopFlag in_loop); | |
632 | |
633 static Handle<Code> ComputeKeyedCallInitialize(int argc, InLoopFlag in_loop); | |
634 | |
635 // Declare global variables and functions in the given array of | 623 // Declare global variables and functions in the given array of |
636 // name/value pairs. | 624 // name/value pairs. |
637 void DeclareGlobals(Handle<FixedArray> pairs); | 625 void DeclareGlobals(Handle<FixedArray> pairs); |
638 | 626 |
639 // Instantiate the function based on the shared function info. | 627 // Instantiate the function based on the shared function info. |
640 Result InstantiateFunction(Handle<SharedFunctionInfo> function_info); | 628 Result InstantiateFunction(Handle<SharedFunctionInfo> function_info); |
641 | 629 |
642 // Support for types. | 630 // Support for types. |
643 void GenerateIsSmi(ZoneList<Expression*>* args); | 631 void GenerateIsSmi(ZoneList<Expression*>* args); |
644 void GenerateIsNonNegativeSmi(ZoneList<Expression*>* args); | 632 void GenerateIsNonNegativeSmi(ZoneList<Expression*>* args); |
(...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
795 | 783 |
796 friend class CodeGeneratorPatcher; // Used in test-log-stack-tracer.cc | 784 friend class CodeGeneratorPatcher; // Used in test-log-stack-tracer.cc |
797 | 785 |
798 DISALLOW_COPY_AND_ASSIGN(CodeGenerator); | 786 DISALLOW_COPY_AND_ASSIGN(CodeGenerator); |
799 }; | 787 }; |
800 | 788 |
801 | 789 |
802 } } // namespace v8::internal | 790 } } // namespace v8::internal |
803 | 791 |
804 #endif // V8_IA32_CODEGEN_IA32_H_ | 792 #endif // V8_IA32_CODEGEN_IA32_H_ |
OLD | NEW |