Commit 0320986a authored by Tobias Tebbi's avatar Tobias Tebbi Committed by Commit Bot

[turbofan] mark Deoptimize{If,Unless} nodes if they are safety checks

Change-Id: I2e9a6e706d75a579033a3bdaf275a5af4512c8d1
Reviewed-on: https://chromium-review.googlesource.com/897492Reviewed-by: 's avatarJaroslav Sevcik <jarin@chromium.org>
Commit-Queue: Tobias Tebbi <tebbi@chromium.org>
Cr-Commit-Position: refs/heads/master@{#51026}
parent bb9d073a
......@@ -2988,7 +2988,7 @@ void BytecodeGraphBuilder::BuildJump() {
}
void BytecodeGraphBuilder::BuildJumpIf(Node* condition) {
NewBranch(condition, BranchHint::kNone, BranchKind::kNoSafetyCheck);
NewBranch(condition, BranchHint::kNone, IsSafetyCheck::kNoSafetyCheck);
{
SubEnvironment sub_environment(this);
NewIfTrue();
......@@ -2998,7 +2998,7 @@ void BytecodeGraphBuilder::BuildJumpIf(Node* condition) {
}
void BytecodeGraphBuilder::BuildJumpIfNot(Node* condition) {
NewBranch(condition, BranchHint::kNone, BranchKind::kNoSafetyCheck);
NewBranch(condition, BranchHint::kNone, IsSafetyCheck::kNoSafetyCheck);
{
SubEnvironment sub_environment(this);
NewIfFalse();
......@@ -3023,7 +3023,7 @@ void BytecodeGraphBuilder::BuildJumpIfNotEqual(Node* comperand) {
void BytecodeGraphBuilder::BuildJumpIfFalse() {
NewBranch(environment()->LookupAccumulator(), BranchHint::kNone,
BranchKind::kNoSafetyCheck);
IsSafetyCheck::kNoSafetyCheck);
{
SubEnvironment sub_environment(this);
NewIfFalse();
......@@ -3036,7 +3036,7 @@ void BytecodeGraphBuilder::BuildJumpIfFalse() {
void BytecodeGraphBuilder::BuildJumpIfTrue() {
NewBranch(environment()->LookupAccumulator(), BranchHint::kNone,
BranchKind::kNoSafetyCheck);
IsSafetyCheck::kNoSafetyCheck);
{
SubEnvironment sub_environment(this);
NewIfTrue();
......
......@@ -101,8 +101,8 @@ class BytecodeGraphBuilder {
Node* NewMerge() { return NewNode(common()->Merge(1), true); }
Node* NewLoop() { return NewNode(common()->Loop(1), true); }
Node* NewBranch(Node* condition, BranchHint hint = BranchHint::kNone,
BranchKind kind = BranchKind::kSafetyCheck) {
return NewNode(common()->Branch(hint, kind), condition);
IsSafetyCheck is_safety_check = IsSafetyCheck::kSafetyCheck) {
return NewNode(common()->Branch(hint, is_safety_check), condition);
}
Node* NewSwitch(Node* condition, int control_output_count) {
return NewNode(common()->Switch(control_output_count), condition);
......
This diff is collapsed.
......@@ -28,12 +28,6 @@ class Node;
// Prediction hint for branches.
enum class BranchHint : uint8_t { kNone, kTrue, kFalse };
enum class BranchKind : uint8_t { kSafetyCheck, kNoSafetyCheck };
struct BranchOperatorInfo {
BranchHint hint;
BranchKind kind;
};
inline BranchHint NegateBranchHint(BranchHint hint) {
switch (hint) {
......@@ -51,15 +45,27 @@ inline size_t hash_value(BranchHint hint) { return static_cast<size_t>(hint); }
V8_EXPORT_PRIVATE std::ostream& operator<<(std::ostream&, BranchHint);
enum class IsSafetyCheck : uint8_t { kSafetyCheck, kNoSafetyCheck };
V8_EXPORT_PRIVATE std::ostream& operator<<(std::ostream&, IsSafetyCheck);
inline size_t hash_value(IsSafetyCheck is_safety_check) {
return static_cast<size_t>(is_safety_check);
}
struct BranchOperatorInfo {
BranchHint hint;
IsSafetyCheck is_safety_check;
};
inline size_t hash_value(const BranchOperatorInfo& info) {
return base::hash_combine(info.hint, static_cast<size_t>(info.kind));
return base::hash_combine(info.hint, info.is_safety_check);
}
V8_EXPORT_PRIVATE std::ostream& operator<<(std::ostream&, BranchOperatorInfo);
inline bool operator==(const BranchOperatorInfo& a,
const BranchOperatorInfo& b) {
return a.hint == b.hint && a.kind == b.kind;
return a.hint == b.hint && a.is_safety_check == b.is_safety_check;
}
V8_EXPORT_PRIVATE const BranchOperatorInfo& BranchOperatorInfoOf(
......@@ -73,17 +79,23 @@ int ValueInputCountOfReturn(Operator const* const op);
class DeoptimizeParameters final {
public:
DeoptimizeParameters(DeoptimizeKind kind, DeoptimizeReason reason,
VectorSlotPair const& feedback)
: kind_(kind), reason_(reason), feedback_(feedback) {}
VectorSlotPair const& feedback,
IsSafetyCheck is_safety_check)
: kind_(kind),
reason_(reason),
feedback_(feedback),
is_safety_check_(is_safety_check) {}
DeoptimizeKind kind() const { return kind_; }
DeoptimizeReason reason() const { return reason_; }
const VectorSlotPair& feedback() const { return feedback_; }
IsSafetyCheck is_safety_check() const { return is_safety_check_; }
private:
DeoptimizeKind const kind_;
DeoptimizeReason const reason_;
VectorSlotPair const feedback_;
IsSafetyCheck is_safety_check_;
};
bool operator==(DeoptimizeParameters, DeoptimizeParameters);
......@@ -95,6 +107,7 @@ std::ostream& operator<<(std::ostream&, DeoptimizeParameters p);
DeoptimizeParameters const& DeoptimizeParametersOf(Operator const* const);
IsSafetyCheck IsSafetyCheckOf(const Operator* op);
class SelectParameters final {
public:
......@@ -374,8 +387,9 @@ class V8_EXPORT_PRIVATE CommonOperatorBuilder final
const Operator* DeadValue(MachineRepresentation rep);
const Operator* Unreachable();
const Operator* End(size_t control_input_count);
const Operator* Branch(BranchHint = BranchHint::kNone,
BranchKind kind = BranchKind::kSafetyCheck);
const Operator* Branch(
BranchHint = BranchHint::kNone,
IsSafetyCheck is_safety_check = IsSafetyCheck::kSafetyCheck);
const Operator* IfTrue();
const Operator* IfFalse();
const Operator* IfSuccess();
......@@ -386,10 +400,14 @@ class V8_EXPORT_PRIVATE CommonOperatorBuilder final
const Operator* Throw();
const Operator* Deoptimize(DeoptimizeKind kind, DeoptimizeReason reason,
VectorSlotPair const& feedback);
const Operator* DeoptimizeIf(DeoptimizeKind kind, DeoptimizeReason reason,
VectorSlotPair const& feedback);
const Operator* DeoptimizeUnless(DeoptimizeKind kind, DeoptimizeReason reason,
VectorSlotPair const& feedback);
const Operator* DeoptimizeIf(
DeoptimizeKind kind, DeoptimizeReason reason,
VectorSlotPair const& feedback,
IsSafetyCheck is_safety_check = IsSafetyCheck::kSafetyCheck);
const Operator* DeoptimizeUnless(
DeoptimizeKind kind, DeoptimizeReason reason,
VectorSlotPair const& feedback,
IsSafetyCheck is_safety_check = IsSafetyCheck::kSafetyCheck);
const Operator* TrapIf(int32_t trap_id);
const Operator* TrapUnless(int32_t trap_id);
const Operator* Return(int value_input_count = 1);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment