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

Side by Side Diff: src/compiler/simplified-lowering.cc

Issue 968773004: [turbofan] Use the typer to statically detect Smis. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 9 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/simplified-lowering.h ('k') | src/compiler/typer.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/simplified-lowering.h" 5 #include "src/compiler/simplified-lowering.h"
6 6
7 #include <limits> 7 #include <limits>
8 8
9 #include "src/base/bits.h" 9 #include "src/base/bits.h"
10 #include "src/code-factory.h" 10 #include "src/code-factory.h"
(...skipping 1117 matching lines...) Expand 10 before | Expand all | Expand 10 after
1128 Node* shift_amount = jsgraph()->Int32Constant(kSmiTagSize + kSmiShiftSize); 1128 Node* shift_amount = jsgraph()->Int32Constant(kSmiTagSize + kSmiShiftSize);
1129 return graph()->NewNode(machine()->WordShl(), node, shift_amount); 1129 return graph()->NewNode(machine()->WordShl(), node, shift_amount);
1130 } 1130 }
1131 1131
1132 1132
1133 Node* SimplifiedLowering::OffsetMinusTagConstant(int32_t offset) { 1133 Node* SimplifiedLowering::OffsetMinusTagConstant(int32_t offset) {
1134 return jsgraph()->Int32Constant(offset - kHeapObjectTag); 1134 return jsgraph()->Int32Constant(offset - kHeapObjectTag);
1135 } 1135 }
1136 1136
1137 1137
1138 WriteBarrierKind SimplifiedLowering::ComputeWriteBarrierKind( 1138 namespace {
1139 BaseTaggedness base_is_tagged, MachineType representation, Node* value) { 1139
1140 // TODO(turbofan): skip write barriers for Smis, etc. 1140 WriteBarrierKind ComputeWriteBarrierKind(BaseTaggedness base_is_tagged,
1141 if (machine()->Is64() && value->opcode() == IrOpcode::kChangeInt32ToTagged) { 1141 MachineType representation,
1142 // TODO(bmeurer): Remove this hack once we have a way to represent "sminess" 1142 Type* type) {
1143 // of values, either in types or representations. 1143 if (type->Is(Type::TaggedSigned())) {
1144 // Write barriers are only for writes of heap objects.
1144 return kNoWriteBarrier; 1145 return kNoWriteBarrier;
1145 } 1146 }
1146 if (base_is_tagged == kTaggedBase && 1147 if (base_is_tagged == kTaggedBase &&
1147 RepresentationOf(representation) == kRepTagged) { 1148 RepresentationOf(representation) == kRepTagged) {
1148 // Write barriers are only for writes into heap objects (i.e. tagged base). 1149 // Write barriers are only for writes into heap objects (i.e. tagged base).
1149 return kFullWriteBarrier; 1150 return kFullWriteBarrier;
1150 } 1151 }
1151 return kNoWriteBarrier; 1152 return kNoWriteBarrier;
1152 } 1153 }
1153 1154
1155 } // namespace
1156
1154 1157
1155 void SimplifiedLowering::DoLoadField(Node* node) { 1158 void SimplifiedLowering::DoLoadField(Node* node) {
1156 const FieldAccess& access = FieldAccessOf(node->op()); 1159 const FieldAccess& access = FieldAccessOf(node->op());
1157 node->set_op(machine()->Load(access.machine_type)); 1160 node->set_op(machine()->Load(access.machine_type));
1158 Node* offset = jsgraph()->IntPtrConstant(access.offset - access.tag()); 1161 Node* offset = jsgraph()->IntPtrConstant(access.offset - access.tag());
1159 node->InsertInput(graph()->zone(), 1, offset); 1162 node->InsertInput(graph()->zone(), 1, offset);
1160 } 1163 }
1161 1164
1162 1165
1163 void SimplifiedLowering::DoStoreField(Node* node) { 1166 void SimplifiedLowering::DoStoreField(Node* node) {
1164 const FieldAccess& access = FieldAccessOf(node->op()); 1167 const FieldAccess& access = FieldAccessOf(node->op());
1165 WriteBarrierKind kind = ComputeWriteBarrierKind( 1168 Type* type = NodeProperties::GetBounds(node->InputAt(1)).upper;
1166 access.base_is_tagged, access.machine_type, node->InputAt(1)); 1169 WriteBarrierKind kind =
1170 ComputeWriteBarrierKind(access.base_is_tagged, access.machine_type, type);
1167 node->set_op( 1171 node->set_op(
1168 machine()->Store(StoreRepresentation(access.machine_type, kind))); 1172 machine()->Store(StoreRepresentation(access.machine_type, kind)));
1169 Node* offset = jsgraph()->IntPtrConstant(access.offset - access.tag()); 1173 Node* offset = jsgraph()->IntPtrConstant(access.offset - access.tag());
1170 node->InsertInput(graph()->zone(), 1, offset); 1174 node->InsertInput(graph()->zone(), 1, offset);
1171 } 1175 }
1172 1176
1173 1177
1174 Node* SimplifiedLowering::ComputeIndex(const ElementAccess& access, 1178 Node* SimplifiedLowering::ComputeIndex(const ElementAccess& access,
1175 Node* const key) { 1179 Node* const key) {
1176 Node* index = key; 1180 Node* index = key;
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after
1261 1265
1262 void SimplifiedLowering::DoLoadElement(Node* node) { 1266 void SimplifiedLowering::DoLoadElement(Node* node) {
1263 const ElementAccess& access = ElementAccessOf(node->op()); 1267 const ElementAccess& access = ElementAccessOf(node->op());
1264 node->set_op(machine()->Load(access.machine_type)); 1268 node->set_op(machine()->Load(access.machine_type));
1265 node->ReplaceInput(1, ComputeIndex(access, node->InputAt(1))); 1269 node->ReplaceInput(1, ComputeIndex(access, node->InputAt(1)));
1266 } 1270 }
1267 1271
1268 1272
1269 void SimplifiedLowering::DoStoreElement(Node* node) { 1273 void SimplifiedLowering::DoStoreElement(Node* node) {
1270 const ElementAccess& access = ElementAccessOf(node->op()); 1274 const ElementAccess& access = ElementAccessOf(node->op());
1271 node->set_op(machine()->Store(StoreRepresentation( 1275 Type* type = NodeProperties::GetBounds(node->InputAt(2)).upper;
1272 access.machine_type, 1276 node->set_op(machine()->Store(
1273 ComputeWriteBarrierKind(access.base_is_tagged, access.machine_type, 1277 StoreRepresentation(access.machine_type,
1274 node->InputAt(2))))); 1278 ComputeWriteBarrierKind(access.base_is_tagged,
1279 access.machine_type, type))));
1275 node->ReplaceInput(1, ComputeIndex(access, node->InputAt(1))); 1280 node->ReplaceInput(1, ComputeIndex(access, node->InputAt(1)));
1276 } 1281 }
1277 1282
1278 1283
1279 void SimplifiedLowering::DoStringAdd(Node* node) { 1284 void SimplifiedLowering::DoStringAdd(Node* node) {
1280 Operator::Properties properties = node->op()->properties(); 1285 Operator::Properties properties = node->op()->properties();
1281 Callable callable = CodeFactory::StringAdd( 1286 Callable callable = CodeFactory::StringAdd(
1282 jsgraph()->isolate(), STRING_ADD_CHECK_NONE, NOT_TENURED); 1287 jsgraph()->isolate(), STRING_ADD_CHECK_NONE, NOT_TENURED);
1283 CallDescriptor::Flags flags = CallDescriptor::kNoFlags; 1288 CallDescriptor::Flags flags = CallDescriptor::kNoFlags;
1284 CallDescriptor* desc = Linkage::GetStubCallDescriptor( 1289 CallDescriptor* desc = Linkage::GetStubCallDescriptor(
(...skipping 292 matching lines...) Expand 10 before | Expand all | Expand 10 after
1577 1582
1578 void SimplifiedLowering::DoStringLessThanOrEqual(Node* node) { 1583 void SimplifiedLowering::DoStringLessThanOrEqual(Node* node) {
1579 node->set_op(machine()->IntLessThanOrEqual()); 1584 node->set_op(machine()->IntLessThanOrEqual());
1580 node->ReplaceInput(0, StringComparison(node, true)); 1585 node->ReplaceInput(0, StringComparison(node, true));
1581 node->ReplaceInput(1, jsgraph()->SmiConstant(EQUAL)); 1586 node->ReplaceInput(1, jsgraph()->SmiConstant(EQUAL));
1582 } 1587 }
1583 1588
1584 } // namespace compiler 1589 } // namespace compiler
1585 } // namespace internal 1590 } // namespace internal
1586 } // namespace v8 1591 } // namespace v8
OLDNEW
« no previous file with comments | « src/compiler/simplified-lowering.h ('k') | src/compiler/typer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698