OLD | NEW |
1 // Copyright 2015 the V8 project authors. All rights reserved. | 1 // Copyright 2015 the V8 project authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "src/compiler/code-assembler.h" | 5 #include "src/compiler/code-assembler.h" |
6 | 6 |
7 #include <ostream> | 7 #include <ostream> |
8 | 8 |
9 #include "src/code-factory.h" | 9 #include "src/code-factory.h" |
10 #include "src/compiler/graph.h" | 10 #include "src/compiler/graph.h" |
(...skipping 582 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
593 // properly be verified. | 593 // properly be verified. |
594 class CodeAssembler::Variable::Impl : public ZoneObject { | 594 class CodeAssembler::Variable::Impl : public ZoneObject { |
595 public: | 595 public: |
596 explicit Impl(MachineRepresentation rep) : value_(nullptr), rep_(rep) {} | 596 explicit Impl(MachineRepresentation rep) : value_(nullptr), rep_(rep) {} |
597 Node* value_; | 597 Node* value_; |
598 MachineRepresentation rep_; | 598 MachineRepresentation rep_; |
599 }; | 599 }; |
600 | 600 |
601 CodeAssembler::Variable::Variable(CodeAssembler* assembler, | 601 CodeAssembler::Variable::Variable(CodeAssembler* assembler, |
602 MachineRepresentation rep) | 602 MachineRepresentation rep) |
603 : impl_(new (assembler->zone()) Impl(rep)) { | 603 : impl_(new (assembler->zone()) Impl(rep)), assembler_(assembler) { |
604 assembler->variables_.push_back(impl_); | 604 assembler->variables_.insert(impl_); |
605 } | 605 } |
606 | 606 |
| 607 CodeAssembler::Variable::~Variable() { assembler_->variables_.erase(impl_); } |
| 608 |
607 void CodeAssembler::Variable::Bind(Node* value) { impl_->value_ = value; } | 609 void CodeAssembler::Variable::Bind(Node* value) { impl_->value_ = value; } |
608 | 610 |
609 Node* CodeAssembler::Variable::value() const { | 611 Node* CodeAssembler::Variable::value() const { |
610 DCHECK_NOT_NULL(impl_->value_); | 612 DCHECK_NOT_NULL(impl_->value_); |
611 return impl_->value_; | 613 return impl_->value_; |
612 } | 614 } |
613 | 615 |
614 MachineRepresentation CodeAssembler::Variable::rep() const { | 616 MachineRepresentation CodeAssembler::Variable::rep() const { |
615 return impl_->rep_; | 617 return impl_->rep_; |
616 } | 618 } |
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
730 } | 732 } |
731 } | 733 } |
732 } | 734 } |
733 | 735 |
734 bound_ = true; | 736 bound_ = true; |
735 } | 737 } |
736 | 738 |
737 } // namespace compiler | 739 } // namespace compiler |
738 } // namespace internal | 740 } // namespace internal |
739 } // namespace v8 | 741 } // namespace v8 |
OLD | NEW |