| OLD | NEW |
| 1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 57 deoptimizations_(4, info->zone()), | 57 deoptimizations_(4, info->zone()), |
| 58 deoptimization_literals_(8, info->zone()), | 58 deoptimization_literals_(8, info->zone()), |
| 59 inlined_function_count_(0), | 59 inlined_function_count_(0), |
| 60 scope_(info->scope()), | 60 scope_(info->scope()), |
| 61 status_(UNUSED), | 61 status_(UNUSED), |
| 62 translations_(info->zone()), | 62 translations_(info->zone()), |
| 63 deferred_(8, info->zone()), | 63 deferred_(8, info->zone()), |
| 64 dynamic_frame_alignment_(false), | 64 dynamic_frame_alignment_(false), |
| 65 osr_pc_offset_(-1), | 65 osr_pc_offset_(-1), |
| 66 last_lazy_deopt_pc_(0), | 66 last_lazy_deopt_pc_(0), |
| 67 frame_is_built_(false), |
| 67 safepoints_(info->zone()), | 68 safepoints_(info->zone()), |
| 68 resolver_(this), | 69 resolver_(this), |
| 69 expected_safepoint_kind_(Safepoint::kSimple) { | 70 expected_safepoint_kind_(Safepoint::kSimple) { |
| 70 PopulateDeoptimizationLiteralsWithInlinedFunctions(); | 71 PopulateDeoptimizationLiteralsWithInlinedFunctions(); |
| 71 } | 72 } |
| 72 | 73 |
| 73 // Simple accessors. | 74 // Simple accessors. |
| 74 MacroAssembler* masm() const { return masm_; } | 75 MacroAssembler* masm() const { return masm_; } |
| 75 CompilationInfo* info() const { return info_; } | 76 CompilationInfo* info() const { return info_; } |
| 76 Isolate* isolate() const { return info_->isolate(); } | 77 Isolate* isolate() const { return info_->isolate(); } |
| 77 Factory* factory() const { return isolate()->factory(); } | 78 Factory* factory() const { return isolate()->factory(); } |
| 78 Heap* heap() const { return isolate()->heap(); } | 79 Heap* heap() const { return isolate()->heap(); } |
| 79 Zone* zone() const { return zone_; } | 80 Zone* zone() const { return zone_; } |
| 80 | 81 |
| 82 bool NeedsEagerFrame() const { |
| 83 return GetStackSlotCount() > 0 || |
| 84 info()->is_non_deferred_calling() || |
| 85 !info()->IsStub(); |
| 86 } |
| 87 bool NeedsDeferredFrame() const { |
| 88 return !NeedsEagerFrame() && info()->is_deferred_calling(); |
| 89 } |
| 90 |
| 81 // Support for converting LOperands to assembler types. | 91 // Support for converting LOperands to assembler types. |
| 82 Operand ToOperand(LOperand* op) const; | 92 Operand ToOperand(LOperand* op) const; |
| 83 Register ToRegister(LOperand* op) const; | 93 Register ToRegister(LOperand* op) const; |
| 84 XMMRegister ToDoubleRegister(LOperand* op) const; | 94 XMMRegister ToDoubleRegister(LOperand* op) const; |
| 95 bool IsX87TopOfStack(LOperand* op) const; |
| 85 | 96 |
| 86 bool IsInteger32(LConstantOperand* op) const; | 97 bool IsInteger32(LConstantOperand* op) const; |
| 87 Immediate ToInteger32Immediate(LOperand* op) const { | 98 Immediate ToInteger32Immediate(LOperand* op) const { |
| 88 return Immediate(ToInteger32(LConstantOperand::cast(op))); | 99 return Immediate(ToInteger32(LConstantOperand::cast(op))); |
| 89 } | 100 } |
| 90 | 101 |
| 91 Handle<Object> ToHandle(LConstantOperand* op) const; | 102 Handle<Object> ToHandle(LConstantOperand* op) const; |
| 92 | 103 |
| 104 // A utility for instructions that return floating point values on X87. |
| 105 void HandleX87FPReturnValue(LInstruction* instr); |
| 106 |
| 93 // The operand denoting the second word (the one with a higher address) of | 107 // The operand denoting the second word (the one with a higher address) of |
| 94 // a double stack slot. | 108 // a double stack slot. |
| 95 Operand HighOperand(LOperand* op); | 109 Operand HighOperand(LOperand* op); |
| 96 | 110 |
| 97 // Try to generate code for the entire chunk, but it may fail if the | 111 // Try to generate code for the entire chunk, but it may fail if the |
| 98 // chunk contains constructs we cannot handle. Returns true if the | 112 // chunk contains constructs we cannot handle. Returns true if the |
| 99 // code generation attempt succeeded. | 113 // code generation attempt succeeded. |
| 100 bool GenerateCode(); | 114 bool GenerateCode(); |
| 101 | 115 |
| 102 // Finish the code by setting stack height, safepoint, and bailout | 116 // Finish the code by setting stack height, safepoint, and bailout |
| (...skipping 12 matching lines...) Expand all Loading... |
| 115 void DoDeferredMathAbsTaggedHeapNumber(LUnaryMathOperation* instr); | 129 void DoDeferredMathAbsTaggedHeapNumber(LUnaryMathOperation* instr); |
| 116 void DoDeferredStackCheck(LStackCheck* instr); | 130 void DoDeferredStackCheck(LStackCheck* instr); |
| 117 void DoDeferredRandom(LRandom* instr); | 131 void DoDeferredRandom(LRandom* instr); |
| 118 void DoDeferredStringCharCodeAt(LStringCharCodeAt* instr); | 132 void DoDeferredStringCharCodeAt(LStringCharCodeAt* instr); |
| 119 void DoDeferredStringCharFromCode(LStringCharFromCode* instr); | 133 void DoDeferredStringCharFromCode(LStringCharFromCode* instr); |
| 120 void DoDeferredAllocateObject(LAllocateObject* instr); | 134 void DoDeferredAllocateObject(LAllocateObject* instr); |
| 121 void DoDeferredInstanceOfKnownGlobal(LInstanceOfKnownGlobal* instr, | 135 void DoDeferredInstanceOfKnownGlobal(LInstanceOfKnownGlobal* instr, |
| 122 Label* map_check); | 136 Label* map_check); |
| 123 | 137 |
| 124 void DoCheckMapCommon(Register reg, Handle<Map> map, | 138 void DoCheckMapCommon(Register reg, Handle<Map> map, |
| 125 CompareMapMode mode, LEnvironment* env); | 139 CompareMapMode mode, LInstruction* instr); |
| 126 | 140 |
| 127 // Parallel move support. | 141 // Parallel move support. |
| 128 void DoParallelMove(LParallelMove* move); | 142 void DoParallelMove(LParallelMove* move); |
| 129 void DoGap(LGap* instr); | 143 void DoGap(LGap* instr); |
| 130 | 144 |
| 131 // Emit frame translation commands for an environment. | 145 // Emit frame translation commands for an environment. |
| 132 void WriteTranslation(LEnvironment* environment, | 146 void WriteTranslation(LEnvironment* environment, |
| 133 Translation* translation, | 147 Translation* translation, |
| 134 int* arguments_index, | 148 int* arguments_index, |
| 135 int* arguments_count); | 149 int* arguments_count); |
| (...skipping 29 matching lines...) Expand all Loading... |
| 165 int GetNextEmittedBlock(int block); | 179 int GetNextEmittedBlock(int block); |
| 166 | 180 |
| 167 void EmitClassOfTest(Label* if_true, | 181 void EmitClassOfTest(Label* if_true, |
| 168 Label* if_false, | 182 Label* if_false, |
| 169 Handle<String> class_name, | 183 Handle<String> class_name, |
| 170 Register input, | 184 Register input, |
| 171 Register temporary, | 185 Register temporary, |
| 172 Register temporary2); | 186 Register temporary2); |
| 173 | 187 |
| 174 int GetStackSlotCount() const { return chunk()->spill_slot_count(); } | 188 int GetStackSlotCount() const { return chunk()->spill_slot_count(); } |
| 175 int GetParameterCount() const { return scope()->num_parameters(); } | 189 int GetParameterCount() const { return info()->num_parameters(); } |
| 176 | 190 |
| 177 void Abort(const char* reason); | 191 void Abort(const char* reason); |
| 178 void Comment(const char* format, ...); | 192 void Comment(const char* format, ...); |
| 179 | 193 |
| 180 void AddDeferredCode(LDeferredCode* code) { deferred_.Add(code, zone()); } | 194 void AddDeferredCode(LDeferredCode* code) { deferred_.Add(code, zone()); } |
| 181 | 195 |
| 182 // Code generation passes. Returns true if code generation should | 196 // Code generation passes. Returns true if code generation should |
| 183 // continue. | 197 // continue. |
| 184 bool GeneratePrologue(); | 198 bool GeneratePrologue(); |
| 185 bool GenerateBody(); | 199 bool GenerateBody(); |
| (...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 362 ZoneList<LEnvironment*> deoptimizations_; | 376 ZoneList<LEnvironment*> deoptimizations_; |
| 363 ZoneList<Handle<Object> > deoptimization_literals_; | 377 ZoneList<Handle<Object> > deoptimization_literals_; |
| 364 int inlined_function_count_; | 378 int inlined_function_count_; |
| 365 Scope* const scope_; | 379 Scope* const scope_; |
| 366 Status status_; | 380 Status status_; |
| 367 TranslationBuffer translations_; | 381 TranslationBuffer translations_; |
| 368 ZoneList<LDeferredCode*> deferred_; | 382 ZoneList<LDeferredCode*> deferred_; |
| 369 bool dynamic_frame_alignment_; | 383 bool dynamic_frame_alignment_; |
| 370 int osr_pc_offset_; | 384 int osr_pc_offset_; |
| 371 int last_lazy_deopt_pc_; | 385 int last_lazy_deopt_pc_; |
| 386 bool frame_is_built_; |
| 372 | 387 |
| 373 // Builder that keeps track of safepoints in the code. The table | 388 // Builder that keeps track of safepoints in the code. The table |
| 374 // itself is emitted at the end of the generated code. | 389 // itself is emitted at the end of the generated code. |
| 375 SafepointTableBuilder safepoints_; | 390 SafepointTableBuilder safepoints_; |
| 376 | 391 |
| 377 // Compiler from a set of parallel moves to a sequential list of moves. | 392 // Compiler from a set of parallel moves to a sequential list of moves. |
| 378 LGapResolver resolver_; | 393 LGapResolver resolver_; |
| 379 | 394 |
| 380 Safepoint::Kind expected_safepoint_kind_; | 395 Safepoint::Kind expected_safepoint_kind_; |
| 381 | 396 |
| 382 class PushSafepointRegistersScope BASE_EMBEDDED { | 397 class PushSafepointRegistersScope BASE_EMBEDDED { |
| 383 public: | 398 public: |
| 384 explicit PushSafepointRegistersScope(LCodeGen* codegen) | 399 explicit PushSafepointRegistersScope(LCodeGen* codegen) |
| 385 : codegen_(codegen) { | 400 : codegen_(codegen) { |
| 386 ASSERT(codegen_->expected_safepoint_kind_ == Safepoint::kSimple); | 401 ASSERT(codegen_->expected_safepoint_kind_ == Safepoint::kSimple); |
| 387 codegen_->masm_->PushSafepointRegisters(); | 402 codegen_->masm_->PushSafepointRegisters(); |
| 388 codegen_->expected_safepoint_kind_ = Safepoint::kWithRegisters; | 403 codegen_->expected_safepoint_kind_ = Safepoint::kWithRegisters; |
| 404 ASSERT(codegen_->info()->is_calling()); |
| 389 } | 405 } |
| 390 | 406 |
| 391 ~PushSafepointRegistersScope() { | 407 ~PushSafepointRegistersScope() { |
| 392 ASSERT(codegen_->expected_safepoint_kind_ == Safepoint::kWithRegisters); | 408 ASSERT(codegen_->expected_safepoint_kind_ == Safepoint::kWithRegisters); |
| 393 codegen_->masm_->PopSafepointRegisters(); | 409 codegen_->masm_->PopSafepointRegisters(); |
| 394 codegen_->expected_safepoint_kind_ = Safepoint::kSimple; | 410 codegen_->expected_safepoint_kind_ = Safepoint::kSimple; |
| 395 } | 411 } |
| 396 | 412 |
| 397 private: | 413 private: |
| 398 LCodeGen* codegen_; | 414 LCodeGen* codegen_; |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 431 LCodeGen* codegen_; | 447 LCodeGen* codegen_; |
| 432 Label entry_; | 448 Label entry_; |
| 433 Label exit_; | 449 Label exit_; |
| 434 Label* external_exit_; | 450 Label* external_exit_; |
| 435 int instruction_index_; | 451 int instruction_index_; |
| 436 }; | 452 }; |
| 437 | 453 |
| 438 } } // namespace v8::internal | 454 } } // namespace v8::internal |
| 439 | 455 |
| 440 #endif // V8_IA32_LITHIUM_CODEGEN_IA32_H_ | 456 #endif // V8_IA32_LITHIUM_CODEGEN_IA32_H_ |
| OLD | NEW |