| 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 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 54 deoptimizations_(4, info->zone()), | 54 deoptimizations_(4, info->zone()), |
| 55 deopt_jump_table_(4, info->zone()), | 55 deopt_jump_table_(4, info->zone()), |
| 56 deoptimization_literals_(8, info->zone()), | 56 deoptimization_literals_(8, info->zone()), |
| 57 inlined_function_count_(0), | 57 inlined_function_count_(0), |
| 58 scope_(info->scope()), | 58 scope_(info->scope()), |
| 59 status_(UNUSED), | 59 status_(UNUSED), |
| 60 translations_(info->zone()), | 60 translations_(info->zone()), |
| 61 deferred_(8, info->zone()), | 61 deferred_(8, info->zone()), |
| 62 osr_pc_offset_(-1), | 62 osr_pc_offset_(-1), |
| 63 last_lazy_deopt_pc_(0), | 63 last_lazy_deopt_pc_(0), |
| 64 frame_is_built_(false), |
| 64 safepoints_(info->zone()), | 65 safepoints_(info->zone()), |
| 65 resolver_(this), | 66 resolver_(this), |
| 66 expected_safepoint_kind_(Safepoint::kSimple) { | 67 expected_safepoint_kind_(Safepoint::kSimple) { |
| 67 PopulateDeoptimizationLiteralsWithInlinedFunctions(); | 68 PopulateDeoptimizationLiteralsWithInlinedFunctions(); |
| 68 } | 69 } |
| 69 | 70 |
| 70 | 71 |
| 71 // Simple accessors. | 72 // Simple accessors. |
| 72 MacroAssembler* masm() const { return masm_; } | 73 MacroAssembler* masm() const { return masm_; } |
| 73 CompilationInfo* info() const { return info_; } | 74 CompilationInfo* info() const { return info_; } |
| 74 Isolate* isolate() const { return info_->isolate(); } | 75 Isolate* isolate() const { return info_->isolate(); } |
| 75 Factory* factory() const { return isolate()->factory(); } | 76 Factory* factory() const { return isolate()->factory(); } |
| 76 Heap* heap() const { return isolate()->heap(); } | 77 Heap* heap() const { return isolate()->heap(); } |
| 77 Zone* zone() const { return zone_; } | 78 Zone* zone() const { return zone_; } |
| 78 | 79 |
| 80 bool NeedsEagerFrame() const { |
| 81 return GetStackSlotCount() > 0 || |
| 82 info()->is_non_deferred_calling() || |
| 83 !info()->IsStub(); |
| 84 } |
| 85 bool NeedsDeferredFrame() const { |
| 86 return !NeedsEagerFrame() && info()->is_deferred_calling(); |
| 87 } |
| 88 |
| 79 // Support for converting LOperands to assembler types. | 89 // Support for converting LOperands to assembler types. |
| 80 // LOperand must be a register. | 90 // LOperand must be a register. |
| 81 Register ToRegister(LOperand* op) const; | 91 Register ToRegister(LOperand* op) const; |
| 82 | 92 |
| 83 // LOperand is loaded into scratch, unless already a register. | 93 // LOperand is loaded into scratch, unless already a register. |
| 84 Register EmitLoadRegister(LOperand* op, Register scratch); | 94 Register EmitLoadRegister(LOperand* op, Register scratch); |
| 85 | 95 |
| 86 // LOperand must be a double register. | 96 // LOperand must be a double register. |
| 87 DoubleRegister ToDoubleRegister(LOperand* op) const; | 97 DoubleRegister ToDoubleRegister(LOperand* op) const; |
| 88 | 98 |
| (...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 182 LInstruction* GetNextInstruction(); | 192 LInstruction* GetNextInstruction(); |
| 183 | 193 |
| 184 void EmitClassOfTest(Label* if_true, | 194 void EmitClassOfTest(Label* if_true, |
| 185 Label* if_false, | 195 Label* if_false, |
| 186 Handle<String> class_name, | 196 Handle<String> class_name, |
| 187 Register input, | 197 Register input, |
| 188 Register temporary, | 198 Register temporary, |
| 189 Register temporary2); | 199 Register temporary2); |
| 190 | 200 |
| 191 int GetStackSlotCount() const { return chunk()->spill_slot_count(); } | 201 int GetStackSlotCount() const { return chunk()->spill_slot_count(); } |
| 192 int GetParameterCount() const { return scope()->num_parameters(); } | 202 int GetParameterCount() const { return info()->num_parameters(); } |
| 193 | 203 |
| 194 void Abort(const char* reason); | 204 void Abort(const char* reason); |
| 195 void Comment(const char* format, ...); | 205 void Comment(const char* format, ...); |
| 196 | 206 |
| 197 void AddDeferredCode(LDeferredCode* code) { deferred_.Add(code, zone()); } | 207 void AddDeferredCode(LDeferredCode* code) { deferred_.Add(code, zone()); } |
| 198 | 208 |
| 199 // Code generation passes. Returns true if code generation should | 209 // Code generation passes. Returns true if code generation should |
| 200 // continue. | 210 // continue. |
| 201 bool GeneratePrologue(); | 211 bool GeneratePrologue(); |
| 202 bool GenerateBody(); | 212 bool GenerateBody(); |
| (...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 361 LEnvironment* env); | 371 LEnvironment* env); |
| 362 | 372 |
| 363 // Emits optimized code to deep-copy the contents of statically known | 373 // Emits optimized code to deep-copy the contents of statically known |
| 364 // object graphs (e.g. object literal boilerplate). | 374 // object graphs (e.g. object literal boilerplate). |
| 365 void EmitDeepCopy(Handle<JSObject> object, | 375 void EmitDeepCopy(Handle<JSObject> object, |
| 366 Register result, | 376 Register result, |
| 367 Register source, | 377 Register source, |
| 368 int* offset); | 378 int* offset); |
| 369 | 379 |
| 370 struct JumpTableEntry { | 380 struct JumpTableEntry { |
| 371 explicit inline JumpTableEntry(Address entry) | 381 inline JumpTableEntry(Address entry, bool frame, bool is_lazy) |
| 372 : label(), | 382 : label(), |
| 373 address(entry) { } | 383 address(entry), |
| 384 needs_frame(frame), |
| 385 is_lazy_deopt(is_lazy) { } |
| 374 Label label; | 386 Label label; |
| 375 Address address; | 387 Address address; |
| 388 bool needs_frame; |
| 389 bool is_lazy_deopt; |
| 376 }; | 390 }; |
| 377 | 391 |
| 378 void EnsureSpaceForLazyDeopt(); | 392 void EnsureSpaceForLazyDeopt(); |
| 379 void DoLoadKeyedExternalArray(LLoadKeyed* instr); | 393 void DoLoadKeyedExternalArray(LLoadKeyed* instr); |
| 380 void DoLoadKeyedFixedDoubleArray(LLoadKeyed* instr); | 394 void DoLoadKeyedFixedDoubleArray(LLoadKeyed* instr); |
| 381 void DoLoadKeyedFixedArray(LLoadKeyed* instr); | 395 void DoLoadKeyedFixedArray(LLoadKeyed* instr); |
| 382 void DoStoreKeyedExternalArray(LStoreKeyed* instr); | 396 void DoStoreKeyedExternalArray(LStoreKeyed* instr); |
| 383 void DoStoreKeyedFixedDoubleArray(LStoreKeyed* instr); | 397 void DoStoreKeyedFixedDoubleArray(LStoreKeyed* instr); |
| 384 void DoStoreKeyedFixedArray(LStoreKeyed* instr); | 398 void DoStoreKeyedFixedArray(LStoreKeyed* instr); |
| 385 | 399 |
| 386 Zone* zone_; | 400 Zone* zone_; |
| 387 LPlatformChunk* const chunk_; | 401 LPlatformChunk* const chunk_; |
| 388 MacroAssembler* const masm_; | 402 MacroAssembler* const masm_; |
| 389 CompilationInfo* const info_; | 403 CompilationInfo* const info_; |
| 390 | 404 |
| 391 int current_block_; | 405 int current_block_; |
| 392 int current_instruction_; | 406 int current_instruction_; |
| 393 const ZoneList<LInstruction*>* instructions_; | 407 const ZoneList<LInstruction*>* instructions_; |
| 394 ZoneList<LEnvironment*> deoptimizations_; | 408 ZoneList<LEnvironment*> deoptimizations_; |
| 395 ZoneList<JumpTableEntry> deopt_jump_table_; | 409 ZoneList<JumpTableEntry> deopt_jump_table_; |
| 396 ZoneList<Handle<Object> > deoptimization_literals_; | 410 ZoneList<Handle<Object> > deoptimization_literals_; |
| 397 int inlined_function_count_; | 411 int inlined_function_count_; |
| 398 Scope* const scope_; | 412 Scope* const scope_; |
| 399 Status status_; | 413 Status status_; |
| 400 TranslationBuffer translations_; | 414 TranslationBuffer translations_; |
| 401 ZoneList<LDeferredCode*> deferred_; | 415 ZoneList<LDeferredCode*> deferred_; |
| 402 int osr_pc_offset_; | 416 int osr_pc_offset_; |
| 403 int last_lazy_deopt_pc_; | 417 int last_lazy_deopt_pc_; |
| 418 bool frame_is_built_; |
| 404 | 419 |
| 405 // Builder that keeps track of safepoints in the code. The table | 420 // Builder that keeps track of safepoints in the code. The table |
| 406 // itself is emitted at the end of the generated code. | 421 // itself is emitted at the end of the generated code. |
| 407 SafepointTableBuilder safepoints_; | 422 SafepointTableBuilder safepoints_; |
| 408 | 423 |
| 409 // Compiler from a set of parallel moves to a sequential list of moves. | 424 // Compiler from a set of parallel moves to a sequential list of moves. |
| 410 LGapResolver resolver_; | 425 LGapResolver resolver_; |
| 411 | 426 |
| 412 Safepoint::Kind expected_safepoint_kind_; | 427 Safepoint::Kind expected_safepoint_kind_; |
| 413 | 428 |
| 414 class PushSafepointRegistersScope BASE_EMBEDDED { | 429 class PushSafepointRegistersScope BASE_EMBEDDED { |
| 415 public: | 430 public: |
| 416 PushSafepointRegistersScope(LCodeGen* codegen, | 431 PushSafepointRegistersScope(LCodeGen* codegen, |
| 417 Safepoint::Kind kind) | 432 Safepoint::Kind kind) |
| 418 : codegen_(codegen) { | 433 : codegen_(codegen) { |
| 434 ASSERT(codegen_->info()->is_calling()); |
| 419 ASSERT(codegen_->expected_safepoint_kind_ == Safepoint::kSimple); | 435 ASSERT(codegen_->expected_safepoint_kind_ == Safepoint::kSimple); |
| 420 codegen_->expected_safepoint_kind_ = kind; | 436 codegen_->expected_safepoint_kind_ = kind; |
| 421 | 437 |
| 422 switch (codegen_->expected_safepoint_kind_) { | 438 switch (codegen_->expected_safepoint_kind_) { |
| 423 case Safepoint::kWithRegisters: | 439 case Safepoint::kWithRegisters: |
| 424 codegen_->masm_->PushSafepointRegisters(); | 440 codegen_->masm_->PushSafepointRegisters(); |
| 425 break; | 441 break; |
| 426 case Safepoint::kWithRegistersAndDoubles: | 442 case Safepoint::kWithRegistersAndDoubles: |
| 427 codegen_->masm_->PushSafepointRegistersAndDoubles(); | 443 codegen_->masm_->PushSafepointRegistersAndDoubles(); |
| 428 break; | 444 break; |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 484 LCodeGen* codegen_; | 500 LCodeGen* codegen_; |
| 485 Label entry_; | 501 Label entry_; |
| 486 Label exit_; | 502 Label exit_; |
| 487 Label* external_exit_; | 503 Label* external_exit_; |
| 488 int instruction_index_; | 504 int instruction_index_; |
| 489 }; | 505 }; |
| 490 | 506 |
| 491 } } // namespace v8::internal | 507 } } // namespace v8::internal |
| 492 | 508 |
| 493 #endif // V8_MIPS_LITHIUM_CODEGEN_MIPS_H_ | 509 #endif // V8_MIPS_LITHIUM_CODEGEN_MIPS_H_ |
| OLD | NEW |