Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(130)

Unified Diff: src/x64/builtins-x64.cc

Issue 1213623020: Remove separate construct stub for new.target users. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Ported to all architectures. Created 5 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/mips64/builtins-mips64.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/x64/builtins-x64.cc
diff --git a/src/x64/builtins-x64.cc b/src/x64/builtins-x64.cc
index fa957a1b67bef96dfdfa2dd1e5ab36d6144adb00..704b1c7229354ee97771ff211373c755626def3b 100644
--- a/src/x64/builtins-x64.cc
+++ b/src/x64/builtins-x64.cc
@@ -104,12 +104,12 @@ static void Generate_Runtime_NewObject(MacroAssembler* masm,
Register original_constructor,
Label* count_incremented,
Label* allocated) {
- int offset = 0;
+ int offset = kPointerSize;
if (create_memento) {
// Get the cell or allocation site.
- __ movp(rdi, Operand(rsp, kPointerSize * 2));
+ __ movp(rdi, Operand(rsp, kPointerSize * 3));
__ Push(rdi);
- offset = kPointerSize;
+ offset += kPointerSize;
}
// Must restore rsi (context) and rdi (constructor) before calling runtime.
@@ -136,7 +136,6 @@ static void Generate_Runtime_NewObject(MacroAssembler* masm,
static void Generate_JSConstructStubHelper(MacroAssembler* masm,
bool is_api_function,
- bool use_new_target,
bool create_memento) {
// ----------- S t a t e -------------
// -- rax: number of arguments
@@ -161,9 +160,7 @@ static void Generate_JSConstructStubHelper(MacroAssembler* masm,
__ Integer32ToSmi(rax, rax);
__ Push(rax);
__ Push(rdi);
- if (use_new_target) {
- __ Push(rdx);
- }
+ __ Push(rdx);
Label rt_call, normal_new, allocated, count_incremented;
__ cmpp(rdx, rdi);
@@ -390,8 +387,7 @@ static void Generate_JSConstructStubHelper(MacroAssembler* masm,
__ bind(&allocated);
if (create_memento) {
- int offset = (use_new_target ? 3 : 2) * kPointerSize;
- __ movp(rcx, Operand(rsp, offset));
+ __ movp(rcx, Operand(rsp, 3 * kPointerSize));
__ Cmp(rcx, masm->isolate()->factory()->undefined_value());
__ j(equal, &count_incremented);
// rcx is an AllocationSite. We are creating a memento from it, so we
@@ -403,9 +399,7 @@ static void Generate_JSConstructStubHelper(MacroAssembler* masm,
}
// Restore the parameters.
- if (use_new_target) {
- __ Pop(rdx);
- }
+ __ Pop(rdx);
__ Pop(rdi);
// Retrieve smi-tagged arguments count from the stack.
@@ -414,9 +408,7 @@ static void Generate_JSConstructStubHelper(MacroAssembler* masm,
// Push new.target onto the construct frame. This is stored just below the
// receiver on the stack.
- if (use_new_target) {
- __ Push(rdx);
- }
+ __ Push(rdx);
// Push the allocated receiver to the stack. We need two copies
// because we may have to return the original one and the calling
@@ -449,9 +441,7 @@ static void Generate_JSConstructStubHelper(MacroAssembler* masm,
}
// Store offset of return address for deoptimizer.
- // TODO(arv): Remove the "!use_new_target" before supporting optimization
- // of functions that reference new.target
- if (!is_api_function && !use_new_target) {
+ if (!is_api_function) {
masm->isolate()->heap()->SetConstructStubDeoptPCOffset(masm->pc_offset());
}
@@ -479,8 +469,7 @@ static void Generate_JSConstructStubHelper(MacroAssembler* masm,
// Restore the arguments count and leave the construct frame. The arguments
// count is stored below the reciever and the new.target.
__ bind(&exit);
- int offset = (use_new_target ? 2 : 1) * kPointerSize;
- __ movp(rbx, Operand(rsp, offset));
+ __ movp(rbx, Operand(rsp, 2 * kPointerSize));
// Leave construct frame.
}
@@ -497,17 +486,12 @@ static void Generate_JSConstructStubHelper(MacroAssembler* masm,
void Builtins::Generate_JSConstructStubGeneric(MacroAssembler* masm) {
- Generate_JSConstructStubHelper(masm, false, false, FLAG_pretenuring_call_new);
+ Generate_JSConstructStubHelper(masm, false, FLAG_pretenuring_call_new);
}
void Builtins::Generate_JSConstructStubApi(MacroAssembler* masm) {
- Generate_JSConstructStubHelper(masm, true, false, false);
-}
-
-
-void Builtins::Generate_JSConstructStubNewTarget(MacroAssembler* masm) {
- Generate_JSConstructStubHelper(masm, false, true, FLAG_pretenuring_call_new);
+ Generate_JSConstructStubHelper(masm, true, false);
}
« no previous file with comments | « src/mips64/builtins-mips64.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698