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

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

Issue 803933008: new classes: change semantics of super(...) call and add new.target to construct stub. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Platform ports Created 5 years, 11 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 | « no previous file | src/arm/code-stubs-arm.cc » ('j') | src/ia32/builtins-ia32.cc » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/arm/builtins-arm.cc
diff --git a/src/arm/builtins-arm.cc b/src/arm/builtins-arm.cc
index 8ce57d55447aa84ddeaed0c37e8d1d7fea917734..8e23e81cce6abb3a21e56efe71d79154fa10c3de 100644
--- a/src/arm/builtins-arm.cc
+++ b/src/arm/builtins-arm.cc
@@ -317,6 +317,7 @@ static void Generate_JSConstructStubHelper(MacroAssembler* masm,
// -- r0 : number of arguments
// -- r1 : constructor function
// -- r2 : allocation site or undefined
+ // -- r3 : original constructor
// -- lr : return address
// -- sp[...]: constructor arguments
// -----------------------------------
@@ -331,7 +332,7 @@ static void Generate_JSConstructStubHelper(MacroAssembler* masm,
FrameAndConstantPoolScope scope(masm, StackFrame::CONSTRUCT);
if (create_memento) {
- __ AssertUndefinedOrAllocationSite(r2, r3);
+ __ AssertUndefinedOrAllocationSite(r2, r4);
__ push(r2);
}
@@ -340,9 +341,40 @@ static void Generate_JSConstructStubHelper(MacroAssembler* masm,
__ push(r0); // Smi-tagged arguments count.
__ push(r1); // Constructor function.
+ Label rt_call, allocated, normal_new, count_incremented;
+ __ cmp(r1, r3);
+ __ b(eq, &normal_new);
+
+ // Original constructor and function are different.
+ {
+ if (create_memento) {
+ // Get the cell or allocation site.
+ __ ldr(r2, MemOperand(sp, 2 * kPointerSize));
+ __ push(r2);
+ }
+
+ __ push(r1); // argument for Runtime_NewObject
+ __ push(r3); // original constructor
+ if (create_memento) {
+ __ CallRuntime(Runtime::kNewObjectWithAllocationSite, 3);
+ } else {
+ __ CallRuntime(Runtime::kNewObject, 2);
+ }
+ __ mov(r4, r0);
+
+ // If we ended up using the runtime, and we want a memento, then the
+ // runtime call made it for us, and we shouldn't do create count
+ // increment.
+ if (create_memento) {
+ __ jmp(&count_incremented);
+ } else {
+ __ jmp(&allocated);
+ }
+ }
+ __ bind(&normal_new);
+
// Try to allocate the object without transitioning into C code. If any of
// the preconditions is not met, the code bails out to the runtime call.
- Label rt_call, allocated;
if (FLAG_inline_new) {
Label undo_allocation;
ExternalReference debug_step_in_fp =
@@ -576,17 +608,17 @@ static void Generate_JSConstructStubHelper(MacroAssembler* masm,
}
__ push(r1); // argument for Runtime_NewObject
+ __ push(r1); // original constructor
if (create_memento) {
- __ CallRuntime(Runtime::kNewObjectWithAllocationSite, 2);
+ __ CallRuntime(Runtime::kNewObjectWithAllocationSite, 3);
} else {
- __ CallRuntime(Runtime::kNewObject, 1);
+ __ CallRuntime(Runtime::kNewObject, 2);
}
__ mov(r4, r0);
// If we ended up using the runtime, and we want a memento, then the
// runtime call made it for us, and we shouldn't do create count
// increment.
- Label count_incremented;
if (create_memento) {
__ jmp(&count_incremented);
}
« no previous file with comments | « no previous file | src/arm/code-stubs-arm.cc » ('j') | src/ia32/builtins-ia32.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698