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

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

Issue 2227463003: [WIP] NumberToString operator in TF. Base URL: https://chromium.googlesource.com/v8/v8.git@TurboFan_BuiltinTypingRules
Patch Set: Created 4 years, 4 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/operation-typer.cc ('k') | src/compiler/simplified-operator.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/compiler/simplified-lowering.cc
diff --git a/src/compiler/simplified-lowering.cc b/src/compiler/simplified-lowering.cc
index d72fc827591350c7b4283b89ee861cb23bb340d8..7e93dc512519788e4bdc87b8392168722421563b 100644
--- a/src/compiler/simplified-lowering.cc
+++ b/src/compiler/simplified-lowering.cc
@@ -2028,6 +2028,44 @@ class RepresentationSelector {
if (lower()) DeferReplacement(node, node->InputAt(0));
return;
}
+ case IrOpcode::kNumberToString: {
+ Type* const rhs_type = TypeOf(node->InputAt(1));
+ VisitBinop(node, UseInfo::AnyTagged(), MachineRepresentation::kTagged);
+ if (lower()) {
+ if (rhs_type->Is(type_cache_.kSingletonTen)) {
+ // NumberToString(x, #10) => Call(NumberToStringStub, x, no-context)
+ Operator::Properties properties = Operator::kEliminatable;
+ Callable callable =
+ CodeFactory::NumberToString(jsgraph_->isolate());
+ CallDescriptor::Flags flags = CallDescriptor::kNoFlags;
+ CallDescriptor* desc = Linkage::GetStubCallDescriptor(
+ jsgraph_->isolate(), jsgraph_->zone(), callable.descriptor(), 0,
+ flags, properties);
+ node->InsertInput(jsgraph_->zone(), 0,
+ jsgraph_->HeapConstant(callable.code()));
+ node->ReplaceInput(2, jsgraph_->NoContextConstant());
+ node->AppendInput(jsgraph_->zone(), jsgraph_->graph()->start());
+ NodeProperties::ChangeOp(node, jsgraph_->common()->Call(desc));
+ } else {
+ // NumberToString(x, y) => %NumberToString(x, y, no-context)
+ Operator::Properties properties = Operator::kEliminatable;
+ CallDescriptor::Flags flags = CallDescriptor::kNoFlags;
+ Runtime::FunctionId id = Runtime::kNumberToString;
+ CallDescriptor* desc = Linkage::GetRuntimeCallDescriptor(
+ jsgraph_->zone(), id, 2, properties, flags);
+ node->InsertInput(jsgraph_->zone(), 0,
+ jsgraph_->CEntryStubConstant(1));
+ node->AppendInput(jsgraph_->zone(),
+ jsgraph_->ExternalConstant(
+ ExternalReference(id, jsgraph_->isolate())));
+ node->AppendInput(jsgraph_->zone(), jsgraph_->Int32Constant(2));
+ node->AppendInput(jsgraph_->zone(), jsgraph_->NoContextConstant());
+ node->AppendInput(jsgraph_->zone(), jsgraph_->graph()->start());
+ NodeProperties::ChangeOp(node, jsgraph_->common()->Call(desc));
+ }
+ }
+ return;
+ }
case IrOpcode::kReferenceEqual: {
VisitBinop(node, UseInfo::AnyTagged(), MachineRepresentation::kBit);
if (lower()) {
« no previous file with comments | « src/compiler/operation-typer.cc ('k') | src/compiler/simplified-operator.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698