| OLD | NEW |
| 1 // Copyright 2014 the V8 project authors. All rights reserved. | 1 // Copyright 2014 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 #ifndef V8_COMPILER_INSTRUCTION_SELECTOR_IMPL_H_ | 5 #ifndef V8_COMPILER_INSTRUCTION_SELECTOR_IMPL_H_ |
| 6 #define V8_COMPILER_INSTRUCTION_SELECTOR_IMPL_H_ | 6 #define V8_COMPILER_INSTRUCTION_SELECTOR_IMPL_H_ |
| 7 | 7 |
| 8 #include "src/compiler/instruction.h" | 8 #include "src/compiler/instruction.h" |
| 9 #include "src/compiler/instruction-selector.h" | 9 #include "src/compiler/instruction-selector.h" |
| 10 #include "src/compiler/linkage.h" | 10 #include "src/compiler/linkage.h" |
| (...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 170 case IrOpcode::kHeapConstant: | 170 case IrOpcode::kHeapConstant: |
| 171 return Constant(ValueOf<Handle<HeapObject> >(node->op())); | 171 return Constant(ValueOf<Handle<HeapObject> >(node->op())); |
| 172 default: | 172 default: |
| 173 break; | 173 break; |
| 174 } | 174 } |
| 175 UNREACHABLE(); | 175 UNREACHABLE(); |
| 176 return Constant(static_cast<int32_t>(0)); | 176 return Constant(static_cast<int32_t>(0)); |
| 177 } | 177 } |
| 178 | 178 |
| 179 UnallocatedOperand* Define(Node* node, UnallocatedOperand* operand) { | 179 UnallocatedOperand* Define(Node* node, UnallocatedOperand* operand) { |
| 180 ASSERT_NOT_NULL(node); | 180 DCHECK_NOT_NULL(node); |
| 181 ASSERT_NOT_NULL(operand); | 181 DCHECK_NOT_NULL(operand); |
| 182 operand->set_virtual_register(node->id()); | 182 operand->set_virtual_register(node->id()); |
| 183 selector()->MarkAsDefined(node); | 183 selector()->MarkAsDefined(node); |
| 184 return operand; | 184 return operand; |
| 185 } | 185 } |
| 186 | 186 |
| 187 UnallocatedOperand* Use(Node* node, UnallocatedOperand* operand) { | 187 UnallocatedOperand* Use(Node* node, UnallocatedOperand* operand) { |
| 188 ASSERT_NOT_NULL(node); | 188 DCHECK_NOT_NULL(node); |
| 189 ASSERT_NOT_NULL(operand); | 189 DCHECK_NOT_NULL(operand); |
| 190 operand->set_virtual_register(node->id()); | 190 operand->set_virtual_register(node->id()); |
| 191 selector()->MarkAsUsed(node); | 191 selector()->MarkAsUsed(node); |
| 192 return operand; | 192 return operand; |
| 193 } | 193 } |
| 194 | 194 |
| 195 UnallocatedOperand* ToUnallocatedOperand(LinkageLocation location) { | 195 UnallocatedOperand* ToUnallocatedOperand(LinkageLocation location) { |
| 196 if (location.location_ == LinkageLocation::ANY_REGISTER) { | 196 if (location.location_ == LinkageLocation::ANY_REGISTER) { |
| 197 return new (zone()) | 197 return new (zone()) |
| 198 UnallocatedOperand(UnallocatedOperand::MUST_HAVE_REGISTER); | 198 UnallocatedOperand(UnallocatedOperand::MUST_HAVE_REGISTER); |
| 199 } | 199 } |
| (...skipping 23 matching lines...) Expand all Loading... |
| 223 FlagsContinuation() : mode_(kFlags_none) {} | 223 FlagsContinuation() : mode_(kFlags_none) {} |
| 224 | 224 |
| 225 // Creates a new flags continuation from the given condition and true/false | 225 // Creates a new flags continuation from the given condition and true/false |
| 226 // blocks. | 226 // blocks. |
| 227 FlagsContinuation(FlagsCondition condition, BasicBlock* true_block, | 227 FlagsContinuation(FlagsCondition condition, BasicBlock* true_block, |
| 228 BasicBlock* false_block) | 228 BasicBlock* false_block) |
| 229 : mode_(kFlags_branch), | 229 : mode_(kFlags_branch), |
| 230 condition_(condition), | 230 condition_(condition), |
| 231 true_block_(true_block), | 231 true_block_(true_block), |
| 232 false_block_(false_block) { | 232 false_block_(false_block) { |
| 233 ASSERT_NOT_NULL(true_block); | 233 DCHECK_NOT_NULL(true_block); |
| 234 ASSERT_NOT_NULL(false_block); | 234 DCHECK_NOT_NULL(false_block); |
| 235 } | 235 } |
| 236 | 236 |
| 237 // Creates a new flags continuation from the given condition and result node. | 237 // Creates a new flags continuation from the given condition and result node. |
| 238 FlagsContinuation(FlagsCondition condition, Node* result) | 238 FlagsContinuation(FlagsCondition condition, Node* result) |
| 239 : mode_(kFlags_set), condition_(condition), result_(result) { | 239 : mode_(kFlags_set), condition_(condition), result_(result) { |
| 240 ASSERT_NOT_NULL(result); | 240 DCHECK_NOT_NULL(result); |
| 241 } | 241 } |
| 242 | 242 |
| 243 bool IsNone() const { return mode_ == kFlags_none; } | 243 bool IsNone() const { return mode_ == kFlags_none; } |
| 244 bool IsBranch() const { return mode_ == kFlags_branch; } | 244 bool IsBranch() const { return mode_ == kFlags_branch; } |
| 245 bool IsSet() const { return mode_ == kFlags_set; } | 245 bool IsSet() const { return mode_ == kFlags_set; } |
| 246 FlagsCondition condition() const { | 246 FlagsCondition condition() const { |
| 247 ASSERT(!IsNone()); | 247 DCHECK(!IsNone()); |
| 248 return condition_; | 248 return condition_; |
| 249 } | 249 } |
| 250 Node* result() const { | 250 Node* result() const { |
| 251 ASSERT(IsSet()); | 251 DCHECK(IsSet()); |
| 252 return result_; | 252 return result_; |
| 253 } | 253 } |
| 254 BasicBlock* true_block() const { | 254 BasicBlock* true_block() const { |
| 255 ASSERT(IsBranch()); | 255 DCHECK(IsBranch()); |
| 256 return true_block_; | 256 return true_block_; |
| 257 } | 257 } |
| 258 BasicBlock* false_block() const { | 258 BasicBlock* false_block() const { |
| 259 ASSERT(IsBranch()); | 259 DCHECK(IsBranch()); |
| 260 return false_block_; | 260 return false_block_; |
| 261 } | 261 } |
| 262 | 262 |
| 263 void Negate() { | 263 void Negate() { |
| 264 ASSERT(!IsNone()); | 264 DCHECK(!IsNone()); |
| 265 condition_ = static_cast<FlagsCondition>(condition_ ^ 1); | 265 condition_ = static_cast<FlagsCondition>(condition_ ^ 1); |
| 266 } | 266 } |
| 267 | 267 |
| 268 void Commute() { | 268 void Commute() { |
| 269 ASSERT(!IsNone()); | 269 DCHECK(!IsNone()); |
| 270 switch (condition_) { | 270 switch (condition_) { |
| 271 case kEqual: | 271 case kEqual: |
| 272 case kNotEqual: | 272 case kNotEqual: |
| 273 case kOverflow: | 273 case kOverflow: |
| 274 case kNotOverflow: | 274 case kNotOverflow: |
| 275 return; | 275 return; |
| 276 case kSignedLessThan: | 276 case kSignedLessThan: |
| 277 condition_ = kSignedGreaterThan; | 277 condition_ = kSignedGreaterThan; |
| 278 return; | 278 return; |
| 279 case kSignedGreaterThanOrEqual: | 279 case kSignedGreaterThanOrEqual: |
| (...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 362 int control_count() { return descriptor->CanLazilyDeoptimize() ? 2 : 0; } | 362 int control_count() { return descriptor->CanLazilyDeoptimize() ? 2 : 0; } |
| 363 | 363 |
| 364 int fixed_and_control_count() { return fixed_count + control_count(); } | 364 int fixed_and_control_count() { return fixed_count + control_count(); } |
| 365 }; | 365 }; |
| 366 | 366 |
| 367 } // namespace compiler | 367 } // namespace compiler |
| 368 } // namespace internal | 368 } // namespace internal |
| 369 } // namespace v8 | 369 } // namespace v8 |
| 370 | 370 |
| 371 #endif // V8_COMPILER_INSTRUCTION_SELECTOR_IMPL_H_ | 371 #endif // V8_COMPILER_INSTRUCTION_SELECTOR_IMPL_H_ |
| OLD | NEW |