 Chromium Code Reviews
 Chromium Code Reviews Issue 1109773002:
  [turbofan] Add SimplifiedOperator::Allocate operator.  (Closed) 
  Base URL: https://chromium.googlesource.com/v8/v8.git@master
    
  
    Issue 1109773002:
  [turbofan] Add SimplifiedOperator::Allocate operator.  (Closed) 
  Base URL: https://chromium.googlesource.com/v8/v8.git@master| Index: src/compiler/simplified-lowering.cc | 
| diff --git a/src/compiler/simplified-lowering.cc b/src/compiler/simplified-lowering.cc | 
| index 02ddb3d413336545ee0f45e3196f41d9878734d7..217d1ae85bd4a43a51a4d8c2ce370d4ada59e290 100644 | 
| --- a/src/compiler/simplified-lowering.cc | 
| +++ b/src/compiler/simplified-lowering.cc | 
| @@ -787,6 +787,13 @@ class RepresentationSelector { | 
| if (lower()) lowering->DoStringAdd(node); | 
| break; | 
| } | 
| + case IrOpcode::kAllocate: { | 
| + ProcessInput(node, 0, kMachAnyTagged); | 
| + ProcessRemainingInputs(node, 1); | 
| + SetOutput(node, kMachAnyTagged); | 
| + if (lower()) lowering->DoAllocate(node); | 
| + break; | 
| + } | 
| case IrOpcode::kLoadField: { | 
| FieldAccess access = FieldAccessOf(node->op()); | 
| ProcessInput(node, 0, changer_->TypeForBasePointer(access)); | 
| @@ -1163,6 +1170,23 @@ WriteBarrierKind ComputeWriteBarrierKind(BaseTaggedness base_is_tagged, | 
| } // namespace | 
| +void SimplifiedLowering::DoAllocate(Node* node) { | 
| + PretenureFlag pretenure = OpParameter<PretenureFlag>(node->op()); | 
| + AllocationSpace space = pretenure == TENURED ? OLD_SPACE : NEW_SPACE; | 
| + 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
 | 
| + Operator::Properties props = node->op()->properties(); | 
| + CallDescriptor* desc = Linkage::GetRuntimeCallDescriptor(zone(), f, 2, props); | 
| + node->set_op(common()->Call(desc)); | 
| + ExternalReference ref(f, jsgraph()->isolate()); | 
| + int32_t flags = AllocateTargetSpace::encode(space); | 
| + node->InsertInput(graph()->zone(), 0, jsgraph()->CEntryStubConstant(1)); | 
| + node->InsertInput(graph()->zone(), 2, jsgraph()->SmiConstant(flags)); | 
| + node->InsertInput(graph()->zone(), 3, jsgraph()->ExternalConstant(ref)); | 
| + node->InsertInput(graph()->zone(), 4, jsgraph()->Int32Constant(2)); | 
| + node->InsertInput(graph()->zone(), 5, jsgraph()->NoContextConstant()); | 
| +} | 
| + | 
| + | 
| void SimplifiedLowering::DoLoadField(Node* node) { | 
| const FieldAccess& access = FieldAccessOf(node->op()); | 
| node->set_op(machine()->Load(access.machine_type)); | 
| @@ -1307,7 +1331,6 @@ void SimplifiedLowering::DoStringAdd(Node* node) { | 
| Node* SimplifiedLowering::StringComparison(Node* node, bool requires_ordering) { | 
| - CEntryStub stub(jsgraph()->isolate(), 1); | 
| Runtime::FunctionId f = | 
| requires_ordering ? Runtime::kStringCompareRT : Runtime::kStringEquals; | 
| ExternalReference ref(f, jsgraph()->isolate()); | 
| @@ -1316,12 +1339,12 @@ Node* SimplifiedLowering::StringComparison(Node* node, bool requires_ordering) { | 
| // interface descriptor is available for it. | 
| CallDescriptor* desc = Linkage::GetRuntimeCallDescriptor(zone(), f, 2, props); | 
| return graph()->NewNode(common()->Call(desc), | 
| - jsgraph()->HeapConstant(stub.GetCode()), | 
| + jsgraph()->CEntryStubConstant(1), | 
| NodeProperties::GetValueInput(node, 0), | 
| NodeProperties::GetValueInput(node, 1), | 
| jsgraph()->ExternalConstant(ref), | 
| jsgraph()->Int32Constant(2), | 
| - jsgraph()->UndefinedConstant()); | 
| + jsgraph()->NoContextConstant()); | 
| } |