OLD | NEW |
1 // Copyright 2015 the V8 project authors. All rights reserved. | 1 // Copyright 2015 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/fast-accessor-assembler.h" | 5 #include "src/compiler/fast-accessor-assembler.h" |
6 | 6 |
7 #include "src/base/logging.h" | 7 #include "src/base/logging.h" |
8 #include "src/code-stubs.h" // For CallApiFunctionStub. | 8 #include "src/code-stubs.h" // For CallApiFunctionStub. |
9 #include "src/compiler/graph.h" | 9 #include "src/compiler/graph.h" |
10 #include "src/compiler/linkage.h" | 10 #include "src/compiler/linkage.h" |
(...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
160 void FastAccessorAssembler::CheckNotZeroOrJump(ValueId value_id, | 160 void FastAccessorAssembler::CheckNotZeroOrJump(ValueId value_id, |
161 LabelId label_id) { | 161 LabelId label_id) { |
162 CHECK_EQ(kBuilding, state_); | 162 CHECK_EQ(kBuilding, state_); |
163 RawMachineLabel pass; | 163 RawMachineLabel pass; |
164 assembler_->Branch( | 164 assembler_->Branch( |
165 assembler_->IntPtrEqual(FromId(value_id), assembler_->IntPtrConstant(0)), | 165 assembler_->IntPtrEqual(FromId(value_id), assembler_->IntPtrConstant(0)), |
166 &pass, FromId(label_id)); | 166 &pass, FromId(label_id)); |
167 assembler_->Bind(&pass); | 167 assembler_->Bind(&pass); |
168 } | 168 } |
169 | 169 |
170 | |
171 FastAccessorAssembler::ValueId FastAccessorAssembler::Call( | 170 FastAccessorAssembler::ValueId FastAccessorAssembler::Call( |
172 FunctionCallback callback_function, ValueId arg) { | 171 FunctionCallback callback_function, ValueId arg) { |
173 CHECK_EQ(kBuilding, state_); | 172 CHECK_EQ(kBuilding, state_); |
174 | 173 |
175 // Create API function stub. | 174 // Create API function stub. |
176 CallApiFunctionStub stub(assembler_->isolate(), true); | 175 CallApiFunctionStub stub(assembler_->isolate(), true); |
177 | 176 |
178 // Wrap the FunctionCallback in an ExternalReference. | 177 // Wrap the FunctionCallback in an ExternalReference. |
179 ApiFunction callback_api_function(FUNCTION_ADDR(callback_function)); | 178 ApiFunction callback_api_function(FUNCTION_ADDR(callback_function)); |
180 ExternalReference callback(&callback_api_function, | 179 ExternalReference callback(&callback_api_function, |
(...skipping 21 matching lines...) Expand all Loading... |
202 | 201 |
203 Node* call = assembler_->CallN( | 202 Node* call = assembler_->CallN( |
204 Linkage::GetStubCallDescriptor( | 203 Linkage::GetStubCallDescriptor( |
205 assembler_->isolate(), zone(), stub.GetCallInterfaceDescriptor(), | 204 assembler_->isolate(), zone(), stub.GetCallInterfaceDescriptor(), |
206 kStackParam + stub.GetStackParameterCount(), | 205 kStackParam + stub.GetStackParameterCount(), |
207 CallDescriptor::kNoFlags), | 206 CallDescriptor::kNoFlags), |
208 assembler_->HeapConstant(stub.GetCode()), args); | 207 assembler_->HeapConstant(stub.GetCode()), args); |
209 return FromRaw(call); | 208 return FromRaw(call); |
210 } | 209 } |
211 | 210 |
212 | |
213 MaybeHandle<Code> FastAccessorAssembler::Build() { | 211 MaybeHandle<Code> FastAccessorAssembler::Build() { |
214 CHECK_EQ(kBuilding, state_); | 212 CHECK_EQ(kBuilding, state_); |
215 | 213 |
216 // Cleanup: We no longer need this. | 214 // Cleanup: We no longer need this. |
217 nodes_.clear(); | 215 nodes_.clear(); |
218 labels_.clear(); | 216 labels_.clear(); |
219 | 217 |
220 // Export the schedule and call the compiler. | 218 // Export the schedule and call the compiler. |
221 Schedule* schedule = assembler_->Export(); | 219 Schedule* schedule = assembler_->Export(); |
222 Code::Flags flags = Code::ComputeFlags(Code::STUB); | 220 Code::Flags flags = Code::ComputeFlags(Code::STUB); |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
255 RawMachineLabel* FastAccessorAssembler::FromId(LabelId label) const { | 253 RawMachineLabel* FastAccessorAssembler::FromId(LabelId label) const { |
256 CHECK_LT(label.label_id, labels_.size()); | 254 CHECK_LT(label.label_id, labels_.size()); |
257 CHECK_NOT_NULL(labels_.at(label.label_id)); | 255 CHECK_NOT_NULL(labels_.at(label.label_id)); |
258 return labels_.at(label.label_id); | 256 return labels_.at(label.label_id); |
259 } | 257 } |
260 | 258 |
261 | 259 |
262 } // namespace compiler | 260 } // namespace compiler |
263 } // namespace internal | 261 } // namespace internal |
264 } // namespace v8 | 262 } // namespace v8 |
OLD | NEW |