| 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 174 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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 // TODO(vogelheim): There is currently no clean way to retrieve the context |
| 188 // parameter for a stub and the implementation details are hidden in | 188 // parameter for a stub and the implementation details are hidden in |
| 189 // compiler/*. The context_paramter is computed as: | 189 // compiler/*. The context_paramter is computed as: |
| 190 // Linkage::GetJSCallContextParamIndex(descriptor->JSParameterCount()) | 190 // Linkage::GetJSCallContextParamIndex(descriptor->JSParameterCount()) |
| 191 const int kContextParameter = 3; | 191 const int kContextParameter = 3; |
| 192 Node* context = assembler_->Parameter(kContextParameter); | 192 Node* context = assembler_->Parameter(kContextParameter); |
| 193 Node* target = assembler_->HeapConstant(stub.GetCode()); | 193 Node* target = assembler_->HeapConstant(stub.GetCode()); |
| 194 | 194 |
| 195 int param_count = descriptor.GetParameterCount(); | 195 Node* call = assembler_->CallStub( |
| 196 Node** args = zone()->NewArray<Node*>(param_count + 1 + kJSParameterCount); | 196 descriptor, target, context, |
| 197 // Stub/register parameters: | 197 assembler_->UndefinedConstant(), // callee (there's no JSFunction) |
| 198 args[0] = assembler_->UndefinedConstant(); // callee (there's no JSFunction) | 198 assembler_->UndefinedConstant(), // call_data (undefined) |
| 199 args[1] = assembler_->UndefinedConstant(); // call_data (undefined) | 199 assembler_->Parameter(0), // receiver (same as holder in this case) |
| 200 args[2] = assembler_->Parameter(0); // receiver (same as holder in this case) | 200 assembler_->ExternalConstant(callback), // API callback function |
| 201 args[3] = assembler_->ExternalConstant(callback); // API callback function | 201 FromId(arg)); // JS argument, on stack |
| 202 | |
| 203 // JS arguments, on stack: | |
| 204 args[4] = FromId(arg); | |
| 205 | |
| 206 // Context. | |
| 207 args[5] = context; | |
| 208 | |
| 209 Node* call = | |
| 210 assembler_->CallStubN(descriptor, kJSParameterCount, target, args); | |
| 211 | |
| 212 return FromRaw(call); | 202 return FromRaw(call); |
| 213 } | 203 } |
| 214 | 204 |
| 215 void FastAccessorAssembler::CheckIsJSObjectOrJump(ValueId value_id, | 205 void FastAccessorAssembler::CheckIsJSObjectOrJump(ValueId value_id, |
| 216 LabelId label_id) { | 206 LabelId label_id) { |
| 217 CHECK_EQ(kBuilding, state_); | 207 CHECK_EQ(kBuilding, state_); |
| 218 | 208 |
| 219 // Determine the 'value' object's instance type. | 209 // Determine the 'value' object's instance type. |
| 220 Node* instance_type = assembler_->LoadInstanceType(FromId(value_id)); | 210 Node* instance_type = assembler_->LoadInstanceType(FromId(value_id)); |
| 221 | 211 |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 275 void FastAccessorAssembler::Clear() { | 265 void FastAccessorAssembler::Clear() { |
| 276 for (auto label : labels_) { | 266 for (auto label : labels_) { |
| 277 delete label; | 267 delete label; |
| 278 } | 268 } |
| 279 nodes_.clear(); | 269 nodes_.clear(); |
| 280 labels_.clear(); | 270 labels_.clear(); |
| 281 } | 271 } |
| 282 | 272 |
| 283 } // namespace internal | 273 } // namespace internal |
| 284 } // namespace v8 | 274 } // namespace v8 |
| OLD | NEW |