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-selector.h" |
8 #include "src/compiler/instruction.h" | 9 #include "src/compiler/instruction.h" |
9 #include "src/compiler/instruction-selector.h" | |
10 #include "src/compiler/linkage.h" | 10 #include "src/compiler/linkage.h" |
11 #include "src/compiler/schedule.h" | 11 #include "src/compiler/schedule.h" |
12 #include "src/macro-assembler.h" | 12 #include "src/macro-assembler.h" |
13 | 13 |
14 namespace v8 { | 14 namespace v8 { |
15 namespace internal { | 15 namespace internal { |
16 namespace compiler { | 16 namespace compiler { |
17 | 17 |
18 // Helper struct containing data about a table or lookup switch. | 18 // Helper struct containing data about a table or lookup switch. |
19 struct SwitchInfo { | 19 struct SwitchInfo { |
(...skipping 318 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
338 DeoptimizeReason reason, | 338 DeoptimizeReason reason, |
339 Node* frame_state) { | 339 Node* frame_state) { |
340 return FlagsContinuation(condition, reason, frame_state); | 340 return FlagsContinuation(condition, reason, frame_state); |
341 } | 341 } |
342 | 342 |
343 // Creates a new flags continuation for a boolean value. | 343 // Creates a new flags continuation for a boolean value. |
344 static FlagsContinuation ForSet(FlagsCondition condition, Node* result) { | 344 static FlagsContinuation ForSet(FlagsCondition condition, Node* result) { |
345 return FlagsContinuation(condition, result); | 345 return FlagsContinuation(condition, result); |
346 } | 346 } |
347 | 347 |
| 348 // Creates a new flags continuation for a wasm trap. |
| 349 static FlagsContinuation ForTrap(FlagsCondition condition, |
| 350 Runtime::FunctionId trap_id, Node* result) { |
| 351 return FlagsContinuation(condition, trap_id, result); |
| 352 } |
| 353 |
348 bool IsNone() const { return mode_ == kFlags_none; } | 354 bool IsNone() const { return mode_ == kFlags_none; } |
349 bool IsBranch() const { return mode_ == kFlags_branch; } | 355 bool IsBranch() const { return mode_ == kFlags_branch; } |
350 bool IsDeoptimize() const { return mode_ == kFlags_deoptimize; } | 356 bool IsDeoptimize() const { return mode_ == kFlags_deoptimize; } |
351 bool IsSet() const { return mode_ == kFlags_set; } | 357 bool IsSet() const { return mode_ == kFlags_set; } |
| 358 bool IsTrap() const { return mode_ == kFlags_trap; } |
352 FlagsCondition condition() const { | 359 FlagsCondition condition() const { |
353 DCHECK(!IsNone()); | 360 DCHECK(!IsNone()); |
354 return condition_; | 361 return condition_; |
355 } | 362 } |
356 DeoptimizeReason reason() const { | 363 DeoptimizeReason reason() const { |
357 DCHECK(IsDeoptimize()); | 364 DCHECK(IsDeoptimize()); |
358 return reason_; | 365 return reason_; |
359 } | 366 } |
360 Node* frame_state() const { | 367 Node* frame_state() const { |
361 DCHECK(IsDeoptimize()); | 368 DCHECK(IsDeoptimize()); |
362 return frame_state_or_result_; | 369 return frame_state_or_result_; |
363 } | 370 } |
364 Node* result() const { | 371 Node* result() const { |
365 DCHECK(IsSet()); | 372 DCHECK(IsSet()); |
366 return frame_state_or_result_; | 373 return frame_state_or_result_; |
367 } | 374 } |
| 375 Runtime::FunctionId trap_id() const { |
| 376 DCHECK(IsTrap()); |
| 377 return trap_id_; |
| 378 } |
368 BasicBlock* true_block() const { | 379 BasicBlock* true_block() const { |
369 DCHECK(IsBranch()); | 380 DCHECK(IsBranch()); |
370 return true_block_; | 381 return true_block_; |
371 } | 382 } |
372 BasicBlock* false_block() const { | 383 BasicBlock* false_block() const { |
373 DCHECK(IsBranch()); | 384 DCHECK(IsBranch()); |
374 return false_block_; | 385 return false_block_; |
375 } | 386 } |
376 | 387 |
377 void Negate() { | 388 void Negate() { |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
430 frame_state_or_result_(frame_state) { | 441 frame_state_or_result_(frame_state) { |
431 DCHECK_NOT_NULL(frame_state); | 442 DCHECK_NOT_NULL(frame_state); |
432 } | 443 } |
433 FlagsContinuation(FlagsCondition condition, Node* result) | 444 FlagsContinuation(FlagsCondition condition, Node* result) |
434 : mode_(kFlags_set), | 445 : mode_(kFlags_set), |
435 condition_(condition), | 446 condition_(condition), |
436 frame_state_or_result_(result) { | 447 frame_state_or_result_(result) { |
437 DCHECK_NOT_NULL(result); | 448 DCHECK_NOT_NULL(result); |
438 } | 449 } |
439 | 450 |
| 451 FlagsContinuation(FlagsCondition condition, Runtime::FunctionId trap_id, |
| 452 Node* result) |
| 453 : mode_(kFlags_trap), |
| 454 condition_(condition), |
| 455 frame_state_or_result_(result), |
| 456 trap_id_(trap_id) { |
| 457 DCHECK_NOT_NULL(result); |
| 458 } |
| 459 |
440 FlagsMode const mode_; | 460 FlagsMode const mode_; |
441 FlagsCondition condition_; | 461 FlagsCondition condition_; |
442 DeoptimizeReason reason_; // Only value if mode_ == kFlags_deoptimize | 462 DeoptimizeReason reason_; // Only value if mode_ == kFlags_deoptimize |
443 Node* frame_state_or_result_; // Only valid if mode_ == kFlags_deoptimize | 463 Node* frame_state_or_result_; // Only valid if mode_ == kFlags_deoptimize |
444 // or mode_ == kFlags_set. | 464 // or mode_ == kFlags_set. |
445 BasicBlock* true_block_; // Only valid if mode_ == kFlags_branch. | 465 BasicBlock* true_block_; // Only valid if mode_ == kFlags_branch. |
446 BasicBlock* false_block_; // Only valid if mode_ == kFlags_branch. | 466 BasicBlock* false_block_; // Only valid if mode_ == kFlags_branch. |
| 467 Runtime::FunctionId trap_id_; // Only valid if mode_ == kFlags_trap. |
447 }; | 468 }; |
448 | 469 |
449 } // namespace compiler | 470 } // namespace compiler |
450 } // namespace internal | 471 } // namespace internal |
451 } // namespace v8 | 472 } // namespace v8 |
452 | 473 |
453 #endif // V8_COMPILER_INSTRUCTION_SELECTOR_IMPL_H_ | 474 #endif // V8_COMPILER_INSTRUCTION_SELECTOR_IMPL_H_ |
OLD | NEW |