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

Unified Diff: src/ia32/builtins-ia32.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/arm64/builtins-arm64.cc ('k') | src/ia32/macro-assembler-ia32.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/ia32/builtins-ia32.cc
diff --git a/src/ia32/builtins-ia32.cc b/src/ia32/builtins-ia32.cc
index 4da4cb1db2b98eaf30861fc1f6be7f507e76f48d..687a2ca81f5a20b1eb0bbf2cfdd3285394f97ab8 100644
--- a/src/ia32/builtins-ia32.cc
+++ b/src/ia32/builtins-ia32.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 | « src/arm64/builtins-arm64.cc ('k') | src/ia32/macro-assembler-ia32.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698