Commit da4f2491 authored by peterssen's avatar peterssen Committed by Commit bot

Fix context for fast accessors (lazy).

Fast accessors do not have an associated JSFunction, similar to lazy accessors.
Now using the 'lazy' version of the CallApiCallbackStub.

R=vogelheim@chromium.org
BUG=chromium:508898

Review-Url: https://codereview.chromium.org/2143983002
Cr-Commit-Position: refs/heads/master@{#37782}
parent bc44b1c6
......@@ -1774,8 +1774,10 @@ class CallApiCallbackStub : public PlatformCodeStub {
call_data_undefined, is_lazy) {}
// CallApiCallbackStub for callback functions.
CallApiCallbackStub(Isolate* isolate, int argc, bool call_data_undefined)
: CallApiCallbackStub(isolate, argc, false, call_data_undefined, false) {}
CallApiCallbackStub(Isolate* isolate, int argc, bool call_data_undefined,
bool is_lazy)
: CallApiCallbackStub(isolate, argc, false, call_data_undefined,
is_lazy) {}
CallInterfaceDescriptor GetCallInterfaceDescriptor() const override {
return ApiCallbackDescriptorBase::ForArgs(isolate(), argc());
......
......@@ -9369,7 +9369,7 @@ bool HOptimizedGraphBuilder::TryInlineApiCall(
Vector<HValue*>(op_vals, arraysize(op_vals) - 1),
syntactic_tail_call_mode);
} else {
CallApiCallbackStub stub(isolate(), argc, call_data_undefined);
CallApiCallbackStub stub(isolate(), argc, call_data_undefined, false);
Handle<Code> code = stub.GetCode();
HConstant* code_value = Add<HConstant>(code);
call = New<HCallWithDescriptor>(
......
......@@ -168,23 +168,23 @@ FastAccessorAssembler::ValueId FastAccessorAssembler::Call(
ExternalReference::DIRECT_API_CALL, isolate());
// Create & call API callback via stub.
CallApiCallbackStub stub(isolate(), 1, true);
CallApiCallbackStub stub(isolate(), 1, true, true);
DCHECK_EQ(5, stub.GetCallInterfaceDescriptor().GetParameterCount());
DCHECK_EQ(1, stub.GetCallInterfaceDescriptor().GetStackParameterCount());
// TODO(vogelheim): There is currently no clean way to retrieve the context
// parameter for a stub and the implementation details are hidden in
// compiler/*. The context_paramter is computed as:
// Linkage::GetJSCallContextParamIndex(descriptor->JSParameterCount())
const int context_parameter = 2;
const int context_parameter = 3;
Node* call = assembler_->CallStub(
stub.GetCallInterfaceDescriptor(),
assembler_->HeapConstant(stub.GetCode()),
assembler_->Parameter(context_parameter),
// Stub/register parameters:
assembler_->Parameter(0), /* receiver (use accessor's) */
assembler_->UndefinedConstant(), /* call_data (undefined) */
assembler_->NullConstant(), /* holder (null) */
assembler_->UndefinedConstant(), /* callee (there's no JSFunction) */
assembler_->UndefinedConstant(), /* call_data (undefined) */
assembler_->Parameter(0), /* receiver (same as holder in this case) */
assembler_->ExternalConstant(callback), /* API callback function */
// JS arguments, on stack:
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment