Index: src/arm/builtins-arm.cc |
diff --git a/src/arm/builtins-arm.cc b/src/arm/builtins-arm.cc |
index 6333924ca0ddd203aa0eb20ecb747e38a0111953..4d7bc8ef2f22d7e7589108fa6df4b677c1033f89 100644 |
--- a/src/arm/builtins-arm.cc |
+++ b/src/arm/builtins-arm.cc |
@@ -480,15 +480,20 @@ void Builtins::Generate_InternalArrayCode(MacroAssembler* masm) { |
// Run the native code for the InternalArray function called as a normal |
// function. |
- ArrayNativeCode(masm, &generic_array_code); |
- |
- // Jump to the generic array code if the specialized code cannot handle the |
- // construction. |
- __ bind(&generic_array_code); |
- |
- Handle<Code> array_code = |
- masm->isolate()->builtins()->InternalArrayCodeGeneric(); |
- __ Jump(array_code, RelocInfo::CODE_TARGET); |
+ if (FLAG_optimize_constructed_arrays) { |
+ // tail call a stub |
+ InternalArrayConstructorStub stub(masm->isolate()); |
+ __ TailCallStub(&stub); |
+ } else { |
+ ArrayNativeCode(masm, &generic_array_code); |
+ |
+ // Jump to the generic array code if the specialized code cannot handle the |
+ // construction. |
+ __ bind(&generic_array_code); |
+ Handle<Code> array_code = |
+ masm->isolate()->builtins()->InternalArrayCodeGeneric(); |
+ __ Jump(array_code, RelocInfo::CODE_TARGET); |
+ } |
} |
@@ -513,15 +518,24 @@ void Builtins::Generate_ArrayCode(MacroAssembler* masm) { |
} |
// Run the native code for the Array function called as a normal function. |
- ArrayNativeCode(masm, &generic_array_code); |
- |
- // Jump to the generic array code if the specialized code cannot handle |
- // the construction. |
- __ bind(&generic_array_code); |
- |
- Handle<Code> array_code = |
- masm->isolate()->builtins()->ArrayCodeGeneric(); |
- __ Jump(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(r2, Operand(undefined_sentinel)); |
+ ArrayConstructorStub stub(masm->isolate()); |
+ __ TailCallStub(&stub); |
+ } else { |
+ ArrayNativeCode(masm, &generic_array_code); |
+ |
+ // Jump to the generic array code if the specialized code cannot handle |
+ // the construction. |
+ __ bind(&generic_array_code); |
+ Handle<Code> array_code = |
+ masm->isolate()->builtins()->ArrayCodeGeneric(); |
+ __ Jump(array_code, RelocInfo::CODE_TARGET); |
+ } |
} |