Commit 2772f1ce authored by zhengxing.li's avatar zhengxing.li Committed by Commit bot

X87: Rename original constructor to new target.

  port 07c1d181 (r32023)

  original commit message:

BUG=

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

Cr-Commit-Position: refs/heads/master@{#32067}
parent 09658092
...@@ -3005,7 +3005,7 @@ void FullCodeGenerator::EmitSuperConstructorCall(Call* expr) { ...@@ -3005,7 +3005,7 @@ void FullCodeGenerator::EmitSuperConstructorCall(Call* expr) {
// constructor invocation. // constructor invocation.
SetConstructCallPosition(expr); SetConstructCallPosition(expr);
// Load original constructor into ecx. // Load new target into ecx.
VisitForAccumulatorValue(super_call_ref->new_target_var()); VisitForAccumulatorValue(super_call_ref->new_target_var());
__ mov(ecx, result_register()); __ mov(ecx, result_register());
......
...@@ -127,7 +127,7 @@ static void Generate_JSConstructStubHelper(MacroAssembler* masm, ...@@ -127,7 +127,7 @@ static void Generate_JSConstructStubHelper(MacroAssembler* masm,
// -- eax: number of arguments // -- eax: number of arguments
// -- edi: constructor function // -- edi: constructor function
// -- ebx: allocation site or undefined // -- ebx: allocation site or undefined
// -- edx: original constructor // -- edx: new target
// ----------------------------------- // -----------------------------------
// Enter a construct frame. // Enter a construct frame.
...@@ -151,12 +151,12 @@ static void Generate_JSConstructStubHelper(MacroAssembler* masm, ...@@ -151,12 +151,12 @@ static void Generate_JSConstructStubHelper(MacroAssembler* masm,
__ cmp(Operand::StaticVariable(debug_step_in_fp), Immediate(0)); __ cmp(Operand::StaticVariable(debug_step_in_fp), Immediate(0));
__ j(not_equal, &rt_call); __ j(not_equal, &rt_call);
// Verify that the original constructor is a JSFunction. // Verify that the new target is a JSFunction.
__ CmpObjectType(edx, JS_FUNCTION_TYPE, ebx); __ CmpObjectType(edx, JS_FUNCTION_TYPE, ebx);
__ j(not_equal, &rt_call); __ j(not_equal, &rt_call);
// Load the initial map and verify that it is in fact a map. // Load the initial map and verify that it is in fact a map.
// edx: original constructor // edx: new target
__ mov(eax, FieldOperand(edx, JSFunction::kPrototypeOrInitialMapOffset)); __ mov(eax, FieldOperand(edx, JSFunction::kPrototypeOrInitialMapOffset));
// Will both indicate a NULL and a Smi // Will both indicate a NULL and a Smi
__ JumpIfSmi(eax, &rt_call); __ JumpIfSmi(eax, &rt_call);
...@@ -276,7 +276,7 @@ static void Generate_JSConstructStubHelper(MacroAssembler* masm, ...@@ -276,7 +276,7 @@ static void Generate_JSConstructStubHelper(MacroAssembler* masm,
} }
// Allocate the new receiver object using the runtime call. // Allocate the new receiver object using the runtime call.
// edx: original constructor // edx: new target
__ bind(&rt_call); __ bind(&rt_call);
int offset = kPointerSize; int offset = kPointerSize;
...@@ -285,7 +285,7 @@ static void Generate_JSConstructStubHelper(MacroAssembler* masm, ...@@ -285,7 +285,7 @@ static void Generate_JSConstructStubHelper(MacroAssembler* masm,
__ mov(esi, Operand(ebp, StandardFrameConstants::kContextOffset)); __ mov(esi, Operand(ebp, StandardFrameConstants::kContextOffset));
__ mov(edi, Operand(esp, offset)); __ mov(edi, Operand(esp, offset));
__ push(edi); // constructor function __ push(edi); // constructor function
__ push(edx); // original constructor __ push(edx); // new target
__ CallRuntime(Runtime::kNewObject, 2); __ CallRuntime(Runtime::kNewObject, 2);
__ mov(ebx, eax); // store result in ebx __ mov(ebx, eax); // store result in ebx
...@@ -395,7 +395,7 @@ void Builtins::Generate_JSConstructStubForDerived(MacroAssembler* masm) { ...@@ -395,7 +395,7 @@ void Builtins::Generate_JSConstructStubForDerived(MacroAssembler* masm) {
// -- eax: number of arguments // -- eax: number of arguments
// -- edi: constructor function // -- edi: constructor function
// -- ebx: allocation site or undefined // -- ebx: allocation site or undefined
// -- edx: original constructor // -- edx: new target
// ----------------------------------- // -----------------------------------
{ {
...@@ -766,7 +766,7 @@ void Builtins::Generate_InterpreterPushArgsAndCall(MacroAssembler* masm) { ...@@ -766,7 +766,7 @@ void Builtins::Generate_InterpreterPushArgsAndCall(MacroAssembler* masm) {
void Builtins::Generate_InterpreterPushArgsAndConstruct(MacroAssembler* masm) { void Builtins::Generate_InterpreterPushArgsAndConstruct(MacroAssembler* masm) {
// ----------- S t a t e ------------- // ----------- S t a t e -------------
// -- eax : the number of arguments (not including the receiver) // -- eax : the number of arguments (not including the receiver)
// -- edx : the original constructor // -- edx : the new target
// -- edi : the constructor // -- edi : the constructor
// -- ebx : the address of the first argument to be pushed. Subsequent // -- ebx : the address of the first argument to be pushed. Subsequent
// arguments should be consecutive above this, in the same order as // arguments should be consecutive above this, in the same order as
...@@ -1157,7 +1157,7 @@ static void Generate_ConstructHelper(MacroAssembler* masm) { ...@@ -1157,7 +1157,7 @@ static void Generate_ConstructHelper(MacroAssembler* masm) {
// Stack at entry: // Stack at entry:
// esp : return address // esp : return address
// esp[4] : original constructor (new.target) // esp[4] : new target
// esp[8] : arguments // esp[8] : arguments
// esp[16] : constructor // esp[16] : constructor
{ {
...@@ -1165,7 +1165,7 @@ static void Generate_ConstructHelper(MacroAssembler* masm) { ...@@ -1165,7 +1165,7 @@ static void Generate_ConstructHelper(MacroAssembler* masm) {
// Stack frame: // Stack frame:
// ebp : Old base pointer // ebp : Old base pointer
// ebp[4] : return address // ebp[4] : return address
// ebp[8] : original constructor (new.target) // ebp[8] : new target
// ebp[12] : arguments // ebp[12] : arguments
// ebp[16] : constructor // ebp[16] : constructor
static const int kNewTargetOffset = kFPOnStackSize + kPCOnStackSize; static const int kNewTargetOffset = kFPOnStackSize + kPCOnStackSize;
...@@ -1364,7 +1364,7 @@ void Builtins::Generate_StringConstructor_ConstructStub(MacroAssembler* masm) { ...@@ -1364,7 +1364,7 @@ void Builtins::Generate_StringConstructor_ConstructStub(MacroAssembler* masm) {
// ----------- S t a t e ------------- // ----------- S t a t e -------------
// -- eax : number of arguments // -- eax : number of arguments
// -- edi : constructor function // -- edi : constructor function
// -- edx : original constructor // -- edx : new target
// -- esp[0] : return address // -- esp[0] : return address
// -- esp[(argc - n) * 4] : arg[n] (zero-based) // -- esp[(argc - n) * 4] : arg[n] (zero-based)
// -- esp[(argc + 1) * 4] : receiver // -- esp[(argc + 1) * 4] : receiver
...@@ -1407,7 +1407,7 @@ void Builtins::Generate_StringConstructor_ConstructStub(MacroAssembler* masm) { ...@@ -1407,7 +1407,7 @@ void Builtins::Generate_StringConstructor_ConstructStub(MacroAssembler* masm) {
__ bind(&done_convert); __ bind(&done_convert);
} }
// 3. Check if original constructor and constructor differ. // 3. Check if new target and constructor differ.
Label new_object; Label new_object;
__ cmp(edx, edi); __ cmp(edx, edi);
__ j(not_equal, &new_object); __ j(not_equal, &new_object);
...@@ -1417,7 +1417,7 @@ void Builtins::Generate_StringConstructor_ConstructStub(MacroAssembler* masm) { ...@@ -1417,7 +1417,7 @@ void Builtins::Generate_StringConstructor_ConstructStub(MacroAssembler* masm) {
// ----------- S t a t e ------------- // ----------- S t a t e -------------
// -- ebx : the first argument // -- ebx : the first argument
// -- edi : constructor function // -- edi : constructor function
// -- edx : original constructor // -- edx : new target
// ----------------------------------- // -----------------------------------
__ Allocate(JSValue::kSize, eax, ecx, no_reg, &new_object, TAG_OBJECT); __ Allocate(JSValue::kSize, eax, ecx, no_reg, &new_object, TAG_OBJECT);
...@@ -1439,7 +1439,7 @@ void Builtins::Generate_StringConstructor_ConstructStub(MacroAssembler* masm) { ...@@ -1439,7 +1439,7 @@ void Builtins::Generate_StringConstructor_ConstructStub(MacroAssembler* masm) {
FrameScope scope(masm, StackFrame::INTERNAL); FrameScope scope(masm, StackFrame::INTERNAL);
__ Push(ebx); // the first argument __ Push(ebx); // the first argument
__ Push(edi); // constructor function __ Push(edi); // constructor function
__ Push(edx); // original constructor __ Push(edx); // new target
__ CallRuntime(Runtime::kNewObject, 2); __ CallRuntime(Runtime::kNewObject, 2);
__ Pop(FieldOperand(eax, JSValue::kValueOffset)); __ Pop(FieldOperand(eax, JSValue::kValueOffset));
} }
...@@ -1666,7 +1666,7 @@ void Builtins::Generate_Call(MacroAssembler* masm, ConvertReceiverMode mode) { ...@@ -1666,7 +1666,7 @@ void Builtins::Generate_Call(MacroAssembler* masm, ConvertReceiverMode mode) {
void Builtins::Generate_ConstructFunction(MacroAssembler* masm) { void Builtins::Generate_ConstructFunction(MacroAssembler* masm) {
// ----------- S t a t e ------------- // ----------- S t a t e -------------
// -- eax : the number of arguments (not including the receiver) // -- eax : the number of arguments (not including the receiver)
// -- edx : the original constructor (checked to be a JSFunction) // -- edx : the new target (checked to be a JSFunction)
// -- edi : the constructor to call (checked to be a JSFunction) // -- edi : the constructor to call (checked to be a JSFunction)
// ----------------------------------- // -----------------------------------
__ AssertFunction(edx); __ AssertFunction(edx);
...@@ -1689,7 +1689,7 @@ void Builtins::Generate_ConstructFunction(MacroAssembler* masm) { ...@@ -1689,7 +1689,7 @@ void Builtins::Generate_ConstructFunction(MacroAssembler* masm) {
void Builtins::Generate_ConstructProxy(MacroAssembler* masm) { void Builtins::Generate_ConstructProxy(MacroAssembler* masm) {
// ----------- S t a t e ------------- // ----------- S t a t e -------------
// -- eax : the number of arguments (not including the receiver) // -- eax : the number of arguments (not including the receiver)
// -- edx : the original constructor (either the same as the constructor or // -- edx : the new target (either the same as the constructor or
// the JSFunction on which new was invoked initially) // the JSFunction on which new was invoked initially)
// -- edi : the constructor to call (checked to be a JSFunctionProxy) // -- edi : the constructor to call (checked to be a JSFunctionProxy)
// ----------------------------------- // -----------------------------------
...@@ -1704,7 +1704,7 @@ void Builtins::Generate_ConstructProxy(MacroAssembler* masm) { ...@@ -1704,7 +1704,7 @@ void Builtins::Generate_ConstructProxy(MacroAssembler* masm) {
void Builtins::Generate_Construct(MacroAssembler* masm) { void Builtins::Generate_Construct(MacroAssembler* masm) {
// ----------- S t a t e ------------- // ----------- S t a t e -------------
// -- eax : the number of arguments (not including the receiver) // -- eax : the number of arguments (not including the receiver)
// -- edx : the original constructor (either the same as the constructor or // -- edx : the new target (either the same as the constructor or
// the JSFunction on which new was invoked initially) // the JSFunction on which new was invoked initially)
// -- edi : the constructor to call (can be any Object) // -- edi : the constructor to call (can be any Object)
// ----------------------------------- // -----------------------------------
......
...@@ -1739,7 +1739,7 @@ static void GenerateRecordCallTarget(MacroAssembler* masm, bool is_super) { ...@@ -1739,7 +1739,7 @@ static void GenerateRecordCallTarget(MacroAssembler* masm, bool is_super) {
void CallConstructStub::Generate(MacroAssembler* masm) { void CallConstructStub::Generate(MacroAssembler* masm) {
// eax : number of arguments // eax : number of arguments
// ebx : feedback vector // ebx : feedback vector
// ecx : original constructor (for IsSuperConstructorCall) // ecx : new target (for IsSuperConstructorCall)
// edx : slot in feedback vector (Smi, for RecordCallTarget) // edx : slot in feedback vector (Smi, for RecordCallTarget)
// edi : constructor function // edi : constructor function
...@@ -1774,7 +1774,7 @@ void CallConstructStub::Generate(MacroAssembler* masm) { ...@@ -1774,7 +1774,7 @@ void CallConstructStub::Generate(MacroAssembler* masm) {
if (IsSuperConstructorCall()) { if (IsSuperConstructorCall()) {
__ pop(edx); __ pop(edx);
} else { } else {
// Pass original constructor to construct stub. // Pass new target to construct stub.
__ mov(edx, edi); __ mov(edx, edi);
} }
......
...@@ -191,7 +191,7 @@ void CallConstructDescriptor::InitializePlatformSpecific( ...@@ -191,7 +191,7 @@ void CallConstructDescriptor::InitializePlatformSpecific(
CallInterfaceDescriptorData* data) { CallInterfaceDescriptorData* data) {
// eax : number of arguments // eax : number of arguments
// ebx : feedback vector // ebx : feedback vector
// ecx : original constructor (for IsSuperConstructorCall) // ecx : new target (for IsSuperConstructorCall)
// edx : slot in feedback vector (Smi, for RecordCallTarget) // edx : slot in feedback vector (Smi, for RecordCallTarget)
// edi : constructor function // edi : constructor function
// TODO(turbofan): So far we don't gather type feedback and hence skip the // TODO(turbofan): So far we don't gather type feedback and hence skip the
...@@ -416,7 +416,7 @@ void InterpreterPushArgsAndConstructDescriptor::InitializePlatformSpecific( ...@@ -416,7 +416,7 @@ void InterpreterPushArgsAndConstructDescriptor::InitializePlatformSpecific(
CallInterfaceDescriptorData* data) { CallInterfaceDescriptorData* data) {
Register registers[] = { Register registers[] = {
eax, // argument count (not including receiver) eax, // argument count (not including receiver)
edx, // original constructor edx, // new target
edi, // constructor edi, // constructor
ebx, // address of first argument ebx, // address of first argument
}; };
......
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