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

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

Issue 1451603002: X87: [builtins] One runtime fallback is enough for the String constructor. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: 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/x87/macro-assembler-x87.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/x87/builtins-x87.cc
diff --git a/src/x87/builtins-x87.cc b/src/x87/builtins-x87.cc
index 12b41084b411487c7a47f3b8f58678e57b0b24bc..de1a5dfc4e1ecf359d95d9e599b44ef623878aa5 100644
--- a/src/x87/builtins-x87.cc
+++ b/src/x87/builtins-x87.cc
@@ -1407,22 +1407,19 @@ 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(edx, edi);
+ __ j(not_equal, &new_object);
+
+ // 4. Allocate a JSValue wrapper for the string.
{
// ----------- S t a t e -------------
// -- ebx : the first argument
// -- edi : constructor function
// -- edx : original constructor
// -----------------------------------
-
- Label allocate, done_allocate, rt_call;
-
- // Fall back to runtime if the original constructor and constructor differ.
- __ cmp(edx, edi);
- __ j(not_equal, &rt_call);
-
- __ Allocate(JSValue::kSize, eax, ecx, no_reg, &allocate, TAG_OBJECT);
- __ bind(&done_allocate);
+ __ Allocate(JSValue::kSize, eax, ecx, no_reg, &new_object, TAG_OBJECT);
// Initialize the JSValue in eax.
__ LoadGlobalFunctionInitialMap(edi, ecx);
@@ -1434,35 +1431,19 @@ void Builtins::Generate_StringConstructor_ConstructStub(MacroAssembler* masm) {
__ mov(FieldOperand(eax, JSValue::kValueOffset), ebx);
STATIC_ASSERT(JSValue::kSize == 4 * kPointerSize);
__ Ret();
+ }
- // Fallback to the runtime to allocate in new space.
- __ bind(&allocate);
- {
- FrameScope scope(masm, StackFrame::INTERNAL);
- __ Push(ebx);
- __ Push(edi);
- __ Push(Smi::FromInt(JSValue::kSize));
- __ CallRuntime(Runtime::kAllocateInNewSpace, 1);
- __ Pop(edi);
- __ Pop(ebx);
- }
- __ jmp(&done_allocate);
-
- // Fallback to the runtime to create new object.
- __ bind(&rt_call);
- {
- FrameScope scope(masm, StackFrame::INTERNAL);
- __ Push(ebx);
- __ Push(edi);
- __ Push(edi); // constructor function
- __ Push(edx); // original constructor
- __ CallRuntime(Runtime::kNewObject, 2);
- __ Pop(edi);
- __ Pop(ebx);
- }
- __ mov(FieldOperand(eax, JSValue::kValueOffset), ebx);
- __ Ret();
+ // 5. Fallback to the runtime to create new object.
+ __ bind(&new_object);
+ {
+ FrameScope scope(masm, StackFrame::INTERNAL);
+ __ Push(ebx); // the first argument
+ __ Push(edi); // constructor function
+ __ Push(edx); // original constructor
+ __ CallRuntime(Runtime::kNewObject, 2);
+ __ Pop(FieldOperand(eax, JSValue::kValueOffset));
}
+ __ Ret();
}
« no previous file with comments | « no previous file | src/x87/macro-assembler-x87.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698