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/generic-node-inl.h" | 8 #include "src/compiler/generic-node-inl.h" |
9 #include "src/compiler/instruction.h" | 9 #include "src/compiler/instruction.h" |
10 #include "src/compiler/instruction-selector.h" | 10 #include "src/compiler/instruction-selector.h" |
(...skipping 239 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
250 DCHECK(IsBranch()); | 250 DCHECK(IsBranch()); |
251 return true_block_; | 251 return true_block_; |
252 } | 252 } |
253 BasicBlock* false_block() const { | 253 BasicBlock* false_block() const { |
254 DCHECK(IsBranch()); | 254 DCHECK(IsBranch()); |
255 return false_block_; | 255 return false_block_; |
256 } | 256 } |
257 | 257 |
258 void Negate() { | 258 void Negate() { |
259 DCHECK(!IsNone()); | 259 DCHECK(!IsNone()); |
260 condition_ = static_cast<FlagsCondition>(condition_ ^ 1); | 260 condition_ = NegateFlagsCondition(condition_); |
261 } | 261 } |
262 | 262 |
263 void Commute() { | 263 void Commute() { |
264 DCHECK(!IsNone()); | 264 DCHECK(!IsNone()); |
265 switch (condition_) { | 265 switch (condition_) { |
266 case kEqual: | 266 case kEqual: |
267 case kNotEqual: | 267 case kNotEqual: |
268 case kOverflow: | 268 case kOverflow: |
269 case kNotOverflow: | 269 case kNotOverflow: |
270 return; | 270 return; |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
310 } | 310 } |
311 UNREACHABLE(); | 311 UNREACHABLE(); |
312 } | 312 } |
313 | 313 |
314 void OverwriteAndNegateIfEqual(FlagsCondition condition) { | 314 void OverwriteAndNegateIfEqual(FlagsCondition condition) { |
315 bool negate = condition_ == kEqual; | 315 bool negate = condition_ == kEqual; |
316 condition_ = condition; | 316 condition_ = condition; |
317 if (negate) Negate(); | 317 if (negate) Negate(); |
318 } | 318 } |
319 | 319 |
320 void SwapBlocks() { std::swap(true_block_, false_block_); } | |
321 | |
322 // Encodes this flags continuation into the given opcode. | 320 // Encodes this flags continuation into the given opcode. |
323 InstructionCode Encode(InstructionCode opcode) { | 321 InstructionCode Encode(InstructionCode opcode) { |
324 opcode |= FlagsModeField::encode(mode_); | 322 opcode |= FlagsModeField::encode(mode_); |
325 if (mode_ != kFlags_none) { | 323 if (mode_ != kFlags_none) { |
326 opcode |= FlagsConditionField::encode(condition_); | 324 opcode |= FlagsConditionField::encode(condition_); |
327 } | 325 } |
328 return opcode; | 326 return opcode; |
329 } | 327 } |
330 | 328 |
331 private: | 329 private: |
(...skipping 29 matching lines...) Expand all Loading... |
361 : (frame_state_descriptor->GetTotalSize() + | 359 : (frame_state_descriptor->GetTotalSize() + |
362 1); // Include deopt id. | 360 1); // Include deopt id. |
363 } | 361 } |
364 }; | 362 }; |
365 | 363 |
366 } // namespace compiler | 364 } // namespace compiler |
367 } // namespace internal | 365 } // namespace internal |
368 } // namespace v8 | 366 } // namespace v8 |
369 | 367 |
370 #endif // V8_COMPILER_INSTRUCTION_SELECTOR_IMPL_H_ | 368 #endif // V8_COMPILER_INSTRUCTION_SELECTOR_IMPL_H_ |
OLD | NEW |