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

Side by Side Diff: src/compiler/instruction-selector.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/instruction-selector.h ('k') | src/compiler/js-builtin-reducer.cc » ('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/instruction-selector.h" 5 #include "src/compiler/instruction-selector.h"
6 6
7 #include <limits> 7 #include <limits>
8 8
9 #include "src/base/adapters.h" 9 #include "src/base/adapters.h"
10 #include "src/compiler/instruction-selector-impl.h" 10 #include "src/compiler/instruction-selector-impl.h"
(...skipping 281 matching lines...) Expand 10 before | Expand all | Expand 10 after
292 void InstructionSelector::MarkAsDefined(Node* node) { 292 void InstructionSelector::MarkAsDefined(Node* node) {
293 DCHECK_NOT_NULL(node); 293 DCHECK_NOT_NULL(node);
294 size_t const id = node->id(); 294 size_t const id = node->id();
295 DCHECK_LT(id, defined_.size()); 295 DCHECK_LT(id, defined_.size());
296 defined_[id] = true; 296 defined_[id] = true;
297 } 297 }
298 298
299 299
300 bool InstructionSelector::IsUsed(Node* node) const { 300 bool InstructionSelector::IsUsed(Node* node) const {
301 DCHECK_NOT_NULL(node); 301 DCHECK_NOT_NULL(node);
302 // TODO(bmeurer): This is a terrible monster hack, but we have to make sure
303 // that the Retain is actually emitted, otherwise the GC will mess up.
304 if (node->opcode() == IrOpcode::kRetain) return true;
302 if (!node->op()->HasProperty(Operator::kEliminatable)) return true; 305 if (!node->op()->HasProperty(Operator::kEliminatable)) return true;
303 size_t const id = node->id(); 306 size_t const id = node->id();
304 DCHECK_LT(id, used_.size()); 307 DCHECK_LT(id, used_.size());
305 return used_[id]; 308 return used_[id];
306 } 309 }
307 310
308 311
309 void InstructionSelector::MarkAsUsed(Node* node) { 312 void InstructionSelector::MarkAsUsed(Node* node) {
310 DCHECK_NOT_NULL(node); 313 DCHECK_NOT_NULL(node);
311 size_t const id = node->id(); 314 size_t const id = node->id();
(...skipping 610 matching lines...) Expand 10 before | Expand all | Expand 10 after
922 case IrOpcode::kFrameState: 925 case IrOpcode::kFrameState:
923 case IrOpcode::kStateValues: 926 case IrOpcode::kStateValues:
924 case IrOpcode::kObjectState: 927 case IrOpcode::kObjectState:
925 return; 928 return;
926 case IrOpcode::kDebugBreak: 929 case IrOpcode::kDebugBreak:
927 VisitDebugBreak(node); 930 VisitDebugBreak(node);
928 return; 931 return;
929 case IrOpcode::kComment: 932 case IrOpcode::kComment:
930 VisitComment(node); 933 VisitComment(node);
931 return; 934 return;
935 case IrOpcode::kRetain:
936 VisitRetain(node);
937 return;
932 case IrOpcode::kLoad: { 938 case IrOpcode::kLoad: {
933 LoadRepresentation type = LoadRepresentationOf(node->op()); 939 LoadRepresentation type = LoadRepresentationOf(node->op());
934 MarkAsRepresentation(type.representation(), node); 940 MarkAsRepresentation(type.representation(), node);
935 return VisitLoad(node); 941 return VisitLoad(node);
936 } 942 }
937 case IrOpcode::kStore: 943 case IrOpcode::kStore:
938 return VisitStore(node); 944 return VisitStore(node);
939 case IrOpcode::kWord32And: 945 case IrOpcode::kWord32And:
940 return MarkAsWord32(node), VisitWord32And(node); 946 return MarkAsWord32(node), VisitWord32And(node);
941 case IrOpcode::kWord32Or: 947 case IrOpcode::kWord32Or:
(...skipping 348 matching lines...) Expand 10 before | Expand all | Expand 10 after
1290 MarkAsWord32(NodeProperties::FindProjection(node, 0)); 1296 MarkAsWord32(NodeProperties::FindProjection(node, 0));
1291 MarkAsWord32(NodeProperties::FindProjection(node, 1)); 1297 MarkAsWord32(NodeProperties::FindProjection(node, 1));
1292 return VisitWord32PairSar(node); 1298 return VisitWord32PairSar(node);
1293 case IrOpcode::kAtomicLoad: { 1299 case IrOpcode::kAtomicLoad: {
1294 LoadRepresentation type = LoadRepresentationOf(node->op()); 1300 LoadRepresentation type = LoadRepresentationOf(node->op());
1295 MarkAsRepresentation(type.representation(), node); 1301 MarkAsRepresentation(type.representation(), node);
1296 return VisitAtomicLoad(node); 1302 return VisitAtomicLoad(node);
1297 } 1303 }
1298 case IrOpcode::kAtomicStore: 1304 case IrOpcode::kAtomicStore:
1299 return VisitAtomicStore(node); 1305 return VisitAtomicStore(node);
1306 case IrOpcode::kUnsafePointerAdd:
1307 MarkAsRepresentation(MachineType::PointerRepresentation(), node);
1308 return VisitUnsafePointerAdd(node);
1300 default: 1309 default:
1301 V8_Fatal(__FILE__, __LINE__, "Unexpected operator #%d:%s @ node #%d", 1310 V8_Fatal(__FILE__, __LINE__, "Unexpected operator #%d:%s @ node #%d",
1302 node->opcode(), node->op()->mnemonic(), node->id()); 1311 node->opcode(), node->op()->mnemonic(), node->id());
1303 break; 1312 break;
1304 } 1313 }
1305 } 1314 }
1306 1315
1307 void InstructionSelector::VisitImpossibleToWord32(Node* node) { 1316 void InstructionSelector::VisitImpossibleToWord32(Node* node) {
1308 OperandGenerator g(this); 1317 OperandGenerator g(this);
1309 Emit(kArchImpossible, g.DefineAsConstant(node, Constant(0))); 1318 Emit(kArchImpossible, g.DefineAsConstant(node, Constant(0)));
(...skipping 699 matching lines...) Expand 10 before | Expand all | Expand 10 after
2009 OperandGenerator g(this); 2018 OperandGenerator g(this);
2010 Emit(kArchDebugBreak, g.NoOutput()); 2019 Emit(kArchDebugBreak, g.NoOutput());
2011 } 2020 }
2012 2021
2013 void InstructionSelector::VisitComment(Node* node) { 2022 void InstructionSelector::VisitComment(Node* node) {
2014 OperandGenerator g(this); 2023 OperandGenerator g(this);
2015 InstructionOperand operand(g.UseImmediate(node)); 2024 InstructionOperand operand(g.UseImmediate(node));
2016 Emit(kArchComment, 0, nullptr, 1, &operand); 2025 Emit(kArchComment, 0, nullptr, 1, &operand);
2017 } 2026 }
2018 2027
2028 void InstructionSelector::VisitUnsafePointerAdd(Node* node) {
2029 #if V8_TARGET_ARCH_64_BIT
2030 VisitInt64Add(node);
2031 #else // V8_TARGET_ARCH_64_BIT
2032 VisitInt32Add(node);
2033 #endif // V8_TARGET_ARCH_64_BIT
2034 }
2035
2036 void InstructionSelector::VisitRetain(Node* node) {
2037 OperandGenerator g(this);
2038 Emit(kArchNop, g.NoOutput(), g.UseAny(node->InputAt(0)));
2039 }
2040
2019 bool InstructionSelector::CanProduceSignalingNaN(Node* node) { 2041 bool InstructionSelector::CanProduceSignalingNaN(Node* node) {
2020 // TODO(jarin) Improve the heuristic here. 2042 // TODO(jarin) Improve the heuristic here.
2021 if (node->opcode() == IrOpcode::kFloat64Add || 2043 if (node->opcode() == IrOpcode::kFloat64Add ||
2022 node->opcode() == IrOpcode::kFloat64Sub || 2044 node->opcode() == IrOpcode::kFloat64Sub ||
2023 node->opcode() == IrOpcode::kFloat64Mul) { 2045 node->opcode() == IrOpcode::kFloat64Mul) {
2024 return false; 2046 return false;
2025 } 2047 }
2026 return true; 2048 return true;
2027 } 2049 }
2028 2050
(...skipping 22 matching lines...) Expand all
2051 return new (instruction_zone()) FrameStateDescriptor( 2073 return new (instruction_zone()) FrameStateDescriptor(
2052 instruction_zone(), state_info.type(), state_info.bailout_id(), 2074 instruction_zone(), state_info.type(), state_info.bailout_id(),
2053 state_info.state_combine(), parameters, locals, stack, 2075 state_info.state_combine(), parameters, locals, stack,
2054 state_info.shared_info(), outer_state); 2076 state_info.shared_info(), outer_state);
2055 } 2077 }
2056 2078
2057 2079
2058 } // namespace compiler 2080 } // namespace compiler
2059 } // namespace internal 2081 } // namespace internal
2060 } // namespace v8 2082 } // namespace v8
OLDNEW
« no previous file with comments | « src/compiler/instruction-selector.h ('k') | src/compiler/js-builtin-reducer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698