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 1048 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1059 } | 1059 } |
1060 | 1060 |
1061 MachineRepresentation CodeAssembler::Variable::rep() const { | 1061 MachineRepresentation CodeAssembler::Variable::rep() const { |
1062 return impl_->rep_; | 1062 return impl_->rep_; |
1063 } | 1063 } |
1064 | 1064 |
1065 bool CodeAssembler::Variable::IsBound() const { | 1065 bool CodeAssembler::Variable::IsBound() const { |
1066 return impl_->value_ != nullptr; | 1066 return impl_->value_ != nullptr; |
1067 } | 1067 } |
1068 | 1068 |
1069 CodeAssembler::Label::Label(CodeAssembler* assembler, int merged_value_count, | 1069 CodeAssembler::Label::Label(CodeAssembler* assembler, size_t vars_count, |
1070 CodeAssembler::Variable** merged_variables, | 1070 Variable** vars, CodeAssembler::Label::Type type) |
1071 CodeAssembler::Label::Type type) | |
1072 : bound_(false), merge_count_(0), assembler_(assembler), label_(nullptr) { | 1071 : bound_(false), merge_count_(0), assembler_(assembler), label_(nullptr) { |
1073 void* buffer = assembler->zone()->New(sizeof(RawMachineLabel)); | 1072 void* buffer = assembler->zone()->New(sizeof(RawMachineLabel)); |
1074 label_ = new (buffer) | 1073 label_ = new (buffer) |
1075 RawMachineLabel(type == kDeferred ? RawMachineLabel::kDeferred | 1074 RawMachineLabel(type == kDeferred ? RawMachineLabel::kDeferred |
1076 : RawMachineLabel::kNonDeferred); | 1075 : RawMachineLabel::kNonDeferred); |
1077 for (int i = 0; i < merged_value_count; ++i) { | 1076 for (size_t i = 0; i < vars_count; ++i) { |
1078 variable_phis_[merged_variables[i]->impl_] = nullptr; | 1077 variable_phis_[vars[i]->impl_] = nullptr; |
1079 } | 1078 } |
1080 } | 1079 } |
1081 | 1080 |
1082 void CodeAssembler::Label::MergeVariables() { | 1081 void CodeAssembler::Label::MergeVariables() { |
1083 ++merge_count_; | 1082 ++merge_count_; |
1084 for (auto var : assembler_->variables_) { | 1083 for (auto var : assembler_->variables_) { |
1085 size_t count = 0; | 1084 size_t count = 0; |
1086 Node* node = var->value_; | 1085 Node* node = var->value_; |
1087 if (node != nullptr) { | 1086 if (node != nullptr) { |
1088 auto i = variable_merges_.find(var); | 1087 auto i = variable_merges_.find(var); |
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1177 } | 1176 } |
1178 } | 1177 } |
1179 } | 1178 } |
1180 | 1179 |
1181 bound_ = true; | 1180 bound_ = true; |
1182 } | 1181 } |
1183 | 1182 |
1184 } // namespace compiler | 1183 } // namespace compiler |
1185 } // namespace internal | 1184 } // namespace internal |
1186 } // namespace v8 | 1185 } // namespace v8 |
OLD | NEW |