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

Side by Side 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 unified diff | Download patch
« no previous file with comments | « src/compiler/operation-typer.cc ('k') | src/compiler/simplified-operator.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 the V8 project authors. All rights reserved. 1 // Copyright 2014 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "src/compiler/simplified-lowering.h" 5 #include "src/compiler/simplified-lowering.h"
6 6
7 #include <limits> 7 #include <limits>
8 8
9 #include "src/address-map.h" 9 #include "src/address-map.h"
10 #include "src/base/bits.h" 10 #include "src/base/bits.h"
(...skipping 2010 matching lines...) Expand 10 before | Expand all | Expand 10 after
2021 if (lower()) DeferReplacement(node, node->InputAt(0)); 2021 if (lower()) DeferReplacement(node, node->InputAt(0));
2022 return; 2022 return;
2023 } 2023 }
2024 case IrOpcode::kNumberToUint32: { 2024 case IrOpcode::kNumberToUint32: {
2025 // Just change representation if necessary. 2025 // Just change representation if necessary.
2026 VisitUnop(node, UseInfo::TruncatingWord32(), 2026 VisitUnop(node, UseInfo::TruncatingWord32(),
2027 MachineRepresentation::kWord32); 2027 MachineRepresentation::kWord32);
2028 if (lower()) DeferReplacement(node, node->InputAt(0)); 2028 if (lower()) DeferReplacement(node, node->InputAt(0));
2029 return; 2029 return;
2030 } 2030 }
2031 case IrOpcode::kNumberToString: {
2032 Type* const rhs_type = TypeOf(node->InputAt(1));
2033 VisitBinop(node, UseInfo::AnyTagged(), MachineRepresentation::kTagged);
2034 if (lower()) {
2035 if (rhs_type->Is(type_cache_.kSingletonTen)) {
2036 // NumberToString(x, #10) => Call(NumberToStringStub, x, no-context)
2037 Operator::Properties properties = Operator::kEliminatable;
2038 Callable callable =
2039 CodeFactory::NumberToString(jsgraph_->isolate());
2040 CallDescriptor::Flags flags = CallDescriptor::kNoFlags;
2041 CallDescriptor* desc = Linkage::GetStubCallDescriptor(
2042 jsgraph_->isolate(), jsgraph_->zone(), callable.descriptor(), 0,
2043 flags, properties);
2044 node->InsertInput(jsgraph_->zone(), 0,
2045 jsgraph_->HeapConstant(callable.code()));
2046 node->ReplaceInput(2, jsgraph_->NoContextConstant());
2047 node->AppendInput(jsgraph_->zone(), jsgraph_->graph()->start());
2048 NodeProperties::ChangeOp(node, jsgraph_->common()->Call(desc));
2049 } else {
2050 // NumberToString(x, y) => %NumberToString(x, y, no-context)
2051 Operator::Properties properties = Operator::kEliminatable;
2052 CallDescriptor::Flags flags = CallDescriptor::kNoFlags;
2053 Runtime::FunctionId id = Runtime::kNumberToString;
2054 CallDescriptor* desc = Linkage::GetRuntimeCallDescriptor(
2055 jsgraph_->zone(), id, 2, properties, flags);
2056 node->InsertInput(jsgraph_->zone(), 0,
2057 jsgraph_->CEntryStubConstant(1));
2058 node->AppendInput(jsgraph_->zone(),
2059 jsgraph_->ExternalConstant(
2060 ExternalReference(id, jsgraph_->isolate())));
2061 node->AppendInput(jsgraph_->zone(), jsgraph_->Int32Constant(2));
2062 node->AppendInput(jsgraph_->zone(), jsgraph_->NoContextConstant());
2063 node->AppendInput(jsgraph_->zone(), jsgraph_->graph()->start());
2064 NodeProperties::ChangeOp(node, jsgraph_->common()->Call(desc));
2065 }
2066 }
2067 return;
2068 }
2031 case IrOpcode::kReferenceEqual: { 2069 case IrOpcode::kReferenceEqual: {
2032 VisitBinop(node, UseInfo::AnyTagged(), MachineRepresentation::kBit); 2070 VisitBinop(node, UseInfo::AnyTagged(), MachineRepresentation::kBit);
2033 if (lower()) { 2071 if (lower()) {
2034 NodeProperties::ChangeOp(node, lowering->machine()->WordEqual()); 2072 NodeProperties::ChangeOp(node, lowering->machine()->WordEqual());
2035 } 2073 }
2036 return; 2074 return;
2037 } 2075 }
2038 case IrOpcode::kStringEqual: { 2076 case IrOpcode::kStringEqual: {
2039 VisitBinop(node, UseInfo::AnyTagged(), MachineRepresentation::kTagged); 2077 VisitBinop(node, UseInfo::AnyTagged(), MachineRepresentation::kTagged);
2040 if (lower()) { 2078 if (lower()) {
(...skipping 1295 matching lines...) Expand 10 before | Expand all | Expand 10 after
3336 isolate(), graph()->zone(), callable.descriptor(), 0, flags, 3374 isolate(), graph()->zone(), callable.descriptor(), 0, flags,
3337 Operator::kNoProperties); 3375 Operator::kNoProperties);
3338 to_number_operator_.set(common()->Call(desc)); 3376 to_number_operator_.set(common()->Call(desc));
3339 } 3377 }
3340 return to_number_operator_.get(); 3378 return to_number_operator_.get();
3341 } 3379 }
3342 3380
3343 } // namespace compiler 3381 } // namespace compiler
3344 } // namespace internal 3382 } // namespace internal
3345 } // namespace v8 3383 } // namespace v8
OLDNEW
« 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