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

Unified Diff: src/compiler/change-lowering.cc

Issue 1894523002: [turbofan] Introduce ObjectIsString operator. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 4 years, 8 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/compiler/change-lowering.h ('k') | src/compiler/js-native-context-specialization.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/compiler/change-lowering.cc
diff --git a/src/compiler/change-lowering.cc b/src/compiler/change-lowering.cc
index 7f6cd6beda6a83d7480f5d62154e475d04e72371..eb72c3553211ac989a4667682c164beb7f72d670 100644
--- a/src/compiler/change-lowering.cc
+++ b/src/compiler/change-lowering.cc
@@ -49,12 +49,14 @@ Reduction ChangeLowering::Reduce(Node* node) {
return StoreElement(node);
case IrOpcode::kAllocate:
return Allocate(node);
+ case IrOpcode::kObjectIsNumber:
+ return ObjectIsNumber(node);
case IrOpcode::kObjectIsReceiver:
return ObjectIsReceiver(node);
case IrOpcode::kObjectIsSmi:
return ObjectIsSmi(node);
- case IrOpcode::kObjectIsNumber:
- return ObjectIsNumber(node);
+ case IrOpcode::kObjectIsString:
+ return ObjectIsString(node);
case IrOpcode::kObjectIsUndetectable:
return ObjectIsUndetectable(node);
default:
@@ -756,6 +758,25 @@ Reduction ChangeLowering::ObjectIsSmi(Node* node) {
return Changed(node);
}
+Reduction ChangeLowering::ObjectIsString(Node* node) {
+ Node* input = NodeProperties::GetValueInput(node, 0);
+ Node* check = IsSmi(input);
+ Node* branch = graph()->NewNode(common()->Branch(), check, graph()->start());
+ Node* if_true = graph()->NewNode(common()->IfTrue(), branch);
+ Node* vtrue = jsgraph()->Int32Constant(0);
+ Node* if_false = graph()->NewNode(common()->IfFalse(), branch);
+ Node* vfalse =
+ graph()->NewNode(machine()->Uint32LessThan(),
+ LoadMapInstanceType(LoadHeapObjectMap(input, if_false)),
+ jsgraph()->Uint32Constant(FIRST_NONSTRING_TYPE));
+ Node* control = graph()->NewNode(common()->Merge(2), if_true, if_false);
+ node->ReplaceInput(0, vtrue);
+ node->AppendInput(graph()->zone(), vfalse);
+ node->AppendInput(graph()->zone(), control);
+ NodeProperties::ChangeOp(node, common()->Phi(MachineRepresentation::kBit, 2));
+ return Changed(node);
+}
+
Isolate* ChangeLowering::isolate() const { return jsgraph()->isolate(); }
« no previous file with comments | « src/compiler/change-lowering.h ('k') | src/compiler/js-native-context-specialization.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698