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

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

Issue 2203693002: [turbofan] Introduce initial support for TypedArrays. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@5254
Patch Set: Fix Retain 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/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 093b09ecc0f711bd466af097dc88750097a1431f..bc1721e88d173d9af5661f5def7b039ec80bd5dc 100644
--- a/src/compiler/simplified-lowering.cc
+++ b/src/compiler/simplified-lowering.cc
@@ -65,6 +65,27 @@ enum Phase {
namespace {
+MachineRepresentation MachineRepresentationFromArrayType(
+ ExternalArrayType array_type) {
+ switch (array_type) {
+ case kExternalUint8Array:
+ case kExternalUint8ClampedArray:
+ case kExternalInt8Array:
+ return MachineRepresentation::kWord8;
+ case kExternalUint16Array:
+ case kExternalInt16Array:
+ return MachineRepresentation::kWord16;
+ case kExternalUint32Array:
+ case kExternalInt32Array:
+ return MachineRepresentation::kWord32;
+ case kExternalFloat32Array:
+ return MachineRepresentation::kFloat32;
+ case kExternalFloat64Array:
+ return MachineRepresentation::kFloat64;
+ }
+ UNREACHABLE();
+ return MachineRepresentation::kNone;
+}
UseInfo TruncatingUseInfoFromRepresentation(MachineRepresentation rep) {
switch (rep) {
@@ -2209,6 +2230,30 @@ class RepresentationSelector {
}
return;
}
+ case IrOpcode::kLoadTypedElement: {
+ MachineRepresentation const rep =
+ MachineRepresentationFromArrayType(ExternalArrayTypeOf(node->op()));
+ ProcessInput(node, 0, UseInfo::AnyTagged()); // buffer
+ ProcessInput(node, 1, UseInfo::AnyTagged()); // base pointer
+ ProcessInput(node, 2, UseInfo::PointerInt()); // external pointer
+ ProcessInput(node, 3, UseInfo::TruncatingWord32()); // index
+ ProcessRemainingInputs(node, 4);
+ SetOutput(node, rep);
+ return;
+ }
+ case IrOpcode::kStoreTypedElement: {
+ MachineRepresentation const rep =
+ MachineRepresentationFromArrayType(ExternalArrayTypeOf(node->op()));
+ ProcessInput(node, 0, UseInfo::AnyTagged()); // buffer
+ ProcessInput(node, 1, UseInfo::AnyTagged()); // base pointer
+ ProcessInput(node, 2, UseInfo::PointerInt()); // external pointer
+ ProcessInput(node, 3, UseInfo::TruncatingWord32()); // index
+ ProcessInput(node, 4,
+ TruncatingUseInfoFromRepresentation(rep)); // value
+ ProcessRemainingInputs(node, 5);
+ SetOutput(node, MachineRepresentation::kNone);
+ return;
+ }
case IrOpcode::kPlainPrimitiveToNumber: {
if (InputIs(node, Type::Boolean())) {
VisitUnop(node, UseInfo::Bool(), MachineRepresentation::kWord32);
« 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