| 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 24 matching lines...) Expand all  Loading... | 
|   35  |   35  | 
|   36  |   36  | 
|   37 #undef __ |   37 #undef __ | 
|   38 #define __ ACCESS_MASM(masm()) |   38 #define __ ACCESS_MASM(masm()) | 
|   39  |   39  | 
|   40  |   40  | 
|   41 Handle<Code> PropertyICCompiler::CompileKeyedStorePolymorphic( |   41 Handle<Code> PropertyICCompiler::CompileKeyedStorePolymorphic( | 
|   42     MapHandleList* receiver_maps, CodeHandleList* handler_stubs, |   42     MapHandleList* receiver_maps, CodeHandleList* handler_stubs, | 
|   43     MapHandleList* transitioned_maps) { |   43     MapHandleList* transitioned_maps) { | 
|   44   Label miss; |   44   Label miss; | 
|   45   __ JumpIfSmi(receiver(), &miss, Label::kNear); |   45   __ JumpIfSmi(receiver(), &miss); | 
|   46  |   46  | 
|   47   __ movp(scratch1(), FieldOperand(receiver(), HeapObject::kMapOffset)); |   47   Register map_reg = scratch1(); | 
 |   48   __ movp(map_reg, FieldOperand(receiver(), HeapObject::kMapOffset)); | 
|   48   int receiver_count = receiver_maps->length(); |   49   int receiver_count = receiver_maps->length(); | 
|   49   for (int i = 0; i < receiver_count; ++i) { |   50   for (int i = 0; i < receiver_count; ++i) { | 
 |   51     Handle<WeakCell> cell = Map::WeakCellForMap(receiver_maps->at(i)); | 
|   50     // Check map and tail call if there's a match |   52     // Check map and tail call if there's a match | 
|   51     __ Cmp(scratch1(), receiver_maps->at(i)); |   53     __ CmpWeakValue(map_reg, cell, scratch2()); | 
|   52     if (transitioned_maps->at(i).is_null()) { |   54     if (transitioned_maps->at(i).is_null()) { | 
|   53       __ j(equal, handler_stubs->at(i), RelocInfo::CODE_TARGET); |   55       __ j(equal, handler_stubs->at(i), RelocInfo::CODE_TARGET); | 
|   54     } else { |   56     } else { | 
|   55       Label next_map; |   57       Label next_map; | 
|   56       __ j(not_equal, &next_map, Label::kNear); |   58       __ j(not_equal, &next_map, Label::kNear); | 
|   57       __ Move(transition_map(), transitioned_maps->at(i), |   59       Handle<WeakCell> cell = Map::WeakCellForMap(transitioned_maps->at(i)); | 
|   58               RelocInfo::EMBEDDED_OBJECT); |   60       __ LoadWeakValue(transition_map(), cell, &miss); | 
|   59       __ jmp(handler_stubs->at(i), RelocInfo::CODE_TARGET); |   61       __ jmp(handler_stubs->at(i), RelocInfo::CODE_TARGET); | 
|   60       __ bind(&next_map); |   62       __ bind(&next_map); | 
|   61     } |   63     } | 
|   62   } |   64   } | 
|   63  |   65  | 
|   64   __ bind(&miss); |   66   __ bind(&miss); | 
|   65  |   67  | 
|   66   TailCallBuiltin(masm(), MissBuiltin(kind())); |   68   TailCallBuiltin(masm(), MissBuiltin(kind())); | 
|   67  |   69  | 
|   68   // Return the generated code. |   70   // Return the generated code. | 
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|  102   DCHECK(kind() != Code::KEYED_STORE_IC || |  104   DCHECK(kind() != Code::KEYED_STORE_IC || | 
|  103          map_reg.is(ElementTransitionAndStoreDescriptor::MapRegister())); |  105          map_reg.is(ElementTransitionAndStoreDescriptor::MapRegister())); | 
|  104   __ movp(map_reg, FieldOperand(receiver(), HeapObject::kMapOffset)); |  106   __ movp(map_reg, FieldOperand(receiver(), HeapObject::kMapOffset)); | 
|  105   int receiver_count = types->length(); |  107   int receiver_count = types->length(); | 
|  106   int number_of_handled_maps = 0; |  108   int number_of_handled_maps = 0; | 
|  107   for (int current = 0; current < receiver_count; ++current) { |  109   for (int current = 0; current < receiver_count; ++current) { | 
|  108     Handle<HeapType> type = types->at(current); |  110     Handle<HeapType> type = types->at(current); | 
|  109     Handle<Map> map = IC::TypeToMap(*type, isolate()); |  111     Handle<Map> map = IC::TypeToMap(*type, isolate()); | 
|  110     if (!map->is_deprecated()) { |  112     if (!map->is_deprecated()) { | 
|  111       number_of_handled_maps++; |  113       number_of_handled_maps++; | 
 |  114       Handle<WeakCell> cell = Map::WeakCellForMap(map); | 
|  112       // Check map and tail call if there's a match |  115       // Check map and tail call if there's a match | 
|  113       __ Cmp(map_reg, map); |  116       __ CmpWeakValue(map_reg, cell, scratch2()); | 
|  114       if (type->Is(HeapType::Number())) { |  117       if (type->Is(HeapType::Number())) { | 
|  115         DCHECK(!number_case.is_unused()); |  118         DCHECK(!number_case.is_unused()); | 
|  116         __ bind(&number_case); |  119         __ bind(&number_case); | 
|  117       } |  120       } | 
|  118       __ j(equal, handlers->at(current), RelocInfo::CODE_TARGET); |  121       __ j(equal, handlers->at(current), RelocInfo::CODE_TARGET); | 
|  119     } |  122     } | 
|  120   } |  123   } | 
|  121   DCHECK(number_of_handled_maps > 0); |  124   DCHECK(number_of_handled_maps > 0); | 
|  122  |  125  | 
|  123   __ bind(&miss); |  126   __ bind(&miss); | 
|  124   TailCallBuiltin(masm(), MissBuiltin(kind())); |  127   TailCallBuiltin(masm(), MissBuiltin(kind())); | 
|  125  |  128  | 
|  126   // Return the generated code. |  129   // Return the generated code. | 
|  127   InlineCacheState state = |  130   InlineCacheState state = | 
|  128       number_of_handled_maps > 1 ? POLYMORPHIC : MONOMORPHIC; |  131       number_of_handled_maps > 1 ? POLYMORPHIC : MONOMORPHIC; | 
|  129   return GetCode(kind(), type, name, state); |  132   return GetCode(kind(), type, name, state); | 
|  130 } |  133 } | 
|  131  |  134  | 
|  132  |  135  | 
|  133 #undef __ |  136 #undef __ | 
|  134 } |  137 } | 
|  135 }  // namespace v8::internal |  138 }  // namespace v8::internal | 
|  136  |  139  | 
|  137 #endif  // V8_TARGET_ARCH_X64 |  140 #endif  // V8_TARGET_ARCH_X64 | 
| OLD | NEW |