Commit 9c8f4f91 authored by bmeurer's avatar bmeurer Committed by Commit bot

[runtime] Remove the unused weird %Likely and %Unlikely intrinsics.

These intrinsics are completely unused and there doesn't seem to an
actual use case for it in the future.

R=mstarzinger@chromium.org

Review URL: https://codereview.chromium.org/1418663011

Cr-Commit-Position: refs/heads/master@{#31828}
parent dc3c8481
......@@ -63,8 +63,6 @@ Reduction JSIntrinsicLowering::Reduce(Node* node) {
return ReduceIsSmi(node);
case Runtime::kInlineJSValueGetValue:
return ReduceJSValueGetValue(node);
case Runtime::kInlineLikely:
return ReduceUnLikely(node, BranchHint::kTrue);
case Runtime::kInlineMapGetInstanceType:
return ReduceMapGetInstanceType(node);
case Runtime::kInlineMathClz32:
......@@ -83,8 +81,6 @@ Reduction JSIntrinsicLowering::Reduce(Node* node) {
return ReduceSeqStringGetChar(node, String::TWO_BYTE_ENCODING);
case Runtime::kInlineTwoByteSeqStringSetChar:
return ReduceSeqStringSetChar(node, String::TWO_BYTE_ENCODING);
case Runtime::kInlineUnlikely:
return ReduceUnLikely(node, BranchHint::kFalse);
case Runtime::kInlineValueOf:
return ReduceValueOf(node);
case Runtime::kInlineIsMinusZero:
......@@ -341,29 +337,6 @@ Reduction JSIntrinsicLowering::ReduceStringGetLength(Node* node) {
}
Reduction JSIntrinsicLowering::ReduceUnLikely(Node* node, BranchHint hint) {
std::stack<Node*> nodes_to_visit;
nodes_to_visit.push(node);
while (!nodes_to_visit.empty()) {
Node* current = nodes_to_visit.top();
nodes_to_visit.pop();
for (Node* use : current->uses()) {
if (use->opcode() == IrOpcode::kJSToBoolean) {
// We have to "look through" ToBoolean calls.
nodes_to_visit.push(use);
} else if (use->opcode() == IrOpcode::kBranch) {
// Actually set the hint on any branch using the intrinsic node.
NodeProperties::ChangeOp(use, common()->Branch(hint));
}
}
}
// Apart from adding hints to branchs nodes, this is the identity function.
Node* value = NodeProperties::GetValueInput(node, 0);
ReplaceWithValue(node, value);
return Changed(value);
}
Reduction JSIntrinsicLowering::ReduceValueOf(Node* node) {
// if (%_IsSmi(value)) {
// return value;
......
......@@ -55,7 +55,6 @@ class JSIntrinsicLowering final : public AdvancedReducer {
Reduction ReduceSeqStringGetChar(Node* node, String::Encoding encoding);
Reduction ReduceSeqStringSetChar(Node* node, String::Encoding encoding);
Reduction ReduceStringGetLength(Node* node);
Reduction ReduceUnLikely(Node* node, BranchHint hint);
Reduction ReduceValueOf(Node* node);
Reduction ReduceFixedArrayGet(Node* node);
Reduction ReduceFixedArraySet(Node* node);
......
......@@ -12743,17 +12743,6 @@ void HOptimizedGraphBuilder::GenerateMathSqrt(CallRuntime* call) {
}
void HOptimizedGraphBuilder::GenerateLikely(CallRuntime* call) {
DCHECK(call->arguments()->length() == 1);
Visit(call->arguments()->at(0));
}
void HOptimizedGraphBuilder::GenerateUnlikely(CallRuntime* call) {
return GenerateLikely(call);
}
void HOptimizedGraphBuilder::GenerateHasInPrototypeChain(CallRuntime* call) {
DCHECK_EQ(2, call->arguments()->length());
CHECK_ALIVE(VisitForValue(call->arguments()->at(0)));
......
......@@ -2235,8 +2235,6 @@ class HOptimizedGraphBuilder : public HGraphBuilder, public AstVisitor {
F(RegExpConstructResult) \
F(NumberToString) \
F(DebugIsActive) \
F(Likely) \
F(Unlikely) \
F(HasInPrototypeChain) \
/* Typed Arrays */ \
F(TypedArrayInitialize) \
......
......@@ -371,18 +371,6 @@ RUNTIME_FUNCTION(Runtime_IncrementStatsCounter) {
}
RUNTIME_FUNCTION(Runtime_Likely) {
DCHECK(args.length() == 1);
return args[0];
}
RUNTIME_FUNCTION(Runtime_Unlikely) {
DCHECK(args.length() == 1);
return args[0];
}
RUNTIME_FUNCTION(Runtime_HarmonyToString) {
// TODO(caitp): Delete this runtime method when removing --harmony-tostring
return isolate->heap()->ToBoolean(FLAG_harmony_tostring);
......
......@@ -349,8 +349,6 @@ namespace internal {
F(CallSiteIsConstructorRT, 1, 1) \
F(IS_VAR, 1, 1) \
F(IncrementStatsCounter, 1, 1) \
F(Likely, 1, 1) \
F(Unlikely, 1, 1) \
F(HarmonyToString, 0, 1) \
F(GetTypeFeedbackVector, 1, 1) \
F(GetCallerJSFunction, 0, 1) \
......
......@@ -301,30 +301,6 @@ TEST_F(JSIntrinsicLoweringTest, InlineJSValueGetValue) {
}
// -----------------------------------------------------------------------------
// %_Likely
TEST_F(JSIntrinsicLoweringTest, Likely) {
Node* const input = Parameter(0);
Node* const context = Parameter(1);
Node* const effect = graph()->start();
Node* const control = graph()->start();
Node* const likely =
graph()->NewNode(javascript()->CallRuntime(Runtime::kInlineLikely, 1),
input, context, effect, control);
Node* const to_boolean =
graph()->NewNode(javascript()->ToBoolean(), likely, context, effect);
Diamond d(graph(), common(), to_boolean);
graph()->SetEnd(graph()->NewNode(common()->End(1), d.merge));
ASSERT_EQ(BranchHint::kNone, BranchHintOf(d.branch->op()));
Reduction const r = Reduce(likely);
ASSERT_TRUE(r.Changed());
EXPECT_THAT(r.replacement(), input);
ASSERT_EQ(BranchHint::kTrue, BranchHintOf(d.branch->op()));
}
// -----------------------------------------------------------------------------
// %_MathFloor
......@@ -395,30 +371,6 @@ TEST_F(JSIntrinsicLoweringTest, InlineMathClz32) {
}
// -----------------------------------------------------------------------------
// %_Unlikely
TEST_F(JSIntrinsicLoweringTest, Unlikely) {
Node* const input = Parameter(0);
Node* const context = Parameter(1);
Node* const effect = graph()->start();
Node* const control = graph()->start();
Node* const unlikely =
graph()->NewNode(javascript()->CallRuntime(Runtime::kInlineUnlikely, 1),
input, context, effect, control);
Node* const to_boolean =
graph()->NewNode(javascript()->ToBoolean(), unlikely, context, effect);
Diamond d(graph(), common(), to_boolean);
graph()->SetEnd(graph()->NewNode(common()->End(1), d.merge));
ASSERT_EQ(BranchHint::kNone, BranchHintOf(d.branch->op()));
Reduction const r = Reduce(unlikely);
ASSERT_TRUE(r.Changed());
EXPECT_THAT(r.replacement(), input);
ASSERT_EQ(BranchHint::kFalse, BranchHintOf(d.branch->op()));
}
// -----------------------------------------------------------------------------
// %_ValueOf
......
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