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

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

Issue 1109773002: [turbofan] Add SimplifiedOperator::Allocate operator. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Fix tests for ARM. Created 5 years, 8 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
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 769 matching lines...) Expand 10 before | Expand all | Expand 10 after
780 case IrOpcode::kStringLessThanOrEqual: { 780 case IrOpcode::kStringLessThanOrEqual: {
781 VisitBinop(node, kMachAnyTagged, kRepBit); 781 VisitBinop(node, kMachAnyTagged, kRepBit);
782 if (lower()) lowering->DoStringLessThanOrEqual(node); 782 if (lower()) lowering->DoStringLessThanOrEqual(node);
783 break; 783 break;
784 } 784 }
785 case IrOpcode::kStringAdd: { 785 case IrOpcode::kStringAdd: {
786 VisitBinop(node, kMachAnyTagged, kMachAnyTagged); 786 VisitBinop(node, kMachAnyTagged, kMachAnyTagged);
787 if (lower()) lowering->DoStringAdd(node); 787 if (lower()) lowering->DoStringAdd(node);
788 break; 788 break;
789 } 789 }
790 case IrOpcode::kAllocate: {
791 ProcessInput(node, 0, kMachAnyTagged);
792 ProcessRemainingInputs(node, 1);
793 SetOutput(node, kMachAnyTagged);
794 if (lower()) lowering->DoAllocate(node);
795 break;
796 }
790 case IrOpcode::kLoadField: { 797 case IrOpcode::kLoadField: {
791 FieldAccess access = FieldAccessOf(node->op()); 798 FieldAccess access = FieldAccessOf(node->op());
792 ProcessInput(node, 0, changer_->TypeForBasePointer(access)); 799 ProcessInput(node, 0, changer_->TypeForBasePointer(access));
793 ProcessRemainingInputs(node, 1); 800 ProcessRemainingInputs(node, 1);
794 SetOutput(node, access.machine_type); 801 SetOutput(node, access.machine_type);
795 if (lower()) lowering->DoLoadField(node); 802 if (lower()) lowering->DoLoadField(node);
796 break; 803 break;
797 } 804 }
798 case IrOpcode::kStoreField: { 805 case IrOpcode::kStoreField: {
799 FieldAccess access = FieldAccessOf(node->op()); 806 FieldAccess access = FieldAccessOf(node->op());
(...skipping 356 matching lines...) Expand 10 before | Expand all | Expand 10 after
1156 RepresentationOf(representation) == kRepTagged) { 1163 RepresentationOf(representation) == kRepTagged) {
1157 // Write barriers are only for writes into heap objects (i.e. tagged base). 1164 // Write barriers are only for writes into heap objects (i.e. tagged base).
1158 return kFullWriteBarrier; 1165 return kFullWriteBarrier;
1159 } 1166 }
1160 return kNoWriteBarrier; 1167 return kNoWriteBarrier;
1161 } 1168 }
1162 1169
1163 } // namespace 1170 } // namespace
1164 1171
1165 1172
1173 void SimplifiedLowering::DoAllocate(Node* node) {
1174 PretenureFlag pretenure = OpParameter<PretenureFlag>(node->op());
1175 AllocationSpace space = pretenure == TENURED ? OLD_SPACE : NEW_SPACE;
1176 Runtime::FunctionId f = Runtime::kInlineAllocateInTargetSpace;
Benedikt Meurer 2015/04/28 08:24:23 Shouldn't this be Runtime::kAllocateInTargetSpace?
Michael Starzinger 2015/04/30 07:53:51 Done. This was a "cheap and dirty" way to not requ
1177 Operator::Properties props = node->op()->properties();
1178 CallDescriptor* desc = Linkage::GetRuntimeCallDescriptor(zone(), f, 2, props);
1179 node->set_op(common()->Call(desc));
1180 ExternalReference ref(f, jsgraph()->isolate());
1181 int32_t flags = AllocateTargetSpace::encode(space);
1182 node->InsertInput(graph()->zone(), 0, jsgraph()->CEntryStubConstant(1));
1183 node->InsertInput(graph()->zone(), 2, jsgraph()->SmiConstant(flags));
1184 node->InsertInput(graph()->zone(), 3, jsgraph()->ExternalConstant(ref));
1185 node->InsertInput(graph()->zone(), 4, jsgraph()->Int32Constant(2));
1186 node->InsertInput(graph()->zone(), 5, jsgraph()->NoContextConstant());
1187 }
1188
1189
1166 void SimplifiedLowering::DoLoadField(Node* node) { 1190 void SimplifiedLowering::DoLoadField(Node* node) {
1167 const FieldAccess& access = FieldAccessOf(node->op()); 1191 const FieldAccess& access = FieldAccessOf(node->op());
1168 node->set_op(machine()->Load(access.machine_type)); 1192 node->set_op(machine()->Load(access.machine_type));
1169 Node* offset = jsgraph()->IntPtrConstant(access.offset - access.tag()); 1193 Node* offset = jsgraph()->IntPtrConstant(access.offset - access.tag());
1170 node->InsertInput(graph()->zone(), 1, offset); 1194 node->InsertInput(graph()->zone(), 1, offset);
1171 } 1195 }
1172 1196
1173 1197
1174 void SimplifiedLowering::DoStoreField(Node* node) { 1198 void SimplifiedLowering::DoStoreField(Node* node) {
1175 const FieldAccess& access = FieldAccessOf(node->op()); 1199 const FieldAccess& access = FieldAccessOf(node->op());
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after
1300 node->set_op(common()->Call(desc)); 1324 node->set_op(common()->Call(desc));
1301 node->InsertInput(graph()->zone(), 0, 1325 node->InsertInput(graph()->zone(), 0,
1302 jsgraph()->HeapConstant(callable.code())); 1326 jsgraph()->HeapConstant(callable.code()));
1303 node->AppendInput(graph()->zone(), jsgraph()->UndefinedConstant()); 1327 node->AppendInput(graph()->zone(), jsgraph()->UndefinedConstant());
1304 node->AppendInput(graph()->zone(), graph()->start()); 1328 node->AppendInput(graph()->zone(), graph()->start());
1305 node->AppendInput(graph()->zone(), graph()->start()); 1329 node->AppendInput(graph()->zone(), graph()->start());
1306 } 1330 }
1307 1331
1308 1332
1309 Node* SimplifiedLowering::StringComparison(Node* node, bool requires_ordering) { 1333 Node* SimplifiedLowering::StringComparison(Node* node, bool requires_ordering) {
1310 CEntryStub stub(jsgraph()->isolate(), 1);
1311 Runtime::FunctionId f = 1334 Runtime::FunctionId f =
1312 requires_ordering ? Runtime::kStringCompareRT : Runtime::kStringEquals; 1335 requires_ordering ? Runtime::kStringCompareRT : Runtime::kStringEquals;
1313 ExternalReference ref(f, jsgraph()->isolate()); 1336 ExternalReference ref(f, jsgraph()->isolate());
1314 Operator::Properties props = node->op()->properties(); 1337 Operator::Properties props = node->op()->properties();
1315 // TODO(mstarzinger): We should call StringCompareStub here instead, once an 1338 // TODO(mstarzinger): We should call StringCompareStub here instead, once an
1316 // interface descriptor is available for it. 1339 // interface descriptor is available for it.
1317 CallDescriptor* desc = Linkage::GetRuntimeCallDescriptor(zone(), f, 2, props); 1340 CallDescriptor* desc = Linkage::GetRuntimeCallDescriptor(zone(), f, 2, props);
1318 return graph()->NewNode(common()->Call(desc), 1341 return graph()->NewNode(common()->Call(desc),
1319 jsgraph()->HeapConstant(stub.GetCode()), 1342 jsgraph()->CEntryStubConstant(1),
1320 NodeProperties::GetValueInput(node, 0), 1343 NodeProperties::GetValueInput(node, 0),
1321 NodeProperties::GetValueInput(node, 1), 1344 NodeProperties::GetValueInput(node, 1),
1322 jsgraph()->ExternalConstant(ref), 1345 jsgraph()->ExternalConstant(ref),
1323 jsgraph()->Int32Constant(2), 1346 jsgraph()->Int32Constant(2),
1324 jsgraph()->UndefinedConstant()); 1347 jsgraph()->NoContextConstant());
1325 } 1348 }
1326 1349
1327 1350
1328 Node* SimplifiedLowering::Int32Div(Node* const node) { 1351 Node* SimplifiedLowering::Int32Div(Node* const node) {
1329 Int32BinopMatcher m(node); 1352 Int32BinopMatcher m(node);
1330 Node* const zero = jsgraph()->Int32Constant(0); 1353 Node* const zero = jsgraph()->Int32Constant(0);
1331 Node* const minus_one = jsgraph()->Int32Constant(-1); 1354 Node* const minus_one = jsgraph()->Int32Constant(-1);
1332 Node* const lhs = m.left().node(); 1355 Node* const lhs = m.left().node();
1333 Node* const rhs = m.right().node(); 1356 Node* const rhs = m.right().node();
1334 1357
(...skipping 255 matching lines...) Expand 10 before | Expand all | Expand 10 after
1590 1613
1591 void SimplifiedLowering::DoStringLessThanOrEqual(Node* node) { 1614 void SimplifiedLowering::DoStringLessThanOrEqual(Node* node) {
1592 node->set_op(machine()->IntLessThanOrEqual()); 1615 node->set_op(machine()->IntLessThanOrEqual());
1593 node->ReplaceInput(0, StringComparison(node, true)); 1616 node->ReplaceInput(0, StringComparison(node, true));
1594 node->ReplaceInput(1, jsgraph()->SmiConstant(EQUAL)); 1617 node->ReplaceInput(1, jsgraph()->SmiConstant(EQUAL));
1595 } 1618 }
1596 1619
1597 } // namespace compiler 1620 } // namespace compiler
1598 } // namespace internal 1621 } // namespace internal
1599 } // namespace v8 1622 } // namespace v8
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698