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

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

Issue 1440193003: [builtins] One runtime fallback is enough for the String constructor. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Use correct temp registers. 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/macro-assembler-ia32.h ('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 08f8e65359cf31743ee10d3a0a53c9f772d24a5c..541970dea91a850b1015637612e9855606e1d852 100644
--- a/src/mips/builtins-mips.cc
+++ b/src/mips/builtins-mips.cc
@@ -267,7 +267,11 @@ void Builtins::Generate_StringConstructor_ConstructStub(MacroAssembler* masm) {
__ bind(&done_convert);
}
- // 3. Allocate a JSValue wrapper for the string.
+ // 3. Check if original constructor and constructor differ.
+ Label new_object;
+ __ Branch(&new_object, ne, a1, Operand(a3));
+
+ // 4. Allocate a JSValue wrapper for the string.
{
// ----------- S t a t e -------------
// -- a0 : the first argument
@@ -275,14 +279,7 @@ void Builtins::Generate_StringConstructor_ConstructStub(MacroAssembler* masm) {
// -- a3 : original constructor
// -- ra : return address
// -----------------------------------
-
- 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);
+ __ Allocate(JSValue::kSize, v0, a2, t0, &new_object, TAG_OBJECT);
// Initialize the JSValue in eax.
__ LoadGlobalFunctionInitialMap(a1, a2, a3);
@@ -293,29 +290,18 @@ void Builtins::Generate_StringConstructor_ConstructStub(MacroAssembler* masm) {
__ Ret(USE_DELAY_SLOT);
__ sw(a0, FieldMemOperand(v0, JSValue::kValueOffset));
STATIC_ASSERT(JSValue::kSize == 4 * kPointerSize);
+ }
- // Fallback to the runtime to allocate in new space.
- __ bind(&allocate);
- {
- FrameScope scope(masm, StackFrame::INTERNAL);
- __ Move(a2, Smi::FromInt(JSValue::kSize));
- __ Push(a0, a1, a2);
- __ CallRuntime(Runtime::kAllocateInNewSpace, 1);
- __ 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));
+ // 5. Fallback to the runtime to create new object.
+ __ bind(&new_object);
+ {
+ FrameScope scope(masm, StackFrame::INTERNAL);
+ __ Push(a0, a1, a3); // first argument, constructor, original constructor
+ __ CallRuntime(Runtime::kNewObject, 2);
+ __ Pop(a0);
}
+ __ Ret(USE_DELAY_SLOT);
+ __ sw(a0, FieldMemOperand(v0, JSValue::kValueOffset));
}
« no previous file with comments | « src/ia32/macro-assembler-ia32.h ('k') | src/mips64/builtins-mips64.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698