Chromium Code Reviews| 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 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 56 deoptimizations_(4, info->zone()), | 56 deoptimizations_(4, info->zone()), |
| 57 jump_table_(4, info->zone()), | 57 jump_table_(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 osr_pc_offset_(-1), | 64 osr_pc_offset_(-1), |
| 65 last_lazy_deopt_pc_(0), | 65 last_lazy_deopt_pc_(0), |
| 66 frame_is_built_(false), | |
| 66 safepoints_(info->zone()), | 67 safepoints_(info->zone()), |
| 67 resolver_(this), | 68 resolver_(this), |
| 68 expected_safepoint_kind_(Safepoint::kSimple) { | 69 expected_safepoint_kind_(Safepoint::kSimple) { |
| 69 PopulateDeoptimizationLiteralsWithInlinedFunctions(); | 70 PopulateDeoptimizationLiteralsWithInlinedFunctions(); |
| 70 } | 71 } |
| 71 | 72 |
| 72 // Simple accessors. | 73 // Simple accessors. |
| 73 MacroAssembler* masm() const { return masm_; } | 74 MacroAssembler* masm() const { return masm_; } |
| 74 CompilationInfo* info() const { return info_; } | 75 CompilationInfo* info() const { return info_; } |
| 75 Isolate* isolate() const { return info_->isolate(); } | 76 Isolate* isolate() const { return info_->isolate(); } |
| 76 Factory* factory() const { return isolate()->factory(); } | 77 Factory* factory() const { return isolate()->factory(); } |
| 77 Heap* heap() const { return isolate()->heap(); } | 78 Heap* heap() const { return isolate()->heap(); } |
| 78 Zone* zone() const { return zone_; } | 79 Zone* zone() const { return zone_; } |
| 79 | 80 |
| 81 bool NeedsEagerFrame() const { | |
| 82 return GetStackSlotCount() > 0 || | |
| 83 info()->is_non_deferred_calling() || | |
| 84 !info()->IsStub(); | |
| 85 } | |
| 86 bool NeedsDeferredFrame() const { | |
| 87 return !NeedsEagerFrame() && info()->is_deferred_calling(); | |
| 88 } | |
| 89 | |
| 80 // Support for converting LOperands to assembler types. | 90 // Support for converting LOperands to assembler types. |
| 81 Register ToRegister(LOperand* op) const; | 91 Register ToRegister(LOperand* op) const; |
| 82 XMMRegister ToDoubleRegister(LOperand* op) const; | 92 XMMRegister ToDoubleRegister(LOperand* op) const; |
| 83 bool IsInteger32Constant(LConstantOperand* op) const; | 93 bool IsInteger32Constant(LConstantOperand* op) const; |
| 84 int ToInteger32(LConstantOperand* op) const; | 94 int ToInteger32(LConstantOperand* op) const; |
| 85 double ToDouble(LConstantOperand* op) const; | 95 double ToDouble(LConstantOperand* op) const; |
| 86 bool IsTaggedConstant(LConstantOperand* op) const; | 96 bool IsTaggedConstant(LConstantOperand* op) const; |
| 87 Handle<Object> ToHandle(LConstantOperand* op) const; | 97 Handle<Object> ToHandle(LConstantOperand* op) const; |
| 88 Operand ToOperand(LOperand* op) const; | 98 Operand ToOperand(LOperand* op) const; |
| 89 | 99 |
| (...skipping 13 matching lines...) Expand all Loading... | |
| 103 void DoDeferredMathAbsTaggedHeapNumber(LUnaryMathOperation* instr); | 113 void DoDeferredMathAbsTaggedHeapNumber(LUnaryMathOperation* instr); |
| 104 void DoDeferredStackCheck(LStackCheck* instr); | 114 void DoDeferredStackCheck(LStackCheck* instr); |
| 105 void DoDeferredRandom(LRandom* instr); | 115 void DoDeferredRandom(LRandom* instr); |
| 106 void DoDeferredStringCharCodeAt(LStringCharCodeAt* instr); | 116 void DoDeferredStringCharCodeAt(LStringCharCodeAt* instr); |
| 107 void DoDeferredStringCharFromCode(LStringCharFromCode* instr); | 117 void DoDeferredStringCharFromCode(LStringCharFromCode* instr); |
| 108 void DoDeferredAllocateObject(LAllocateObject* instr); | 118 void DoDeferredAllocateObject(LAllocateObject* instr); |
| 109 void DoDeferredInstanceOfKnownGlobal(LInstanceOfKnownGlobal* instr, | 119 void DoDeferredInstanceOfKnownGlobal(LInstanceOfKnownGlobal* instr, |
| 110 Label* map_check); | 120 Label* map_check); |
| 111 | 121 |
| 112 void DoCheckMapCommon(Register reg, Handle<Map> map, | 122 void DoCheckMapCommon(Register reg, Handle<Map> map, |
| 113 CompareMapMode mode, LEnvironment* env); | 123 CompareMapMode mode, LInstruction* instr); |
| 114 | 124 |
| 115 // Parallel move support. | 125 // Parallel move support. |
| 116 void DoParallelMove(LParallelMove* move); | 126 void DoParallelMove(LParallelMove* move); |
| 117 void DoGap(LGap* instr); | 127 void DoGap(LGap* instr); |
| 118 | 128 |
| 119 // Emit frame translation commands for an environment. | 129 // Emit frame translation commands for an environment. |
| 120 void WriteTranslation(LEnvironment* environment, | 130 void WriteTranslation(LEnvironment* environment, |
| 121 Translation* translation, | 131 Translation* translation, |
| 122 int* arguments_index, | 132 int* arguments_index, |
| 123 int* arguments_count); | 133 int* arguments_count); |
| (...skipping 27 matching lines...) Expand all Loading... | |
| 151 int GetNextEmittedBlock(int block); | 161 int GetNextEmittedBlock(int block); |
| 152 | 162 |
| 153 void EmitClassOfTest(Label* if_true, | 163 void EmitClassOfTest(Label* if_true, |
| 154 Label* if_false, | 164 Label* if_false, |
| 155 Handle<String> class_name, | 165 Handle<String> class_name, |
| 156 Register input, | 166 Register input, |
| 157 Register temporary, | 167 Register temporary, |
| 158 Register scratch); | 168 Register scratch); |
| 159 | 169 |
| 160 int GetStackSlotCount() const { return chunk()->spill_slot_count(); } | 170 int GetStackSlotCount() const { return chunk()->spill_slot_count(); } |
| 161 int GetParameterCount() const { return scope()->num_parameters(); } | 171 int GetParameterCount() const { return info()->num_parameters(); } |
| 162 | 172 |
| 163 void Abort(const char* reason); | 173 void Abort(const char* reason); |
| 164 void Comment(const char* format, ...); | 174 void Comment(const char* format, ...); |
| 165 | 175 |
| 166 void AddDeferredCode(LDeferredCode* code) { deferred_.Add(code, zone()); } | 176 void AddDeferredCode(LDeferredCode* code) { deferred_.Add(code, zone()); } |
| 167 | 177 |
| 168 // Code generation passes. Returns true if code generation should | 178 // Code generation passes. Returns true if code generation should |
| 169 // continue. | 179 // continue. |
| 170 bool GeneratePrologue(); | 180 bool GeneratePrologue(); |
| 171 bool GenerateBody(); | 181 bool GenerateBody(); |
| (...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 320 void EmitPushTaggedOperand(LOperand* operand); | 330 void EmitPushTaggedOperand(LOperand* operand); |
| 321 | 331 |
| 322 // Emits optimized code to deep-copy the contents of statically known | 332 // Emits optimized code to deep-copy the contents of statically known |
| 323 // object graphs (e.g. object literal boilerplate). | 333 // object graphs (e.g. object literal boilerplate). |
| 324 void EmitDeepCopy(Handle<JSObject> object, | 334 void EmitDeepCopy(Handle<JSObject> object, |
| 325 Register result, | 335 Register result, |
| 326 Register source, | 336 Register source, |
| 327 int* offset); | 337 int* offset); |
| 328 | 338 |
| 329 struct JumpTableEntry { | 339 struct JumpTableEntry { |
| 330 explicit inline JumpTableEntry(Address entry) | 340 explicit inline JumpTableEntry(Address entry, bool frame, bool is_lazy) |
|
Jakob Kummerow
2012/11/28 16:28:22
nit: no need for explicit
danno
2012/11/30 16:23:24
Done.
| |
| 331 : label(), | 341 : label(), |
| 332 address(entry) { } | 342 address(entry), |
| 343 needs_frame(frame), | |
| 344 is_lazy_deopt(is_lazy) { } | |
| 333 Label label; | 345 Label label; |
| 334 Address address; | 346 Address address; |
| 347 bool needs_frame; | |
| 348 bool is_lazy_deopt; | |
| 335 }; | 349 }; |
| 336 | 350 |
| 337 void EnsureSpaceForLazyDeopt(int space_needed); | 351 void EnsureSpaceForLazyDeopt(int space_needed); |
| 338 void DoLoadKeyedExternalArray(LLoadKeyed* instr); | 352 void DoLoadKeyedExternalArray(LLoadKeyed* instr); |
| 339 void DoLoadKeyedFixedDoubleArray(LLoadKeyed* instr); | 353 void DoLoadKeyedFixedDoubleArray(LLoadKeyed* instr); |
| 340 void DoLoadKeyedFixedArray(LLoadKeyed* instr); | 354 void DoLoadKeyedFixedArray(LLoadKeyed* instr); |
| 341 void DoStoreKeyedExternalArray(LStoreKeyed* instr); | 355 void DoStoreKeyedExternalArray(LStoreKeyed* instr); |
| 342 void DoStoreKeyedFixedDoubleArray(LStoreKeyed* instr); | 356 void DoStoreKeyedFixedDoubleArray(LStoreKeyed* instr); |
| 343 void DoStoreKeyedFixedArray(LStoreKeyed* instr); | 357 void DoStoreKeyedFixedArray(LStoreKeyed* instr); |
| 344 | 358 |
| 345 Zone* zone_; | 359 Zone* zone_; |
| 346 LPlatformChunk* const chunk_; | 360 LPlatformChunk* const chunk_; |
| 347 MacroAssembler* const masm_; | 361 MacroAssembler* const masm_; |
| 348 CompilationInfo* const info_; | 362 CompilationInfo* const info_; |
| 349 | 363 |
| 350 int current_block_; | 364 int current_block_; |
| 351 int current_instruction_; | 365 int current_instruction_; |
| 352 const ZoneList<LInstruction*>* instructions_; | 366 const ZoneList<LInstruction*>* instructions_; |
| 353 ZoneList<LEnvironment*> deoptimizations_; | 367 ZoneList<LEnvironment*> deoptimizations_; |
| 354 ZoneList<JumpTableEntry> jump_table_; | 368 ZoneList<JumpTableEntry> jump_table_; |
| 355 ZoneList<Handle<Object> > deoptimization_literals_; | 369 ZoneList<Handle<Object> > deoptimization_literals_; |
| 356 int inlined_function_count_; | 370 int inlined_function_count_; |
| 357 Scope* const scope_; | 371 Scope* const scope_; |
| 358 Status status_; | 372 Status status_; |
| 359 TranslationBuffer translations_; | 373 TranslationBuffer translations_; |
| 360 ZoneList<LDeferredCode*> deferred_; | 374 ZoneList<LDeferredCode*> deferred_; |
| 361 int osr_pc_offset_; | 375 int osr_pc_offset_; |
| 362 int last_lazy_deopt_pc_; | 376 int last_lazy_deopt_pc_; |
| 377 bool frame_is_built_; | |
| 363 | 378 |
| 364 // Builder that keeps track of safepoints in the code. The table | 379 // Builder that keeps track of safepoints in the code. The table |
| 365 // itself is emitted at the end of the generated code. | 380 // itself is emitted at the end of the generated code. |
| 366 SafepointTableBuilder safepoints_; | 381 SafepointTableBuilder safepoints_; |
| 367 | 382 |
| 368 // Compiler from a set of parallel moves to a sequential list of moves. | 383 // Compiler from a set of parallel moves to a sequential list of moves. |
| 369 LGapResolver resolver_; | 384 LGapResolver resolver_; |
| 370 | 385 |
| 371 Safepoint::Kind expected_safepoint_kind_; | 386 Safepoint::Kind expected_safepoint_kind_; |
| 372 | 387 |
| 373 class PushSafepointRegistersScope BASE_EMBEDDED { | 388 class PushSafepointRegistersScope BASE_EMBEDDED { |
| 374 public: | 389 public: |
| 375 explicit PushSafepointRegistersScope(LCodeGen* codegen) | 390 explicit PushSafepointRegistersScope(LCodeGen* codegen) |
| 376 : codegen_(codegen) { | 391 : codegen_(codegen) { |
| 392 ASSERT(codegen_->info()->is_calling()); | |
| 377 ASSERT(codegen_->expected_safepoint_kind_ == Safepoint::kSimple); | 393 ASSERT(codegen_->expected_safepoint_kind_ == Safepoint::kSimple); |
| 378 codegen_->masm_->PushSafepointRegisters(); | 394 codegen_->masm_->PushSafepointRegisters(); |
| 379 codegen_->expected_safepoint_kind_ = Safepoint::kWithRegisters; | 395 codegen_->expected_safepoint_kind_ = Safepoint::kWithRegisters; |
| 380 } | 396 } |
| 381 | 397 |
| 382 ~PushSafepointRegistersScope() { | 398 ~PushSafepointRegistersScope() { |
| 383 ASSERT(codegen_->expected_safepoint_kind_ == Safepoint::kWithRegisters); | 399 ASSERT(codegen_->expected_safepoint_kind_ == Safepoint::kWithRegisters); |
| 384 codegen_->masm_->PopSafepointRegisters(); | 400 codegen_->masm_->PopSafepointRegisters(); |
| 385 codegen_->expected_safepoint_kind_ = Safepoint::kSimple; | 401 codegen_->expected_safepoint_kind_ = Safepoint::kSimple; |
| 386 } | 402 } |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 422 LCodeGen* codegen_; | 438 LCodeGen* codegen_; |
| 423 Label entry_; | 439 Label entry_; |
| 424 Label exit_; | 440 Label exit_; |
| 425 Label* external_exit_; | 441 Label* external_exit_; |
| 426 int instruction_index_; | 442 int instruction_index_; |
| 427 }; | 443 }; |
| 428 | 444 |
| 429 } } // namespace v8::internal | 445 } } // namespace v8::internal |
| 430 | 446 |
| 431 #endif // V8_X64_LITHIUM_CODEGEN_X64_H_ | 447 #endif // V8_X64_LITHIUM_CODEGEN_X64_H_ |
| OLD | NEW |