Chromium Code Reviews| Index: src/compiler/fast-accessor-assembler.cc | 
| diff --git a/src/compiler/fast-accessor-assembler.cc b/src/compiler/fast-accessor-assembler.cc | 
| index 09d513fdc622c4a141a26601ae0501c1bedd5f14..81396ad24d34ddcc3beb80534b068c8dcf5808ad 100644 | 
| --- a/src/compiler/fast-accessor-assembler.cc | 
| +++ b/src/compiler/fast-accessor-assembler.cc | 
| @@ -5,6 +5,7 @@ | 
| #include "src/compiler/fast-accessor-assembler.h" | 
| #include "src/base/logging.h" | 
| +#include "src/code-stubs.h" // For CallApiFunctionStub. | 
| #include "src/compiler/graph.h" | 
| #include "src/compiler/linkage.h" | 
| #include "src/compiler/pipeline.h" | 
| @@ -167,6 +168,44 @@ void FastAccessorAssembler::CheckNotZeroOrJump(ValueId value_id, | 
| } | 
| +FastAccessorAssembler::ValueId FastAccessorAssembler::Call( | 
| + FunctionCallback callback_function, ValueId arg) { | 
| + CHECK_EQ(kBuilding, state_); | 
| + | 
| + // Create API function stub. | 
| + CallApiFunctionStub stub(assembler_->isolate(), true); | 
| + | 
| + // Wrap the FunctionCallback in an ExternalReference. | 
| + ApiFunction callback_api_function(FUNCTION_ADDR(callback_function)); | 
| + ExternalReference callback(&callback_api_function, | 
| + ExternalReference::DIRECT_API_CALL, | 
| + assembler_->isolate()); | 
| + | 
| + // The stub has 5 parameters, and N (here: N = 1) parameters to pass through | 
| + // to the callback. | 
| + // See: ApiFunctionDescriptor::BuildCallInterfaceDescriptorFunctionType | 
| + Node* args[] = { | 
| + // Stub arguments: | 
| + assembler_->Parameter(0), /* receiver (use accessor's) */ | 
| + assembler_->UndefinedConstant(), /* call_data (undefined) */ | 
| + assembler_->NullConstant(), /* holder (null) */ | 
| + assembler_->ExternalConstant(callback), /* API callback function */ | 
| + assembler_->IntPtrConstant(1), /* # arguments */ | 
| + | 
| + // Callback arguments: | 
| + FromId(arg), | 
| + FromId(arg) | 
| 
 
vogelheim
2016/01/25 17:10:33
I'm not sure if I'm doing this right:
As I unders
 
 | 
| + }; | 
| + | 
| + Node* call = assembler_->CallN( | 
| + Linkage::GetStubCallDescriptor( | 
| + assembler_->isolate(), zone(), stub.GetCallInterfaceDescriptor(), | 
| + 1 + stub.GetStackParameterCount(), CallDescriptor::kNoFlags), | 
| + assembler_->HeapConstant(stub.GetCode()), args); | 
| + return FromRaw(call); | 
| +} | 
| + | 
| + | 
| MaybeHandle<Code> FastAccessorAssembler::Build() { | 
| CHECK_EQ(kBuilding, state_); |