Index: src/x64/stub-cache-x64.cc |
diff --git a/src/x64/stub-cache-x64.cc b/src/x64/stub-cache-x64.cc |
index 4e440c5b5277312631787baa96a49376e807f048..51a21461d3c88aeb95252317ead705b2725c32a8 100644 |
--- a/src/x64/stub-cache-x64.cc |
+++ b/src/x64/stub-cache-x64.cc |
@@ -919,7 +919,9 @@ Register StubCompiler::CheckPrototypes(Handle<JSObject> object, |
Register scratch2, |
Handle<String> name, |
int save_at_depth, |
- Label* miss) { |
+ Label* miss, |
+ PrototypeCheckType check) { |
+ Handle<JSObject> first = object; |
// Make sure there's no overlap between holder and object registers. |
ASSERT(!scratch1.is(object_reg) && !scratch1.is(holder_reg)); |
ASSERT(!scratch2.is(object_reg) && !scratch2.is(holder_reg) |
@@ -968,8 +970,10 @@ Register StubCompiler::CheckPrototypes(Handle<JSObject> object, |
// Save the map in scratch1 for later. |
__ movq(scratch1, FieldOperand(reg, HeapObject::kMapOffset)); |
} |
- __ CheckMap(reg, Handle<Map>(current_map), |
- miss, DONT_DO_SMI_CHECK, ALLOW_ELEMENT_TRANSITION_MAPS); |
+ if (!current.is_identical_to(first) || check == CHECK_ALL_MAPS) { |
+ __ CheckMap(reg, current_map, miss, DONT_DO_SMI_CHECK, |
+ ALLOW_ELEMENT_TRANSITION_MAPS); |
+ } |
// Check access rights to the global object. This has to happen after |
// the map check so that we know that the object is actually a global |
@@ -1137,8 +1141,8 @@ void BaseLoadStubCompiler::GenerateLoadCallback( |
} |
__ PushAddress(ExternalReference::isolate_address()); // isolate |
__ push(name()); // name |
- // Save a pointer to where we pushed the arguments pointer. |
- // This will be passed as the const AccessorInfo& to the C++ callback. |
+ // Save a pointer to where we pushed the arguments pointer. This will be |
+ // passed as the const ExecutableAccessorInfo& to the C++ callback. |
#if defined(__MINGW64__) |
Register accessor_info_arg = rdx; |
@@ -2882,31 +2886,30 @@ Handle<Code> KeyedLoadStubCompiler::CompileLoadElement( |
} |
-Handle<Code> KeyedLoadStubCompiler::CompileLoadPolymorphic( |
+Handle<Code> BaseLoadStubCompiler::CompilePolymorphicIC( |
MapHandleList* receiver_maps, |
- CodeHandleList* handler_ics) { |
- // ----------- S t a t e ------------- |
- // -- rax : key |
- // -- rdx : receiver |
- // -- rsp[0] : return address |
- // ----------------------------------- |
+ CodeHandleList* handlers, |
+ Handle<String> name, |
+ Code::StubType type) { |
Label miss; |
- __ JumpIfSmi(rdx, &miss); |
+ __ JumpIfSmi(receiver(), &miss); |
- Register map_reg = rbx; |
- __ movq(map_reg, FieldOperand(rdx, HeapObject::kMapOffset)); |
+ Register map_reg = scratch1(); |
+ __ movq(map_reg, FieldOperand(receiver(), HeapObject::kMapOffset)); |
int receiver_count = receiver_maps->length(); |
for (int current = 0; current < receiver_count; ++current) { |
// Check map and tail call if there's a match |
__ Cmp(map_reg, receiver_maps->at(current)); |
- __ j(equal, handler_ics->at(current), RelocInfo::CODE_TARGET); |
+ __ j(equal, handlers->at(current), RelocInfo::CODE_TARGET); |
} |
__ bind(&miss); |
- GenerateLoadMiss(masm(), Code::KEYED_LOAD_IC); |
+ GenerateLoadMiss(masm(), kind()); |
// Return the generated code. |
- return GetCode(Code::NORMAL, factory()->empty_string(), POLYMORPHIC); |
+ InlineCacheState state = |
+ receiver_maps->length() > 1 ? POLYMORPHIC : MONOMORPHIC; |
+ return GetCode(type, name, state); |
} |