Index: src/ia32/builtins-ia32.cc |
diff --git a/src/ia32/builtins-ia32.cc b/src/ia32/builtins-ia32.cc |
index 4420102eb095218815a3fbbe3c789d9637e39a21..bf4ee949ed29be5be0cf4b661922a30873f5ebec 100644 |
--- a/src/ia32/builtins-ia32.cc |
+++ b/src/ia32/builtins-ia32.cc |
@@ -1459,14 +1459,20 @@ void Builtins::Generate_InternalArrayCode(MacroAssembler* masm) { |
// Run the native code for the InternalArray function called as a normal |
// function. |
- ArrayNativeCode(masm, false, &generic_array_code); |
- |
- // Jump to the generic internal array code in case the specialized code cannot |
- // handle the construction. |
- __ bind(&generic_array_code); |
- Handle<Code> array_code = |
- masm->isolate()->builtins()->InternalArrayCodeGeneric(); |
- __ jmp(array_code, RelocInfo::CODE_TARGET); |
+ if (FLAG_optimize_constructed_arrays) { |
+ // tail call a stub |
+ InternalArrayConstructorStub stub(masm->isolate()); |
+ __ TailCallStub(&stub); |
+ } else { |
+ ArrayNativeCode(masm, false, &generic_array_code); |
+ |
+ // Jump to the generic internal array code in case the specialized code |
+ // cannot handle the construction. |
+ __ bind(&generic_array_code); |
+ Handle<Code> array_code = |
+ masm->isolate()->builtins()->InternalArrayCodeGeneric(); |
+ __ jmp(array_code, RelocInfo::CODE_TARGET); |
+ } |
} |
@@ -1492,14 +1498,24 @@ void Builtins::Generate_ArrayCode(MacroAssembler* masm) { |
} |
// Run the native code for the Array function called as a normal function. |
- ArrayNativeCode(masm, false, &generic_array_code); |
- |
- // Jump to the generic array code in case the specialized code cannot handle |
- // the construction. |
- __ bind(&generic_array_code); |
- Handle<Code> array_code = |
- masm->isolate()->builtins()->ArrayCodeGeneric(); |
- __ jmp(array_code, RelocInfo::CODE_TARGET); |
+ if (FLAG_optimize_constructed_arrays) { |
+ // tail call a stub |
+ Handle<Object> undefined_sentinel( |
+ masm->isolate()->heap()->undefined_value(), |
+ masm->isolate()); |
+ __ mov(ebx, Immediate(undefined_sentinel)); |
+ ArrayConstructorStub stub(masm->isolate()); |
+ __ TailCallStub(&stub); |
+ } else { |
+ ArrayNativeCode(masm, false, &generic_array_code); |
+ |
+ // Jump to the generic internal array code in case the specialized code |
+ // cannot handle the construction. |
+ __ bind(&generic_array_code); |
+ Handle<Code> array_code = |
+ masm->isolate()->builtins()->ArrayCodeGeneric(); |
+ __ jmp(array_code, RelocInfo::CODE_TARGET); |
+ } |
} |