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

Unified Diff: src/arm/builtins-arm.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 | « no previous file | src/arm64/builtins-arm64.cc » ('j') | no next file with comments »
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 4464816f725ed6d8a0816656eb2ef9fd43cf2d0b..2ead847cbfa1bc2711c5c51580490c2ab42d6a1d 100644
--- a/src/arm/builtins-arm.cc
+++ b/src/arm/builtins-arm.cc
@@ -251,7 +251,12 @@ 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;
+ __ cmp(r1, r3);
+ __ b(ne, &new_object);
+
+ // 4. Allocate a JSValue wrapper for the string.
{
// ----------- S t a t e -------------
// -- r2 : the first argument
@@ -259,15 +264,7 @@ void Builtins::Generate_StringConstructor_ConstructStub(MacroAssembler* masm) {
// -- r3 : original constructor
// -- lr : return address
// -----------------------------------
-
- Label allocate, done_allocate, rt_call;
-
- // Fall back to runtime if the original constructor and function differ.
- __ cmp(r1, r3);
- __ b(ne, &rt_call);
-
- __ Allocate(JSValue::kSize, r0, r3, r4, &allocate, TAG_OBJECT);
- __ bind(&done_allocate);
+ __ Allocate(JSValue::kSize, r0, r4, r5, &new_object, TAG_OBJECT);
// Initialize the JSValue in r0.
__ LoadGlobalFunctionInitialMap(r1, r3, r4);
@@ -278,30 +275,18 @@ void Builtins::Generate_StringConstructor_ConstructStub(MacroAssembler* masm) {
__ str(r2, FieldMemOperand(r0, JSValue::kValueOffset));
STATIC_ASSERT(JSValue::kSize == 4 * kPointerSize);
__ Ret();
+ }
- // Fallback to the runtime to allocate in new space.
- __ bind(&allocate);
- {
- FrameAndConstantPoolScope scope(masm, StackFrame::INTERNAL);
- __ Move(r3, Smi::FromInt(JSValue::kSize));
- __ Push(r1, r2, r3);
- __ CallRuntime(Runtime::kAllocateInNewSpace, 1);
- __ Pop(r1, r2);
- }
- __ b(&done_allocate);
-
- // Fallback to the runtime to create new object.
- __ bind(&rt_call);
- {
- FrameScope scope(masm, StackFrame::INTERNAL);
- __ Push(r1, r2);
- __ Push(r1, r3); // constructor function, original constructor
- __ CallRuntime(Runtime::kNewObject, 2);
- __ Pop(r1, r2);
- }
- __ str(r2, FieldMemOperand(r0, JSValue::kValueOffset));
- __ Ret();
+ // 5. Fallback to the runtime to create new object.
+ __ bind(&new_object);
+ {
+ FrameAndConstantPoolScope scope(masm, StackFrame::INTERNAL);
+ __ Push(r2, r1, r3); // first argument, constructor, original constructor
+ __ CallRuntime(Runtime::kNewObject, 2);
+ __ Pop(r2);
}
+ __ str(r2, FieldMemOperand(r0, JSValue::kValueOffset));
+ __ Ret();
}
« no previous file with comments | « no previous file | src/arm64/builtins-arm64.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698