Commit bc42d95c authored by serya@chromium.org's avatar serya@chromium.org

Avoiding repacking payload for v8::Arguments and v8::AccessorInfo (arm)

Review URL: http://codereview.chromium.org/5107002

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@5859 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
parent afbbf485
...@@ -58,6 +58,9 @@ class ImplementationUtilities { ...@@ -58,6 +58,9 @@ class ImplementationUtilities {
static v8::Arguments NewArguments(internal::Object** implicit_args, static v8::Arguments NewArguments(internal::Object** implicit_args,
internal::Object** argv, int argc, internal::Object** argv, int argc,
bool is_construct_call) { bool is_construct_call) {
ASSERT(implicit_args[v8::Arguments::kCalleeIndex]->IsJSFunction());
ASSERT(implicit_args[v8::Arguments::kHolderIndex]->IsHeapObject());
return v8::Arguments(implicit_args, argv, argc, is_construct_call); return v8::Arguments(implicit_args, argv, argc, is_construct_call);
} }
......
...@@ -598,8 +598,8 @@ static void GenerateFastApiCall(MacroAssembler* masm, ...@@ -598,8 +598,8 @@ static void GenerateFastApiCall(MacroAssembler* masm,
int argc) { int argc) {
// Get the function and setup the context. // Get the function and setup the context.
JSFunction* function = optimization.constant_function(); JSFunction* function = optimization.constant_function();
__ mov(r7, Operand(Handle<JSFunction>(function))); __ mov(r5, Operand(Handle<JSFunction>(function)));
__ ldr(cp, FieldMemOperand(r7, JSFunction::kContextOffset)); __ ldr(cp, FieldMemOperand(r5, JSFunction::kContextOffset));
// Pass the additional arguments FastHandleApiCall expects. // Pass the additional arguments FastHandleApiCall expects.
bool info_loaded = false; bool info_loaded = false;
...@@ -607,18 +607,18 @@ static void GenerateFastApiCall(MacroAssembler* masm, ...@@ -607,18 +607,18 @@ static void GenerateFastApiCall(MacroAssembler* masm,
if (Heap::InNewSpace(callback)) { if (Heap::InNewSpace(callback)) {
info_loaded = true; info_loaded = true;
__ Move(r0, Handle<CallHandlerInfo>(optimization.api_call_info())); __ Move(r0, Handle<CallHandlerInfo>(optimization.api_call_info()));
__ ldr(r6, FieldMemOperand(r0, CallHandlerInfo::kCallbackOffset)); __ ldr(r7, FieldMemOperand(r0, CallHandlerInfo::kCallbackOffset));
} else { } else {
__ Move(r6, Handle<Object>(callback)); __ Move(r7, Handle<Object>(callback));
} }
Object* call_data = optimization.api_call_info()->data(); Object* call_data = optimization.api_call_info()->data();
if (Heap::InNewSpace(call_data)) { if (Heap::InNewSpace(call_data)) {
if (!info_loaded) { if (!info_loaded) {
__ Move(r0, Handle<CallHandlerInfo>(optimization.api_call_info())); __ Move(r0, Handle<CallHandlerInfo>(optimization.api_call_info()));
} }
__ ldr(r5, FieldMemOperand(r0, CallHandlerInfo::kDataOffset)); __ ldr(r6, FieldMemOperand(r0, CallHandlerInfo::kDataOffset));
} else { } else {
__ Move(r5, Handle<Object>(call_data)); __ Move(r6, Handle<Object>(call_data));
} }
__ add(sp, sp, Operand(1 * kPointerSize)); __ add(sp, sp, Operand(1 * kPointerSize));
...@@ -1082,10 +1082,9 @@ bool StubCompiler::GenerateLoadCallback(JSObject* object, ...@@ -1082,10 +1082,9 @@ bool StubCompiler::GenerateLoadCallback(JSObject* object,
// Push the arguments on the JS stack of the caller. // Push the arguments on the JS stack of the caller.
__ push(receiver); // Receiver. __ push(receiver); // Receiver.
__ push(reg); // Holder. __ mov(scratch3, Operand(Handle<AccessorInfo>(callback))); // callback data
__ mov(ip, Operand(Handle<AccessorInfo>(callback))); // callback data __ ldr(ip, FieldMemOperand(scratch3, AccessorInfo::kDataOffset));
__ ldr(reg, FieldMemOperand(ip, AccessorInfo::kDataOffset)); __ Push(reg, ip, scratch3, name_reg);
__ Push(ip, reg, name_reg);
// Do tail-call to the runtime system. // Do tail-call to the runtime system.
ExternalReference load_callback_property = ExternalReference load_callback_property =
...@@ -1208,15 +1207,15 @@ void StubCompiler::GenerateLoadInterceptor(JSObject* object, ...@@ -1208,15 +1207,15 @@ void StubCompiler::GenerateLoadInterceptor(JSObject* object,
// holder_reg is either receiver or scratch1. // holder_reg is either receiver or scratch1.
if (!receiver.is(holder_reg)) { if (!receiver.is(holder_reg)) {
ASSERT(scratch1.is(holder_reg)); ASSERT(scratch1.is(holder_reg));
__ Push(receiver, holder_reg, scratch2); __ Push(receiver, holder_reg);
__ ldr(scratch1, __ ldr(scratch3,
FieldMemOperand(holder_reg, AccessorInfo::kDataOffset)); FieldMemOperand(scratch2, AccessorInfo::kDataOffset));
__ Push(scratch1, name_reg); __ Push(scratch3, scratch2, name_reg);
} else { } else {
__ push(receiver); __ push(receiver);
__ ldr(scratch1, __ ldr(scratch3,
FieldMemOperand(holder_reg, AccessorInfo::kDataOffset)); FieldMemOperand(scratch2, AccessorInfo::kDataOffset));
__ Push(holder_reg, scratch2, scratch1, name_reg); __ Push(holder_reg, scratch3, scratch2, name_reg);
} }
ExternalReference ref = ExternalReference ref =
......
...@@ -1081,29 +1081,22 @@ BUILTIN(FastHandleApiCall) { ...@@ -1081,29 +1081,22 @@ BUILTIN(FastHandleApiCall) {
ASSERT(!CalledAsConstructor()); ASSERT(!CalledAsConstructor());
const bool is_construct = false; const bool is_construct = false;
// We expect four more arguments: function, callback, call data, and holder. // We expect four more arguments: callback, function, call data, and holder.
const int args_length = args.length() - 4; const int args_length = args.length() - 4;
ASSERT(args_length >= 0); ASSERT(args_length >= 0);
Handle<JSFunction> function = args.at<JSFunction>(args_length); Object* callback_obj = args[args_length];
Object* callback_obj = args[args_length + 1];
Handle<Object> data = args.at<Object>(args_length + 2);
Handle<JSObject> checked_holder = args.at<JSObject>(args_length + 3);
#ifdef DEBUG
VerifyTypeCheck(checked_holder, function);
#endif
CustomArguments custom;
v8::ImplementationUtilities::PrepareArgumentsData(custom.end(),
*data, *function, *checked_holder);
v8::Arguments new_args = v8::ImplementationUtilities::NewArguments( v8::Arguments new_args = v8::ImplementationUtilities::NewArguments(
custom.end(), &args[args_length + 1],
&args[0] - 1, &args[0] - 1,
args_length - 1, args_length - 1,
is_construct); is_construct);
#ifdef DEBUG
VerifyTypeCheck(Utils::OpenHandle(*new_args.Holder()),
Utils::OpenHandle(*new_args.Callee()));
#endif
HandleScope scope; HandleScope scope;
Object* result; Object* result;
v8::Handle<v8::Value> value; v8::Handle<v8::Value> value;
......
...@@ -417,7 +417,7 @@ static void CompileCallLoadPropertyWithInterceptor(MacroAssembler* masm, ...@@ -417,7 +417,7 @@ static void CompileCallLoadPropertyWithInterceptor(MacroAssembler* masm,
static const int kFastApiCallArguments = 3; static const int kFastApiCallArguments = 3;
// Reserves space for the extra arguments to FastHandleApiCall in the // Reserves space for the extra arguments to API function in the
// caller's frame. // caller's frame.
// //
// These arguments are set by CheckPrototypes and GenerateFastApiCall. // These arguments are set by CheckPrototypes and GenerateFastApiCall.
...@@ -450,7 +450,7 @@ static void FreeSpaceForFastApiCall(MacroAssembler* masm, Register scratch) { ...@@ -450,7 +450,7 @@ static void FreeSpaceForFastApiCall(MacroAssembler* masm, Register scratch) {
} }
// Generates call to FastHandleApiCall builtin. // Generates call to API function.
static bool GenerateFastApiCall(MacroAssembler* masm, static bool GenerateFastApiCall(MacroAssembler* masm,
const CallOptimization& optimization, const CallOptimization& optimization,
int argc, int argc,
...@@ -473,7 +473,7 @@ static bool GenerateFastApiCall(MacroAssembler* masm, ...@@ -473,7 +473,7 @@ static bool GenerateFastApiCall(MacroAssembler* masm,
__ mov(edi, Immediate(Handle<JSFunction>(function))); __ mov(edi, Immediate(Handle<JSFunction>(function)));
__ mov(esi, FieldOperand(edi, JSFunction::kContextOffset)); __ mov(esi, FieldOperand(edi, JSFunction::kContextOffset));
// Pass the additional arguments FastHandleApiCall expects. // Pass the additional arguments.
__ mov(Operand(esp, 2 * kPointerSize), edi); __ mov(Operand(esp, 2 * kPointerSize), edi);
Object* call_data = optimization.api_call_info()->data(); Object* call_data = optimization.api_call_info()->data();
Handle<CallHandlerInfo> api_call_info_handle(optimization.api_call_info()); Handle<CallHandlerInfo> api_call_info_handle(optimization.api_call_info());
...@@ -1263,8 +1263,8 @@ void StubCompiler::GenerateLoadInterceptor(JSObject* object, ...@@ -1263,8 +1263,8 @@ void StubCompiler::GenerateLoadInterceptor(JSObject* object,
__ push(receiver); __ push(receiver);
__ push(holder_reg); __ push(holder_reg);
__ mov(holder_reg, Immediate(Handle<AccessorInfo>(callback))); __ mov(holder_reg, Immediate(Handle<AccessorInfo>(callback)));
__ push(holder_reg);
__ push(FieldOperand(holder_reg, AccessorInfo::kDataOffset)); __ push(FieldOperand(holder_reg, AccessorInfo::kDataOffset));
__ push(holder_reg);
__ push(name_reg); __ push(name_reg);
__ push(scratch2); // restore return address __ push(scratch2); // restore return address
......
...@@ -960,14 +960,11 @@ void StubCache::Clear() { ...@@ -960,14 +960,11 @@ void StubCache::Clear() {
MaybeObject* LoadCallbackProperty(Arguments args) { MaybeObject* LoadCallbackProperty(Arguments args) {
ASSERT(args[0]->IsJSObject()); ASSERT(args[0]->IsJSObject());
ASSERT(args[1]->IsJSObject()); ASSERT(args[1]->IsJSObject());
AccessorInfo* callback = AccessorInfo::cast(args[2]); AccessorInfo* callback = AccessorInfo::cast(args[3]);
Address getter_address = v8::ToCData<Address>(callback->getter()); Address getter_address = v8::ToCData<Address>(callback->getter());
v8::AccessorGetter fun = FUNCTION_CAST<v8::AccessorGetter>(getter_address); v8::AccessorGetter fun = FUNCTION_CAST<v8::AccessorGetter>(getter_address);
ASSERT(fun != NULL); ASSERT(fun != NULL);
CustomArguments custom_args(callback->data(), v8::AccessorInfo info(&args[0]);
JSObject::cast(args[0]),
JSObject::cast(args[1]));
v8::AccessorInfo info(custom_args.end());
HandleScope scope; HandleScope scope;
v8::Handle<v8::Value> result; v8::Handle<v8::Value> result;
{ {
......
...@@ -2588,8 +2588,8 @@ void StubCompiler::GenerateLoadInterceptor(JSObject* object, ...@@ -2588,8 +2588,8 @@ void StubCompiler::GenerateLoadInterceptor(JSObject* object,
__ push(receiver); __ push(receiver);
__ push(holder_reg); __ push(holder_reg);
__ Move(holder_reg, Handle<AccessorInfo>(callback)); __ Move(holder_reg, Handle<AccessorInfo>(callback));
__ push(holder_reg);
__ push(FieldOperand(holder_reg, AccessorInfo::kDataOffset)); __ push(FieldOperand(holder_reg, AccessorInfo::kDataOffset));
__ push(holder_reg);
__ push(name_reg); __ push(name_reg);
__ push(scratch2); // restore return address __ push(scratch2); // restore return address
......
...@@ -6324,7 +6324,7 @@ static void CheckInterceptorLoadIC(NamedPropertyGetter getter, ...@@ -6324,7 +6324,7 @@ static void CheckInterceptorLoadIC(NamedPropertyGetter getter,
int expected) { int expected) {
v8::HandleScope scope; v8::HandleScope scope;
v8::Handle<v8::ObjectTemplate> templ = ObjectTemplate::New(); v8::Handle<v8::ObjectTemplate> templ = ObjectTemplate::New();
templ->SetNamedPropertyHandler(getter); templ->SetNamedPropertyHandler(getter, 0, 0, 0, 0, v8_str("data"));
LocalContext context; LocalContext context;
context->Global()->Set(v8_str("o"), templ->NewInstance()); context->Global()->Set(v8_str("o"), templ->NewInstance());
v8::Handle<Value> value = CompileRun(source); v8::Handle<Value> value = CompileRun(source);
...@@ -6335,7 +6335,8 @@ static void CheckInterceptorLoadIC(NamedPropertyGetter getter, ...@@ -6335,7 +6335,8 @@ static void CheckInterceptorLoadIC(NamedPropertyGetter getter,
static v8::Handle<Value> InterceptorLoadICGetter(Local<String> name, static v8::Handle<Value> InterceptorLoadICGetter(Local<String> name,
const AccessorInfo& info) { const AccessorInfo& info) {
ApiTestFuzzer::Fuzz(); ApiTestFuzzer::Fuzz();
CHECK(v8_str("x")->Equals(name)); CHECK_EQ(v8_str("data"), info.Data());
CHECK_EQ(v8_str("x"), name);
return v8::Integer::New(42); return v8::Integer::New(42);
} }
...@@ -6733,7 +6734,8 @@ THREADED_TEST(InterceptorStoreIC) { ...@@ -6733,7 +6734,8 @@ THREADED_TEST(InterceptorStoreIC) {
v8::HandleScope scope; v8::HandleScope scope;
v8::Handle<v8::ObjectTemplate> templ = ObjectTemplate::New(); v8::Handle<v8::ObjectTemplate> templ = ObjectTemplate::New();
templ->SetNamedPropertyHandler(InterceptorLoadICGetter, templ->SetNamedPropertyHandler(InterceptorLoadICGetter,
InterceptorStoreICSetter); InterceptorStoreICSetter,
0, 0, 0, v8_str("data"));
LocalContext context; LocalContext context;
context->Global()->Set(v8_str("o"), templ->NewInstance()); context->Global()->Set(v8_str("o"), templ->NewInstance());
v8::Handle<Value> value = CompileRun( v8::Handle<Value> value = CompileRun(
......
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