| 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 27 matching lines...) Expand all Loading... |
| 38 #include "v8utils.h" | 38 #include "v8utils.h" |
| 39 | 39 |
| 40 namespace v8 { | 40 namespace v8 { |
| 41 namespace internal { | 41 namespace internal { |
| 42 | 42 |
| 43 // Forward declarations. | 43 // Forward declarations. |
| 44 class LDeferredCode; | 44 class LDeferredCode; |
| 45 class LGapNode; | 45 class LGapNode; |
| 46 class SafepointGenerator; | 46 class SafepointGenerator; |
| 47 | 47 |
| 48 class LCodeGen BASE_EMBEDDED { | 48 class LCodeGen V8_FINAL BASE_EMBEDDED { |
| 49 public: | 49 public: |
| 50 LCodeGen(LChunk* chunk, MacroAssembler* assembler, CompilationInfo* info) | 50 LCodeGen(LChunk* chunk, MacroAssembler* assembler, CompilationInfo* info) |
| 51 : zone_(info->zone()), | 51 : zone_(info->zone()), |
| 52 chunk_(static_cast<LPlatformChunk*>(chunk)), | 52 chunk_(static_cast<LPlatformChunk*>(chunk)), |
| 53 masm_(assembler), | 53 masm_(assembler), |
| 54 info_(info), | 54 info_(info), |
| 55 current_block_(-1), | 55 current_block_(-1), |
| 56 current_instruction_(-1), | 56 current_instruction_(-1), |
| 57 instructions_(chunk->instructions()), | 57 instructions_(chunk->instructions()), |
| 58 deoptimizations_(4, info->zone()), | 58 deoptimizations_(4, info->zone()), |
| (...skipping 386 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 445 // itself is emitted at the end of the generated code. | 445 // itself is emitted at the end of the generated code. |
| 446 SafepointTableBuilder safepoints_; | 446 SafepointTableBuilder safepoints_; |
| 447 | 447 |
| 448 // Compiler from a set of parallel moves to a sequential list of moves. | 448 // Compiler from a set of parallel moves to a sequential list of moves. |
| 449 LGapResolver resolver_; | 449 LGapResolver resolver_; |
| 450 | 450 |
| 451 Safepoint::Kind expected_safepoint_kind_; | 451 Safepoint::Kind expected_safepoint_kind_; |
| 452 | 452 |
| 453 int old_position_; | 453 int old_position_; |
| 454 | 454 |
| 455 class PushSafepointRegistersScope BASE_EMBEDDED { | 455 class PushSafepointRegistersScope V8_FINAL BASE_EMBEDDED { |
| 456 public: | 456 public: |
| 457 explicit PushSafepointRegistersScope(LCodeGen* codegen) | 457 explicit PushSafepointRegistersScope(LCodeGen* codegen) |
| 458 : codegen_(codegen) { | 458 : codegen_(codegen) { |
| 459 ASSERT(codegen_->expected_safepoint_kind_ == Safepoint::kSimple); | 459 ASSERT(codegen_->expected_safepoint_kind_ == Safepoint::kSimple); |
| 460 codegen_->masm_->PushSafepointRegisters(); | 460 codegen_->masm_->PushSafepointRegisters(); |
| 461 codegen_->expected_safepoint_kind_ = Safepoint::kWithRegisters; | 461 codegen_->expected_safepoint_kind_ = Safepoint::kWithRegisters; |
| 462 ASSERT(codegen_->info()->is_calling()); | 462 ASSERT(codegen_->info()->is_calling()); |
| 463 } | 463 } |
| 464 | 464 |
| 465 ~PushSafepointRegistersScope() { | 465 ~PushSafepointRegistersScope() { |
| 466 ASSERT(codegen_->expected_safepoint_kind_ == Safepoint::kWithRegisters); | 466 ASSERT(codegen_->expected_safepoint_kind_ == Safepoint::kWithRegisters); |
| 467 codegen_->masm_->PopSafepointRegisters(); | 467 codegen_->masm_->PopSafepointRegisters(); |
| 468 codegen_->expected_safepoint_kind_ = Safepoint::kSimple; | 468 codegen_->expected_safepoint_kind_ = Safepoint::kSimple; |
| 469 } | 469 } |
| 470 | 470 |
| 471 private: | 471 private: |
| 472 LCodeGen* codegen_; | 472 LCodeGen* codegen_; |
| 473 }; | 473 }; |
| 474 | 474 |
| 475 friend class LDeferredCode; | 475 friend class LDeferredCode; |
| 476 friend class LEnvironment; | 476 friend class LEnvironment; |
| 477 friend class SafepointGenerator; | 477 friend class SafepointGenerator; |
| 478 DISALLOW_COPY_AND_ASSIGN(LCodeGen); | 478 DISALLOW_COPY_AND_ASSIGN(LCodeGen); |
| 479 }; | 479 }; |
| 480 | 480 |
| 481 | 481 |
| 482 class LDeferredCode: public ZoneObject { | 482 class LDeferredCode : public ZoneObject { |
| 483 public: | 483 public: |
| 484 explicit LDeferredCode(LCodeGen* codegen) | 484 explicit LDeferredCode(LCodeGen* codegen) |
| 485 : codegen_(codegen), | 485 : codegen_(codegen), |
| 486 external_exit_(NULL), | 486 external_exit_(NULL), |
| 487 instruction_index_(codegen->current_instruction_) { | 487 instruction_index_(codegen->current_instruction_) { |
| 488 codegen->AddDeferredCode(this); | 488 codegen->AddDeferredCode(this); |
| 489 } | 489 } |
| 490 | 490 |
| 491 virtual ~LDeferredCode() { } | 491 virtual ~LDeferredCode() {} |
| 492 virtual void Generate() = 0; | 492 virtual void Generate() = 0; |
| 493 virtual LInstruction* instr() = 0; | 493 virtual LInstruction* instr() = 0; |
| 494 | 494 |
| 495 void SetExit(Label* exit) { external_exit_ = exit; } | 495 void SetExit(Label* exit) { external_exit_ = exit; } |
| 496 Label* entry() { return &entry_; } | 496 Label* entry() { return &entry_; } |
| 497 Label* exit() { return external_exit_ != NULL ? external_exit_ : &exit_; } | 497 Label* exit() { return external_exit_ != NULL ? external_exit_ : &exit_; } |
| 498 int instruction_index() const { return instruction_index_; } | 498 int instruction_index() const { return instruction_index_; } |
| 499 | 499 |
| 500 protected: | 500 protected: |
| 501 LCodeGen* codegen() const { return codegen_; } | 501 LCodeGen* codegen() const { return codegen_; } |
| 502 MacroAssembler* masm() const { return codegen_->masm(); } | 502 MacroAssembler* masm() const { return codegen_->masm(); } |
| 503 | 503 |
| 504 private: | 504 private: |
| 505 LCodeGen* codegen_; | 505 LCodeGen* codegen_; |
| 506 Label entry_; | 506 Label entry_; |
| 507 Label exit_; | 507 Label exit_; |
| 508 Label* external_exit_; | 508 Label* external_exit_; |
| 509 int instruction_index_; | 509 int instruction_index_; |
| 510 }; | 510 }; |
| 511 | 511 |
| 512 } } // namespace v8::internal | 512 } } // namespace v8::internal |
| 513 | 513 |
| 514 #endif // V8_IA32_LITHIUM_CODEGEN_IA32_H_ | 514 #endif // V8_IA32_LITHIUM_CODEGEN_IA32_H_ |
| OLD | NEW |