Chromium Code Reviews| 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 682 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 693 Node* value_; | 693 Node* value_; |
| 694 MachineRepresentation rep_; | 694 MachineRepresentation rep_; |
| 695 }; | 695 }; |
| 696 | 696 |
| 697 CodeAssemblerVariable::CodeAssemblerVariable(CodeAssembler* assembler, | 697 CodeAssemblerVariable::CodeAssemblerVariable(CodeAssembler* assembler, |
| 698 MachineRepresentation rep) | 698 MachineRepresentation rep) |
| 699 : impl_(new (assembler->zone()) Impl(rep)), state_(assembler->state()) { | 699 : impl_(new (assembler->zone()) Impl(rep)), state_(assembler->state()) { |
| 700 state_->variables_.insert(impl_); | 700 state_->variables_.insert(impl_); |
| 701 } | 701 } |
| 702 | 702 |
| 703 CodeAssemblerVariable::CodeAssemblerVariable(CodeAssembler* assembler, | |
| 704 MachineRepresentation rep, | |
| 705 Node* initial_value) | |
| 706 : impl_(new (assembler->zone()) Impl(rep)), state_(assembler->state()) { | |
|
Igor Sheludko
2017/01/24 15:10:31
I think it's better to implement it as:
: CodeAs
jgruber
2017/01/24 15:16:26
Done.
| |
| 707 state_->variables_.insert(impl_); | |
| 708 Bind(initial_value); | |
| 709 } | |
| 710 | |
| 703 CodeAssemblerVariable::~CodeAssemblerVariable() { | 711 CodeAssemblerVariable::~CodeAssemblerVariable() { |
| 704 state_->variables_.erase(impl_); | 712 state_->variables_.erase(impl_); |
| 705 } | 713 } |
| 706 | 714 |
| 707 void CodeAssemblerVariable::Bind(Node* value) { impl_->value_ = value; } | 715 void CodeAssemblerVariable::Bind(Node* value) { impl_->value_ = value; } |
| 708 | 716 |
| 709 Node* CodeAssemblerVariable::value() const { | 717 Node* CodeAssemblerVariable::value() const { |
| 710 DCHECK_NOT_NULL(impl_->value_); | 718 DCHECK_NOT_NULL(impl_->value_); |
| 711 return impl_->value_; | 719 return impl_->value_; |
| 712 } | 720 } |
| (...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 833 } | 841 } |
| 834 } | 842 } |
| 835 } | 843 } |
| 836 | 844 |
| 837 bound_ = true; | 845 bound_ = true; |
| 838 } | 846 } |
| 839 | 847 |
| 840 } // namespace compiler | 848 } // namespace compiler |
| 841 } // namespace internal | 849 } // namespace internal |
| 842 } // namespace v8 | 850 } // namespace v8 |
| OLD | NEW |