| 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/pipeline.h" | 5 #include "src/compiler/pipeline.h" |
| 6 #include "src/compiler/raw-machine-assembler.h" | 6 #include "src/compiler/raw-machine-assembler.h" |
| 7 #include "src/compiler/scheduler.h" | 7 #include "src/compiler/scheduler.h" |
| 8 | 8 |
| 9 namespace v8 { | 9 namespace v8 { |
| 10 namespace internal { | 10 namespace internal { |
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 69 current_block_ = NULL; | 69 current_block_ = NULL; |
| 70 } | 70 } |
| 71 | 71 |
| 72 | 72 |
| 73 void RawMachineAssembler::Return(Node* value) { | 73 void RawMachineAssembler::Return(Node* value) { |
| 74 schedule()->AddReturn(CurrentBlock(), value); | 74 schedule()->AddReturn(CurrentBlock(), value); |
| 75 current_block_ = NULL; | 75 current_block_ = NULL; |
| 76 } | 76 } |
| 77 | 77 |
| 78 | 78 |
| 79 void RawMachineAssembler::Deoptimize(Node* state) { | |
| 80 Node* deopt = graph()->NewNode(common()->Deoptimize(), state); | |
| 81 schedule()->AddDeoptimize(CurrentBlock(), deopt); | |
| 82 current_block_ = NULL; | |
| 83 } | |
| 84 | |
| 85 | |
| 86 Node* RawMachineAssembler::CallFunctionStub0(Node* function, Node* receiver, | 79 Node* RawMachineAssembler::CallFunctionStub0(Node* function, Node* receiver, |
| 87 Node* context, Node* frame_state, | 80 Node* context, Node* frame_state, |
| 88 Label* continuation, | |
| 89 Label* deoptimization, | |
| 90 CallFunctionFlags flags) { | 81 CallFunctionFlags flags) { |
| 91 CallFunctionStub stub(isolate(), 0, flags); | 82 CallFunctionStub stub(isolate(), 0, flags); |
| 92 CodeStubInterfaceDescriptor* d = isolate()->code_stub_interface_descriptor( | 83 CodeStubInterfaceDescriptor* d = isolate()->code_stub_interface_descriptor( |
| 93 reinterpret_cast<CodeStub*>(&stub)->MajorKey()); | 84 reinterpret_cast<CodeStub*>(&stub)->MajorKey()); |
| 94 stub.InitializeInterfaceDescriptor(d); | 85 stub.InitializeInterfaceDescriptor(d); |
| 95 | 86 |
| 96 CallDescriptor* desc = Linkage::GetStubCallDescriptor( | 87 CallDescriptor* desc = Linkage::GetStubCallDescriptor( |
| 97 d, 1, | 88 d, 1, CallDescriptor::kNeedsFrameState, zone()); |
| 98 CallDescriptor::kLazyDeoptimization | CallDescriptor::kNeedsFrameState, | |
| 99 zone()); | |
| 100 Node* stub_code = HeapConstant(stub.GetCode()); | 89 Node* stub_code = HeapConstant(stub.GetCode()); |
| 101 Node* call = graph()->NewNode(common()->Call(desc), stub_code, function, | 90 Node* call = graph()->NewNode(common()->Call(desc), stub_code, function, |
| 102 receiver, context, frame_state); | 91 receiver, context, frame_state); |
| 103 schedule()->AddCall(CurrentBlock(), call, Use(continuation), | 92 schedule()->AddNode(CurrentBlock(), call); |
| 104 Use(deoptimization)); | |
| 105 current_block_ = NULL; | |
| 106 return call; | 93 return call; |
| 107 } | 94 } |
| 108 | 95 |
| 109 | 96 |
| 110 Node* RawMachineAssembler::CallJS0(Node* function, Node* receiver, | 97 Node* RawMachineAssembler::CallJS0(Node* function, Node* receiver, |
| 111 Label* continuation, Label* deoptimization) { | 98 Node* frame_state) { |
| 112 CallDescriptor* descriptor = Linkage::GetJSCallDescriptor(1, zone()); | 99 CallDescriptor* descriptor = Linkage::GetJSCallDescriptor(1, zone()); |
| 113 Node* call = graph()->NewNode(common()->Call(descriptor), function, receiver); | 100 Node* call = graph()->NewNode(common()->Call(descriptor), function, receiver, |
| 114 schedule()->AddCall(CurrentBlock(), call, Use(continuation), | 101 frame_state); |
| 115 Use(deoptimization)); | 102 schedule()->AddNode(CurrentBlock(), call); |
| 116 current_block_ = NULL; | |
| 117 return call; | 103 return call; |
| 118 } | 104 } |
| 119 | 105 |
| 120 | 106 |
| 121 Node* RawMachineAssembler::CallRuntime1(Runtime::FunctionId function, | 107 Node* RawMachineAssembler::CallRuntime1(Runtime::FunctionId function, |
| 122 Node* arg0, Label* continuation, | 108 Node* arg0, Node* frame_state) { |
| 123 Label* deoptimization) { | |
| 124 CallDescriptor* descriptor = Linkage::GetRuntimeCallDescriptor( | 109 CallDescriptor* descriptor = Linkage::GetRuntimeCallDescriptor( |
| 125 function, 1, Operator::kNoProperties, CallDescriptor::kLazyDeoptimization, | 110 function, 1, Operator::kNoProperties, CallDescriptor::kNeedsFrameState, |
| 126 zone()); | 111 zone()); |
| 127 | 112 |
| 128 Node* centry = HeapConstant(CEntryStub(isolate(), 1).GetCode()); | 113 Node* centry = HeapConstant(CEntryStub(isolate(), 1).GetCode()); |
| 129 Node* ref = NewNode( | 114 Node* ref = NewNode( |
| 130 common()->ExternalConstant(ExternalReference(function, isolate()))); | 115 common()->ExternalConstant(ExternalReference(function, isolate()))); |
| 131 Node* arity = Int32Constant(1); | 116 Node* arity = Int32Constant(1); |
| 132 Node* context = Parameter(1); | 117 Node* context = Parameter(1); |
| 133 | 118 |
| 134 Node* call = graph()->NewNode(common()->Call(descriptor), centry, arg0, ref, | 119 Node* call = graph()->NewNode(common()->Call(descriptor), centry, arg0, ref, |
| 135 arity, context); | 120 arity, context, frame_state); |
| 136 schedule()->AddCall(CurrentBlock(), call, Use(continuation), | 121 schedule()->AddNode(CurrentBlock(), call); |
| 137 Use(deoptimization)); | |
| 138 current_block_ = NULL; | |
| 139 return call; | 122 return call; |
| 140 } | 123 } |
| 141 | 124 |
| 142 | 125 |
| 143 void RawMachineAssembler::Bind(Label* label) { | 126 void RawMachineAssembler::Bind(Label* label) { |
| 144 DCHECK(current_block_ == NULL); | 127 DCHECK(current_block_ == NULL); |
| 145 DCHECK(!label->bound_); | 128 DCHECK(!label->bound_); |
| 146 label->bound_ = true; | 129 label->bound_ = true; |
| 147 current_block_ = EnsureBlock(label); | 130 current_block_ = EnsureBlock(label); |
| 148 } | 131 } |
| (...skipping 24 matching lines...) Expand all Loading... |
| 173 Node* node = graph()->NewNode(op, input_count, inputs); | 156 Node* node = graph()->NewNode(op, input_count, inputs); |
| 174 BasicBlock* block = op->opcode() == IrOpcode::kParameter ? schedule()->start() | 157 BasicBlock* block = op->opcode() == IrOpcode::kParameter ? schedule()->start() |
| 175 : CurrentBlock(); | 158 : CurrentBlock(); |
| 176 schedule()->AddNode(block, node); | 159 schedule()->AddNode(block, node); |
| 177 return node; | 160 return node; |
| 178 } | 161 } |
| 179 | 162 |
| 180 } // namespace compiler | 163 } // namespace compiler |
| 181 } // namespace internal | 164 } // namespace internal |
| 182 } // namespace v8 | 165 } // namespace v8 |
| OLD | NEW |