Revert of Removes the Callee parameter from FunctionCallbackInfo. (patchset #1 id:1 of https://codereview.chromium.org/1510483002/ )

Reason for revert:
Need to figure out a better solution for this.

Original issue's description:
> Removes the Callee parameter from FunctionCallbackInfo.
>
> This will help us to instantiate AccessorPair's getters and setters only when they are needed.
>
> BUG=
>
> Committed: https://crrev.com/2fe34ebdcdee0f21b88daa4098a7918e91abb8fb
> Cr-Commit-Position: refs/heads/master@{#32759}

TBR=jochen@chromium.org,verwaest@chromium.org
NOPRESUBMIT=true
NOTREECHECKS=true
NOTRY=true
BUG=

Review URL: https://codereview.chromium.org/1520843002

Cr-Commit-Position: refs/heads/master@{#32787}
This commit is contained in:
epertoso 2015-12-11 02:20:04 -08:00 committed by Commit bot
parent 5819e4be5b
commit 474ecd67ea
12 changed files with 61 additions and 21 deletions

View File

@ -3142,6 +3142,7 @@ class FunctionCallbackInfo {
public:
V8_INLINE int Length() const;
V8_INLINE Local<Value> operator[](int i) const;
V8_INLINE Local<Function> Callee() const;
V8_INLINE Local<Object> This() const;
V8_INLINE Local<Object> Holder() const;
V8_INLINE bool IsConstructCall() const;
@ -3149,7 +3150,7 @@ class FunctionCallbackInfo {
V8_INLINE Isolate* GetIsolate() const;
V8_INLINE ReturnValue<T> GetReturnValue() const;
// This shouldn't be public, but the arm compiler needs it.
static const int kArgsLength = 6;
static const int kArgsLength = 7;
protected:
friend class internal::FunctionCallbackArguments;
@ -3159,7 +3160,8 @@ class FunctionCallbackInfo {
static const int kReturnValueDefaultValueIndex = 2;
static const int kReturnValueIndex = 3;
static const int kDataIndex = 4;
static const int kContextSaveIndex = 5;
static const int kCalleeIndex = 5;
static const int kContextSaveIndex = 6;
V8_INLINE FunctionCallbackInfo(internal::Object** implicit_args,
internal::Object** values,
@ -7588,6 +7590,13 @@ Local<Value> FunctionCallbackInfo<T>::operator[](int i) const {
}
template<typename T>
Local<Function> FunctionCallbackInfo<T>::Callee() const {
return Local<Function>(reinterpret_cast<Function*>(
&implicit_args_[kCalleeIndex]));
}
template<typename T>
Local<Object> FunctionCallbackInfo<T>::This() const {
return Local<Object>(reinterpret_cast<Object*>(values_ + 1));

View File

@ -215,10 +215,12 @@ class FunctionCallbackArguments
static const int kReturnValueDefaultValueIndex =
T::kReturnValueDefaultValueIndex;
static const int kIsolateIndex = T::kIsolateIndex;
static const int kCalleeIndex = T::kCalleeIndex;
static const int kContextSaveIndex = T::kContextSaveIndex;
FunctionCallbackArguments(internal::Isolate* isolate,
internal::Object* data,
internal::JSFunction* callee,
internal::Object* holder,
internal::Object** argv,
int argc,
@ -229,6 +231,7 @@ class FunctionCallbackArguments
is_construct_call_(is_construct_call) {
Object** values = begin();
values[T::kDataIndex] = data;
values[T::kCalleeIndex] = callee;
values[T::kHolderIndex] = holder;
values[T::kContextSaveIndex] = isolate->heap()->the_hole_value();
values[T::kIsolateIndex] = reinterpret_cast<internal::Object*>(isolate);
@ -237,6 +240,7 @@ class FunctionCallbackArguments
values[T::kReturnValueDefaultValueIndex] =
isolate->heap()->the_hole_value();
values[T::kReturnValueIndex] = isolate->heap()->the_hole_value();
DCHECK(values[T::kCalleeIndex]->IsJSFunction());
DCHECK(values[T::kHolderIndex]->IsHeapObject());
DCHECK(values[T::kIsolateIndex]->IsSmi());
}

View File

@ -5215,13 +5215,14 @@ static void CallApiFunctionStubHelper(MacroAssembler* masm,
typedef FunctionCallbackArguments FCA;
STATIC_ASSERT(FCA::kContextSaveIndex == 5);
STATIC_ASSERT(FCA::kContextSaveIndex == 6);
STATIC_ASSERT(FCA::kCalleeIndex == 5);
STATIC_ASSERT(FCA::kDataIndex == 4);
STATIC_ASSERT(FCA::kReturnValueOffset == 3);
STATIC_ASSERT(FCA::kReturnValueDefaultValueIndex == 2);
STATIC_ASSERT(FCA::kIsolateIndex == 1);
STATIC_ASSERT(FCA::kHolderIndex == 0);
STATIC_ASSERT(FCA::kArgsLength == 6);
STATIC_ASSERT(FCA::kArgsLength == 7);
DCHECK(argc.is_immediate() || r3.is(argc.reg()));
@ -5230,6 +5231,9 @@ static void CallApiFunctionStubHelper(MacroAssembler* masm,
// load context from callee
__ ldr(context, FieldMemOperand(callee, JSFunction::kContextOffset));
// callee
__ push(callee);
// call data
__ push(call_data);

View File

@ -5640,18 +5640,19 @@ static void CallApiFunctionStubHelper(MacroAssembler* masm,
typedef FunctionCallbackArguments FCA;
STATIC_ASSERT(FCA::kContextSaveIndex == 5);
STATIC_ASSERT(FCA::kContextSaveIndex == 6);
STATIC_ASSERT(FCA::kCalleeIndex == 5);
STATIC_ASSERT(FCA::kDataIndex == 4);
STATIC_ASSERT(FCA::kReturnValueOffset == 3);
STATIC_ASSERT(FCA::kReturnValueDefaultValueIndex == 2);
STATIC_ASSERT(FCA::kIsolateIndex == 1);
STATIC_ASSERT(FCA::kHolderIndex == 0);
STATIC_ASSERT(FCA::kArgsLength == 6);
STATIC_ASSERT(FCA::kArgsLength == 7);
DCHECK(argc.is_immediate() || x3.is(argc.reg()));
// FunctionCallbackArguments: context, callee and call data.
__ Push(context, call_data);
__ Push(context, callee, call_data);
// Load context from callee
__ Ldr(context, FieldMemOperand(callee, JSFunction::kContextOffset));

View File

@ -1903,6 +1903,7 @@ MUST_USE_RESULT MaybeHandle<Object> HandleApiCallHelper(
FunctionCallbackArguments custom(isolate,
data_obj,
*function,
raw_holder,
&args[0] - 1,
args.length() - 1,
@ -2065,6 +2066,7 @@ MUST_USE_RESULT static Object* HandleApiCallAsFunctionOrConstructor(
FunctionCallbackArguments custom(isolate,
call_data->data(),
constructor,
obj,
&args[0] - 1,
args.length() - 1,

View File

@ -5473,13 +5473,14 @@ static void CallApiFunctionStubHelper(MacroAssembler* masm,
typedef FunctionCallbackArguments FCA;
STATIC_ASSERT(FCA::kContextSaveIndex == 5);
STATIC_ASSERT(FCA::kContextSaveIndex == 6);
STATIC_ASSERT(FCA::kCalleeIndex == 5);
STATIC_ASSERT(FCA::kDataIndex == 4);
STATIC_ASSERT(FCA::kReturnValueOffset == 3);
STATIC_ASSERT(FCA::kReturnValueDefaultValueIndex == 2);
STATIC_ASSERT(FCA::kIsolateIndex == 1);
STATIC_ASSERT(FCA::kHolderIndex == 0);
STATIC_ASSERT(FCA::kArgsLength == 6);
STATIC_ASSERT(FCA::kArgsLength == 7);
DCHECK(argc.is_immediate() || eax.is(argc.reg()));
@ -5493,6 +5494,9 @@ static void CallApiFunctionStubHelper(MacroAssembler* masm,
return_address = context;
}
// callee
__ push(callee);
// call data
__ push(call_data);

View File

@ -5425,18 +5425,19 @@ static void CallApiFunctionStubHelper(MacroAssembler* masm,
typedef FunctionCallbackArguments FCA;
STATIC_ASSERT(FCA::kContextSaveIndex == 5);
STATIC_ASSERT(FCA::kContextSaveIndex == 6);
STATIC_ASSERT(FCA::kCalleeIndex == 5);
STATIC_ASSERT(FCA::kDataIndex == 4);
STATIC_ASSERT(FCA::kReturnValueOffset == 3);
STATIC_ASSERT(FCA::kReturnValueDefaultValueIndex == 2);
STATIC_ASSERT(FCA::kIsolateIndex == 1);
STATIC_ASSERT(FCA::kHolderIndex == 0);
STATIC_ASSERT(FCA::kArgsLength == 6);
STATIC_ASSERT(FCA::kArgsLength == 7);
DCHECK(argc.is_immediate() || a3.is(argc.reg()));
// Save context, callee and call data.
__ Push(context, call_data);
__ Push(context, callee, call_data);
// Load context from callee.
__ lw(context, FieldMemOperand(callee, JSFunction::kContextOffset));

View File

@ -5451,18 +5451,19 @@ static void CallApiFunctionStubHelper(MacroAssembler* masm,
typedef FunctionCallbackArguments FCA;
STATIC_ASSERT(FCA::kContextSaveIndex == 5);
STATIC_ASSERT(FCA::kContextSaveIndex == 6);
STATIC_ASSERT(FCA::kCalleeIndex == 5);
STATIC_ASSERT(FCA::kDataIndex == 4);
STATIC_ASSERT(FCA::kReturnValueOffset == 3);
STATIC_ASSERT(FCA::kReturnValueDefaultValueIndex == 2);
STATIC_ASSERT(FCA::kIsolateIndex == 1);
STATIC_ASSERT(FCA::kHolderIndex == 0);
STATIC_ASSERT(FCA::kArgsLength == 6);
STATIC_ASSERT(FCA::kArgsLength == 7);
DCHECK(argc.is_immediate() || a3.is(argc.reg()));
// Save context, callee and call data.
__ Push(context, call_data);
__ Push(context, callee, call_data);
// Load context from callee.
__ ld(context, FieldMemOperand(callee, JSFunction::kContextOffset));

View File

@ -5454,13 +5454,14 @@ static void CallApiFunctionStubHelper(MacroAssembler* masm,
typedef FunctionCallbackArguments FCA;
STATIC_ASSERT(FCA::kContextSaveIndex == 5);
STATIC_ASSERT(FCA::kContextSaveIndex == 6);
STATIC_ASSERT(FCA::kCalleeIndex == 5);
STATIC_ASSERT(FCA::kDataIndex == 4);
STATIC_ASSERT(FCA::kReturnValueOffset == 3);
STATIC_ASSERT(FCA::kReturnValueDefaultValueIndex == 2);
STATIC_ASSERT(FCA::kIsolateIndex == 1);
STATIC_ASSERT(FCA::kHolderIndex == 0);
STATIC_ASSERT(FCA::kArgsLength == 6);
STATIC_ASSERT(FCA::kArgsLength == 7);
DCHECK(argc.is_immediate() || r3.is(argc.reg()));
@ -5469,6 +5470,9 @@ static void CallApiFunctionStubHelper(MacroAssembler* masm,
// load context from callee
__ LoadP(context, FieldMemOperand(callee, JSFunction::kContextOffset));
// callee
__ push(callee);
// call data
__ push(call_data);

View File

@ -5210,13 +5210,14 @@ static void CallApiFunctionStubHelper(MacroAssembler* masm,
typedef FunctionCallbackArguments FCA;
STATIC_ASSERT(FCA::kContextSaveIndex == 5);
STATIC_ASSERT(FCA::kContextSaveIndex == 6);
STATIC_ASSERT(FCA::kCalleeIndex == 5);
STATIC_ASSERT(FCA::kDataIndex == 4);
STATIC_ASSERT(FCA::kReturnValueOffset == 3);
STATIC_ASSERT(FCA::kReturnValueDefaultValueIndex == 2);
STATIC_ASSERT(FCA::kIsolateIndex == 1);
STATIC_ASSERT(FCA::kHolderIndex == 0);
STATIC_ASSERT(FCA::kArgsLength == 6);
STATIC_ASSERT(FCA::kArgsLength == 7);
DCHECK(argc.is_immediate() || rax.is(argc.reg()));
@ -5225,6 +5226,9 @@ static void CallApiFunctionStubHelper(MacroAssembler* masm,
// context save
__ Push(context);
// callee
__ Push(callee);
// call data
__ Push(call_data);
Register scratch = call_data;

View File

@ -5155,13 +5155,14 @@ static void CallApiFunctionStubHelper(MacroAssembler* masm,
typedef FunctionCallbackArguments FCA;
STATIC_ASSERT(FCA::kContextSaveIndex == 5);
STATIC_ASSERT(FCA::kContextSaveIndex == 6);
STATIC_ASSERT(FCA::kCalleeIndex == 5);
STATIC_ASSERT(FCA::kDataIndex == 4);
STATIC_ASSERT(FCA::kReturnValueOffset == 3);
STATIC_ASSERT(FCA::kReturnValueDefaultValueIndex == 2);
STATIC_ASSERT(FCA::kIsolateIndex == 1);
STATIC_ASSERT(FCA::kHolderIndex == 0);
STATIC_ASSERT(FCA::kArgsLength == 6);
STATIC_ASSERT(FCA::kArgsLength == 7);
DCHECK(argc.is_immediate() || eax.is(argc.reg()));
@ -5175,6 +5176,9 @@ static void CallApiFunctionStubHelper(MacroAssembler* masm,
return_address = context;
}
// callee
__ push(callee);
// call data
__ push(call_data);

View File

@ -7682,6 +7682,7 @@ static void ArgumentsTestCallback(
ApiTestFuzzer::Fuzz();
v8::Isolate* isolate = args.GetIsolate();
Local<Context> context = isolate->GetCurrentContext();
CHECK(args_fun->Equals(context, args.Callee()).FromJust());
CHECK_EQ(3, args.Length());
CHECK(v8::Integer::New(isolate, 1)->Equals(context, args[0]).FromJust());
CHECK(v8::Integer::New(isolate, 2)->Equals(context, args[1]).FromJust());
@ -21757,6 +21758,7 @@ class ApiCallOptimizationChecker {
static void OptimizationCallback(
const v8::FunctionCallbackInfo<v8::Value>& info) {
CHECK(callee == info.Callee());
CHECK(data == info.Data());
CHECK(receiver == info.This());
if (info.Length() == 1) {