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

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

Issue 652363006: [turbofan] First step towards correctified 64-bit addressing. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Fixes2 Created 6 years, 1 month 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 | Annotate | Revision Log
« no previous file with comments | « src/compiler/node-matchers.cc ('k') | src/compiler/x64/code-generator-x64.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 1100 matching lines...) Expand 10 before | Expand all | Expand 10 after
1111 // Write barriers are only for writes into heap objects (i.e. tagged base). 1111 // Write barriers are only for writes into heap objects (i.e. tagged base).
1112 return kFullWriteBarrier; 1112 return kFullWriteBarrier;
1113 } 1113 }
1114 return kNoWriteBarrier; 1114 return kNoWriteBarrier;
1115 } 1115 }
1116 1116
1117 1117
1118 void SimplifiedLowering::DoLoadField(Node* node) { 1118 void SimplifiedLowering::DoLoadField(Node* node) {
1119 const FieldAccess& access = FieldAccessOf(node->op()); 1119 const FieldAccess& access = FieldAccessOf(node->op());
1120 node->set_op(machine()->Load(access.machine_type)); 1120 node->set_op(machine()->Load(access.machine_type));
1121 Node* offset = jsgraph()->Int32Constant(access.offset - access.tag()); 1121 Node* offset = jsgraph()->IntPtrConstant(access.offset - access.tag());
1122 node->InsertInput(graph()->zone(), 1, offset); 1122 node->InsertInput(graph()->zone(), 1, offset);
1123 } 1123 }
1124 1124
1125 1125
1126 void SimplifiedLowering::DoStoreField(Node* node) { 1126 void SimplifiedLowering::DoStoreField(Node* node) {
1127 const FieldAccess& access = FieldAccessOf(node->op()); 1127 const FieldAccess& access = FieldAccessOf(node->op());
1128 WriteBarrierKind kind = ComputeWriteBarrierKind( 1128 WriteBarrierKind kind = ComputeWriteBarrierKind(
1129 access.base_is_tagged, access.machine_type, access.type); 1129 access.base_is_tagged, access.machine_type, access.type);
1130 node->set_op( 1130 node->set_op(
1131 machine()->Store(StoreRepresentation(access.machine_type, kind))); 1131 machine()->Store(StoreRepresentation(access.machine_type, kind)));
1132 Node* offset = jsgraph()->Int32Constant(access.offset - access.tag()); 1132 Node* offset = jsgraph()->IntPtrConstant(access.offset - access.tag());
1133 node->InsertInput(graph()->zone(), 1, offset); 1133 node->InsertInput(graph()->zone(), 1, offset);
1134 } 1134 }
1135 1135
1136 1136
1137 Node* SimplifiedLowering::ComputeIndex(const ElementAccess& access, 1137 Node* SimplifiedLowering::ComputeIndex(const ElementAccess& access,
1138 Node* const key) { 1138 Node* const key) {
1139 Node* index = key; 1139 Node* index = key;
1140 const int element_size = ElementSizeOf(access.machine_type); 1140 const int element_size_shift = ElementSizeLog2Of(access.machine_type);
1141 if (element_size != 1) { 1141 if (element_size_shift) {
1142 index = graph()->NewNode(machine()->Int32Mul(), index, 1142 index = graph()->NewNode(machine()->Word32Shl(), index,
1143 jsgraph()->Int32Constant(element_size)); 1143 jsgraph()->Int32Constant(element_size_shift));
1144 } 1144 }
1145 const int fixed_offset = access.header_size - access.tag(); 1145 const int fixed_offset = access.header_size - access.tag();
1146 if (fixed_offset != 0) { 1146 if (fixed_offset) {
1147 index = graph()->NewNode(machine()->Int32Add(), index, 1147 index = graph()->NewNode(machine()->Int32Add(), index,
1148 jsgraph()->Int32Constant(fixed_offset)); 1148 jsgraph()->Int32Constant(fixed_offset));
1149 } 1149 }
1150 // TODO(bmeurer): 64-Bit 1150 if (machine()->Is64()) {
1151 // if (machine()->Is64()) { 1151 // TODO(turbofan): This is probably only correct for typed arrays, and only
1152 // index = graph()->NewNode(machine()->ChangeInt32ToInt64(), index); 1152 // if the typed arrays are at most 2GiB in size, which happens to match
1153 // } 1153 // exactly our current situation.
1154 index = graph()->NewNode(machine()->ChangeUint32ToUint64(), index);
1155 }
1154 return index; 1156 return index;
1155 } 1157 }
1156 1158
1157 1159
1158 namespace { 1160 namespace {
1159 1161
1160 intptr_t AddressForOutOfBoundsLoad(MachineType type) { 1162 intptr_t AddressForOutOfBoundsLoad(MachineType type) {
1161 switch (RepresentationOf(type)) { 1163 switch (RepresentationOf(type)) {
1162 case kRepFloat32: { 1164 case kRepFloat32: {
1163 static const float dummy = std::numeric_limits<float>::quiet_NaN(); 1165 static const float dummy = std::numeric_limits<float>::quiet_NaN();
(...skipping 354 matching lines...) Expand 10 before | Expand all | Expand 10 after
1518 1520
1519 void SimplifiedLowering::DoStringLessThanOrEqual(Node* node) { 1521 void SimplifiedLowering::DoStringLessThanOrEqual(Node* node) {
1520 node->set_op(machine()->IntLessThanOrEqual()); 1522 node->set_op(machine()->IntLessThanOrEqual());
1521 node->ReplaceInput(0, StringComparison(node, true)); 1523 node->ReplaceInput(0, StringComparison(node, true));
1522 node->ReplaceInput(1, jsgraph()->SmiConstant(EQUAL)); 1524 node->ReplaceInput(1, jsgraph()->SmiConstant(EQUAL));
1523 } 1525 }
1524 1526
1525 } // namespace compiler 1527 } // namespace compiler
1526 } // namespace internal 1528 } // namespace internal
1527 } // namespace v8 1529 } // namespace v8
OLDNEW
« no previous file with comments | « src/compiler/node-matchers.cc ('k') | src/compiler/x64/code-generator-x64.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698