Index: src/x64/stub-cache-x64.cc |
diff --git a/src/x64/stub-cache-x64.cc b/src/x64/stub-cache-x64.cc |
index 57cba142128c3f3d36adc1ad2d0de1a058fcf54f..05eaf0b348e0ba0955f3055c37d1ab2551123d3d 100644 |
--- a/src/x64/stub-cache-x64.cc |
+++ b/src/x64/stub-cache-x64.cc |
@@ -1327,8 +1327,8 @@ void CallStubCompiler::GenerateLoadFunctionFromCell(JSGlobalPropertyCell* cell, |
MaybeObject* CallStubCompiler::GenerateMissBranch() { |
- MaybeObject* maybe_obj = |
- StubCache::ComputeCallMiss(arguments().immediate(), kind_); |
+ MaybeObject* maybe_obj = StubCache::ComputeCallMiss(arguments().immediate(), |
+ kind_); |
Object* obj; |
if (!maybe_obj->ToObject(&obj)) return maybe_obj; |
__ Jump(Handle<Code>(Code::cast(obj)), RelocInfo::CODE_TARGET); |
@@ -1660,9 +1660,15 @@ MaybeObject* CallStubCompiler::CompileStringCharCodeAtCall( |
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(), |
@@ -1690,7 +1696,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()); |
__ ret((argc + 1) * kPointerSize); |
@@ -1698,11 +1704,16 @@ MaybeObject* CallStubCompiler::CompileStringCharCodeAtCall( |
StubRuntimeCallHelper call_helper; |
char_code_at_generator.GenerateSlow(masm(), call_helper); |
- __ bind(&index_out_of_range); |
- __ LoadRoot(rax, Heap::kNanValueRootIndex); |
- __ ret((argc + 1) * kPointerSize); |
+ if (index_out_of_range.is_linked()) { |
+ __ bind(&index_out_of_range); |
+ __ LoadRoot(rax, Heap::kNanValueRootIndex); |
+ __ ret((argc + 1) * kPointerSize); |
+ } |
__ bind(&miss); |
+ // Restore function name in rcx. |
+ __ Move(rcx, Handle<String>(name)); |
+ __ bind(&name_miss); |
Object* obj; |
{ MaybeObject* maybe_obj = GenerateMissBranch(); |
if (!maybe_obj->ToObject(&obj)) return maybe_obj; |
@@ -1733,9 +1744,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(), |
@@ -1765,7 +1782,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()); |
__ ret((argc + 1) * kPointerSize); |
@@ -1773,11 +1790,16 @@ MaybeObject* CallStubCompiler::CompileStringCharAtCall( |
StubRuntimeCallHelper call_helper; |
char_at_generator.GenerateSlow(masm(), call_helper); |
- __ bind(&index_out_of_range); |
- __ LoadRoot(rax, Heap::kEmptyStringRootIndex); |
- __ ret((argc + 1) * kPointerSize); |
+ if (index_out_of_range.is_linked()) { |
+ __ bind(&index_out_of_range); |
+ __ LoadRoot(rax, Heap::kEmptyStringRootIndex); |
+ __ ret((argc + 1) * kPointerSize); |
+ } |
__ bind(&miss); |
+ // Restore function name in rcx. |
+ __ Move(rcx, Handle<String>(name)); |
+ __ bind(&name_miss); |
Object* obj; |
{ MaybeObject* maybe_obj = GenerateMissBranch(); |
if (!maybe_obj->ToObject(&obj)) return maybe_obj; |