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 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) : stack_depth_(0), masm_(masm) { } | 451 explicit X87Stack(MacroAssembler* masm) |
| 452 : stack_depth_(0), copy_(false), masm_(masm) { } | |
| 452 explicit X87Stack(const X87Stack& other) | 453 explicit X87Stack(const X87Stack& other) |
| 453 : stack_depth_(0), masm_(other.masm_) { | 454 : stack_depth_(other.stack_depth_), copy_(true), masm_(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); |
|
Michael Starzinger
2013/08/29 08:55:56
I think both, "PrepareToWrite" and "CommitWrite" s
oliv
2013/08/29 09:23:25
Done.
| |
| 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() { stack_depth_--; } | 473 void pop() { |
| 474 ASSERT(!copy_); | |
| 475 stack_depth_--; | |
| 476 } | |
| 474 void push(X87Register reg) { | 477 void push(X87Register reg) { |
| 478 ASSERT(!copy_); | |
| 475 ASSERT(stack_depth_ < X87Register::kNumAllocatableRegisters); | 479 ASSERT(stack_depth_ < X87Register::kNumAllocatableRegisters); |
| 476 stack_[stack_depth_] = reg; | 480 stack_[stack_depth_] = reg; |
| 477 stack_depth_++; | 481 stack_depth_++; |
| 478 } | 482 } |
| 479 | 483 |
| 480 MacroAssembler* masm() const { return masm_; } | 484 MacroAssembler* masm() const { return masm_; } |
| 481 | 485 |
| 482 private: | 486 private: |
| 483 int ArrayIndex(X87Register reg); | 487 int ArrayIndex(X87Register reg); |
| 484 int st2idx(int pos); | 488 int st2idx(int pos); |
| 489 | |
| 485 X87Register stack_[X87Register::kNumAllocatableRegisters]; | 490 X87Register stack_[X87Register::kNumAllocatableRegisters]; |
| 486 int stack_depth_; | 491 int stack_depth_; |
| 487 MacroAssembler* const masm_; | 492 bool copy_; |
|
Michael Starzinger
2013/08/29 08:55:56
Let's call this "is_mutable_" instead and reverse
oliv
2013/08/29 09:23:25
Done.
| |
| 493 MacroAssembler* masm_; | |
| 488 }; | 494 }; |
| 489 X87Stack x87_stack_; | 495 X87Stack x87_stack_; |
| 490 | 496 |
| 491 // Builder that keeps track of safepoints in the code. The table | 497 // Builder that keeps track of safepoints in the code. The table |
| 492 // itself is emitted at the end of the generated code. | 498 // itself is emitted at the end of the generated code. |
| 493 SafepointTableBuilder safepoints_; | 499 SafepointTableBuilder safepoints_; |
| 494 | 500 |
| 495 // Compiler from a set of parallel moves to a sequential list of moves. | 501 // Compiler from a set of parallel moves to a sequential list of moves. |
| 496 LGapResolver resolver_; | 502 LGapResolver resolver_; |
| 497 | 503 |
| (...skipping 23 matching lines...) Expand all Loading... | |
| 521 | 527 |
| 522 friend class LDeferredCode; | 528 friend class LDeferredCode; |
| 523 friend class LEnvironment; | 529 friend class LEnvironment; |
| 524 friend class SafepointGenerator; | 530 friend class SafepointGenerator; |
| 525 DISALLOW_COPY_AND_ASSIGN(LCodeGen); | 531 DISALLOW_COPY_AND_ASSIGN(LCodeGen); |
| 526 }; | 532 }; |
| 527 | 533 |
| 528 | 534 |
| 529 class LDeferredCode : public ZoneObject { | 535 class LDeferredCode : public ZoneObject { |
| 530 public: | 536 public: |
| 531 explicit LDeferredCode(LCodeGen* codegen) | 537 explicit LDeferredCode(LCodeGen* codegen, const LCodeGen::X87Stack& x87_stack) |
| 532 : codegen_(codegen), | 538 : codegen_(codegen), |
| 533 external_exit_(NULL), | 539 external_exit_(NULL), |
| 534 instruction_index_(codegen->current_instruction_) { | 540 instruction_index_(codegen->current_instruction_), |
| 541 x87_stack_(x87_stack) { | |
| 535 codegen->AddDeferredCode(this); | 542 codegen->AddDeferredCode(this); |
| 536 } | 543 } |
| 537 | 544 |
| 538 virtual ~LDeferredCode() {} | 545 virtual ~LDeferredCode() {} |
| 539 virtual void Generate() = 0; | 546 virtual void Generate() = 0; |
| 540 virtual LInstruction* instr() = 0; | 547 virtual LInstruction* instr() = 0; |
| 541 | 548 |
| 542 void SetExit(Label* exit) { external_exit_ = exit; } | 549 void SetExit(Label* exit) { external_exit_ = exit; } |
| 543 Label* entry() { return &entry_; } | 550 Label* entry() { return &entry_; } |
| 544 Label* exit() { return external_exit_ != NULL ? external_exit_ : &exit_; } | 551 Label* exit() { return external_exit_ != NULL ? external_exit_ : &exit_; } |
| 545 int instruction_index() const { return instruction_index_; } | 552 int instruction_index() const { return instruction_index_; } |
| 553 const LCodeGen::X87Stack& x87_stack() const { return x87_stack_; } | |
| 546 | 554 |
| 547 protected: | 555 protected: |
| 548 LCodeGen* codegen() const { return codegen_; } | 556 LCodeGen* codegen() const { return codegen_; } |
| 549 MacroAssembler* masm() const { return codegen_->masm(); } | 557 MacroAssembler* masm() const { return codegen_->masm(); } |
| 550 | 558 |
| 551 private: | 559 private: |
| 552 LCodeGen* codegen_; | 560 LCodeGen* codegen_; |
| 553 Label entry_; | 561 Label entry_; |
| 554 Label exit_; | 562 Label exit_; |
| 555 Label* external_exit_; | 563 Label* external_exit_; |
| 556 int instruction_index_; | 564 int instruction_index_; |
| 565 LCodeGen::X87Stack x87_stack_; | |
| 557 }; | 566 }; |
| 558 | 567 |
| 559 } } // namespace v8::internal | 568 } } // namespace v8::internal |
| 560 | 569 |
| 561 #endif // V8_IA32_LITHIUM_CODEGEN_IA32_H_ | 570 #endif // V8_IA32_LITHIUM_CODEGEN_IA32_H_ |
| OLD | NEW |