Index: src/arm/stub-cache-arm.cc |
diff --git a/src/arm/stub-cache-arm.cc b/src/arm/stub-cache-arm.cc |
index 20e2801826c26e8f85af0978e4d707447bef8fc8..b7ec5d245a9fe7c3584d18d191da6f6edd956bdd 100644 |
--- a/src/arm/stub-cache-arm.cc |
+++ b/src/arm/stub-cache-arm.cc |
@@ -1332,11 +1332,10 @@ void CallStubCompiler::GenerateLoadFunctionFromCell(JSGlobalPropertyCell* cell, |
MaybeObject* CallStubCompiler::GenerateMissBranch() { |
+ MaybeObject* maybe_obj = StubCache::ComputeCallMiss(arguments().immediate(), |
+ kind_); |
Object* obj; |
- { MaybeObject* maybe_obj = |
- StubCache::ComputeCallMiss(arguments().immediate(), kind_); |
- if (!maybe_obj->ToObject(&obj)) return maybe_obj; |
- } |
+ if (!maybe_obj->ToObject(&obj)) return maybe_obj; |
__ Jump(Handle<Code>(Code::cast(obj)), RelocInfo::CODE_TARGET); |
return obj; |
} |
@@ -1646,8 +1645,15 @@ MaybeObject* CallStubCompiler::CompileStringCharCodeAtCall( |
const int argc = arguments().immediate(); |
Label miss; |
+ Label name_miss; |
Label index_out_of_range; |
- GenerateNameCheck(name, &miss); |
+ Label* index_out_of_range_label = &index_out_of_range; |
+ |
+ if (kind_ == Code::CALL_IC && extra_ic_state_ == DEFAULT_STRING_STUB) { |
+ index_out_of_range_label = &miss; |
+ } |
+ |
+ GenerateNameCheck(name, &name_miss); |
// Check that the maps starting from the prototype haven't changed. |
GenerateDirectLoadGlobalFunctionPrototype(masm(), |
@@ -1675,7 +1681,7 @@ MaybeObject* CallStubCompiler::CompileStringCharCodeAtCall( |
result, |
&miss, // When not a string. |
&miss, // When not a number. |
- &index_out_of_range, |
+ index_out_of_range_label, |
STRING_INDEX_IS_NUMBER); |
char_code_at_generator.GenerateFast(masm()); |
__ Drop(argc + 1); |
@@ -1684,12 +1690,17 @@ MaybeObject* CallStubCompiler::CompileStringCharCodeAtCall( |
StubRuntimeCallHelper call_helper; |
char_code_at_generator.GenerateSlow(masm(), call_helper); |
- __ bind(&index_out_of_range); |
- __ LoadRoot(r0, Heap::kNanValueRootIndex); |
- __ Drop(argc + 1); |
- __ Ret(); |
+ if (index_out_of_range.is_linked()) { |
+ __ bind(&index_out_of_range); |
+ __ LoadRoot(r0, Heap::kNanValueRootIndex); |
+ __ Drop(argc + 1); |
+ __ Ret(); |
+ } |
__ bind(&miss); |
+ // Restore function name in r2. |
+ __ Move(r2, Handle<String>(name)); |
+ __ bind(&name_miss); |
Object* obj; |
{ MaybeObject* maybe_obj = GenerateMissBranch(); |
if (!maybe_obj->ToObject(&obj)) return maybe_obj; |
@@ -1720,9 +1731,15 @@ MaybeObject* CallStubCompiler::CompileStringCharAtCall( |
const int argc = arguments().immediate(); |
Label miss; |
+ Label name_miss; |
Label index_out_of_range; |
+ Label* index_out_of_range_label = &index_out_of_range; |
- GenerateNameCheck(name, &miss); |
+ if (kind_ == Code::CALL_IC && extra_ic_state_ == DEFAULT_STRING_STUB) { |
+ index_out_of_range_label = &miss; |
+ } |
+ |
+ GenerateNameCheck(name, &name_miss); |
// Check that the maps starting from the prototype haven't changed. |
GenerateDirectLoadGlobalFunctionPrototype(masm(), |
@@ -1752,7 +1769,7 @@ MaybeObject* CallStubCompiler::CompileStringCharAtCall( |
result, |
&miss, // When not a string. |
&miss, // When not a number. |
- &index_out_of_range, |
+ index_out_of_range_label, |
STRING_INDEX_IS_NUMBER); |
char_at_generator.GenerateFast(masm()); |
__ Drop(argc + 1); |
@@ -1761,12 +1778,17 @@ MaybeObject* CallStubCompiler::CompileStringCharAtCall( |
StubRuntimeCallHelper call_helper; |
char_at_generator.GenerateSlow(masm(), call_helper); |
- __ bind(&index_out_of_range); |
- __ LoadRoot(r0, Heap::kEmptyStringRootIndex); |
- __ Drop(argc + 1); |
- __ Ret(); |
+ if (index_out_of_range.is_linked()) { |
+ __ bind(&index_out_of_range); |
+ __ LoadRoot(r0, Heap::kEmptyStringRootIndex); |
+ __ Drop(argc + 1); |
+ __ Ret(); |
+ } |
__ bind(&miss); |
+ // Restore function name in r2. |
+ __ Move(r2, Handle<String>(name)); |
+ __ bind(&name_miss); |
Object* obj; |
{ MaybeObject* maybe_obj = GenerateMissBranch(); |
if (!maybe_obj->ToObject(&obj)) return maybe_obj; |