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

Side by Side 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 unified diff | Download patch
« no previous file with comments | « src/compiler/opcodes.h ('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 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
58 // operators for some nodes, expanding some nodes to multiple nodes, or 58 // operators for some nodes, expanding some nodes to multiple nodes, or
59 // removing some (redundant) nodes. 59 // removing some (redundant) nodes.
60 // During this phase, use the {RepresentationChanger} to insert 60 // During this phase, use the {RepresentationChanger} to insert
61 // representation changes between uses that demand a particular 61 // representation changes between uses that demand a particular
62 // representation and nodes that produce a different representation. 62 // representation and nodes that produce a different representation.
63 LOWER 63 LOWER
64 }; 64 };
65 65
66 namespace { 66 namespace {
67 67
68 MachineRepresentation MachineRepresentationFromArrayType(
69 ExternalArrayType array_type) {
70 switch (array_type) {
71 case kExternalUint8Array:
72 case kExternalUint8ClampedArray:
73 case kExternalInt8Array:
74 return MachineRepresentation::kWord8;
75 case kExternalUint16Array:
76 case kExternalInt16Array:
77 return MachineRepresentation::kWord16;
78 case kExternalUint32Array:
79 case kExternalInt32Array:
80 return MachineRepresentation::kWord32;
81 case kExternalFloat32Array:
82 return MachineRepresentation::kFloat32;
83 case kExternalFloat64Array:
84 return MachineRepresentation::kFloat64;
85 }
86 UNREACHABLE();
87 return MachineRepresentation::kNone;
88 }
68 89
69 UseInfo TruncatingUseInfoFromRepresentation(MachineRepresentation rep) { 90 UseInfo TruncatingUseInfoFromRepresentation(MachineRepresentation rep) {
70 switch (rep) { 91 switch (rep) {
71 case MachineRepresentation::kTagged: 92 case MachineRepresentation::kTagged:
72 return UseInfo::AnyTagged(); 93 return UseInfo::AnyTagged();
73 case MachineRepresentation::kFloat64: 94 case MachineRepresentation::kFloat64:
74 return UseInfo::TruncatingFloat64(); 95 return UseInfo::TruncatingFloat64();
75 case MachineRepresentation::kFloat32: 96 case MachineRepresentation::kFloat32:
76 return UseInfo::TruncatingFloat32(); 97 return UseInfo::TruncatingFloat32();
77 case MachineRepresentation::kWord64: 98 case MachineRepresentation::kWord64:
(...skipping 2124 matching lines...) Expand 10 before | Expand all | Expand 10 after
2202 SetOutput(node, MachineRepresentation::kNone); 2223 SetOutput(node, MachineRepresentation::kNone);
2203 if (lower()) { 2224 if (lower()) {
2204 if (write_barrier_kind < access.write_barrier_kind) { 2225 if (write_barrier_kind < access.write_barrier_kind) {
2205 access.write_barrier_kind = write_barrier_kind; 2226 access.write_barrier_kind = write_barrier_kind;
2206 NodeProperties::ChangeOp( 2227 NodeProperties::ChangeOp(
2207 node, jsgraph_->simplified()->StoreElement(access)); 2228 node, jsgraph_->simplified()->StoreElement(access));
2208 } 2229 }
2209 } 2230 }
2210 return; 2231 return;
2211 } 2232 }
2233 case IrOpcode::kLoadTypedElement: {
2234 MachineRepresentation const rep =
2235 MachineRepresentationFromArrayType(ExternalArrayTypeOf(node->op()));
2236 ProcessInput(node, 0, UseInfo::AnyTagged()); // buffer
2237 ProcessInput(node, 1, UseInfo::AnyTagged()); // base pointer
2238 ProcessInput(node, 2, UseInfo::PointerInt()); // external pointer
2239 ProcessInput(node, 3, UseInfo::TruncatingWord32()); // index
2240 ProcessRemainingInputs(node, 4);
2241 SetOutput(node, rep);
2242 return;
2243 }
2244 case IrOpcode::kStoreTypedElement: {
2245 MachineRepresentation const rep =
2246 MachineRepresentationFromArrayType(ExternalArrayTypeOf(node->op()));
2247 ProcessInput(node, 0, UseInfo::AnyTagged()); // buffer
2248 ProcessInput(node, 1, UseInfo::AnyTagged()); // base pointer
2249 ProcessInput(node, 2, UseInfo::PointerInt()); // external pointer
2250 ProcessInput(node, 3, UseInfo::TruncatingWord32()); // index
2251 ProcessInput(node, 4,
2252 TruncatingUseInfoFromRepresentation(rep)); // value
2253 ProcessRemainingInputs(node, 5);
2254 SetOutput(node, MachineRepresentation::kNone);
2255 return;
2256 }
2212 case IrOpcode::kPlainPrimitiveToNumber: { 2257 case IrOpcode::kPlainPrimitiveToNumber: {
2213 if (InputIs(node, Type::Boolean())) { 2258 if (InputIs(node, Type::Boolean())) {
2214 VisitUnop(node, UseInfo::Bool(), MachineRepresentation::kWord32); 2259 VisitUnop(node, UseInfo::Bool(), MachineRepresentation::kWord32);
2215 if (lower()) DeferReplacement(node, node->InputAt(0)); 2260 if (lower()) DeferReplacement(node, node->InputAt(0));
2216 } else if (InputIs(node, Type::String())) { 2261 } else if (InputIs(node, Type::String())) {
2217 VisitUnop(node, UseInfo::AnyTagged(), MachineRepresentation::kTagged); 2262 VisitUnop(node, UseInfo::AnyTagged(), MachineRepresentation::kTagged);
2218 if (lower()) lowering->DoStringToNumber(node); 2263 if (lower()) lowering->DoStringToNumber(node);
2219 } else if (truncation.IsUsedAsWord32()) { 2264 } else if (truncation.IsUsedAsWord32()) {
2220 if (InputIs(node, Type::NumberOrOddball())) { 2265 if (InputIs(node, Type::NumberOrOddball())) {
2221 VisitUnop(node, UseInfo::TruncatingWord32(), 2266 VisitUnop(node, UseInfo::TruncatingWord32(),
(...skipping 1350 matching lines...) Expand 10 before | Expand all | Expand 10 after
3572 isolate(), graph()->zone(), callable.descriptor(), 0, flags, 3617 isolate(), graph()->zone(), callable.descriptor(), 0, flags,
3573 Operator::kNoProperties); 3618 Operator::kNoProperties);
3574 to_number_operator_.set(common()->Call(desc)); 3619 to_number_operator_.set(common()->Call(desc));
3575 } 3620 }
3576 return to_number_operator_.get(); 3621 return to_number_operator_.get();
3577 } 3622 }
3578 3623
3579 } // namespace compiler 3624 } // namespace compiler
3580 } // namespace internal 3625 } // namespace internal
3581 } // namespace v8 3626 } // namespace v8
OLDNEW
« 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