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 24 matching lines...) Expand all Loading... |
35 #include "scopes.h" | 35 #include "scopes.h" |
36 #include "v8utils.h" | 36 #include "v8utils.h" |
37 | 37 |
38 namespace v8 { | 38 namespace v8 { |
39 namespace internal { | 39 namespace internal { |
40 | 40 |
41 // Forward declarations. | 41 // Forward declarations. |
42 class LDeferredCode; | 42 class LDeferredCode; |
43 class SafepointGenerator; | 43 class SafepointGenerator; |
44 | 44 |
45 class LCodeGen V8_FINAL BASE_EMBEDDED { | 45 class LCodeGen BASE_EMBEDDED { |
46 public: | 46 public: |
47 LCodeGen(LChunk* chunk, MacroAssembler* assembler, CompilationInfo* info) | 47 LCodeGen(LChunk* chunk, MacroAssembler* assembler, CompilationInfo* info) |
48 : zone_(info->zone()), | 48 : zone_(info->zone()), |
49 chunk_(static_cast<LPlatformChunk*>(chunk)), | 49 chunk_(static_cast<LPlatformChunk*>(chunk)), |
50 masm_(assembler), | 50 masm_(assembler), |
51 info_(info), | 51 info_(info), |
52 current_block_(-1), | 52 current_block_(-1), |
53 current_instruction_(-1), | 53 current_instruction_(-1), |
54 instructions_(chunk->instructions()), | 54 instructions_(chunk->instructions()), |
55 deoptimizations_(4, info->zone()), | 55 deoptimizations_(4, info->zone()), |
(...skipping 378 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
434 // itself is emitted at the end of the generated code. | 434 // itself is emitted at the end of the generated code. |
435 SafepointTableBuilder safepoints_; | 435 SafepointTableBuilder safepoints_; |
436 | 436 |
437 // Compiler from a set of parallel moves to a sequential list of moves. | 437 // Compiler from a set of parallel moves to a sequential list of moves. |
438 LGapResolver resolver_; | 438 LGapResolver resolver_; |
439 | 439 |
440 Safepoint::Kind expected_safepoint_kind_; | 440 Safepoint::Kind expected_safepoint_kind_; |
441 | 441 |
442 int old_position_; | 442 int old_position_; |
443 | 443 |
444 class PushSafepointRegistersScope V8_FINAL BASE_EMBEDDED { | 444 class PushSafepointRegistersScope BASE_EMBEDDED { |
445 public: | 445 public: |
446 PushSafepointRegistersScope(LCodeGen* codegen, | 446 PushSafepointRegistersScope(LCodeGen* codegen, |
447 Safepoint::Kind kind) | 447 Safepoint::Kind kind) |
448 : codegen_(codegen) { | 448 : codegen_(codegen) { |
449 ASSERT(codegen_->info()->is_calling()); | 449 ASSERT(codegen_->info()->is_calling()); |
450 ASSERT(codegen_->expected_safepoint_kind_ == Safepoint::kSimple); | 450 ASSERT(codegen_->expected_safepoint_kind_ == Safepoint::kSimple); |
451 codegen_->expected_safepoint_kind_ = kind; | 451 codegen_->expected_safepoint_kind_ = kind; |
452 | 452 |
453 switch (codegen_->expected_safepoint_kind_) { | 453 switch (codegen_->expected_safepoint_kind_) { |
454 case Safepoint::kWithRegisters: | 454 case Safepoint::kWithRegisters: |
(...skipping 27 matching lines...) Expand all Loading... |
482 LCodeGen* codegen_; | 482 LCodeGen* codegen_; |
483 }; | 483 }; |
484 | 484 |
485 friend class LDeferredCode; | 485 friend class LDeferredCode; |
486 friend class LEnvironment; | 486 friend class LEnvironment; |
487 friend class SafepointGenerator; | 487 friend class SafepointGenerator; |
488 DISALLOW_COPY_AND_ASSIGN(LCodeGen); | 488 DISALLOW_COPY_AND_ASSIGN(LCodeGen); |
489 }; | 489 }; |
490 | 490 |
491 | 491 |
492 class LDeferredCode : public ZoneObject { | 492 class LDeferredCode: public ZoneObject { |
493 public: | 493 public: |
494 explicit LDeferredCode(LCodeGen* codegen) | 494 explicit LDeferredCode(LCodeGen* codegen) |
495 : codegen_(codegen), | 495 : codegen_(codegen), |
496 external_exit_(NULL), | 496 external_exit_(NULL), |
497 instruction_index_(codegen->current_instruction_) { | 497 instruction_index_(codegen->current_instruction_) { |
498 codegen->AddDeferredCode(this); | 498 codegen->AddDeferredCode(this); |
499 } | 499 } |
500 | 500 |
501 virtual ~LDeferredCode() {} | 501 virtual ~LDeferredCode() { } |
502 virtual void Generate() = 0; | 502 virtual void Generate() = 0; |
503 virtual LInstruction* instr() = 0; | 503 virtual LInstruction* instr() = 0; |
504 | 504 |
505 void SetExit(Label* exit) { external_exit_ = exit; } | 505 void SetExit(Label* exit) { external_exit_ = exit; } |
506 Label* entry() { return &entry_; } | 506 Label* entry() { return &entry_; } |
507 Label* exit() { return external_exit_ != NULL ? external_exit_ : &exit_; } | 507 Label* exit() { return external_exit_ != NULL ? external_exit_ : &exit_; } |
508 int instruction_index() const { return instruction_index_; } | 508 int instruction_index() const { return instruction_index_; } |
509 | 509 |
510 protected: | 510 protected: |
511 LCodeGen* codegen() const { return codegen_; } | 511 LCodeGen* codegen() const { return codegen_; } |
512 MacroAssembler* masm() const { return codegen_->masm(); } | 512 MacroAssembler* masm() const { return codegen_->masm(); } |
513 | 513 |
514 private: | 514 private: |
515 LCodeGen* codegen_; | 515 LCodeGen* codegen_; |
516 Label entry_; | 516 Label entry_; |
517 Label exit_; | 517 Label exit_; |
518 Label* external_exit_; | 518 Label* external_exit_; |
519 int instruction_index_; | 519 int instruction_index_; |
520 }; | 520 }; |
521 | 521 |
522 } } // namespace v8::internal | 522 } } // namespace v8::internal |
523 | 523 |
524 #endif // V8_MIPS_LITHIUM_CODEGEN_MIPS_H_ | 524 #endif // V8_MIPS_LITHIUM_CODEGEN_MIPS_H_ |
OLD | NEW |