Index: src/x64/stub-cache-x64.cc |
diff --git a/src/x64/stub-cache-x64.cc b/src/x64/stub-cache-x64.cc |
index 889392ae4ff85dab2dfe4e4b098f28af972c49b7..f1ebd48cc4010867495d3656763ee619782ed595 100644 |
--- a/src/x64/stub-cache-x64.cc |
+++ b/src/x64/stub-cache-x64.cc |
@@ -3071,7 +3071,20 @@ Handle<Code> BaseLoadStoreStubCompiler::CompilePolymorphicIC( |
GenerateNameCheck(name, this->name(), &miss); |
} |
- __ JumpIfSmi(receiver(), &miss); |
+ Label number_case; |
+ Label* smi_target = &miss; |
+ for (int i = 0; i < receiver_maps->length(); ++i) { |
+ Handle<Map> map = receiver_maps->at(i); |
+ if (map.is_identical_to(isolate()->factory()->heap_number_map())) { |
+ // Indirectly jump to the number handler to ensure map / handler pairs are |
+ // still in sync, rather than off-by-one because of an extra handler in |
+ // the beginning of the stub. |
+ smi_target = &number_case; |
+ break; |
+ } |
+ } |
+ __ JumpIfSmi(receiver(), smi_target); |
+ |
Register map_reg = scratch1(); |
__ movq(map_reg, FieldOperand(receiver(), HeapObject::kMapOffset)); |
int receiver_count = receiver_maps->length(); |
@@ -3082,6 +3095,10 @@ Handle<Code> BaseLoadStoreStubCompiler::CompilePolymorphicIC( |
number_of_handled_maps++; |
// Check map and tail call if there's a match |
__ Cmp(map_reg, receiver_maps->at(current)); |
+ if (map.is_identical_to(isolate()->factory()->heap_number_map())) { |
+ ASSERT(!number_case.is_unused()); |
+ __ bind(&number_case); |
+ } |
__ j(equal, handlers->at(current), RelocInfo::CODE_TARGET); |
} |
} |