| OLD | NEW |
| 1 // Copyright 2014 the V8 project authors. All rights reserved. | 1 // Copyright 2014 the V8 project authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "src/v8.h" | 5 #include "src/v8.h" |
| 6 | 6 |
| 7 #if V8_TARGET_ARCH_X64 | 7 #if V8_TARGET_ARCH_X64 |
| 8 | 8 |
| 9 #include "src/ic/ic.h" | 9 #include "src/ic/ic.h" |
| 10 #include "src/ic/ic-compiler.h" | 10 #include "src/ic/ic-compiler.h" |
| (...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 100 // Polymorphic keyed stores may use the map register | 100 // Polymorphic keyed stores may use the map register |
| 101 Register map_reg = scratch1(); | 101 Register map_reg = scratch1(); |
| 102 DCHECK(kind() != Code::KEYED_STORE_IC || | 102 DCHECK(kind() != Code::KEYED_STORE_IC || |
| 103 map_reg.is(ElementTransitionAndStoreDescriptor::MapRegister())); | 103 map_reg.is(ElementTransitionAndStoreDescriptor::MapRegister())); |
| 104 __ movp(map_reg, FieldOperand(receiver(), HeapObject::kMapOffset)); | 104 __ movp(map_reg, FieldOperand(receiver(), HeapObject::kMapOffset)); |
| 105 int receiver_count = types->length(); | 105 int receiver_count = types->length(); |
| 106 int number_of_handled_maps = 0; | 106 int number_of_handled_maps = 0; |
| 107 for (int current = 0; current < receiver_count; ++current) { | 107 for (int current = 0; current < receiver_count; ++current) { |
| 108 Handle<HeapType> type = types->at(current); | 108 Handle<HeapType> type = types->at(current); |
| 109 Handle<Map> map = IC::TypeToMap(*type, isolate()); | 109 Handle<Map> map = IC::TypeToMap(*type, isolate()); |
| 110 Handle<WeakCell> cell = Map::WeakCellForMap(map); |
| 110 if (!map->is_deprecated()) { | 111 if (!map->is_deprecated()) { |
| 111 number_of_handled_maps++; | 112 number_of_handled_maps++; |
| 112 // Check map and tail call if there's a match | 113 // Check map and tail call if there's a match |
| 113 __ Cmp(map_reg, map); | 114 __ CmpWeakValue(map_reg, scratch2(), cell); |
| 114 if (type->Is(HeapType::Number())) { | 115 if (type->Is(HeapType::Number())) { |
| 115 DCHECK(!number_case.is_unused()); | 116 DCHECK(!number_case.is_unused()); |
| 116 __ bind(&number_case); | 117 __ bind(&number_case); |
| 117 } | 118 } |
| 118 __ j(equal, handlers->at(current), RelocInfo::CODE_TARGET); | 119 __ j(equal, handlers->at(current), RelocInfo::CODE_TARGET); |
| 119 } | 120 } |
| 120 } | 121 } |
| 121 DCHECK(number_of_handled_maps > 0); | 122 DCHECK(number_of_handled_maps > 0); |
| 122 | 123 |
| 123 __ bind(&miss); | 124 __ bind(&miss); |
| 124 TailCallBuiltin(masm(), MissBuiltin(kind())); | 125 TailCallBuiltin(masm(), MissBuiltin(kind())); |
| 125 | 126 |
| 126 // Return the generated code. | 127 // Return the generated code. |
| 127 InlineCacheState state = | 128 InlineCacheState state = |
| 128 number_of_handled_maps > 1 ? POLYMORPHIC : MONOMORPHIC; | 129 number_of_handled_maps > 1 ? POLYMORPHIC : MONOMORPHIC; |
| 129 return GetCode(kind(), type, name, state); | 130 return GetCode(kind(), type, name, state); |
| 130 } | 131 } |
| 131 | 132 |
| 132 | 133 |
| 133 #undef __ | 134 #undef __ |
| 134 } | 135 } |
| 135 } // namespace v8::internal | 136 } // namespace v8::internal |
| 136 | 137 |
| 137 #endif // V8_TARGET_ARCH_X64 | 138 #endif // V8_TARGET_ARCH_X64 |
| OLD | NEW |