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 1194 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1205 return kFullWriteBarrier; | 1205 return kFullWriteBarrier; |
1206 } | 1206 } |
1207 return kNoWriteBarrier; | 1207 return kNoWriteBarrier; |
1208 } | 1208 } |
1209 | 1209 |
1210 } // namespace | 1210 } // namespace |
1211 | 1211 |
1212 | 1212 |
1213 void SimplifiedLowering::DoAllocate(Node* node) { | 1213 void SimplifiedLowering::DoAllocate(Node* node) { |
1214 PretenureFlag pretenure = OpParameter<PretenureFlag>(node->op()); | 1214 PretenureFlag pretenure = OpParameter<PretenureFlag>(node->op()); |
1215 AllocationSpace space = pretenure == TENURED ? OLD_SPACE : NEW_SPACE; | 1215 if (pretenure == NOT_TENURED) { |
1216 Runtime::FunctionId f = Runtime::kAllocateInTargetSpace; | 1216 Callable callable = CodeFactory::AllocateInNewSpace(isolate()); |
1217 Operator::Properties props = node->op()->properties(); | 1217 Node* target = jsgraph()->HeapConstant(callable.code()); |
1218 CallDescriptor* desc = Linkage::GetRuntimeCallDescriptor(zone(), f, 2, props); | 1218 CallDescriptor* descriptor = Linkage::GetStubCallDescriptor( |
1219 ExternalReference ref(f, jsgraph()->isolate()); | 1219 isolate(), jsgraph()->zone(), callable.descriptor(), 0, |
1220 int32_t flags = AllocateTargetSpace::encode(space); | 1220 CallDescriptor::kNoFlags, Operator::kNoThrow); |
1221 node->InsertInput(graph()->zone(), 0, jsgraph()->CEntryStubConstant(1)); | 1221 const Operator* op = common()->Call(descriptor); |
1222 node->InsertInput(graph()->zone(), 2, jsgraph()->SmiConstant(flags)); | 1222 node->InsertInput(graph()->zone(), 0, target); |
1223 node->InsertInput(graph()->zone(), 3, jsgraph()->ExternalConstant(ref)); | 1223 node->InsertInput(graph()->zone(), 2, jsgraph()->NoContextConstant()); |
1224 node->InsertInput(graph()->zone(), 4, jsgraph()->Int32Constant(2)); | 1224 NodeProperties::ChangeOp(node, op); |
1225 node->InsertInput(graph()->zone(), 5, jsgraph()->NoContextConstant()); | 1225 } else { |
1226 NodeProperties::ChangeOp(node, common()->Call(desc)); | 1226 DCHECK_EQ(TENURED, pretenure); |
| 1227 AllocationSpace space = OLD_SPACE; |
| 1228 Runtime::FunctionId f = Runtime::kAllocateInTargetSpace; |
| 1229 Operator::Properties props = node->op()->properties(); |
| 1230 CallDescriptor* desc = |
| 1231 Linkage::GetRuntimeCallDescriptor(zone(), f, 2, props); |
| 1232 ExternalReference ref(f, jsgraph()->isolate()); |
| 1233 int32_t flags = AllocateTargetSpace::encode(space); |
| 1234 node->InsertInput(graph()->zone(), 0, jsgraph()->CEntryStubConstant(1)); |
| 1235 node->InsertInput(graph()->zone(), 2, jsgraph()->SmiConstant(flags)); |
| 1236 node->InsertInput(graph()->zone(), 3, jsgraph()->ExternalConstant(ref)); |
| 1237 node->InsertInput(graph()->zone(), 4, jsgraph()->Int32Constant(2)); |
| 1238 node->InsertInput(graph()->zone(), 5, jsgraph()->NoContextConstant()); |
| 1239 NodeProperties::ChangeOp(node, common()->Call(desc)); |
| 1240 } |
1227 } | 1241 } |
1228 | 1242 |
1229 | 1243 |
1230 void SimplifiedLowering::DoLoadField(Node* node) { | 1244 void SimplifiedLowering::DoLoadField(Node* node) { |
1231 const FieldAccess& access = FieldAccessOf(node->op()); | 1245 const FieldAccess& access = FieldAccessOf(node->op()); |
1232 Node* offset = jsgraph()->IntPtrConstant(access.offset - access.tag()); | 1246 Node* offset = jsgraph()->IntPtrConstant(access.offset - access.tag()); |
1233 node->InsertInput(graph()->zone(), 1, offset); | 1247 node->InsertInput(graph()->zone(), 1, offset); |
1234 NodeProperties::ChangeOp(node, machine()->Load(access.machine_type)); | 1248 NodeProperties::ChangeOp(node, machine()->Load(access.machine_type)); |
1235 } | 1249 } |
1236 | 1250 |
(...skipping 434 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1671 ReplaceEffectUses(node, comparison); | 1685 ReplaceEffectUses(node, comparison); |
1672 node->ReplaceInput(0, comparison); | 1686 node->ReplaceInput(0, comparison); |
1673 node->ReplaceInput(1, jsgraph()->SmiConstant(EQUAL)); | 1687 node->ReplaceInput(1, jsgraph()->SmiConstant(EQUAL)); |
1674 node->TrimInputCount(2); | 1688 node->TrimInputCount(2); |
1675 NodeProperties::ChangeOp(node, machine()->IntLessThanOrEqual()); | 1689 NodeProperties::ChangeOp(node, machine()->IntLessThanOrEqual()); |
1676 } | 1690 } |
1677 | 1691 |
1678 } // namespace compiler | 1692 } // namespace compiler |
1679 } // namespace internal | 1693 } // namespace internal |
1680 } // namespace v8 | 1694 } // namespace v8 |
OLD | NEW |