From 6fbad6e230eac6726eaea8f47c5453dc1274e70d Mon Sep 17 00:00:00 2001 From: "vitalyr@chromium.org" Date: Thu, 25 Mar 2010 17:08:22 +0000 Subject: [PATCH] Simplify passing of AccessorInfo to interceptors: * Use slots on the native stack when possible instead of Relocatable. * Got rid of a gap in AccessorInfo fields. * Added test for non-cacheable post-interceptor lookup. Review URL: http://codereview.chromium.org/1327002 git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@4288 ce2b1a6d-e550-0410-aec6-3dcde31c8c00 --- include/v8.h | 2 +- src/arguments.h | 11 +++++------ src/arm/stub-cache-arm.cc | 7 +++---- src/codegen.h | 2 +- src/handles.cc | 2 +- src/ia32/stub-cache-ia32.cc | 16 ++++++++-------- src/stub-cache.cc | 36 +++++++++++++++++++++--------------- src/x64/stub-cache-x64.cc | 7 +++---- test/cctest/test-api.cc | 32 ++++++++++++++++++++++++++++++++ 9 files changed, 75 insertions(+), 40 deletions(-) diff --git a/include/v8.h b/include/v8.h index 7b42178..f64b386 100644 --- a/include/v8.h +++ b/include/v8.h @@ -3361,7 +3361,7 @@ External* External::Cast(v8::Value* value) { Local AccessorInfo::Data() const { - return Local(reinterpret_cast(&args_[-3])); + return Local(reinterpret_cast(&args_[-2])); } diff --git a/src/arguments.h b/src/arguments.h index 3fed223..c17f4cf 100644 --- a/src/arguments.h +++ b/src/arguments.h @@ -72,7 +72,7 @@ class Arguments BASE_EMBEDDED { }; -// Cursom arguments replicate a small segment of stack that can be +// Custom arguments replicate a small segment of stack that can be // accessed through an Arguments object the same way the actual stack // can. class CustomArguments : public Relocatable { @@ -80,15 +80,14 @@ class CustomArguments : public Relocatable { inline CustomArguments(Object* data, JSObject* self, JSObject* holder) { - values_[3] = self; - values_[2] = holder; - values_[1] = Smi::FromInt(0); + values_[2] = self; + values_[1] = holder; values_[0] = data; } void IterateInstance(ObjectVisitor* v); - Object** end() { return values_ + 3; } + Object** end() { return values_ + ARRAY_SIZE(values_) - 1; } private: - Object* values_[4]; + Object* values_[3]; }; diff --git a/src/arm/stub-cache-arm.cc b/src/arm/stub-cache-arm.cc index abf2f64..bbffef22 100644 --- a/src/arm/stub-cache-arm.cc +++ b/src/arm/stub-cache-arm.cc @@ -396,15 +396,14 @@ static void PushInterceptorArguments(MacroAssembler* masm, Register holder, Register name, JSObject* holder_obj) { - __ push(receiver); - __ push(holder); __ push(name); InterceptorInfo* interceptor = holder_obj->GetNamedInterceptor(); ASSERT(!Heap::InNewSpace(interceptor)); - - Register scratch = receiver; + Register scratch = name; __ mov(scratch, Operand(Handle(interceptor))); __ push(scratch); + __ push(receiver); + __ push(holder); __ ldr(scratch, FieldMemOperand(scratch, InterceptorInfo::kDataOffset)); __ push(scratch); } diff --git a/src/codegen.h b/src/codegen.h index 4634f4c..0dfea8d 100644 --- a/src/codegen.h +++ b/src/codegen.h @@ -450,7 +450,7 @@ class ApiGetterEntryStub : public CodeStub { virtual bool GetCustomCache(Code** code_out); virtual void SetCustomCache(Code* value); - static const int kStackSpace = 6; + static const int kStackSpace = 5; static const int kArgc = 4; private: Handle info() { return info_; } diff --git a/src/handles.cc b/src/handles.cc index f8a679b..d4c593f 100644 --- a/src/handles.cc +++ b/src/handles.cc @@ -541,7 +541,7 @@ int GetScriptLineNumberSafe(Handle