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

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

Issue 1413033006: Reland "[es6] Better support for built-ins subclassing." (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: We don't need TypedArray map smashing anymore Created 5 years, 1 month 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/ia32/builtins-ia32.cc ('k') | src/mips64/builtins-mips64.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/mips/builtins-mips.cc
diff --git a/src/mips/builtins-mips.cc b/src/mips/builtins-mips.cc
index 2779e7e900f3137c76719b0040f6a3d06c1f0560..712ba8c2bb7284ac0924d1540811d6fb05b99b01 100644
--- a/src/mips/builtins-mips.cc
+++ b/src/mips/builtins-mips.cc
@@ -227,6 +227,7 @@ void Builtins::Generate_StringConstructor_ConstructStub(MacroAssembler* masm) {
// ----------- S t a t e -------------
// -- a0 : number of arguments
// -- a1 : constructor function
+ // -- a3 : original constructor
// -- ra : return address
// -- sp[(argc - n - 1) * 4] : arg[n] (zero based)
// -- sp[argc * 4] : receiver
@@ -260,10 +261,10 @@ void Builtins::Generate_StringConstructor_ConstructStub(MacroAssembler* masm) {
{
FrameScope scope(masm, StackFrame::INTERNAL);
ToStringStub stub(masm->isolate());
- __ Push(a1);
+ __ Push(a1, a3);
__ CallStub(&stub);
__ Move(a0, v0);
- __ Pop(a1);
+ __ Pop(a1, a3);
}
__ bind(&done_convert);
}
@@ -273,10 +274,15 @@ void Builtins::Generate_StringConstructor_ConstructStub(MacroAssembler* masm) {
// ----------- S t a t e -------------
// -- a0 : the first argument
// -- a1 : constructor function
+ // -- a3 : original constructor
// -- ra : return address
// -----------------------------------
- Label allocate, done_allocate;
+ Label allocate, done_allocate, rt_call;
+
+ // Fall back to runtime if the original constructor and function differ.
+ __ Branch(&rt_call, ne, a1, Operand(a3));
+
__ Allocate(JSValue::kSize, v0, a2, a3, &allocate, TAG_OBJECT);
__ bind(&done_allocate);
@@ -300,6 +306,17 @@ void Builtins::Generate_StringConstructor_ConstructStub(MacroAssembler* masm) {
__ Pop(a0, a1);
}
__ jmp(&done_allocate);
+
+ // Fallback to the runtime to create new object.
+ __ bind(&rt_call);
+ {
+ FrameScope scope(masm, StackFrame::INTERNAL);
+ __ Push(a0, a1, a1, a3); // constructor function, original constructor
+ __ CallRuntime(Runtime::kNewObject, 2);
+ __ Pop(a0, a1);
+ }
+ __ Ret(USE_DELAY_SLOT);
+ __ sw(a0, FieldMemOperand(v0, JSValue::kValueOffset));
}
}
@@ -510,7 +527,7 @@ static void Generate_JSConstructStubHelper(MacroAssembler* masm,
// a3: original constructor
__ bind(&rt_call);
- __ Push(a1, a3); // arguments 2-3 / 1-2
+ __ Push(a1, a3); // constructor function, original constructor
__ CallRuntime(Runtime::kNewObject, 2);
__ mov(t4, v0);
« no previous file with comments | « src/ia32/builtins-ia32.cc ('k') | src/mips64/builtins-mips64.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698