Revert of Change calling convention of CallApiGetterStub to accept the AccessorInfo (patchset #8 id:140001 of https://codereview.chromium.org/1892533004/ )
Reason for revert: Blocks roll: https://codereview.chromium.org/1896103002/ Can also be seen on internal waterfall: https://chromegw.corp.google.com/i/internal.client.v8/builders/v8_cros_perf_1/builds/7558 Original issue's description: > Change calling convention of CallApiGetterStub to accept the AccessorInfo > > MIPS port contributed by Balazs Kilvady <balazs.kilvady@imgtec.com> > > Committed: https://crrev.com/d2b0a4b727f77f97960c7fa71da3431591dc959f > Cr-Commit-Position: refs/heads/master@{#35606} TBR=rodolph.perfetta@arm.com,jkummerow@chromium.org,jacob.bramley@arm.com,verwaest@chromium.org # Skipping CQ checks because original CL landed less than 1 days ago. NOPRESUBMIT=true NOTREECHECKS=true NOTRY=true Review URL: https://codereview.chromium.org/1906453002 Cr-Commit-Position: refs/heads/master@{#35644}
This commit is contained in:
parent
95f0d4ed39
commit
12d727a86e
@ -39,13 +39,6 @@ Handle<AccessorInfo> Accessors::MakeAccessor(
|
||||
Handle<Object> set = v8::FromCData(isolate, setter);
|
||||
info->set_getter(*get);
|
||||
info->set_setter(*set);
|
||||
#ifdef USE_SIMULATOR
|
||||
Address redirected = info->redirected_getter();
|
||||
if (redirected != nullptr) {
|
||||
Handle<Object> js_get = v8::FromCData(isolate, redirected);
|
||||
info->set_js_getter(*js_get);
|
||||
}
|
||||
#endif
|
||||
return info;
|
||||
}
|
||||
|
||||
|
@ -1224,10 +1224,8 @@ static i::Handle<i::AccessorInfo> SetAccessorInfoProperties(
|
||||
return obj;
|
||||
}
|
||||
|
||||
namespace {
|
||||
|
||||
template <typename Getter, typename Setter>
|
||||
i::Handle<i::AccessorInfo> MakeAccessorInfo(
|
||||
static i::Handle<i::AccessorInfo> MakeAccessorInfo(
|
||||
v8::Local<Name> name, Getter getter, Setter setter, v8::Local<Value> data,
|
||||
v8::AccessControl settings, v8::PropertyAttribute attributes,
|
||||
v8::Local<AccessorSignature> signature, bool is_special_data_property) {
|
||||
@ -1238,10 +1236,6 @@ i::Handle<i::AccessorInfo> MakeAccessorInfo(
|
||||
setter = reinterpret_cast<Setter>(&i::Accessors::ReconfigureToDataProperty);
|
||||
}
|
||||
SET_FIELD_WRAPPED(obj, set_setter, setter);
|
||||
#ifdef USE_SIMULATOR
|
||||
i::Address redirected = obj->redirected_getter();
|
||||
if (redirected != nullptr) SET_FIELD_WRAPPED(obj, set_js_getter, redirected);
|
||||
#endif
|
||||
if (data.IsEmpty()) {
|
||||
data = v8::Undefined(reinterpret_cast<v8::Isolate*>(isolate));
|
||||
}
|
||||
@ -1250,7 +1244,6 @@ i::Handle<i::AccessorInfo> MakeAccessorInfo(
|
||||
return SetAccessorInfoProperties(obj, name, settings, attributes, signature);
|
||||
}
|
||||
|
||||
} // namespace
|
||||
|
||||
Local<ObjectTemplate> FunctionTemplate::InstanceTemplate() {
|
||||
i::Handle<i::FunctionTemplateInfo> handle = Utils::OpenHandle(this, true);
|
||||
|
@ -5512,36 +5512,16 @@ void CallApiCallbackStub::Generate(MacroAssembler* masm) {
|
||||
|
||||
|
||||
void CallApiGetterStub::Generate(MacroAssembler* masm) {
|
||||
// Build v8::PropertyCallbackInfo::args_ array on the stack and push property
|
||||
// name below the exit frame to make GC aware of them.
|
||||
STATIC_ASSERT(PropertyCallbackArguments::kShouldThrowOnErrorIndex == 0);
|
||||
STATIC_ASSERT(PropertyCallbackArguments::kHolderIndex == 1);
|
||||
STATIC_ASSERT(PropertyCallbackArguments::kIsolateIndex == 2);
|
||||
STATIC_ASSERT(PropertyCallbackArguments::kReturnValueDefaultValueIndex == 3);
|
||||
STATIC_ASSERT(PropertyCallbackArguments::kReturnValueOffset == 4);
|
||||
STATIC_ASSERT(PropertyCallbackArguments::kDataIndex == 5);
|
||||
STATIC_ASSERT(PropertyCallbackArguments::kThisIndex == 6);
|
||||
STATIC_ASSERT(PropertyCallbackArguments::kArgsLength == 7);
|
||||
// ----------- S t a t e -------------
|
||||
// -- sp[0] : name
|
||||
// -- sp[4 .. (4 + kArgsLength*4)] : v8::PropertyCallbackInfo::args_
|
||||
// -- ...
|
||||
// -- r2 : api_function_address
|
||||
// -----------------------------------
|
||||
|
||||
Register receiver = ApiGetterDescriptor::ReceiverRegister();
|
||||
Register holder = ApiGetterDescriptor::HolderRegister();
|
||||
Register callback = ApiGetterDescriptor::CallbackRegister();
|
||||
Register scratch = r4;
|
||||
DCHECK(!AreAliased(receiver, holder, callback, scratch));
|
||||
Register api_function_address = ApiGetterDescriptor::function_address();
|
||||
DCHECK(api_function_address.is(r2));
|
||||
|
||||
Register api_function_address = r2;
|
||||
|
||||
__ push(receiver);
|
||||
// Push data from AccessorInfo.
|
||||
__ ldr(scratch, FieldMemOperand(callback, AccessorInfo::kDataOffset));
|
||||
__ push(scratch);
|
||||
__ LoadRoot(scratch, Heap::kUndefinedValueRootIndex);
|
||||
__ Push(scratch, scratch);
|
||||
__ mov(scratch, Operand(ExternalReference::isolate_address(isolate())));
|
||||
__ Push(scratch, holder);
|
||||
__ Push(Smi::FromInt(0)); // should_throw_on_error -> false
|
||||
__ ldr(scratch, FieldMemOperand(callback, AccessorInfo::kNameOffset));
|
||||
__ push(scratch);
|
||||
// v8::PropertyCallbackInfo::args_ array and name handle.
|
||||
const int kStackUnwindSpace = PropertyCallbackArguments::kArgsLength + 1;
|
||||
|
||||
@ -5561,10 +5541,6 @@ void CallApiGetterStub::Generate(MacroAssembler* masm) {
|
||||
ExternalReference thunk_ref =
|
||||
ExternalReference::invoke_accessor_getter_callback(isolate());
|
||||
|
||||
__ ldr(scratch, FieldMemOperand(callback, AccessorInfo::kJsGetterOffset));
|
||||
__ ldr(api_function_address,
|
||||
FieldMemOperand(scratch, Foreign::kForeignAddressOffset));
|
||||
|
||||
// +3 is to skip prolog, return address and name handle.
|
||||
MemOperand return_value_operand(
|
||||
fp, (PropertyCallbackArguments::kReturnValueOffset + 3) * kPointerSize);
|
||||
|
@ -55,8 +55,9 @@ const Register InstanceOfDescriptor::RightRegister() { return r0; }
|
||||
const Register StringCompareDescriptor::LeftRegister() { return r1; }
|
||||
const Register StringCompareDescriptor::RightRegister() { return r0; }
|
||||
|
||||
const Register ApiGetterDescriptor::HolderRegister() { return r0; }
|
||||
const Register ApiGetterDescriptor::CallbackRegister() { return r3; }
|
||||
|
||||
const Register ApiGetterDescriptor::function_address() { return r2; }
|
||||
|
||||
|
||||
const Register MathPowTaggedDescriptor::exponent() { return r2; }
|
||||
|
||||
|
@ -5890,34 +5890,15 @@ void CallApiCallbackStub::Generate(MacroAssembler* masm) {
|
||||
|
||||
|
||||
void CallApiGetterStub::Generate(MacroAssembler* masm) {
|
||||
// Build v8::PropertyCallbackInfo::args_ array on the stack and push property
|
||||
// name below the exit frame to make GC aware of them.
|
||||
STATIC_ASSERT(PropertyCallbackArguments::kShouldThrowOnErrorIndex == 0);
|
||||
STATIC_ASSERT(PropertyCallbackArguments::kHolderIndex == 1);
|
||||
STATIC_ASSERT(PropertyCallbackArguments::kIsolateIndex == 2);
|
||||
STATIC_ASSERT(PropertyCallbackArguments::kReturnValueDefaultValueIndex == 3);
|
||||
STATIC_ASSERT(PropertyCallbackArguments::kReturnValueOffset == 4);
|
||||
STATIC_ASSERT(PropertyCallbackArguments::kDataIndex == 5);
|
||||
STATIC_ASSERT(PropertyCallbackArguments::kThisIndex == 6);
|
||||
STATIC_ASSERT(PropertyCallbackArguments::kArgsLength == 7);
|
||||
// ----------- S t a t e -------------
|
||||
// -- sp[0] : name
|
||||
// -- sp[8 .. (8 + kArgsLength*8)] : v8::PropertyCallbackInfo::args_
|
||||
// -- ...
|
||||
// -- x2 : api_function_address
|
||||
// -----------------------------------
|
||||
|
||||
Register receiver = ApiGetterDescriptor::ReceiverRegister();
|
||||
Register holder = ApiGetterDescriptor::HolderRegister();
|
||||
Register callback = ApiGetterDescriptor::CallbackRegister();
|
||||
Register scratch = x4;
|
||||
Register scratch2 = x5;
|
||||
Register scratch3 = x6;
|
||||
DCHECK(!AreAliased(receiver, holder, callback, scratch));
|
||||
|
||||
__ Push(receiver);
|
||||
|
||||
__ LoadRoot(scratch, Heap::kUndefinedValueRootIndex);
|
||||
__ Mov(scratch2, Operand(ExternalReference::isolate_address(isolate())));
|
||||
__ Ldr(scratch3, FieldMemOperand(callback, AccessorInfo::kDataOffset));
|
||||
__ Push(scratch3, scratch, scratch, scratch2, holder);
|
||||
__ Push(Smi::FromInt(0)); // should_throw_on_error -> false
|
||||
__ Ldr(scratch, FieldMemOperand(callback, AccessorInfo::kNameOffset));
|
||||
__ Push(scratch);
|
||||
Register api_function_address = ApiGetterDescriptor::function_address();
|
||||
DCHECK(api_function_address.is(x2));
|
||||
|
||||
// v8::PropertyCallbackInfo::args_ array and name handle.
|
||||
const int kStackUnwindSpace = PropertyCallbackArguments::kArgsLength + 1;
|
||||
@ -5944,11 +5925,6 @@ void CallApiGetterStub::Generate(MacroAssembler* masm) {
|
||||
ExternalReference thunk_ref =
|
||||
ExternalReference::invoke_accessor_getter_callback(isolate());
|
||||
|
||||
Register api_function_address = x2;
|
||||
__ Ldr(scratch, FieldMemOperand(callback, AccessorInfo::kJsGetterOffset));
|
||||
__ Ldr(api_function_address,
|
||||
FieldMemOperand(scratch, Foreign::kForeignAddressOffset));
|
||||
|
||||
const int spill_offset = 1 + kApiStackSpace;
|
||||
// +3 is to skip prolog, return address and name handle.
|
||||
MemOperand return_value_operand(
|
||||
|
@ -55,8 +55,9 @@ const Register InstanceOfDescriptor::RightRegister() { return x0; }
|
||||
const Register StringCompareDescriptor::LeftRegister() { return x1; }
|
||||
const Register StringCompareDescriptor::RightRegister() { return x0; }
|
||||
|
||||
const Register ApiGetterDescriptor::HolderRegister() { return x0; }
|
||||
const Register ApiGetterDescriptor::CallbackRegister() { return x3; }
|
||||
|
||||
const Register ApiGetterDescriptor::function_address() { return x2; }
|
||||
|
||||
|
||||
const Register MathPowTaggedDescriptor::exponent() { return x11; }
|
||||
|
||||
|
@ -297,29 +297,19 @@ ExternalReferenceTable::ExternalReferenceTable(Isolate* isolate) {
|
||||
const char* name;
|
||||
};
|
||||
|
||||
static const AccessorRefTable getters[] = {
|
||||
static const AccessorRefTable accessors[] = {
|
||||
#define ACCESSOR_INFO_DECLARATION(name) \
|
||||
{FUNCTION_ADDR(&Accessors::name##Getter), "Accessors::" #name "Getter"},
|
||||
ACCESSOR_INFO_LIST(ACCESSOR_INFO_DECLARATION)
|
||||
#undef ACCESSOR_INFO_DECLARATION
|
||||
};
|
||||
static const AccessorRefTable setters[] = {
|
||||
#define ACCESSOR_SETTER_DECLARATION(name) \
|
||||
{FUNCTION_ADDR(&Accessors::name), "Accessors::" #name},
|
||||
ACCESSOR_SETTER_LIST(ACCESSOR_SETTER_DECLARATION)
|
||||
ACCESSOR_SETTER_LIST(ACCESSOR_SETTER_DECLARATION)
|
||||
#undef ACCESSOR_INFO_DECLARATION
|
||||
};
|
||||
|
||||
for (unsigned i = 0; i < arraysize(getters); ++i) {
|
||||
Add(getters[i].address, getters[i].name);
|
||||
#ifdef USE_SIMULATOR
|
||||
Add(AccessorInfo::redirect(isolate, getters[i].address, ACCESSOR_GETTER),
|
||||
getters[i].name);
|
||||
#endif
|
||||
}
|
||||
|
||||
for (unsigned i = 0; i < arraysize(setters); ++i) {
|
||||
Add(setters[i].address, setters[i].name);
|
||||
for (unsigned i = 0; i < arraysize(accessors); ++i) {
|
||||
Add(accessors[i].address, accessors[i].name);
|
||||
}
|
||||
|
||||
StubCache* stub_cache = isolate->stub_cache();
|
||||
|
@ -5792,34 +5792,14 @@ void CallApiCallbackStub::Generate(MacroAssembler* masm) {
|
||||
|
||||
|
||||
void CallApiGetterStub::Generate(MacroAssembler* masm) {
|
||||
// Build v8::PropertyCallbackInfo::args_ array on the stack and push property
|
||||
// name below the exit frame to make GC aware of them.
|
||||
STATIC_ASSERT(PropertyCallbackArguments::kShouldThrowOnErrorIndex == 0);
|
||||
STATIC_ASSERT(PropertyCallbackArguments::kHolderIndex == 1);
|
||||
STATIC_ASSERT(PropertyCallbackArguments::kIsolateIndex == 2);
|
||||
STATIC_ASSERT(PropertyCallbackArguments::kReturnValueDefaultValueIndex == 3);
|
||||
STATIC_ASSERT(PropertyCallbackArguments::kReturnValueOffset == 4);
|
||||
STATIC_ASSERT(PropertyCallbackArguments::kDataIndex == 5);
|
||||
STATIC_ASSERT(PropertyCallbackArguments::kThisIndex == 6);
|
||||
STATIC_ASSERT(PropertyCallbackArguments::kArgsLength == 7);
|
||||
|
||||
Register receiver = ApiGetterDescriptor::ReceiverRegister();
|
||||
Register holder = ApiGetterDescriptor::HolderRegister();
|
||||
Register callback = ApiGetterDescriptor::CallbackRegister();
|
||||
Register scratch = ebx;
|
||||
DCHECK(!AreAliased(receiver, holder, callback, scratch));
|
||||
|
||||
__ pop(scratch); // Pop return address to extend the frame.
|
||||
__ push(receiver);
|
||||
__ push(FieldOperand(callback, AccessorInfo::kDataOffset));
|
||||
__ PushRoot(Heap::kUndefinedValueRootIndex); // ReturnValue
|
||||
// ReturnValue default value
|
||||
__ PushRoot(Heap::kUndefinedValueRootIndex);
|
||||
__ push(Immediate(ExternalReference::isolate_address(isolate())));
|
||||
__ push(holder);
|
||||
__ push(Immediate(Smi::FromInt(0))); // should_throw_on_error -> false
|
||||
__ push(FieldOperand(callback, AccessorInfo::kNameOffset));
|
||||
__ push(scratch); // Restore return address.
|
||||
// ----------- S t a t e -------------
|
||||
// -- esp[0] : return address
|
||||
// -- esp[4] : name
|
||||
// -- esp[8 .. (8 + kArgsLength*4)] : v8::PropertyCallbackInfo::args_
|
||||
// -- ...
|
||||
// -- edx : api_function_address
|
||||
// -----------------------------------
|
||||
DCHECK(edx.is(ApiGetterDescriptor::function_address()));
|
||||
|
||||
// v8::PropertyCallbackInfo::args_ array and name handle.
|
||||
const int kStackUnwindSpace = PropertyCallbackArguments::kArgsLength + 1;
|
||||
@ -5829,6 +5809,9 @@ void CallApiGetterStub::Generate(MacroAssembler* masm) {
|
||||
// active) in non-GCed stack space.
|
||||
const int kApiArgc = 3 + 1;
|
||||
|
||||
Register api_function_address = edx;
|
||||
Register scratch = ebx;
|
||||
|
||||
// Load address of v8::PropertyAccessorInfo::args_ array.
|
||||
__ lea(scratch, Operand(esp, 2 * kPointerSize));
|
||||
|
||||
@ -5838,28 +5821,22 @@ void CallApiGetterStub::Generate(MacroAssembler* masm) {
|
||||
Operand info_object = ApiParameterOperand(3);
|
||||
__ mov(info_object, scratch);
|
||||
|
||||
// Name as handle.
|
||||
__ sub(scratch, Immediate(kPointerSize));
|
||||
__ mov(ApiParameterOperand(0), scratch);
|
||||
// Arguments pointer.
|
||||
__ mov(ApiParameterOperand(0), scratch); // name.
|
||||
__ lea(scratch, info_object);
|
||||
__ mov(ApiParameterOperand(1), scratch);
|
||||
__ mov(ApiParameterOperand(1), scratch); // arguments pointer.
|
||||
// Reserve space for optional callback address parameter.
|
||||
Operand thunk_last_arg = ApiParameterOperand(2);
|
||||
|
||||
ExternalReference thunk_ref =
|
||||
ExternalReference::invoke_accessor_getter_callback(isolate());
|
||||
|
||||
__ mov(scratch, FieldOperand(callback, AccessorInfo::kJsGetterOffset));
|
||||
Register function_address = edx;
|
||||
__ mov(function_address,
|
||||
FieldOperand(scratch, Foreign::kForeignAddressOffset));
|
||||
// +3 is to skip prolog, return address and name handle.
|
||||
Operand return_value_operand(
|
||||
ebp, (PropertyCallbackArguments::kReturnValueOffset + 3) * kPointerSize);
|
||||
CallApiFunctionAndReturn(masm, function_address, thunk_ref, thunk_last_arg,
|
||||
kStackUnwindSpace, nullptr, return_value_operand,
|
||||
NULL);
|
||||
CallApiFunctionAndReturn(masm, api_function_address, thunk_ref,
|
||||
thunk_last_arg, kStackUnwindSpace, nullptr,
|
||||
return_value_operand, NULL);
|
||||
}
|
||||
|
||||
#undef __
|
||||
|
@ -58,8 +58,9 @@ const Register InstanceOfDescriptor::RightRegister() { return eax; }
|
||||
const Register StringCompareDescriptor::LeftRegister() { return edx; }
|
||||
const Register StringCompareDescriptor::RightRegister() { return eax; }
|
||||
|
||||
const Register ApiGetterDescriptor::HolderRegister() { return ecx; }
|
||||
const Register ApiGetterDescriptor::CallbackRegister() { return eax; }
|
||||
|
||||
const Register ApiGetterDescriptor::function_address() { return edx; }
|
||||
|
||||
|
||||
const Register MathPowTaggedDescriptor::exponent() { return eax; }
|
||||
|
||||
|
@ -597,6 +597,57 @@ void NamedLoadHandlerCompiler::GenerateLoadConstant(Handle<Object> value) {
|
||||
__ Ret();
|
||||
}
|
||||
|
||||
|
||||
void NamedLoadHandlerCompiler::GenerateLoadCallback(
|
||||
Register reg, Handle<AccessorInfo> callback) {
|
||||
DCHECK(!AreAliased(scratch2(), scratch3(), scratch4(), receiver()));
|
||||
DCHECK(!AreAliased(scratch2(), scratch3(), scratch4(), reg));
|
||||
|
||||
// Build v8::PropertyCallbackInfo::args_ array on the stack and push property
|
||||
// name below the exit frame to make GC aware of them.
|
||||
STATIC_ASSERT(PropertyCallbackArguments::kShouldThrowOnErrorIndex == 0);
|
||||
STATIC_ASSERT(PropertyCallbackArguments::kHolderIndex == 1);
|
||||
STATIC_ASSERT(PropertyCallbackArguments::kIsolateIndex == 2);
|
||||
STATIC_ASSERT(PropertyCallbackArguments::kReturnValueDefaultValueIndex == 3);
|
||||
STATIC_ASSERT(PropertyCallbackArguments::kReturnValueOffset == 4);
|
||||
STATIC_ASSERT(PropertyCallbackArguments::kDataIndex == 5);
|
||||
STATIC_ASSERT(PropertyCallbackArguments::kThisIndex == 6);
|
||||
STATIC_ASSERT(PropertyCallbackArguments::kArgsLength == 7);
|
||||
|
||||
__ push(receiver());
|
||||
// Push data from AccessorInfo.
|
||||
Handle<Object> data(callback->data(), isolate());
|
||||
if (data->IsUndefined() || data->IsSmi()) {
|
||||
__ Move(scratch2(), data);
|
||||
} else {
|
||||
Handle<WeakCell> cell =
|
||||
isolate()->factory()->NewWeakCell(Handle<HeapObject>::cast(data));
|
||||
// The callback is alive if this instruction is executed,
|
||||
// so the weak cell is not cleared and points to data.
|
||||
__ GetWeakValue(scratch2(), cell);
|
||||
}
|
||||
__ push(scratch2());
|
||||
__ LoadRoot(scratch2(), Heap::kUndefinedValueRootIndex);
|
||||
__ Push(scratch2(), scratch2());
|
||||
__ mov(scratch2(), Operand(ExternalReference::isolate_address(isolate())));
|
||||
__ Push(scratch2(), reg);
|
||||
__ Push(Smi::FromInt(0)); // should_throw_on_error -> false
|
||||
__ push(name());
|
||||
|
||||
// Abi for CallApiGetter
|
||||
Register getter_address_reg = ApiGetterDescriptor::function_address();
|
||||
|
||||
Address getter_address = v8::ToCData<Address>(callback->getter());
|
||||
ApiFunction fun(getter_address);
|
||||
ExternalReference::Type type = ExternalReference::DIRECT_GETTER_CALL;
|
||||
ExternalReference ref = ExternalReference(&fun, type, isolate());
|
||||
__ mov(getter_address_reg, Operand(ref));
|
||||
|
||||
CallApiGetterStub stub(isolate());
|
||||
__ TailCallStub(&stub);
|
||||
}
|
||||
|
||||
|
||||
void NamedLoadHandlerCompiler::GenerateLoadInterceptorWithFollowup(
|
||||
LookupIterator* it, Register holder_reg) {
|
||||
DCHECK(holder()->HasNamedInterceptor());
|
||||
|
@ -632,6 +632,56 @@ void NamedLoadHandlerCompiler::GenerateLoadConstant(Handle<Object> value) {
|
||||
__ Ret();
|
||||
}
|
||||
|
||||
|
||||
void NamedLoadHandlerCompiler::GenerateLoadCallback(
|
||||
Register reg, Handle<AccessorInfo> callback) {
|
||||
DCHECK(!AreAliased(scratch2(), scratch3(), scratch4(), receiver()));
|
||||
DCHECK(!AreAliased(scratch2(), scratch3(), scratch4(), reg));
|
||||
|
||||
// Build v8::PropertyCallbackInfo::args_ array on the stack and push property
|
||||
// name below the exit frame to make GC aware of them.
|
||||
STATIC_ASSERT(PropertyCallbackArguments::kShouldThrowOnErrorIndex == 0);
|
||||
STATIC_ASSERT(PropertyCallbackArguments::kHolderIndex == 1);
|
||||
STATIC_ASSERT(PropertyCallbackArguments::kIsolateIndex == 2);
|
||||
STATIC_ASSERT(PropertyCallbackArguments::kReturnValueDefaultValueIndex == 3);
|
||||
STATIC_ASSERT(PropertyCallbackArguments::kReturnValueOffset == 4);
|
||||
STATIC_ASSERT(PropertyCallbackArguments::kDataIndex == 5);
|
||||
STATIC_ASSERT(PropertyCallbackArguments::kThisIndex == 6);
|
||||
STATIC_ASSERT(PropertyCallbackArguments::kArgsLength == 7);
|
||||
|
||||
__ Push(receiver());
|
||||
|
||||
Handle<Object> data(callback->data(), isolate());
|
||||
if (data->IsUndefined() || data->IsSmi()) {
|
||||
__ Mov(scratch3(), Operand(data));
|
||||
} else {
|
||||
Handle<WeakCell> cell =
|
||||
isolate()->factory()->NewWeakCell(Handle<HeapObject>::cast(data));
|
||||
// The callback is alive if this instruction is executed,
|
||||
// so the weak cell is not cleared and points to data.
|
||||
__ GetWeakValue(scratch3(), cell);
|
||||
}
|
||||
__ LoadRoot(scratch4(), Heap::kUndefinedValueRootIndex);
|
||||
__ Mov(scratch2(), Operand(ExternalReference::isolate_address(isolate())));
|
||||
__ Push(scratch3(), scratch4(), scratch4(), scratch2(), reg);
|
||||
__ Push(Smi::FromInt(0)); // should_throw_on_error -> false
|
||||
__ Push(name());
|
||||
|
||||
// Abi for CallApiGetter.
|
||||
Register getter_address_reg = x2;
|
||||
|
||||
// Set up the call.
|
||||
Address getter_address = v8::ToCData<Address>(callback->getter());
|
||||
ApiFunction fun(getter_address);
|
||||
ExternalReference::Type type = ExternalReference::DIRECT_GETTER_CALL;
|
||||
ExternalReference ref = ExternalReference(&fun, type, isolate());
|
||||
__ Mov(getter_address_reg, ref);
|
||||
|
||||
CallApiGetterStub stub(isolate());
|
||||
__ TailCallStub(&stub);
|
||||
}
|
||||
|
||||
|
||||
void NamedLoadHandlerCompiler::GenerateLoadInterceptorWithFollowup(
|
||||
LookupIterator* it, Register holder_reg) {
|
||||
DCHECK(!AreAliased(receiver(), this->name(), scratch1(), scratch2(),
|
||||
|
@ -358,18 +358,6 @@ Handle<Code> NamedLoadHandlerCompiler::CompileLoadInterceptor(
|
||||
return GetCode(kind(), it->name());
|
||||
}
|
||||
|
||||
void NamedLoadHandlerCompiler::GenerateLoadCallback(
|
||||
Register reg, Handle<AccessorInfo> callback) {
|
||||
DCHECK(receiver().is(ApiGetterDescriptor::ReceiverRegister()));
|
||||
__ Move(ApiGetterDescriptor::HolderRegister(), reg);
|
||||
// The callback is alive if this instruction is executed,
|
||||
// so the weak cell is not cleared and points to data.
|
||||
Handle<WeakCell> cell = isolate()->factory()->NewWeakCell(callback);
|
||||
__ GetWeakValue(ApiGetterDescriptor::CallbackRegister(), cell);
|
||||
|
||||
CallApiGetterStub stub(isolate());
|
||||
__ TailCallStub(&stub);
|
||||
}
|
||||
|
||||
void NamedLoadHandlerCompiler::GenerateLoadPostInterceptor(
|
||||
LookupIterator* it, Register interceptor_reg) {
|
||||
|
@ -594,6 +594,58 @@ void NamedStoreHandlerCompiler::FrontendFooter(Handle<Name> name, Label* miss) {
|
||||
}
|
||||
|
||||
|
||||
void NamedLoadHandlerCompiler::GenerateLoadCallback(
|
||||
Register reg, Handle<AccessorInfo> callback) {
|
||||
DCHECK(!AreAliased(scratch2(), scratch3(), receiver()));
|
||||
DCHECK(!AreAliased(scratch2(), scratch3(), reg));
|
||||
|
||||
// Insert additional parameters into the stack frame above return address.
|
||||
__ pop(scratch3()); // Get return address to place it below.
|
||||
|
||||
// Build v8::PropertyCallbackInfo::args_ array on the stack and push property
|
||||
// name below the exit frame to make GC aware of them.
|
||||
STATIC_ASSERT(PropertyCallbackArguments::kShouldThrowOnErrorIndex == 0);
|
||||
STATIC_ASSERT(PropertyCallbackArguments::kHolderIndex == 1);
|
||||
STATIC_ASSERT(PropertyCallbackArguments::kIsolateIndex == 2);
|
||||
STATIC_ASSERT(PropertyCallbackArguments::kReturnValueDefaultValueIndex == 3);
|
||||
STATIC_ASSERT(PropertyCallbackArguments::kReturnValueOffset == 4);
|
||||
STATIC_ASSERT(PropertyCallbackArguments::kDataIndex == 5);
|
||||
STATIC_ASSERT(PropertyCallbackArguments::kThisIndex == 6);
|
||||
STATIC_ASSERT(PropertyCallbackArguments::kArgsLength == 7);
|
||||
|
||||
__ push(receiver()); // receiver
|
||||
// Push data from AccessorInfo.
|
||||
Handle<Object> data(callback->data(), isolate());
|
||||
if (data->IsUndefined() || data->IsSmi()) {
|
||||
__ push(Immediate(data));
|
||||
} else {
|
||||
Handle<WeakCell> cell =
|
||||
isolate()->factory()->NewWeakCell(Handle<HeapObject>::cast(data));
|
||||
// The callback is alive if this instruction is executed,
|
||||
// so the weak cell is not cleared and points to data.
|
||||
__ GetWeakValue(scratch2(), cell);
|
||||
__ push(scratch2());
|
||||
}
|
||||
__ push(Immediate(isolate()->factory()->undefined_value())); // ReturnValue
|
||||
// ReturnValue default value
|
||||
__ push(Immediate(isolate()->factory()->undefined_value()));
|
||||
__ push(Immediate(reinterpret_cast<int>(isolate())));
|
||||
__ push(reg); // holder
|
||||
__ push(Immediate(Smi::FromInt(0))); // should_throw_on_error -> false
|
||||
|
||||
__ push(name()); // name
|
||||
__ push(scratch3()); // Restore return address.
|
||||
|
||||
// Abi for CallApiGetter
|
||||
Register getter_address = ApiGetterDescriptor::function_address();
|
||||
Address function_address = v8::ToCData<Address>(callback->getter());
|
||||
__ mov(getter_address, Immediate(function_address));
|
||||
|
||||
CallApiGetterStub stub(isolate());
|
||||
__ TailCallStub(&stub);
|
||||
}
|
||||
|
||||
|
||||
void NamedLoadHandlerCompiler::GenerateLoadConstant(Handle<Object> value) {
|
||||
// Return the constant value.
|
||||
__ LoadObject(eax, value);
|
||||
|
@ -584,6 +584,66 @@ void NamedLoadHandlerCompiler::GenerateLoadConstant(Handle<Object> value) {
|
||||
}
|
||||
|
||||
|
||||
void NamedLoadHandlerCompiler::GenerateLoadCallback(
|
||||
Register reg, Handle<AccessorInfo> callback) {
|
||||
DCHECK(!AreAliased(scratch2(), scratch3(), scratch4(), receiver()));
|
||||
DCHECK(!AreAliased(scratch2(), scratch3(), scratch4(), reg));
|
||||
|
||||
// Build v8::PropertyCallbackInfo::args_ array on the stack and push property
|
||||
// name below the exit frame to make GC aware of them.
|
||||
STATIC_ASSERT(PropertyCallbackArguments::kShouldThrowOnErrorIndex == 0);
|
||||
STATIC_ASSERT(PropertyCallbackArguments::kHolderIndex == 1);
|
||||
STATIC_ASSERT(PropertyCallbackArguments::kIsolateIndex == 2);
|
||||
STATIC_ASSERT(PropertyCallbackArguments::kReturnValueDefaultValueIndex == 3);
|
||||
STATIC_ASSERT(PropertyCallbackArguments::kReturnValueOffset == 4);
|
||||
STATIC_ASSERT(PropertyCallbackArguments::kDataIndex == 5);
|
||||
STATIC_ASSERT(PropertyCallbackArguments::kThisIndex == 6);
|
||||
STATIC_ASSERT(PropertyCallbackArguments::kArgsLength == 7);
|
||||
|
||||
// Here and below +1 is for name() pushed after the args_ array.
|
||||
typedef PropertyCallbackArguments PCA;
|
||||
__ Subu(sp, sp, (PCA::kArgsLength + 1) * kPointerSize);
|
||||
__ sw(receiver(), MemOperand(sp, (PCA::kThisIndex + 1) * kPointerSize));
|
||||
Handle<Object> data(callback->data(), isolate());
|
||||
if (data->IsUndefined() || data->IsSmi()) {
|
||||
__ li(scratch2(), data);
|
||||
} else {
|
||||
Handle<WeakCell> cell =
|
||||
isolate()->factory()->NewWeakCell(Handle<HeapObject>::cast(data));
|
||||
// The callback is alive if this instruction is executed,
|
||||
// so the weak cell is not cleared and points to data.
|
||||
__ GetWeakValue(scratch2(), cell);
|
||||
}
|
||||
__ sw(scratch2(), MemOperand(sp, (PCA::kDataIndex + 1) * kPointerSize));
|
||||
__ LoadRoot(scratch2(), Heap::kUndefinedValueRootIndex);
|
||||
__ sw(scratch2(),
|
||||
MemOperand(sp, (PCA::kReturnValueOffset + 1) * kPointerSize));
|
||||
__ sw(scratch2(), MemOperand(sp, (PCA::kReturnValueDefaultValueIndex + 1) *
|
||||
kPointerSize));
|
||||
__ li(scratch2(), Operand(ExternalReference::isolate_address(isolate())));
|
||||
__ sw(scratch2(), MemOperand(sp, (PCA::kIsolateIndex + 1) * kPointerSize));
|
||||
__ sw(reg, MemOperand(sp, (PCA::kHolderIndex + 1) * kPointerSize));
|
||||
// should_throw_on_error -> false
|
||||
DCHECK(Smi::FromInt(0) == nullptr);
|
||||
__ sw(zero_reg,
|
||||
MemOperand(sp, (PCA::kShouldThrowOnErrorIndex + 1) * kPointerSize));
|
||||
|
||||
__ sw(name(), MemOperand(sp, 0 * kPointerSize));
|
||||
|
||||
// Abi for CallApiGetter.
|
||||
Register getter_address_reg = ApiGetterDescriptor::function_address();
|
||||
|
||||
Address getter_address = v8::ToCData<Address>(callback->getter());
|
||||
ApiFunction fun(getter_address);
|
||||
ExternalReference::Type type = ExternalReference::DIRECT_GETTER_CALL;
|
||||
ExternalReference ref = ExternalReference(&fun, type, isolate());
|
||||
__ li(getter_address_reg, Operand(ref));
|
||||
|
||||
CallApiGetterStub stub(isolate());
|
||||
__ TailCallStub(&stub);
|
||||
}
|
||||
|
||||
|
||||
void NamedLoadHandlerCompiler::GenerateLoadInterceptorWithFollowup(
|
||||
LookupIterator* it, Register holder_reg) {
|
||||
DCHECK(holder()->HasNamedInterceptor());
|
||||
|
@ -584,6 +584,66 @@ void NamedLoadHandlerCompiler::GenerateLoadConstant(Handle<Object> value) {
|
||||
}
|
||||
|
||||
|
||||
void NamedLoadHandlerCompiler::GenerateLoadCallback(
|
||||
Register reg, Handle<AccessorInfo> callback) {
|
||||
DCHECK(!AreAliased(scratch2(), scratch3(), scratch4(), receiver()));
|
||||
DCHECK(!AreAliased(scratch2(), scratch3(), scratch4(), reg));
|
||||
|
||||
// Build v8::PropertyCallbackInfo::args_ array on the stack and push property
|
||||
// name below the exit frame to make GC aware of them.
|
||||
STATIC_ASSERT(PropertyCallbackArguments::kShouldThrowOnErrorIndex == 0);
|
||||
STATIC_ASSERT(PropertyCallbackArguments::kHolderIndex == 1);
|
||||
STATIC_ASSERT(PropertyCallbackArguments::kIsolateIndex == 2);
|
||||
STATIC_ASSERT(PropertyCallbackArguments::kReturnValueDefaultValueIndex == 3);
|
||||
STATIC_ASSERT(PropertyCallbackArguments::kReturnValueOffset == 4);
|
||||
STATIC_ASSERT(PropertyCallbackArguments::kDataIndex == 5);
|
||||
STATIC_ASSERT(PropertyCallbackArguments::kThisIndex == 6);
|
||||
STATIC_ASSERT(PropertyCallbackArguments::kArgsLength == 7);
|
||||
|
||||
// Here and below +1 is for name() pushed after the args_ array.
|
||||
typedef PropertyCallbackArguments PCA;
|
||||
__ Dsubu(sp, sp, (PCA::kArgsLength + 1) * kPointerSize);
|
||||
__ sd(receiver(), MemOperand(sp, (PCA::kThisIndex + 1) * kPointerSize));
|
||||
Handle<Object> data(callback->data(), isolate());
|
||||
if (data->IsUndefined() || data->IsSmi()) {
|
||||
__ li(scratch2(), data);
|
||||
} else {
|
||||
Handle<WeakCell> cell =
|
||||
isolate()->factory()->NewWeakCell(Handle<HeapObject>::cast(data));
|
||||
// The callback is alive if this instruction is executed,
|
||||
// so the weak cell is not cleared and points to data.
|
||||
__ GetWeakValue(scratch2(), cell);
|
||||
}
|
||||
__ sd(scratch2(), MemOperand(sp, (PCA::kDataIndex + 1) * kPointerSize));
|
||||
__ LoadRoot(scratch2(), Heap::kUndefinedValueRootIndex);
|
||||
__ sd(scratch2(),
|
||||
MemOperand(sp, (PCA::kReturnValueOffset + 1) * kPointerSize));
|
||||
__ sd(scratch2(), MemOperand(sp, (PCA::kReturnValueDefaultValueIndex + 1) *
|
||||
kPointerSize));
|
||||
__ li(scratch2(), Operand(ExternalReference::isolate_address(isolate())));
|
||||
__ sd(scratch2(), MemOperand(sp, (PCA::kIsolateIndex + 1) * kPointerSize));
|
||||
__ sd(reg, MemOperand(sp, (PCA::kHolderIndex + 1) * kPointerSize));
|
||||
// should_throw_on_error -> false
|
||||
DCHECK(Smi::FromInt(0) == nullptr);
|
||||
__ sd(zero_reg,
|
||||
MemOperand(sp, (PCA::kShouldThrowOnErrorIndex + 1) * kPointerSize));
|
||||
|
||||
__ sd(name(), MemOperand(sp, 0 * kPointerSize));
|
||||
|
||||
// Abi for CallApiGetter.
|
||||
Register getter_address_reg = ApiGetterDescriptor::function_address();
|
||||
|
||||
Address getter_address = v8::ToCData<Address>(callback->getter());
|
||||
ApiFunction fun(getter_address);
|
||||
ExternalReference::Type type = ExternalReference::DIRECT_GETTER_CALL;
|
||||
ExternalReference ref = ExternalReference(&fun, type, isolate());
|
||||
__ li(getter_address_reg, Operand(ref));
|
||||
|
||||
CallApiGetterStub stub(isolate());
|
||||
__ TailCallStub(&stub);
|
||||
}
|
||||
|
||||
|
||||
void NamedLoadHandlerCompiler::GenerateLoadInterceptorWithFollowup(
|
||||
LookupIterator* it, Register holder_reg) {
|
||||
DCHECK(holder()->HasNamedInterceptor());
|
||||
|
@ -597,6 +597,58 @@ void NamedStoreHandlerCompiler::FrontendFooter(Handle<Name> name, Label* miss) {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void NamedLoadHandlerCompiler::GenerateLoadCallback(
|
||||
Register reg, Handle<AccessorInfo> callback) {
|
||||
DCHECK(!AreAliased(kScratchRegister, scratch2(), scratch3(), receiver()));
|
||||
DCHECK(!AreAliased(kScratchRegister, scratch2(), scratch3(), reg));
|
||||
|
||||
// Insert additional parameters into the stack frame above return address.
|
||||
__ PopReturnAddressTo(scratch3());
|
||||
|
||||
// Build v8::PropertyCallbackInfo::args_ array on the stack and push property
|
||||
// name below the exit frame to make GC aware of them.
|
||||
STATIC_ASSERT(PropertyCallbackArguments::kShouldThrowOnErrorIndex == 0);
|
||||
STATIC_ASSERT(PropertyCallbackArguments::kHolderIndex == 1);
|
||||
STATIC_ASSERT(PropertyCallbackArguments::kIsolateIndex == 2);
|
||||
STATIC_ASSERT(PropertyCallbackArguments::kReturnValueDefaultValueIndex == 3);
|
||||
STATIC_ASSERT(PropertyCallbackArguments::kReturnValueOffset == 4);
|
||||
STATIC_ASSERT(PropertyCallbackArguments::kDataIndex == 5);
|
||||
STATIC_ASSERT(PropertyCallbackArguments::kThisIndex == 6);
|
||||
STATIC_ASSERT(PropertyCallbackArguments::kArgsLength == 7);
|
||||
|
||||
__ Push(receiver()); // receiver
|
||||
Handle<Object> data(callback->data(), isolate());
|
||||
if (data->IsUndefined() || data->IsSmi()) {
|
||||
__ Push(data);
|
||||
} else {
|
||||
Handle<WeakCell> cell =
|
||||
isolate()->factory()->NewWeakCell(Handle<HeapObject>::cast(data));
|
||||
// The callback is alive if this instruction is executed,
|
||||
// so the weak cell is not cleared and points to data.
|
||||
__ GetWeakValue(scratch2(), cell);
|
||||
__ Push(scratch2());
|
||||
}
|
||||
__ LoadRoot(kScratchRegister, Heap::kUndefinedValueRootIndex);
|
||||
__ Push(kScratchRegister); // return value
|
||||
__ Push(kScratchRegister); // return value default
|
||||
__ PushAddress(ExternalReference::isolate_address(isolate()));
|
||||
__ Push(reg); // holder
|
||||
__ Push(Smi::FromInt(0)); // should_throw_on_error -> false
|
||||
|
||||
__ Push(name()); // name
|
||||
__ PushReturnAddressFrom(scratch3());
|
||||
|
||||
// Abi for CallApiGetter
|
||||
Register api_function_address = ApiGetterDescriptor::function_address();
|
||||
Address getter_address = v8::ToCData<Address>(callback->getter());
|
||||
__ Move(api_function_address, getter_address, RelocInfo::EXTERNAL_REFERENCE);
|
||||
|
||||
CallApiGetterStub stub(isolate());
|
||||
__ TailCallStub(&stub);
|
||||
}
|
||||
|
||||
|
||||
void NamedLoadHandlerCompiler::GenerateLoadConstant(Handle<Object> value) {
|
||||
// Return the constant value.
|
||||
__ Move(rax, value);
|
||||
|
@ -301,17 +301,23 @@ void VectorStoreICTrampolineDescriptor::InitializePlatformSpecific(
|
||||
data->InitializePlatformSpecific(arraysize(registers), registers);
|
||||
}
|
||||
|
||||
const Register ApiGetterDescriptor::ReceiverRegister() {
|
||||
return LoadDescriptor::ReceiverRegister();
|
||||
FunctionType* ApiGetterDescriptor::BuildCallInterfaceDescriptorFunctionType(
|
||||
Isolate* isolate, int paramater_count) {
|
||||
Zone* zone = isolate->interface_descriptor_zone();
|
||||
FunctionType* function =
|
||||
Type::Function(AnyTagged(zone), Type::Undefined(), 1, zone)->AsFunction();
|
||||
function->InitParameter(0, ExternalPointer(zone));
|
||||
return function;
|
||||
}
|
||||
|
||||
|
||||
void ApiGetterDescriptor::InitializePlatformSpecific(
|
||||
CallInterfaceDescriptorData* data) {
|
||||
Register registers[] = {ReceiverRegister(), HolderRegister(),
|
||||
CallbackRegister()};
|
||||
Register registers[] = {function_address()};
|
||||
data->InitializePlatformSpecific(arraysize(registers), registers);
|
||||
}
|
||||
|
||||
|
||||
void ContextOnlyDescriptor::InitializePlatformSpecific(
|
||||
CallInterfaceDescriptorData* data) {
|
||||
data->InitializePlatformSpecific(0, nullptr);
|
||||
|
@ -746,11 +746,10 @@ class ApiCallbackWith7ArgsDescriptor : public ApiCallbackDescriptorBase {
|
||||
|
||||
class ApiGetterDescriptor : public CallInterfaceDescriptor {
|
||||
public:
|
||||
DECLARE_DESCRIPTOR(ApiGetterDescriptor, CallInterfaceDescriptor)
|
||||
DECLARE_DESCRIPTOR_WITH_CUSTOM_FUNCTION_TYPE(ApiGetterDescriptor,
|
||||
CallInterfaceDescriptor)
|
||||
|
||||
static const Register ReceiverRegister();
|
||||
static const Register HolderRegister();
|
||||
static const Register CallbackRegister();
|
||||
static const Register function_address();
|
||||
};
|
||||
|
||||
|
||||
|
@ -5690,36 +5690,16 @@ void CallApiCallbackStub::Generate(MacroAssembler* masm) {
|
||||
|
||||
|
||||
void CallApiGetterStub::Generate(MacroAssembler* masm) {
|
||||
// Build v8::PropertyCallbackInfo::args_ array on the stack and push property
|
||||
// name below the exit frame to make GC aware of them.
|
||||
STATIC_ASSERT(PropertyCallbackArguments::kShouldThrowOnErrorIndex == 0);
|
||||
STATIC_ASSERT(PropertyCallbackArguments::kHolderIndex == 1);
|
||||
STATIC_ASSERT(PropertyCallbackArguments::kIsolateIndex == 2);
|
||||
STATIC_ASSERT(PropertyCallbackArguments::kReturnValueDefaultValueIndex == 3);
|
||||
STATIC_ASSERT(PropertyCallbackArguments::kReturnValueOffset == 4);
|
||||
STATIC_ASSERT(PropertyCallbackArguments::kDataIndex == 5);
|
||||
STATIC_ASSERT(PropertyCallbackArguments::kThisIndex == 6);
|
||||
STATIC_ASSERT(PropertyCallbackArguments::kArgsLength == 7);
|
||||
// ----------- S t a t e -------------
|
||||
// -- sp[0] : name
|
||||
// -- sp[4 .. (4 + kArgsLength*4)] : v8::PropertyCallbackInfo::args_
|
||||
// -- ...
|
||||
// -- a2 : api_function_address
|
||||
// -----------------------------------
|
||||
|
||||
Register receiver = ApiGetterDescriptor::ReceiverRegister();
|
||||
Register holder = ApiGetterDescriptor::HolderRegister();
|
||||
Register callback = ApiGetterDescriptor::CallbackRegister();
|
||||
Register scratch = t0;
|
||||
Register scratch2 = t1;
|
||||
Register scratch3 = t2;
|
||||
DCHECK(!AreAliased(receiver, holder, callback, scratch, scratch2, scratch3));
|
||||
Register api_function_address = ApiGetterDescriptor::function_address();
|
||||
DCHECK(api_function_address.is(a2));
|
||||
|
||||
Register api_function_address = a2;
|
||||
|
||||
__ Push(receiver);
|
||||
// Push data from AccessorInfo.
|
||||
__ LoadRoot(scratch, Heap::kUndefinedValueRootIndex);
|
||||
__ li(scratch2, Operand(ExternalReference::isolate_address(isolate())));
|
||||
__ lw(scratch3, FieldMemOperand(callback, AccessorInfo::kDataOffset));
|
||||
__ Push(scratch3, scratch, scratch, scratch2, holder);
|
||||
__ Push(Smi::FromInt(0)); // should_throw_on_error -> false
|
||||
__ lw(scratch, FieldMemOperand(callback, AccessorInfo::kNameOffset));
|
||||
__ push(scratch);
|
||||
// v8::PropertyCallbackInfo::args_ array and name handle.
|
||||
const int kStackUnwindSpace = PropertyCallbackArguments::kArgsLength + 1;
|
||||
|
||||
@ -5739,10 +5719,6 @@ void CallApiGetterStub::Generate(MacroAssembler* masm) {
|
||||
ExternalReference thunk_ref =
|
||||
ExternalReference::invoke_accessor_getter_callback(isolate());
|
||||
|
||||
__ lw(scratch, FieldMemOperand(callback, AccessorInfo::kJsGetterOffset));
|
||||
__ lw(api_function_address,
|
||||
FieldMemOperand(scratch, Foreign::kForeignAddressOffset));
|
||||
|
||||
// +3 is to skip prolog, return address and name handle.
|
||||
MemOperand return_value_operand(
|
||||
fp, (PropertyCallbackArguments::kReturnValueOffset + 3) * kPointerSize);
|
||||
|
@ -53,8 +53,9 @@ const Register InstanceOfDescriptor::RightRegister() { return a0; }
|
||||
const Register StringCompareDescriptor::LeftRegister() { return a1; }
|
||||
const Register StringCompareDescriptor::RightRegister() { return a0; }
|
||||
|
||||
const Register ApiGetterDescriptor::HolderRegister() { return a0; }
|
||||
const Register ApiGetterDescriptor::CallbackRegister() { return a3; }
|
||||
|
||||
const Register ApiGetterDescriptor::function_address() { return a2; }
|
||||
|
||||
|
||||
const Register MathPowTaggedDescriptor::exponent() { return a2; }
|
||||
|
||||
|
@ -5717,36 +5717,16 @@ void CallApiCallbackStub::Generate(MacroAssembler* masm) {
|
||||
|
||||
|
||||
void CallApiGetterStub::Generate(MacroAssembler* masm) {
|
||||
// Build v8::PropertyCallbackInfo::args_ array on the stack and push property
|
||||
// name below the exit frame to make GC aware of them.
|
||||
STATIC_ASSERT(PropertyCallbackArguments::kShouldThrowOnErrorIndex == 0);
|
||||
STATIC_ASSERT(PropertyCallbackArguments::kHolderIndex == 1);
|
||||
STATIC_ASSERT(PropertyCallbackArguments::kIsolateIndex == 2);
|
||||
STATIC_ASSERT(PropertyCallbackArguments::kReturnValueDefaultValueIndex == 3);
|
||||
STATIC_ASSERT(PropertyCallbackArguments::kReturnValueOffset == 4);
|
||||
STATIC_ASSERT(PropertyCallbackArguments::kDataIndex == 5);
|
||||
STATIC_ASSERT(PropertyCallbackArguments::kThisIndex == 6);
|
||||
STATIC_ASSERT(PropertyCallbackArguments::kArgsLength == 7);
|
||||
// ----------- S t a t e -------------
|
||||
// -- sp[0] : name
|
||||
// -- sp[8 .. (8 + kArgsLength*8)] : v8::PropertyCallbackInfo::args_
|
||||
// -- ...
|
||||
// -- a2 : api_function_address
|
||||
// -----------------------------------
|
||||
|
||||
Register receiver = ApiGetterDescriptor::ReceiverRegister();
|
||||
Register holder = ApiGetterDescriptor::HolderRegister();
|
||||
Register callback = ApiGetterDescriptor::CallbackRegister();
|
||||
Register scratch = a4;
|
||||
Register scratch2 = a5;
|
||||
Register scratch3 = a6;
|
||||
DCHECK(!AreAliased(receiver, holder, callback, scratch, scratch2, scratch3));
|
||||
Register api_function_address = ApiGetterDescriptor::function_address();
|
||||
DCHECK(api_function_address.is(a2));
|
||||
|
||||
Register api_function_address = a2;
|
||||
|
||||
__ Push(receiver);
|
||||
// Push data from AccessorInfo.
|
||||
__ LoadRoot(scratch, Heap::kUndefinedValueRootIndex);
|
||||
__ li(scratch2, Operand(ExternalReference::isolate_address(isolate())));
|
||||
__ ld(scratch3, FieldMemOperand(callback, AccessorInfo::kDataOffset));
|
||||
__ Push(scratch3, scratch, scratch, scratch2, holder);
|
||||
__ Push(Smi::FromInt(0)); // should_throw_on_error -> false
|
||||
__ ld(scratch, FieldMemOperand(callback, AccessorInfo::kNameOffset));
|
||||
__ Push(scratch);
|
||||
// v8::PropertyCallbackInfo::args_ array and name handle.
|
||||
const int kStackUnwindSpace = PropertyCallbackArguments::kArgsLength + 1;
|
||||
|
||||
@ -5767,10 +5747,6 @@ void CallApiGetterStub::Generate(MacroAssembler* masm) {
|
||||
ExternalReference thunk_ref =
|
||||
ExternalReference::invoke_accessor_getter_callback(isolate());
|
||||
|
||||
__ ld(scratch, FieldMemOperand(callback, AccessorInfo::kJsGetterOffset));
|
||||
__ ld(api_function_address,
|
||||
FieldMemOperand(scratch, Foreign::kForeignAddressOffset));
|
||||
|
||||
// +3 is to skip prolog, return address and name handle.
|
||||
MemOperand return_value_operand(
|
||||
fp, (PropertyCallbackArguments::kReturnValueOffset + 3) * kPointerSize);
|
||||
|
@ -53,8 +53,9 @@ const Register InstanceOfDescriptor::RightRegister() { return a0; }
|
||||
const Register StringCompareDescriptor::LeftRegister() { return a1; }
|
||||
const Register StringCompareDescriptor::RightRegister() { return a0; }
|
||||
|
||||
const Register ApiGetterDescriptor::HolderRegister() { return a0; }
|
||||
const Register ApiGetterDescriptor::CallbackRegister() { return a3; }
|
||||
|
||||
const Register ApiGetterDescriptor::function_address() { return a2; }
|
||||
|
||||
|
||||
const Register MathPowTaggedDescriptor::exponent() { return a2; }
|
||||
|
||||
|
@ -907,7 +907,6 @@ void AccessorInfo::AccessorInfoVerify() {
|
||||
VerifyPointer(expected_receiver_type());
|
||||
VerifyPointer(getter());
|
||||
VerifyPointer(setter());
|
||||
VerifyPointer(js_getter());
|
||||
VerifyPointer(data());
|
||||
}
|
||||
|
||||
|
@ -5424,7 +5424,6 @@ ACCESSORS(AccessorInfo, expected_receiver_type, Object,
|
||||
|
||||
ACCESSORS(AccessorInfo, getter, Object, kGetterOffset)
|
||||
ACCESSORS(AccessorInfo, setter, Object, kSetterOffset)
|
||||
ACCESSORS(AccessorInfo, js_getter, Object, kJsGetterOffset)
|
||||
ACCESSORS(AccessorInfo, data, Object, kDataOffset)
|
||||
|
||||
ACCESSORS(Box, value, Object, kValueOffset)
|
||||
|
@ -992,7 +992,6 @@ void AccessorInfo::AccessorInfoPrint(std::ostream& os) { // NOLINT
|
||||
os << "\n - flag: " << flag();
|
||||
os << "\n - getter: " << Brief(getter());
|
||||
os << "\n - setter: " << Brief(setter());
|
||||
os << "\n - js_getter: " << Brief(js_getter());
|
||||
os << "\n - data: " << Brief(data());
|
||||
os << "\n";
|
||||
}
|
||||
|
@ -1092,22 +1092,6 @@ MaybeHandle<Object> Object::GetPropertyWithAccessor(LookupIterator* it) {
|
||||
return ReadAbsentProperty(isolate, receiver, it->GetName());
|
||||
}
|
||||
|
||||
#ifdef USE_SIMULATOR
|
||||
// static
|
||||
Address AccessorInfo::redirect(Isolate* isolate, Address address,
|
||||
AccessorComponent component) {
|
||||
ApiFunction fun(address);
|
||||
DCHECK_EQ(ACCESSOR_GETTER, component);
|
||||
ExternalReference::Type type = ExternalReference::DIRECT_GETTER_CALL;
|
||||
return ExternalReference(&fun, type, isolate).address();
|
||||
}
|
||||
|
||||
Address AccessorInfo::redirected_getter() const {
|
||||
Address accessor = v8::ToCData<Address>(getter());
|
||||
if (accessor == nullptr) return nullptr;
|
||||
return redirect(GetIsolate(), accessor, ACCESSOR_GETTER);
|
||||
}
|
||||
#endif
|
||||
|
||||
bool AccessorInfo::IsCompatibleReceiverMap(Isolate* isolate,
|
||||
Handle<AccessorInfo> info,
|
||||
|
@ -10251,20 +10251,10 @@ class AccessorInfo: public Struct {
|
||||
DECL_ACCESSORS(name, Object)
|
||||
DECL_INT_ACCESSORS(flag)
|
||||
DECL_ACCESSORS(expected_receiver_type, Object)
|
||||
// This directly points at a foreign C function to be used from the runtime.
|
||||
DECL_ACCESSORS(getter, Object)
|
||||
DECL_ACCESSORS(setter, Object)
|
||||
// This either points at the same as above, or a trampoline in case we are
|
||||
// running with the simulator. Use these entries from generated code.
|
||||
DECL_ACCESSORS(js_getter, Object)
|
||||
DECL_ACCESSORS(data, Object)
|
||||
|
||||
#ifdef USE_SIMULATOR
|
||||
static Address redirect(Isolate* isolate, Address address,
|
||||
AccessorComponent component);
|
||||
Address redirected_getter() const;
|
||||
#endif
|
||||
|
||||
// Dispatched behavior.
|
||||
DECLARE_PRINTER(AccessorInfo)
|
||||
|
||||
@ -10300,14 +10290,9 @@ class AccessorInfo: public Struct {
|
||||
static const int kNameOffset = HeapObject::kHeaderSize;
|
||||
static const int kFlagOffset = kNameOffset + kPointerSize;
|
||||
static const int kExpectedReceiverTypeOffset = kFlagOffset + kPointerSize;
|
||||
static const int kSetterOffset = kExpectedReceiverTypeOffset + kPointerSize;
|
||||
static const int kGetterOffset = kSetterOffset + kPointerSize;
|
||||
#ifdef USE_SIMULATOR
|
||||
static const int kJsGetterOffset = kGetterOffset + kPointerSize;
|
||||
#else
|
||||
static const int kJsGetterOffset = kGetterOffset;
|
||||
#endif
|
||||
static const int kDataOffset = kJsGetterOffset + kPointerSize;
|
||||
static const int kGetterOffset = kExpectedReceiverTypeOffset + kPointerSize;
|
||||
static const int kSetterOffset = kGetterOffset + kPointerSize;
|
||||
static const int kDataOffset = kSetterOffset + kPointerSize;
|
||||
static const int kSize = kDataOffset + kPointerSize;
|
||||
|
||||
|
||||
|
@ -5507,6 +5507,14 @@ void CallApiCallbackStub::Generate(MacroAssembler* masm) {
|
||||
|
||||
|
||||
void CallApiGetterStub::Generate(MacroAssembler* masm) {
|
||||
// ----------- S t a t e -------------
|
||||
// -- rsp[0] : return address
|
||||
// -- rsp[8] : name
|
||||
// -- rsp[16 .. (16 + kArgsLength*8)] : v8::PropertyCallbackInfo::args_
|
||||
// -- ...
|
||||
// -- r8 : api_function_address
|
||||
// -----------------------------------
|
||||
|
||||
#if defined(__MINGW64__) || defined(_WIN64)
|
||||
Register getter_arg = r8;
|
||||
Register accessor_info_arg = rdx;
|
||||
@ -5516,36 +5524,9 @@ void CallApiGetterStub::Generate(MacroAssembler* masm) {
|
||||
Register accessor_info_arg = rsi;
|
||||
Register name_arg = rdi;
|
||||
#endif
|
||||
Register api_function_address = r8;
|
||||
Register receiver = ApiGetterDescriptor::ReceiverRegister();
|
||||
Register holder = ApiGetterDescriptor::HolderRegister();
|
||||
Register callback = ApiGetterDescriptor::CallbackRegister();
|
||||
Register api_function_address = ApiGetterDescriptor::function_address();
|
||||
DCHECK(api_function_address.is(r8));
|
||||
Register scratch = rax;
|
||||
DCHECK(!AreAliased(receiver, holder, callback, scratch));
|
||||
|
||||
// Build v8::PropertyCallbackInfo::args_ array on the stack and push property
|
||||
// name below the exit frame to make GC aware of them.
|
||||
STATIC_ASSERT(PropertyCallbackArguments::kShouldThrowOnErrorIndex == 0);
|
||||
STATIC_ASSERT(PropertyCallbackArguments::kHolderIndex == 1);
|
||||
STATIC_ASSERT(PropertyCallbackArguments::kIsolateIndex == 2);
|
||||
STATIC_ASSERT(PropertyCallbackArguments::kReturnValueDefaultValueIndex == 3);
|
||||
STATIC_ASSERT(PropertyCallbackArguments::kReturnValueOffset == 4);
|
||||
STATIC_ASSERT(PropertyCallbackArguments::kDataIndex == 5);
|
||||
STATIC_ASSERT(PropertyCallbackArguments::kThisIndex == 6);
|
||||
STATIC_ASSERT(PropertyCallbackArguments::kArgsLength == 7);
|
||||
|
||||
// Insert additional parameters into the stack frame above return address.
|
||||
__ PopReturnAddressTo(scratch);
|
||||
__ Push(receiver);
|
||||
__ Push(FieldOperand(callback, AccessorInfo::kDataOffset));
|
||||
__ LoadRoot(kScratchRegister, Heap::kUndefinedValueRootIndex);
|
||||
__ Push(kScratchRegister); // return value
|
||||
__ Push(kScratchRegister); // return value default
|
||||
__ PushAddress(ExternalReference::isolate_address(isolate()));
|
||||
__ Push(holder);
|
||||
__ Push(Smi::FromInt(0)); // should_throw_on_error -> false
|
||||
__ Push(FieldOperand(callback, AccessorInfo::kNameOffset));
|
||||
__ PushReturnAddressFrom(scratch);
|
||||
|
||||
// v8::PropertyCallbackInfo::args_ array and name handle.
|
||||
const int kStackUnwindSpace = PropertyCallbackArguments::kArgsLength + 1;
|
||||
@ -5572,11 +5553,8 @@ void CallApiGetterStub::Generate(MacroAssembler* masm) {
|
||||
|
||||
// It's okay if api_function_address == getter_arg
|
||||
// but not accessor_info_arg or name_arg
|
||||
DCHECK(!api_function_address.is(accessor_info_arg));
|
||||
DCHECK(!api_function_address.is(name_arg));
|
||||
__ movp(scratch, FieldOperand(callback, AccessorInfo::kJsGetterOffset));
|
||||
__ movp(api_function_address,
|
||||
FieldOperand(scratch, Foreign::kForeignAddressOffset));
|
||||
DCHECK(!api_function_address.is(accessor_info_arg) &&
|
||||
!api_function_address.is(name_arg));
|
||||
|
||||
// +3 is to skip prolog, return address and name handle.
|
||||
Operand return_value_operand(
|
||||
|
@ -53,8 +53,9 @@ const Register InstanceOfDescriptor::RightRegister() { return rax; }
|
||||
const Register StringCompareDescriptor::LeftRegister() { return rdx; }
|
||||
const Register StringCompareDescriptor::RightRegister() { return rax; }
|
||||
|
||||
const Register ApiGetterDescriptor::HolderRegister() { return rcx; }
|
||||
const Register ApiGetterDescriptor::CallbackRegister() { return rbx; }
|
||||
|
||||
const Register ApiGetterDescriptor::function_address() { return r8; }
|
||||
|
||||
|
||||
const Register MathPowTaggedDescriptor::exponent() { return rdx; }
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user