OLD | NEW |
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 1023 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1034 return kFullWriteBarrier; | 1034 return kFullWriteBarrier; |
1035 } | 1035 } |
1036 return kNoWriteBarrier; | 1036 return kNoWriteBarrier; |
1037 } | 1037 } |
1038 | 1038 |
1039 | 1039 |
1040 void SimplifiedLowering::DoLoadField(Node* node) { | 1040 void SimplifiedLowering::DoLoadField(Node* node) { |
1041 const FieldAccess& access = FieldAccessOf(node->op()); | 1041 const FieldAccess& access = FieldAccessOf(node->op()); |
1042 node->set_op(machine()->Load(access.machine_type)); | 1042 node->set_op(machine()->Load(access.machine_type)); |
1043 Node* offset = jsgraph()->Int32Constant(access.offset - access.tag()); | 1043 Node* offset = jsgraph()->Int32Constant(access.offset - access.tag()); |
1044 node->InsertInput(zone(), 1, offset); | 1044 node->InsertInput(graph()->zone(), 1, offset); |
1045 } | 1045 } |
1046 | 1046 |
1047 | 1047 |
1048 void SimplifiedLowering::DoStoreField(Node* node) { | 1048 void SimplifiedLowering::DoStoreField(Node* node) { |
1049 const FieldAccess& access = FieldAccessOf(node->op()); | 1049 const FieldAccess& access = FieldAccessOf(node->op()); |
1050 WriteBarrierKind kind = ComputeWriteBarrierKind( | 1050 WriteBarrierKind kind = ComputeWriteBarrierKind( |
1051 access.base_is_tagged, access.machine_type, access.type); | 1051 access.base_is_tagged, access.machine_type, access.type); |
1052 node->set_op( | 1052 node->set_op( |
1053 machine()->Store(StoreRepresentation(access.machine_type, kind))); | 1053 machine()->Store(StoreRepresentation(access.machine_type, kind))); |
1054 Node* offset = jsgraph()->Int32Constant(access.offset - access.tag()); | 1054 Node* offset = jsgraph()->Int32Constant(access.offset - access.tag()); |
1055 node->InsertInput(zone(), 1, offset); | 1055 node->InsertInput(graph()->zone(), 1, offset); |
1056 } | 1056 } |
1057 | 1057 |
1058 | 1058 |
1059 Node* SimplifiedLowering::ComputeIndex(const ElementAccess& access, | 1059 Node* SimplifiedLowering::ComputeIndex(const ElementAccess& access, |
1060 Node* index) { | 1060 Node* index) { |
1061 int element_size = ElementSizeOf(access.machine_type); | 1061 int element_size = ElementSizeOf(access.machine_type); |
1062 if (element_size != 1) { | 1062 if (element_size != 1) { |
1063 index = graph()->NewNode(machine()->Int32Mul(), | 1063 index = graph()->NewNode(machine()->Int32Mul(), |
1064 jsgraph()->Int32Constant(element_size), index); | 1064 jsgraph()->Int32Constant(element_size), index); |
1065 } | 1065 } |
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1180 } | 1180 } |
1181 | 1181 |
1182 | 1182 |
1183 void SimplifiedLowering::DoStringAdd(Node* node) { | 1183 void SimplifiedLowering::DoStringAdd(Node* node) { |
1184 Callable callable = CodeFactory::StringAdd( | 1184 Callable callable = CodeFactory::StringAdd( |
1185 zone()->isolate(), STRING_ADD_CHECK_NONE, NOT_TENURED); | 1185 zone()->isolate(), STRING_ADD_CHECK_NONE, NOT_TENURED); |
1186 CallDescriptor::Flags flags = CallDescriptor::kNoFlags; | 1186 CallDescriptor::Flags flags = CallDescriptor::kNoFlags; |
1187 CallDescriptor* desc = | 1187 CallDescriptor* desc = |
1188 Linkage::GetStubCallDescriptor(callable.descriptor(), 0, flags, zone()); | 1188 Linkage::GetStubCallDescriptor(callable.descriptor(), 0, flags, zone()); |
1189 node->set_op(common()->Call(desc)); | 1189 node->set_op(common()->Call(desc)); |
1190 node->InsertInput(zone(), 0, jsgraph()->HeapConstant(callable.code())); | 1190 node->InsertInput(graph()->zone(), 0, |
1191 node->AppendInput(zone(), jsgraph()->UndefinedConstant()); | 1191 jsgraph()->HeapConstant(callable.code())); |
1192 node->AppendInput(zone(), graph()->start()); | 1192 node->AppendInput(graph()->zone(), jsgraph()->UndefinedConstant()); |
1193 node->AppendInput(zone(), graph()->start()); | 1193 node->AppendInput(graph()->zone(), graph()->start()); |
| 1194 node->AppendInput(graph()->zone(), graph()->start()); |
1194 } | 1195 } |
1195 | 1196 |
1196 | 1197 |
1197 Node* SimplifiedLowering::StringComparison(Node* node, bool requires_ordering) { | 1198 Node* SimplifiedLowering::StringComparison(Node* node, bool requires_ordering) { |
1198 CEntryStub stub(zone()->isolate(), 1); | 1199 CEntryStub stub(zone()->isolate(), 1); |
1199 Runtime::FunctionId f = | 1200 Runtime::FunctionId f = |
1200 requires_ordering ? Runtime::kStringCompare : Runtime::kStringEquals; | 1201 requires_ordering ? Runtime::kStringCompare : Runtime::kStringEquals; |
1201 ExternalReference ref(f, zone()->isolate()); | 1202 ExternalReference ref(f, zone()->isolate()); |
1202 Operator::Properties props = node->op()->properties(); | 1203 Operator::Properties props = node->op()->properties(); |
1203 // TODO(mstarzinger): We should call StringCompareStub here instead, once an | 1204 // TODO(mstarzinger): We should call StringCompareStub here instead, once an |
(...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1372 void SimplifiedLowering::DoStringLessThanOrEqual(Node* node) { | 1373 void SimplifiedLowering::DoStringLessThanOrEqual(Node* node) { |
1373 node->set_op(machine()->IntLessThanOrEqual()); | 1374 node->set_op(machine()->IntLessThanOrEqual()); |
1374 node->ReplaceInput(0, StringComparison(node, true)); | 1375 node->ReplaceInput(0, StringComparison(node, true)); |
1375 node->ReplaceInput(1, jsgraph()->SmiConstant(EQUAL)); | 1376 node->ReplaceInput(1, jsgraph()->SmiConstant(EQUAL)); |
1376 } | 1377 } |
1377 | 1378 |
1378 | 1379 |
1379 } // namespace compiler | 1380 } // namespace compiler |
1380 } // namespace internal | 1381 } // namespace internal |
1381 } // namespace v8 | 1382 } // namespace v8 |
OLD | NEW |