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/fast-accessor-assembler.h" | 5 #include "src/fast-accessor-assembler.h" |
6 | 6 |
7 #include "src/base/logging.h" | 7 #include "src/base/logging.h" |
8 #include "src/code-stub-assembler.h" | 8 #include "src/code-stub-assembler.h" |
9 #include "src/code-stubs.h" // For CallApiCallbackStub. | 9 #include "src/code-stubs.h" // For CallApiCallbackStub. |
10 #include "src/handles-inl.h" | 10 #include "src/handles-inl.h" |
(...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
177 ApiFunction callback_api_function(FUNCTION_ADDR(callback_function)); | 177 ApiFunction callback_api_function(FUNCTION_ADDR(callback_function)); |
178 ExternalReference callback(&callback_api_function, | 178 ExternalReference callback(&callback_api_function, |
179 ExternalReference::DIRECT_API_CALL, isolate()); | 179 ExternalReference::DIRECT_API_CALL, isolate()); |
180 | 180 |
181 // Create & call API callback via stub. | 181 // Create & call API callback via stub. |
182 const int kJSParameterCount = 1; | 182 const int kJSParameterCount = 1; |
183 CallApiCallbackStub stub(isolate(), kJSParameterCount, true, true); | 183 CallApiCallbackStub stub(isolate(), kJSParameterCount, true, true); |
184 CallInterfaceDescriptor descriptor = stub.GetCallInterfaceDescriptor(); | 184 CallInterfaceDescriptor descriptor = stub.GetCallInterfaceDescriptor(); |
185 DCHECK_EQ(4, descriptor.GetParameterCount()); | 185 DCHECK_EQ(4, descriptor.GetParameterCount()); |
186 DCHECK_EQ(0, descriptor.GetStackParameterCount()); | 186 DCHECK_EQ(0, descriptor.GetStackParameterCount()); |
187 // TODO(vogelheim): There is currently no clean way to retrieve the context | 187 Node* context = assembler_->GetJSContextParameter(); |
188 // parameter for a stub and the implementation details are hidden in | |
189 // compiler/*. The context_paramter is computed as: | |
190 // Linkage::GetJSCallContextParamIndex(descriptor->JSParameterCount()) | |
191 const int kContextParameter = 3; | |
192 Node* context = assembler_->Parameter(kContextParameter); | |
193 Node* target = assembler_->HeapConstant(stub.GetCode()); | 188 Node* target = assembler_->HeapConstant(stub.GetCode()); |
194 | 189 |
195 Node* call = assembler_->CallStub( | 190 Node* call = assembler_->CallStub( |
196 descriptor, target, context, | 191 descriptor, target, context, |
197 assembler_->UndefinedConstant(), // callee (there's no JSFunction) | 192 assembler_->UndefinedConstant(), // callee (there's no JSFunction) |
198 assembler_->UndefinedConstant(), // call_data (undefined) | 193 assembler_->UndefinedConstant(), // call_data (undefined) |
199 assembler_->Parameter(0), // receiver (same as holder in this case) | 194 assembler_->Parameter(0), // receiver (same as holder in this case) |
200 assembler_->ExternalConstant(callback), // API callback function | 195 assembler_->ExternalConstant(callback), // API callback function |
201 FromId(arg)); // JS argument, on stack | 196 FromId(arg)); // JS argument, on stack |
202 return FromRaw(call); | 197 return FromRaw(call); |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
265 void FastAccessorAssembler::Clear() { | 260 void FastAccessorAssembler::Clear() { |
266 for (auto label : labels_) { | 261 for (auto label : labels_) { |
267 delete label; | 262 delete label; |
268 } | 263 } |
269 nodes_.clear(); | 264 nodes_.clear(); |
270 labels_.clear(); | 265 labels_.clear(); |
271 } | 266 } |
272 | 267 |
273 } // namespace internal | 268 } // namespace internal |
274 } // namespace v8 | 269 } // namespace v8 |
OLD | NEW |