Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(86)

Unified Diff: src/compiler/instruction-selector-impl.h

Issue 2562393002: [wasm] Introduce the TrapIf and TrapUnless operators to generate trap code. (Closed)
Patch Set: Created 4 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: src/compiler/instruction-selector-impl.h
diff --git a/src/compiler/instruction-selector-impl.h b/src/compiler/instruction-selector-impl.h
index 6cb87ea0c06cd2ecff9da771ba60c997cb2c728b..3b0b7c038fb9089380b63bd14777704d87b0fcfd 100644
--- a/src/compiler/instruction-selector-impl.h
+++ b/src/compiler/instruction-selector-impl.h
@@ -5,14 +5,17 @@
#ifndef V8_COMPILER_INSTRUCTION_SELECTOR_IMPL_H_
#define V8_COMPILER_INSTRUCTION_SELECTOR_IMPL_H_
-#include "src/compiler/instruction.h"
#include "src/compiler/instruction-selector.h"
+#include "src/compiler/instruction.h"
#include "src/compiler/linkage.h"
#include "src/compiler/schedule.h"
#include "src/macro-assembler.h"
namespace v8 {
namespace internal {
+
+class SourcePosition;
+
namespace compiler {
// Helper struct containing data about a table or lookup switch.
@@ -345,10 +348,19 @@ class FlagsContinuation final {
return FlagsContinuation(condition, result);
}
+ // Creates a new flags continuation for a wasm trap.
+ static FlagsContinuation ForTrap(FlagsCondition condition,
+ Runtime::FunctionId trap_id,
+ SourcePosition* source_position,
+ Node* result) {
+ return FlagsContinuation(condition, trap_id, source_position, result);
+ }
+
bool IsNone() const { return mode_ == kFlags_none; }
bool IsBranch() const { return mode_ == kFlags_branch; }
bool IsDeoptimize() const { return mode_ == kFlags_deoptimize; }
bool IsSet() const { return mode_ == kFlags_set; }
+ bool IsTrap() const { return mode_ == kFlags_trap; }
FlagsCondition condition() const {
DCHECK(!IsNone());
return condition_;
@@ -365,6 +377,14 @@ class FlagsContinuation final {
DCHECK(IsSet());
return frame_state_or_result_;
}
+ int trap_id() const {
+ DCHECK(IsTrap());
+ return trap_id_;
+ }
+ SourcePosition* source_position() const {
+ DCHECK(IsTrap());
+ return source_position_;
+ }
BasicBlock* true_block() const {
DCHECK(IsBranch());
return true_block_;
@@ -437,6 +457,16 @@ class FlagsContinuation final {
DCHECK_NOT_NULL(result);
}
+ FlagsContinuation(FlagsCondition condition, int32_t trap_id,
+ SourcePosition* source_position, Node* result)
+ : mode_(kFlags_trap),
+ condition_(condition),
+ frame_state_or_result_(result),
+ trap_id_(trap_id),
+ source_position_(source_position) {
+ DCHECK_NOT_NULL(result);
+ }
+
FlagsMode const mode_;
FlagsCondition condition_;
DeoptimizeReason reason_; // Only value if mode_ == kFlags_deoptimize
@@ -444,6 +474,8 @@ class FlagsContinuation final {
// or mode_ == kFlags_set.
BasicBlock* true_block_; // Only valid if mode_ == kFlags_branch.
BasicBlock* false_block_; // Only valid if mode_ == kFlags_branch.
+ int32_t trap_id_; // Only valid if mode_ == kFlags_trap.
titzer 2016/12/12 14:21:33 I wonder if we could squeeze this into a uint8_t a
ahaas 2016/12/13 12:38:59 trap_id_ contains a runtime::FunctionId, and there
+ SourcePosition* source_position_; // Only valid if mode_ == kFlags_trap.
};
} // namespace compiler

Powered by Google App Engine
This is Rietveld 408576698