Commit f5b83dec authored by jgruber's avatar jgruber Committed by Commit bot

[builtins] Always pass target and new target to C++ builtins

As a first step towards showing builtin frames in stack traces, we will now
push target and new target unconditionally.

Since the various specializations of BuiltinArguments are made redundant by
this change, we can remove them and all related code.

R=bmeurer@chromium.org
BUG=

Review-Url: https://codereview.chromium.org/2074063002
Cr-Commit-Position: refs/heads/master@{#37061}
parent 42279f16
......@@ -16,10 +16,7 @@ namespace internal {
#define __ ACCESS_MASM(masm)
void Builtins::Generate_Adaptor(MacroAssembler* masm,
CFunctionId id,
BuiltinExtraArguments extra_args) {
void Builtins::Generate_Adaptor(MacroAssembler* masm, CFunctionId id) {
// ----------- S t a t e -------------
// -- r0 : number of arguments excluding receiver
// -- r1 : target
......@@ -38,23 +35,8 @@ void Builtins::Generate_Adaptor(MacroAssembler* masm,
__ ldr(cp, FieldMemOperand(r1, JSFunction::kContextOffset));
// Insert extra arguments.
int num_extra_args = 0;
switch (extra_args) {
case BuiltinExtraArguments::kTarget:
__ Push(r1);
++num_extra_args;
break;
case BuiltinExtraArguments::kNewTarget:
__ Push(r3);
++num_extra_args;
break;
case BuiltinExtraArguments::kTargetAndNewTarget:
__ Push(r1, r3);
num_extra_args += 2;
break;
case BuiltinExtraArguments::kNone:
break;
}
const int num_extra_args = 2;
__ Push(r1, r3);
// JumpToExternalReference expects r0 to contain the number of arguments
// including the receiver and the extra arguments.
......
......@@ -32,10 +32,7 @@ static void GenerateLoadInternalArrayFunction(MacroAssembler* masm,
__ LoadNativeContextSlot(Context::INTERNAL_ARRAY_FUNCTION_INDEX, result);
}
void Builtins::Generate_Adaptor(MacroAssembler* masm,
CFunctionId id,
BuiltinExtraArguments extra_args) {
void Builtins::Generate_Adaptor(MacroAssembler* masm, CFunctionId id) {
// ----------- S t a t e -------------
// -- x0 : number of arguments excluding receiver
// -- x1 : target
......@@ -54,23 +51,8 @@ void Builtins::Generate_Adaptor(MacroAssembler* masm,
__ Ldr(cp, FieldMemOperand(x1, JSFunction::kContextOffset));
// Insert extra arguments.
int num_extra_args = 0;
switch (extra_args) {
case BuiltinExtraArguments::kTarget:
__ Push(x1);
++num_extra_args;
break;
case BuiltinExtraArguments::kNewTarget:
__ Push(x3);
++num_extra_args;
break;
case BuiltinExtraArguments::kTargetAndNewTarget:
__ Push(x1, x3);
num_extra_args += 2;
break;
case BuiltinExtraArguments::kNone:
break;
}
const int num_extra_args = 2;
__ Push(x1, x3);
// JumpToExternalReference expects x0 to contain the number of arguments
// including the receiver and the extra arguments.
......
This diff is collapsed.
This diff is collapsed.
......@@ -318,7 +318,7 @@ void RuntimeCallStats::Print(std::ostream& os) {
FOR_EACH_INTRINSIC(PRINT_COUNTER)
#undef PRINT_COUNTER
#define PRINT_COUNTER(name, type) entries.Add(&this->Builtin_##name);
#define PRINT_COUNTER(name) entries.Add(&this->Builtin_##name);
BUILTIN_LIST_C(PRINT_COUNTER)
#undef PRINT_COUNTER
......@@ -343,7 +343,7 @@ void RuntimeCallStats::Reset() {
FOR_EACH_INTRINSIC(RESET_COUNTER)
#undef RESET_COUNTER
#define RESET_COUNTER(name, type) this->Builtin_##name.Reset();
#define RESET_COUNTER(name) this->Builtin_##name.Reset();
BUILTIN_LIST_C(RESET_COUNTER)
#undef RESET_COUNTER
......
......@@ -746,7 +746,7 @@ class RuntimeCallStats {
RuntimeCallCounter Runtime_##name = RuntimeCallCounter(#name);
FOR_EACH_INTRINSIC(CALL_RUNTIME_COUNTER)
#undef CALL_RUNTIME_COUNTER
#define CALL_BUILTIN_COUNTER(name, type) \
#define CALL_BUILTIN_COUNTER(name) \
RuntimeCallCounter Builtin_##name = RuntimeCallCounter(#name);
BUILTIN_LIST_C(CALL_BUILTIN_COUNTER)
#undef CALL_BUILTIN_COUNTER
......
......@@ -240,7 +240,7 @@ ExternalReferenceTable::ExternalReferenceTable(Isolate* isolate) {
};
static const RefTableEntry c_builtins[] = {
#define DEF_ENTRY_C(name, ignored) {Builtins::c_##name, "Builtins::" #name},
#define DEF_ENTRY_C(name) {Builtins::c_##name, "Builtins::" #name},
BUILTIN_LIST_C(DEF_ENTRY_C)
#undef DEF_ENTRY_C
};
......@@ -252,7 +252,7 @@ ExternalReferenceTable::ExternalReferenceTable(Isolate* isolate) {
}
static const RefTableEntry builtins[] = {
#define DEF_ENTRY_C(name, ignored) {Builtins::k##name, "Builtins::" #name},
#define DEF_ENTRY_C(name) {Builtins::k##name, "Builtins::" #name},
#define DEF_ENTRY_A(name, i1, i2) {Builtins::k##name, "Builtins::" #name},
BUILTIN_LIST_C(DEF_ENTRY_C) BUILTIN_LIST_A(DEF_ENTRY_A)
BUILTIN_LIST_DEBUG_A(DEF_ENTRY_A)
......
......@@ -16,10 +16,7 @@ namespace internal {
#define __ ACCESS_MASM(masm)
void Builtins::Generate_Adaptor(MacroAssembler* masm,
CFunctionId id,
BuiltinExtraArguments extra_args) {
void Builtins::Generate_Adaptor(MacroAssembler* masm, CFunctionId id) {
// ----------- S t a t e -------------
// -- eax : number of arguments excluding receiver
// -- edi : target
......@@ -39,19 +36,11 @@ void Builtins::Generate_Adaptor(MacroAssembler* masm,
__ mov(esi, FieldOperand(edi, JSFunction::kContextOffset));
// Insert extra arguments.
int num_extra_args = 0;
if (extra_args != BuiltinExtraArguments::kNone) {
__ PopReturnAddressTo(ecx);
if (extra_args & BuiltinExtraArguments::kTarget) {
++num_extra_args;
__ Push(edi);
}
if (extra_args & BuiltinExtraArguments::kNewTarget) {
++num_extra_args;
__ Push(edx);
}
__ PushReturnAddressFrom(ecx);
}
const int num_extra_args = 2;
__ PopReturnAddressTo(ecx);
__ Push(edi);
__ Push(edx);
__ PushReturnAddressFrom(ecx);
// JumpToExternalReference expects eax to contain the number of arguments
// including the receiver and the extra arguments.
......
......@@ -17,10 +17,7 @@ namespace internal {
#define __ ACCESS_MASM(masm)
void Builtins::Generate_Adaptor(MacroAssembler* masm,
CFunctionId id,
BuiltinExtraArguments extra_args) {
void Builtins::Generate_Adaptor(MacroAssembler* masm, CFunctionId id) {
// ----------- S t a t e -------------
// -- a0 : number of arguments excluding receiver
// -- a1 : target
......@@ -39,23 +36,8 @@ void Builtins::Generate_Adaptor(MacroAssembler* masm,
__ lw(cp, FieldMemOperand(a1, JSFunction::kContextOffset));
// Insert extra arguments.
int num_extra_args = 0;
switch (extra_args) {
case BuiltinExtraArguments::kTarget:
__ Push(a1);
++num_extra_args;
break;
case BuiltinExtraArguments::kNewTarget:
__ Push(a3);
++num_extra_args;
break;
case BuiltinExtraArguments::kTargetAndNewTarget:
__ Push(a1, a3);
num_extra_args += 2;
break;
case BuiltinExtraArguments::kNone:
break;
}
const int num_extra_args = 2;
__ Push(a1, a3);
// JumpToExternalReference expects a0 to contain the number of arguments
// including the receiver and the extra arguments.
......
......@@ -16,10 +16,7 @@ namespace internal {
#define __ ACCESS_MASM(masm)
void Builtins::Generate_Adaptor(MacroAssembler* masm,
CFunctionId id,
BuiltinExtraArguments extra_args) {
void Builtins::Generate_Adaptor(MacroAssembler* masm, CFunctionId id) {
// ----------- S t a t e -------------
// -- a0 : number of arguments excluding receiver
// -- a1 : target
......@@ -38,23 +35,8 @@ void Builtins::Generate_Adaptor(MacroAssembler* masm,
__ ld(cp, FieldMemOperand(a1, JSFunction::kContextOffset));
// Insert extra arguments.
int num_extra_args = 0;
switch (extra_args) {
case BuiltinExtraArguments::kTarget:
__ Push(a1);
++num_extra_args;
break;
case BuiltinExtraArguments::kNewTarget:
__ Push(a3);
++num_extra_args;
break;
case BuiltinExtraArguments::kTargetAndNewTarget:
__ Push(a1, a3);
num_extra_args += 2;
break;
case BuiltinExtraArguments::kNone:
break;
}
const int num_extra_args = 2;
__ Push(a1, a3);
// JumpToExternalReference expects a0 to contain the number of arguments
// including the receiver and the extra arguments.
......
......@@ -15,10 +15,7 @@ namespace internal {
#define __ ACCESS_MASM(masm)
void Builtins::Generate_Adaptor(MacroAssembler* masm,
CFunctionId id,
BuiltinExtraArguments extra_args) {
void Builtins::Generate_Adaptor(MacroAssembler* masm, CFunctionId id) {
// ----------- S t a t e -------------
// -- rax : number of arguments excluding receiver
// -- rdi : target
......@@ -37,20 +34,13 @@ void Builtins::Generate_Adaptor(MacroAssembler* masm,
// ordinary functions).
__ movp(rsi, FieldOperand(rdi, JSFunction::kContextOffset));
// Insert extra arguments.
int num_extra_args = 0;
if (extra_args != BuiltinExtraArguments::kNone) {
__ PopReturnAddressTo(kScratchRegister);
if (extra_args & BuiltinExtraArguments::kTarget) {
++num_extra_args;
__ Push(rdi);
}
if (extra_args & BuiltinExtraArguments::kNewTarget) {
++num_extra_args;
__ Push(rdx);
}
__ PushReturnAddressFrom(kScratchRegister);
}
// Unconditionally insert the target and new target as extra arguments. They
// will be used by stack frame iterators when constructing the stack trace.
const int num_extra_args = 2;
__ PopReturnAddressTo(kScratchRegister);
__ Push(rdi);
__ Push(rdx);
__ PushReturnAddressFrom(kScratchRegister);
// JumpToExternalReference expects rax to contain the number of arguments
// including the receiver and the extra arguments.
......
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