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

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

Issue 871693002: MIPS: 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: Fixed nits. 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 | « src/mips/full-codegen-mips.cc ('k') | src/mips64/code-stubs-mips64.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/mips64/builtins-mips64.cc
diff --git a/src/mips64/builtins-mips64.cc b/src/mips64/builtins-mips64.cc
index c95ff3078533c95a407006ceb856c10033588830..e34dbe89472f0c9051eda8479b4ee50df4b3f86d 100644
--- a/src/mips64/builtins-mips64.cc
+++ b/src/mips64/builtins-mips64.cc
@@ -314,6 +314,36 @@ void Builtins::Generate_InOptimizationQueue(MacroAssembler* masm) {
}
+static void Generate_Runtime_NewObject(MacroAssembler* masm,
+ bool create_memento,
+ Register original_constructor,
+ Label* count_incremented,
+ Label* allocated) {
+ if (create_memento) {
+ // Get the cell or allocation site.
+ __ ld(a2, MemOperand(sp, 2 * kPointerSize));
+ __ push(a2);
+ }
+
+ __ push(a1); // argument for Runtime_NewObject
+ __ push(original_constructor); // original constructor
+ if (create_memento) {
+ __ CallRuntime(Runtime::kNewObjectWithAllocationSite, 3);
+ } else {
+ __ CallRuntime(Runtime::kNewObject, 2);
+ }
+ __ mov(t0, v0);
+
+ // Runtime_NewObjectWithAllocationSite increments allocation count.
+ // Skip the increment.
+ if (create_memento) {
+ __ jmp(count_incremented);
+ } else {
+ __ jmp(allocated);
+ }
+}
+
+
static void Generate_JSConstructStubHelper(MacroAssembler* masm,
bool is_api_function,
bool create_memento) {
@@ -321,6 +351,7 @@ static void Generate_JSConstructStubHelper(MacroAssembler* masm,
// -- a0 : number of arguments
// -- a1 : constructor function
// -- a2 : allocation site or undefined
+ // -- a3 : original constructor
// -- ra : return address
// -- sp[...]: constructor arguments
// -----------------------------------
@@ -342,7 +373,7 @@ static void Generate_JSConstructStubHelper(MacroAssembler* masm,
FrameScope scope(masm, StackFrame::CONSTRUCT);
if (create_memento) {
- __ AssertUndefinedOrAllocationSite(a2, a3);
+ __ AssertUndefinedOrAllocationSite(a2, t0);
__ push(a2);
}
@@ -351,7 +382,14 @@ static void Generate_JSConstructStubHelper(MacroAssembler* masm,
__ dsll32(a0, a0, 0);
__ MultiPushReversed(a0.bit() | a1.bit());
- Label rt_call, allocated;
+ Label rt_call, allocated, normal_new, count_incremented;
+ __ Branch(&normal_new, eq, a1, Operand(a3));
+
+ // Original constructor and function are different.
+ Generate_Runtime_NewObject(masm, create_memento, a3, &count_incremented,
+ &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.
if (FLAG_inline_new) {
@@ -597,27 +635,9 @@ static void Generate_JSConstructStubHelper(MacroAssembler* masm,
// Allocate the new receiver object using the runtime call.
// a1: constructor function
__ bind(&rt_call);
- if (create_memento) {
- // Get the cell or allocation site.
- __ ld(a2, MemOperand(sp, 2 * kPointerSize));
- __ push(a2);
- }
-
- __ push(a1); // Argument for Runtime_NewObject.
- if (create_memento) {
- __ CallRuntime(Runtime::kNewObjectWithAllocationSite, 2);
- } else {
- __ CallRuntime(Runtime::kNewObject, 1);
- }
- __ mov(t0, v0);
+ Generate_Runtime_NewObject(masm, create_memento, a1, &count_incremented,
+ &allocated);
- // 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);
- }
// Receiver for constructor call allocated.
// t0: JSObject
« no previous file with comments | « src/mips/full-codegen-mips.cc ('k') | src/mips64/code-stubs-mips64.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698