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

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

Issue 868883002: Remove the dependency of Zone on Isolate (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Fix compilation issues Created 5 years, 11 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/select-lowering.cc ('k') | src/compiler/typer.h » ('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 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
69 : jsgraph_(jsgraph), 69 : jsgraph_(jsgraph),
70 count_(jsgraph->graph()->NodeCount()), 70 count_(jsgraph->graph()->NodeCount()),
71 info_(zone->NewArray<NodeInfo>(count_)), 71 info_(zone->NewArray<NodeInfo>(count_)),
72 nodes_(zone), 72 nodes_(zone),
73 replacements_(zone), 73 replacements_(zone),
74 phase_(PROPAGATE), 74 phase_(PROPAGATE),
75 changer_(changer), 75 changer_(changer),
76 queue_(zone) { 76 queue_(zone) {
77 memset(info_, 0, sizeof(NodeInfo) * count_); 77 memset(info_, 0, sizeof(NodeInfo) * count_);
78 78
79 Factory* f = zone->isolate()->factory(); 79 Factory* f = jsgraph->isolate()->factory();
80 safe_int_additive_range_ = 80 safe_int_additive_range_ =
81 Type::Range(f->NewNumber(-std::pow(2.0, 52.0)), 81 Type::Range(f->NewNumber(-std::pow(2.0, 52.0)),
82 f->NewNumber(std::pow(2.0, 52.0)), zone); 82 f->NewNumber(std::pow(2.0, 52.0)), zone);
83 } 83 }
84 84
85 void Run(SimplifiedLowering* lowering) { 85 void Run(SimplifiedLowering* lowering) {
86 // Run propagation phase to a fixpoint. 86 // Run propagation phase to a fixpoint.
87 TRACE(("--{Propagation phase}--\n")); 87 TRACE(("--{Propagation phase}--\n"));
88 phase_ = PROPAGATE; 88 phase_ = PROPAGATE;
89 Enqueue(jsgraph_->graph()->end()); 89 Enqueue(jsgraph_->graph()->end());
(...skipping 433 matching lines...) Expand 10 before | Expand all | Expand 10 after
523 //------------------------------------------------------------------ 523 //------------------------------------------------------------------
524 case IrOpcode::kAnyToBoolean: { 524 case IrOpcode::kAnyToBoolean: {
525 VisitUnop(node, kMachAnyTagged, kTypeBool | kRepTagged); 525 VisitUnop(node, kMachAnyTagged, kTypeBool | kRepTagged);
526 if (lower()) { 526 if (lower()) {
527 // AnyToBoolean(x) => Call(ToBooleanStub, x, no-context) 527 // AnyToBoolean(x) => Call(ToBooleanStub, x, no-context)
528 Operator::Properties properties = node->op()->properties(); 528 Operator::Properties properties = node->op()->properties();
529 Callable callable = CodeFactory::ToBoolean( 529 Callable callable = CodeFactory::ToBoolean(
530 jsgraph_->isolate(), ToBooleanStub::RESULT_AS_ODDBALL); 530 jsgraph_->isolate(), ToBooleanStub::RESULT_AS_ODDBALL);
531 CallDescriptor::Flags flags = CallDescriptor::kPatchableCallSite; 531 CallDescriptor::Flags flags = CallDescriptor::kPatchableCallSite;
532 CallDescriptor* desc = Linkage::GetStubCallDescriptor( 532 CallDescriptor* desc = Linkage::GetStubCallDescriptor(
533 callable.descriptor(), 0, flags, properties, jsgraph_->zone()); 533 jsgraph_->isolate(), jsgraph_->zone(), callable.descriptor(), 0,
534 flags, properties);
534 node->set_op(jsgraph_->common()->Call(desc)); 535 node->set_op(jsgraph_->common()->Call(desc));
535 node->InsertInput(jsgraph_->zone(), 0, 536 node->InsertInput(jsgraph_->zone(), 0,
536 jsgraph_->HeapConstant(callable.code())); 537 jsgraph_->HeapConstant(callable.code()));
537 node->AppendInput(jsgraph_->zone(), jsgraph_->NoContextConstant()); 538 node->AppendInput(jsgraph_->zone(), jsgraph_->NoContextConstant());
538 } 539 }
539 break; 540 break;
540 } 541 }
541 case IrOpcode::kBooleanNot: { 542 case IrOpcode::kBooleanNot: {
542 if (lower()) { 543 if (lower()) {
543 MachineTypeUnion input = GetInfo(node->InputAt(0))->output; 544 MachineTypeUnion input = GetInfo(node->InputAt(0))->output;
(...skipping 189 matching lines...) Expand 10 before | Expand all | Expand 10 after
733 break; 734 break;
734 } 735 }
735 case IrOpcode::kPlainPrimitiveToNumber: { 736 case IrOpcode::kPlainPrimitiveToNumber: {
736 VisitUnop(node, kMachAnyTagged, kTypeNumber | kRepTagged); 737 VisitUnop(node, kMachAnyTagged, kTypeNumber | kRepTagged);
737 if (lower()) { 738 if (lower()) {
738 // PlainPrimitiveToNumber(x) => Call(ToNumberStub, x, no-context) 739 // PlainPrimitiveToNumber(x) => Call(ToNumberStub, x, no-context)
739 Operator::Properties properties = node->op()->properties(); 740 Operator::Properties properties = node->op()->properties();
740 Callable callable = CodeFactory::ToNumber(jsgraph_->isolate()); 741 Callable callable = CodeFactory::ToNumber(jsgraph_->isolate());
741 CallDescriptor::Flags flags = CallDescriptor::kNoFlags; 742 CallDescriptor::Flags flags = CallDescriptor::kNoFlags;
742 CallDescriptor* desc = Linkage::GetStubCallDescriptor( 743 CallDescriptor* desc = Linkage::GetStubCallDescriptor(
743 callable.descriptor(), 0, flags, properties, jsgraph_->zone()); 744 jsgraph_->isolate(), jsgraph_->zone(), callable.descriptor(), 0,
745 flags, properties);
744 node->set_op(jsgraph_->common()->Call(desc)); 746 node->set_op(jsgraph_->common()->Call(desc));
745 node->InsertInput(jsgraph_->zone(), 0, 747 node->InsertInput(jsgraph_->zone(), 0,
746 jsgraph_->HeapConstant(callable.code())); 748 jsgraph_->HeapConstant(callable.code()));
747 node->AppendInput(jsgraph_->zone(), jsgraph_->NoContextConstant()); 749 node->AppendInput(jsgraph_->zone(), jsgraph_->NoContextConstant());
748 } 750 }
749 break; 751 break;
750 } 752 }
751 case IrOpcode::kReferenceEqual: { 753 case IrOpcode::kReferenceEqual: {
752 VisitBinop(node, kMachAnyTagged, kRepBit); 754 VisitBinop(node, kMachAnyTagged, kRepBit);
753 if (lower()) node->set_op(lowering->machine()->WordEqual()); 755 if (lower()) node->set_op(lowering->machine()->WordEqual());
(...skipping 328 matching lines...) Expand 10 before | Expand all | Expand 10 after
1082 Node* SimplifiedLowering::IsTagged(Node* node) { 1084 Node* SimplifiedLowering::IsTagged(Node* node) {
1083 // TODO(titzer): factor this out to a TaggingScheme abstraction. 1085 // TODO(titzer): factor this out to a TaggingScheme abstraction.
1084 STATIC_ASSERT(kSmiTagMask == 1); // Only works if tag is the low bit. 1086 STATIC_ASSERT(kSmiTagMask == 1); // Only works if tag is the low bit.
1085 return graph()->NewNode(machine()->WordAnd(), node, 1087 return graph()->NewNode(machine()->WordAnd(), node,
1086 jsgraph()->Int32Constant(kSmiTagMask)); 1088 jsgraph()->Int32Constant(kSmiTagMask));
1087 } 1089 }
1088 1090
1089 1091
1090 void SimplifiedLowering::LowerAllNodes() { 1092 void SimplifiedLowering::LowerAllNodes() {
1091 SimplifiedOperatorBuilder simplified(graph()->zone()); 1093 SimplifiedOperatorBuilder simplified(graph()->zone());
1092 RepresentationChanger changer(jsgraph(), &simplified, 1094 RepresentationChanger changer(jsgraph(), &simplified, jsgraph()->isolate());
1093 graph()->zone()->isolate());
1094 RepresentationSelector selector(jsgraph(), zone_, &changer); 1095 RepresentationSelector selector(jsgraph(), zone_, &changer);
1095 selector.Run(this); 1096 selector.Run(this);
1096 } 1097 }
1097 1098
1098 1099
1099 Node* SimplifiedLowering::Untag(Node* node) { 1100 Node* SimplifiedLowering::Untag(Node* node) {
1100 // TODO(titzer): factor this out to a TaggingScheme abstraction. 1101 // TODO(titzer): factor this out to a TaggingScheme abstraction.
1101 Node* shift_amount = jsgraph()->Int32Constant(kSmiTagSize + kSmiShiftSize); 1102 Node* shift_amount = jsgraph()->Int32Constant(kSmiTagSize + kSmiShiftSize);
1102 return graph()->NewNode(machine()->WordSar(), node, shift_amount); 1103 return graph()->NewNode(machine()->WordSar(), node, shift_amount);
1103 } 1104 }
(...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after
1248 access.machine_type, 1249 access.machine_type,
1249 ComputeWriteBarrierKind(access.base_is_tagged, access.machine_type, 1250 ComputeWriteBarrierKind(access.base_is_tagged, access.machine_type,
1250 access.type)))); 1251 access.type))));
1251 node->ReplaceInput(1, ComputeIndex(access, node->InputAt(1))); 1252 node->ReplaceInput(1, ComputeIndex(access, node->InputAt(1)));
1252 } 1253 }
1253 1254
1254 1255
1255 void SimplifiedLowering::DoStringAdd(Node* node) { 1256 void SimplifiedLowering::DoStringAdd(Node* node) {
1256 Operator::Properties properties = node->op()->properties(); 1257 Operator::Properties properties = node->op()->properties();
1257 Callable callable = CodeFactory::StringAdd( 1258 Callable callable = CodeFactory::StringAdd(
1258 zone()->isolate(), STRING_ADD_CHECK_NONE, NOT_TENURED); 1259 jsgraph()->isolate(), STRING_ADD_CHECK_NONE, NOT_TENURED);
1259 CallDescriptor::Flags flags = CallDescriptor::kNoFlags; 1260 CallDescriptor::Flags flags = CallDescriptor::kNoFlags;
1260 CallDescriptor* desc = Linkage::GetStubCallDescriptor( 1261 CallDescriptor* desc = Linkage::GetStubCallDescriptor(
1261 callable.descriptor(), 0, flags, properties, zone()); 1262 jsgraph()->isolate(), zone(), callable.descriptor(), 0, flags,
1263 properties);
1262 node->set_op(common()->Call(desc)); 1264 node->set_op(common()->Call(desc));
1263 node->InsertInput(graph()->zone(), 0, 1265 node->InsertInput(graph()->zone(), 0,
1264 jsgraph()->HeapConstant(callable.code())); 1266 jsgraph()->HeapConstant(callable.code()));
1265 node->AppendInput(graph()->zone(), jsgraph()->UndefinedConstant()); 1267 node->AppendInput(graph()->zone(), jsgraph()->UndefinedConstant());
1266 node->AppendInput(graph()->zone(), graph()->start()); 1268 node->AppendInput(graph()->zone(), graph()->start());
1267 node->AppendInput(graph()->zone(), graph()->start()); 1269 node->AppendInput(graph()->zone(), graph()->start());
1268 } 1270 }
1269 1271
1270 1272
1271 Node* SimplifiedLowering::StringComparison(Node* node, bool requires_ordering) { 1273 Node* SimplifiedLowering::StringComparison(Node* node, bool requires_ordering) {
1272 CEntryStub stub(zone()->isolate(), 1); 1274 CEntryStub stub(jsgraph()->isolate(), 1);
1273 Runtime::FunctionId f = 1275 Runtime::FunctionId f =
1274 requires_ordering ? Runtime::kStringCompare : Runtime::kStringEquals; 1276 requires_ordering ? Runtime::kStringCompare : Runtime::kStringEquals;
1275 ExternalReference ref(f, zone()->isolate()); 1277 ExternalReference ref(f, jsgraph()->isolate());
1276 Operator::Properties props = node->op()->properties(); 1278 Operator::Properties props = node->op()->properties();
1277 // TODO(mstarzinger): We should call StringCompareStub here instead, once an 1279 // TODO(mstarzinger): We should call StringCompareStub here instead, once an
1278 // interface descriptor is available for it. 1280 // interface descriptor is available for it.
1279 CallDescriptor* desc = Linkage::GetRuntimeCallDescriptor(f, 2, props, zone()); 1281 CallDescriptor* desc = Linkage::GetRuntimeCallDescriptor(zone(), f, 2, props);
1280 return graph()->NewNode(common()->Call(desc), 1282 return graph()->NewNode(common()->Call(desc),
1281 jsgraph()->HeapConstant(stub.GetCode()), 1283 jsgraph()->HeapConstant(stub.GetCode()),
1282 NodeProperties::GetValueInput(node, 0), 1284 NodeProperties::GetValueInput(node, 0),
1283 NodeProperties::GetValueInput(node, 1), 1285 NodeProperties::GetValueInput(node, 1),
1284 jsgraph()->ExternalConstant(ref), 1286 jsgraph()->ExternalConstant(ref),
1285 jsgraph()->Int32Constant(2), 1287 jsgraph()->Int32Constant(2),
1286 jsgraph()->UndefinedConstant()); 1288 jsgraph()->UndefinedConstant());
1287 } 1289 }
1288 1290
1289 1291
(...skipping 220 matching lines...) Expand 10 before | Expand all | Expand 10 after
1510 1512
1511 void SimplifiedLowering::DoStringLessThanOrEqual(Node* node) { 1513 void SimplifiedLowering::DoStringLessThanOrEqual(Node* node) {
1512 node->set_op(machine()->IntLessThanOrEqual()); 1514 node->set_op(machine()->IntLessThanOrEqual());
1513 node->ReplaceInput(0, StringComparison(node, true)); 1515 node->ReplaceInput(0, StringComparison(node, true));
1514 node->ReplaceInput(1, jsgraph()->SmiConstant(EQUAL)); 1516 node->ReplaceInput(1, jsgraph()->SmiConstant(EQUAL));
1515 } 1517 }
1516 1518
1517 } // namespace compiler 1519 } // namespace compiler
1518 } // namespace internal 1520 } // namespace internal
1519 } // namespace v8 1521 } // namespace v8
OLDNEW
« no previous file with comments | « src/compiler/select-lowering.cc ('k') | src/compiler/typer.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698