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/code-factory.h" | 5 #include "src/code-factory.h" |
6 #include "src/compiler/pipeline.h" | 6 #include "src/compiler/pipeline.h" |
7 #include "src/compiler/raw-machine-assembler.h" | 7 #include "src/compiler/raw-machine-assembler.h" |
8 #include "src/compiler/scheduler.h" | 8 #include "src/compiler/scheduler.h" |
9 | 9 |
10 namespace v8 { | 10 namespace v8 { |
11 namespace internal { | 11 namespace internal { |
12 namespace compiler { | 12 namespace compiler { |
13 | 13 |
14 RawMachineAssembler::RawMachineAssembler(Graph* graph, | 14 RawMachineAssembler::RawMachineAssembler(Isolate* isolate, Graph* graph, |
15 MachineSignature* machine_sig, | 15 MachineSignature* machine_sig, |
16 MachineType word, | 16 MachineType word, |
17 MachineOperatorBuilder::Flags flags) | 17 MachineOperatorBuilder::Flags flags) |
18 : GraphBuilder(graph), | 18 : GraphBuilder(isolate, graph), |
19 schedule_(new (zone()) Schedule(zone())), | 19 schedule_(new (zone()) Schedule(zone())), |
20 machine_(zone(), word, flags), | 20 machine_(zone(), word, flags), |
21 common_(zone()), | 21 common_(zone()), |
22 machine_sig_(machine_sig), | 22 machine_sig_(machine_sig), |
23 call_descriptor_( | 23 call_descriptor_( |
24 Linkage::GetSimplifiedCDescriptor(graph->zone(), machine_sig)), | 24 Linkage::GetSimplifiedCDescriptor(graph->zone(), machine_sig)), |
25 parameters_(NULL), | 25 parameters_(NULL), |
26 exit_label_(schedule()->end()), | 26 exit_label_(schedule()->end()), |
27 current_block_(schedule()->start()) { | 27 current_block_(schedule()->start()) { |
28 int param_count = static_cast<int>(parameter_count()); | 28 int param_count = static_cast<int>(parameter_count()); |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
80 schedule()->AddReturn(CurrentBlock(), value); | 80 schedule()->AddReturn(CurrentBlock(), value); |
81 current_block_ = NULL; | 81 current_block_ = NULL; |
82 } | 82 } |
83 | 83 |
84 | 84 |
85 Node* RawMachineAssembler::CallFunctionStub0(Node* function, Node* receiver, | 85 Node* RawMachineAssembler::CallFunctionStub0(Node* function, Node* receiver, |
86 Node* context, Node* frame_state, | 86 Node* context, Node* frame_state, |
87 CallFunctionFlags flags) { | 87 CallFunctionFlags flags) { |
88 Callable callable = CodeFactory::CallFunction(isolate(), 0, flags); | 88 Callable callable = CodeFactory::CallFunction(isolate(), 0, flags); |
89 CallDescriptor* desc = Linkage::GetStubCallDescriptor( | 89 CallDescriptor* desc = Linkage::GetStubCallDescriptor( |
90 callable.descriptor(), 1, CallDescriptor::kNeedsFrameState, | 90 isolate(), zone(), callable.descriptor(), 1, |
91 Operator::kNoProperties, zone()); | 91 CallDescriptor::kNeedsFrameState, Operator::kNoProperties); |
92 Node* stub_code = HeapConstant(callable.code()); | 92 Node* stub_code = HeapConstant(callable.code()); |
93 Node* call = graph()->NewNode(common()->Call(desc), stub_code, function, | 93 Node* call = graph()->NewNode(common()->Call(desc), stub_code, function, |
94 receiver, context, frame_state); | 94 receiver, context, frame_state); |
95 schedule()->AddNode(CurrentBlock(), call); | 95 schedule()->AddNode(CurrentBlock(), call); |
96 return call; | 96 return call; |
97 } | 97 } |
98 | 98 |
99 | 99 |
100 Node* RawMachineAssembler::CallJS0(Node* function, Node* receiver, | 100 Node* RawMachineAssembler::CallJS0(Node* function, Node* receiver, |
101 Node* context, Node* frame_state) { | 101 Node* context, Node* frame_state) { |
102 CallDescriptor* descriptor = | 102 CallDescriptor* descriptor = |
103 Linkage::GetJSCallDescriptor(1, zone(), CallDescriptor::kNeedsFrameState); | 103 Linkage::GetJSCallDescriptor(zone(), 1, CallDescriptor::kNeedsFrameState); |
104 Node* call = graph()->NewNode(common()->Call(descriptor), function, receiver, | 104 Node* call = graph()->NewNode(common()->Call(descriptor), function, receiver, |
105 context, frame_state); | 105 context, frame_state); |
106 schedule()->AddNode(CurrentBlock(), call); | 106 schedule()->AddNode(CurrentBlock(), call); |
107 return call; | 107 return call; |
108 } | 108 } |
109 | 109 |
110 | 110 |
111 Node* RawMachineAssembler::CallRuntime1(Runtime::FunctionId function, | 111 Node* RawMachineAssembler::CallRuntime1(Runtime::FunctionId function, |
112 Node* arg0, Node* context, | 112 Node* arg0, Node* context, |
113 Node* frame_state) { | 113 Node* frame_state) { |
114 CallDescriptor* descriptor = Linkage::GetRuntimeCallDescriptor( | 114 CallDescriptor* descriptor = Linkage::GetRuntimeCallDescriptor( |
115 function, 1, Operator::kNoProperties, zone()); | 115 zone(), function, 1, Operator::kNoProperties); |
116 | 116 |
117 Node* centry = HeapConstant(CEntryStub(isolate(), 1).GetCode()); | 117 Node* centry = HeapConstant(CEntryStub(isolate(), 1).GetCode()); |
118 Node* ref = NewNode( | 118 Node* ref = NewNode( |
119 common()->ExternalConstant(ExternalReference(function, isolate()))); | 119 common()->ExternalConstant(ExternalReference(function, isolate()))); |
120 Node* arity = Int32Constant(1); | 120 Node* arity = Int32Constant(1); |
121 | 121 |
122 Node* call = graph()->NewNode(common()->Call(descriptor), centry, arg0, ref, | 122 Node* call = graph()->NewNode(common()->Call(descriptor), centry, arg0, ref, |
123 arity, context, frame_state); | 123 arity, context, frame_state); |
124 schedule()->AddNode(CurrentBlock(), call); | 124 schedule()->AddNode(CurrentBlock(), call); |
125 return call; | 125 return call; |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
159 Node* node = graph()->NewNode(op, input_count, inputs, incomplete); | 159 Node* node = graph()->NewNode(op, input_count, inputs, incomplete); |
160 BasicBlock* block = op->opcode() == IrOpcode::kParameter ? schedule()->start() | 160 BasicBlock* block = op->opcode() == IrOpcode::kParameter ? schedule()->start() |
161 : CurrentBlock(); | 161 : CurrentBlock(); |
162 schedule()->AddNode(block, node); | 162 schedule()->AddNode(block, node); |
163 return node; | 163 return node; |
164 } | 164 } |
165 | 165 |
166 } // namespace compiler | 166 } // namespace compiler |
167 } // namespace internal | 167 } // namespace internal |
168 } // namespace v8 | 168 } // namespace v8 |
OLD | NEW |