| 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 430 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 441 TranslationBuffer translations_; | 441 TranslationBuffer translations_; |
| 442 ZoneList<LDeferredCode*> deferred_; | 442 ZoneList<LDeferredCode*> deferred_; |
| 443 bool dynamic_frame_alignment_; | 443 bool dynamic_frame_alignment_; |
| 444 bool support_aligned_spilled_doubles_; | 444 bool support_aligned_spilled_doubles_; |
| 445 int osr_pc_offset_; | 445 int osr_pc_offset_; |
| 446 int last_lazy_deopt_pc_; | 446 int last_lazy_deopt_pc_; |
| 447 bool frame_is_built_; | 447 bool frame_is_built_; |
| 448 | 448 |
| 449 class X87Stack { | 449 class X87Stack { |
| 450 public: | 450 public: |
| 451 explicit X87Stack(MacroAssembler* masm) | 451 explicit X87Stack(MacroAssembler* masm) : stack_depth_(0), masm_(masm) { } |
| 452 : stack_depth_(0), is_mutable_(true), masm_(masm) { } | |
| 453 explicit X87Stack(const X87Stack& other) | 452 explicit X87Stack(const X87Stack& other) |
| 454 : stack_depth_(other.stack_depth_), is_mutable_(false), masm_(masm()) { | 453 : stack_depth_(0), masm_(other.masm_) { |
| 454 stack_depth_ = other.stack_depth_; |
| 455 for (int i = 0; i < stack_depth_; i++) { | 455 for (int i = 0; i < stack_depth_; i++) { |
| 456 stack_[i] = other.stack_[i]; | 456 stack_[i] = other.stack_[i]; |
| 457 } | 457 } |
| 458 } | 458 } |
| 459 bool operator==(const X87Stack& other) const { | 459 bool operator==(const X87Stack& other) const { |
| 460 if (stack_depth_ != other.stack_depth_) return false; | 460 if (stack_depth_ != other.stack_depth_) return false; |
| 461 for (int i = 0; i < stack_depth_; i++) { | 461 for (int i = 0; i < stack_depth_; i++) { |
| 462 if (!stack_[i].is(other.stack_[i])) return false; | 462 if (!stack_[i].is(other.stack_[i])) return false; |
| 463 } | 463 } |
| 464 return true; | 464 return true; |
| 465 } | 465 } |
| 466 bool Contains(X87Register reg); | 466 bool Contains(X87Register reg); |
| 467 void Fxch(X87Register reg, int other_slot = 0); | 467 void Fxch(X87Register reg, int other_slot = 0); |
| 468 void Free(X87Register reg); | 468 void Free(X87Register reg); |
| 469 void PrepareToWrite(X87Register reg); | 469 void PrepareToWrite(X87Register reg); |
| 470 void CommitWrite(X87Register reg); | 470 void CommitWrite(X87Register reg); |
| 471 void FlushIfNecessary(LInstruction* instr, LCodeGen* cgen); | 471 void FlushIfNecessary(LInstruction* instr, LCodeGen* cgen); |
| 472 int depth() const { return stack_depth_; } | 472 int depth() const { return stack_depth_; } |
| 473 void pop() { | 473 void pop() { stack_depth_--; } |
| 474 ASSERT(is_mutable_); | |
| 475 stack_depth_--; | |
| 476 } | |
| 477 void push(X87Register reg) { | 474 void push(X87Register reg) { |
| 478 ASSERT(is_mutable_); | |
| 479 ASSERT(stack_depth_ < X87Register::kNumAllocatableRegisters); | 475 ASSERT(stack_depth_ < X87Register::kNumAllocatableRegisters); |
| 480 stack_[stack_depth_] = reg; | 476 stack_[stack_depth_] = reg; |
| 481 stack_depth_++; | 477 stack_depth_++; |
| 482 } | 478 } |
| 483 | 479 |
| 484 MacroAssembler* masm() const { return masm_; } | 480 MacroAssembler* masm() const { return masm_; } |
| 485 | 481 |
| 486 private: | 482 private: |
| 487 int ArrayIndex(X87Register reg); | 483 int ArrayIndex(X87Register reg); |
| 488 int st2idx(int pos); | 484 int st2idx(int pos); |
| 489 | |
| 490 X87Register stack_[X87Register::kNumAllocatableRegisters]; | 485 X87Register stack_[X87Register::kNumAllocatableRegisters]; |
| 491 int stack_depth_; | 486 int stack_depth_; |
| 492 bool is_mutable_; | 487 MacroAssembler* const masm_; |
| 493 MacroAssembler* masm_; | |
| 494 }; | 488 }; |
| 495 X87Stack x87_stack_; | 489 X87Stack x87_stack_; |
| 496 | 490 |
| 497 // Builder that keeps track of safepoints in the code. The table | 491 // Builder that keeps track of safepoints in the code. The table |
| 498 // itself is emitted at the end of the generated code. | 492 // itself is emitted at the end of the generated code. |
| 499 SafepointTableBuilder safepoints_; | 493 SafepointTableBuilder safepoints_; |
| 500 | 494 |
| 501 // Compiler from a set of parallel moves to a sequential list of moves. | 495 // Compiler from a set of parallel moves to a sequential list of moves. |
| 502 LGapResolver resolver_; | 496 LGapResolver resolver_; |
| 503 | 497 |
| (...skipping 23 matching lines...) Expand all Loading... |
| 527 | 521 |
| 528 friend class LDeferredCode; | 522 friend class LDeferredCode; |
| 529 friend class LEnvironment; | 523 friend class LEnvironment; |
| 530 friend class SafepointGenerator; | 524 friend class SafepointGenerator; |
| 531 DISALLOW_COPY_AND_ASSIGN(LCodeGen); | 525 DISALLOW_COPY_AND_ASSIGN(LCodeGen); |
| 532 }; | 526 }; |
| 533 | 527 |
| 534 | 528 |
| 535 class LDeferredCode : public ZoneObject { | 529 class LDeferredCode : public ZoneObject { |
| 536 public: | 530 public: |
| 537 explicit LDeferredCode(LCodeGen* codegen, const LCodeGen::X87Stack& x87_stack) | 531 explicit LDeferredCode(LCodeGen* codegen) |
| 538 : codegen_(codegen), | 532 : codegen_(codegen), |
| 539 external_exit_(NULL), | 533 external_exit_(NULL), |
| 540 instruction_index_(codegen->current_instruction_), | 534 instruction_index_(codegen->current_instruction_) { |
| 541 x87_stack_(x87_stack) { | |
| 542 codegen->AddDeferredCode(this); | 535 codegen->AddDeferredCode(this); |
| 543 } | 536 } |
| 544 | 537 |
| 545 virtual ~LDeferredCode() {} | 538 virtual ~LDeferredCode() {} |
| 546 virtual void Generate() = 0; | 539 virtual void Generate() = 0; |
| 547 virtual LInstruction* instr() = 0; | 540 virtual LInstruction* instr() = 0; |
| 548 | 541 |
| 549 void SetExit(Label* exit) { external_exit_ = exit; } | 542 void SetExit(Label* exit) { external_exit_ = exit; } |
| 550 Label* entry() { return &entry_; } | 543 Label* entry() { return &entry_; } |
| 551 Label* exit() { return external_exit_ != NULL ? external_exit_ : &exit_; } | 544 Label* exit() { return external_exit_ != NULL ? external_exit_ : &exit_; } |
| 552 int instruction_index() const { return instruction_index_; } | 545 int instruction_index() const { return instruction_index_; } |
| 553 const LCodeGen::X87Stack& x87_stack() const { return x87_stack_; } | |
| 554 | 546 |
| 555 protected: | 547 protected: |
| 556 LCodeGen* codegen() const { return codegen_; } | 548 LCodeGen* codegen() const { return codegen_; } |
| 557 MacroAssembler* masm() const { return codegen_->masm(); } | 549 MacroAssembler* masm() const { return codegen_->masm(); } |
| 558 | 550 |
| 559 private: | 551 private: |
| 560 LCodeGen* codegen_; | 552 LCodeGen* codegen_; |
| 561 Label entry_; | 553 Label entry_; |
| 562 Label exit_; | 554 Label exit_; |
| 563 Label* external_exit_; | 555 Label* external_exit_; |
| 564 int instruction_index_; | 556 int instruction_index_; |
| 565 LCodeGen::X87Stack x87_stack_; | |
| 566 }; | 557 }; |
| 567 | 558 |
| 568 } } // namespace v8::internal | 559 } } // namespace v8::internal |
| 569 | 560 |
| 570 #endif // V8_IA32_LITHIUM_CODEGEN_IA32_H_ | 561 #endif // V8_IA32_LITHIUM_CODEGEN_IA32_H_ |
| OLD | NEW |