X87: [Interpreter] Support for operator new.
port 7557dc5a70
(r31312).
original commit message:
This change add a new bytecode for operator new and implements it using
the Construct() builtin.
BUG=
Review URL: https://codereview.chromium.org/1423733002
Cr-Commit-Position: refs/heads/master@{#31518}
This commit is contained in:
parent
2ab54f109e
commit
b5b590f511
@ -713,6 +713,24 @@ void Builtins::Generate_InterpreterExitTrampoline(MacroAssembler* masm) {
|
||||
}
|
||||
|
||||
|
||||
static void Generate_InterpreterPushArgs(MacroAssembler* masm,
|
||||
Register array_limit) {
|
||||
// ----------- S t a t e -------------
|
||||
// -- ebx : Pointer to the last argument in the args array.
|
||||
// -- array_limit : Pointer to one before the first argument in the
|
||||
// args array.
|
||||
// -----------------------------------
|
||||
Label loop_header, loop_check;
|
||||
__ jmp(&loop_check);
|
||||
__ bind(&loop_header);
|
||||
__ Push(Operand(ebx, 0));
|
||||
__ sub(ebx, Immediate(kPointerSize));
|
||||
__ bind(&loop_check);
|
||||
__ cmp(ebx, array_limit);
|
||||
__ j(greater, &loop_header, Label::kNear);
|
||||
}
|
||||
|
||||
|
||||
// static
|
||||
void Builtins::Generate_InterpreterPushArgsAndCall(MacroAssembler* masm) {
|
||||
// ----------- S t a t e -------------
|
||||
@ -721,6 +739,7 @@ void Builtins::Generate_InterpreterPushArgsAndCall(MacroAssembler* masm) {
|
||||
// arguments should be consecutive above this, in the same order as
|
||||
// they are to be pushed onto the stack.
|
||||
// -- edi : the target to call (can be any Object).
|
||||
// -----------------------------------
|
||||
|
||||
// Pop return address to allow tail-call after pushing arguments.
|
||||
__ Pop(edx);
|
||||
@ -732,15 +751,7 @@ void Builtins::Generate_InterpreterPushArgsAndCall(MacroAssembler* masm) {
|
||||
__ neg(ecx);
|
||||
__ add(ecx, ebx);
|
||||
|
||||
// Push the arguments.
|
||||
Label loop_header, loop_check;
|
||||
__ jmp(&loop_check);
|
||||
__ bind(&loop_header);
|
||||
__ Push(Operand(ebx, 0));
|
||||
__ sub(ebx, Immediate(kPointerSize));
|
||||
__ bind(&loop_check);
|
||||
__ cmp(ebx, ecx);
|
||||
__ j(greater, &loop_header, Label::kNear);
|
||||
Generate_InterpreterPushArgs(masm, ecx);
|
||||
|
||||
// Call the target.
|
||||
__ Push(edx); // Re-push return address.
|
||||
@ -748,13 +759,53 @@ void Builtins::Generate_InterpreterPushArgsAndCall(MacroAssembler* masm) {
|
||||
}
|
||||
|
||||
|
||||
// static
|
||||
void Builtins::Generate_InterpreterPushArgsAndConstruct(MacroAssembler* masm) {
|
||||
// ----------- S t a t e -------------
|
||||
// -- eax : the number of arguments (not including the receiver)
|
||||
// -- edx : the original constructor
|
||||
// -- edi : the constructor
|
||||
// -- ebx : the address of the first argument to be pushed. Subsequent
|
||||
// arguments should be consecutive above this, in the same order as
|
||||
// they are to be pushed onto the stack.
|
||||
// -----------------------------------
|
||||
|
||||
// Save number of arguments on the stack below where arguments are going
|
||||
// to be pushed.
|
||||
__ mov(ecx, eax);
|
||||
__ neg(ecx);
|
||||
__ mov(Operand(esp, ecx, times_pointer_size, -kPointerSize), eax);
|
||||
__ mov(eax, ecx);
|
||||
|
||||
// Pop return address to allow tail-call after pushing arguments.
|
||||
__ Pop(ecx);
|
||||
|
||||
// Find the address of the last argument.
|
||||
__ shl(eax, kPointerSizeLog2);
|
||||
__ add(eax, ebx);
|
||||
|
||||
// Push padding for receiver.
|
||||
__ Push(Immediate(0));
|
||||
|
||||
Generate_InterpreterPushArgs(masm, eax);
|
||||
|
||||
// Restore number of arguments from slot on stack.
|
||||
__ mov(eax, Operand(esp, -kPointerSize));
|
||||
|
||||
// Re-push return address.
|
||||
__ Push(ecx);
|
||||
|
||||
// Call the constructor with unmodified eax, edi, ebi values.
|
||||
__ Jump(masm->isolate()->builtins()->Construct(), RelocInfo::CONSTRUCT_CALL);
|
||||
}
|
||||
|
||||
|
||||
void Builtins::Generate_CompileLazy(MacroAssembler* masm) {
|
||||
CallRuntimePassFunction(masm, Runtime::kCompileLazy);
|
||||
GenerateTailCallToReturnedCode(masm);
|
||||
}
|
||||
|
||||
|
||||
|
||||
static void CallCompileOptimized(MacroAssembler* masm, bool concurrent) {
|
||||
FrameScope scope(masm, StackFrame::INTERNAL);
|
||||
// Push a copy of the function.
|
||||
|
@ -408,6 +408,18 @@ void InterpreterPushArgsAndCallDescriptor::InitializePlatformSpecific(
|
||||
}
|
||||
|
||||
|
||||
void InterpreterPushArgsAndConstructDescriptor::InitializePlatformSpecific(
|
||||
CallInterfaceDescriptorData* data) {
|
||||
Register registers[] = {
|
||||
eax, // argument count (not including receiver)
|
||||
edx, // original constructor
|
||||
edi, // constructor
|
||||
ebx, // address of first argument
|
||||
};
|
||||
data->InitializePlatformSpecific(arraysize(registers), registers);
|
||||
}
|
||||
|
||||
|
||||
void InterpreterCEntryDescriptor::InitializePlatformSpecific(
|
||||
CallInterfaceDescriptorData* data) {
|
||||
Register registers[] = {
|
||||
|
Loading…
Reference in New Issue
Block a user