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

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

Issue 2180373005: [turbofan] Add support for String.prototype.charCodeAt/charAt. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 4 years, 5 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/opcodes.h ('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 09a157f93564319d04276a671dfa0cf7759e6434..9e1cf22543af90ff5929e016b0955e4ed84da551 100644
--- a/src/compiler/simplified-lowering.cc
+++ b/src/compiler/simplified-lowering.cc
@@ -822,10 +822,17 @@ class RepresentationSelector {
return MachineRepresentation::kWord32;
} else if (type->Is(Type::Boolean())) {
return MachineRepresentation::kBit;
- } else if (type->Is(Type::Number())) {
- return MachineRepresentation::kFloat64;
} else if (use.IsUsedAsFloat64()) {
return MachineRepresentation::kFloat64;
+ } else if (type->Is(
+ Type::Union(Type::SignedSmall(), Type::NaN(), zone()))) {
+ // TODO(turbofan): For Phis that return either NaN or some Smi, it's
+ // beneficial to not go all the way to double, unless the uses are
+ // double uses. For tagging that just means some potentially expensive
+ // allocation code; we might want to do the same for -0 as well?
+ return MachineRepresentation::kTagged;
+ } else if (type->Is(Type::Number())) {
+ return MachineRepresentation::kFloat64;
} else if (type->Is(Type::Internal())) {
// We mark (u)int64 as Type::Internal.
// TODO(jarin) This is a workaround for our lack of (u)int64
@@ -1936,6 +1943,11 @@ class RepresentationSelector {
}
return;
}
+ case IrOpcode::kStringCharCodeAt: {
+ VisitBinop(node, UseInfo::AnyTagged(), UseInfo::TruncatingWord32(),
+ MachineRepresentation::kWord32);
+ return;
+ }
case IrOpcode::kStringFromCharCode: {
VisitUnop(node, UseInfo::TruncatingWord32(),
MachineRepresentation::kTagged);
« no previous file with comments | « src/compiler/opcodes.h ('k') | src/compiler/simplified-operator.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698