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

Unified Diff: src/compiler/js-intrinsic-lowering.cc

Issue 1846683006: [stubs] Introduce ToIntegerStub and unify the handling of %_ToInteger. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 4 years, 9 months 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
« no previous file with comments | « src/code-stubs.cc ('k') | src/crankshaft/hydrogen.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/compiler/js-intrinsic-lowering.cc
diff --git a/src/compiler/js-intrinsic-lowering.cc b/src/compiler/js-intrinsic-lowering.cc
index 5ca08c411bafda2cb85b608bc92b95b545647ebe..95c1e22d595853e67bb49ca90ad8fb006cfac3b2 100644
--- a/src/compiler/js-intrinsic-lowering.cc
+++ b/src/compiler/js-intrinsic-lowering.cc
@@ -352,10 +352,6 @@ Reduction JSIntrinsicLowering::ReduceSubString(Node* node) {
Reduction JSIntrinsicLowering::ReduceToInteger(Node* node) {
Node* value = NodeProperties::GetValueInput(node, 0);
- Node* context = NodeProperties::GetContextInput(node);
- Node* frame_state = NodeProperties::GetFrameStateInput(node, 0);
- Node* effect = NodeProperties::GetEffectInput(node);
- Node* control = NodeProperties::GetControlInput(node);
// ToInteger is a no-op on integer values and -0.
Type* value_type = NodeProperties::GetType(value);
@@ -364,36 +360,7 @@ Reduction JSIntrinsicLowering::ReduceToInteger(Node* node) {
return Replace(value);
}
- Node* check = graph()->NewNode(simplified()->ObjectIsSmi(), value);
- Node* branch =
- graph()->NewNode(common()->Branch(BranchHint::kTrue), check, control);
-
- Node* if_true = graph()->NewNode(common()->IfTrue(), branch);
- Node* etrue = effect;
- Node* vtrue =
- graph()->NewNode(common()->Guard(type_cache_.kSmi), value, if_true);
-
- Node* if_false = graph()->NewNode(common()->IfFalse(), branch);
- Node* efalse = effect;
- Node* vfalse;
- {
- vfalse = efalse =
- graph()->NewNode(javascript()->CallRuntime(Runtime::kToInteger), value,
- context, frame_state, efalse, if_false);
- // TODO(jarin) Intersect the type with integers?
- NodeProperties::SetType(vfalse, NodeProperties::GetType(node));
-
- if_false = graph()->NewNode(common()->IfSuccess(), vfalse);
- }
-
- control = graph()->NewNode(common()->Merge(2), if_true, if_false);
- effect = graph()->NewNode(common()->EffectPhi(2), etrue, efalse, control);
- value = graph()->NewNode(common()->Phi(MachineRepresentation::kTagged, 2),
- vtrue, vfalse, control);
-
- // TODO(bmeurer, mstarzinger): Rewire IfException inputs to {vfalse}.
- ReplaceWithValue(node, value, effect, control);
- return Changed(value);
+ return Change(node, CodeFactory::ToInteger(isolate()), 0);
}
« no previous file with comments | « src/code-stubs.cc ('k') | src/crankshaft/hydrogen.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698