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_ARM | 7 #if V8_TARGET_ARCH_ARM |
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 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
65 map_reg.is(ElementTransitionAndStoreDescriptor::MapRegister())); | 65 map_reg.is(ElementTransitionAndStoreDescriptor::MapRegister())); |
66 | 66 |
67 int receiver_count = types->length(); | 67 int receiver_count = types->length(); |
68 int number_of_handled_maps = 0; | 68 int number_of_handled_maps = 0; |
69 __ ldr(map_reg, FieldMemOperand(receiver(), HeapObject::kMapOffset)); | 69 __ ldr(map_reg, FieldMemOperand(receiver(), HeapObject::kMapOffset)); |
70 for (int current = 0; current < receiver_count; ++current) { | 70 for (int current = 0; current < receiver_count; ++current) { |
71 Handle<HeapType> type = types->at(current); | 71 Handle<HeapType> type = types->at(current); |
72 Handle<Map> map = IC::TypeToMap(*type, isolate()); | 72 Handle<Map> map = IC::TypeToMap(*type, isolate()); |
73 if (!map->is_deprecated()) { | 73 if (!map->is_deprecated()) { |
74 number_of_handled_maps++; | 74 number_of_handled_maps++; |
75 __ mov(ip, Operand(map)); | 75 Handle<WeakCell> cell = Map::WeakCellForMap(map); |
76 __ cmp(map_reg, ip); | 76 __ CmpWeakValue(map_reg, cell, scratch2()); |
77 if (type->Is(HeapType::Number())) { | 77 if (type->Is(HeapType::Number())) { |
78 DCHECK(!number_case.is_unused()); | 78 DCHECK(!number_case.is_unused()); |
79 __ bind(&number_case); | 79 __ bind(&number_case); |
80 } | 80 } |
81 __ Jump(handlers->at(current), RelocInfo::CODE_TARGET, eq); | 81 __ Jump(handlers->at(current), RelocInfo::CODE_TARGET, eq); |
82 } | 82 } |
83 } | 83 } |
84 DCHECK(number_of_handled_maps != 0); | 84 DCHECK(number_of_handled_maps != 0); |
85 | 85 |
86 __ bind(&miss); | 86 __ bind(&miss); |
87 TailCallBuiltin(masm(), MissBuiltin(kind())); | 87 TailCallBuiltin(masm(), MissBuiltin(kind())); |
88 | 88 |
89 // Return the generated code. | 89 // Return the generated code. |
90 InlineCacheState state = | 90 InlineCacheState state = |
91 number_of_handled_maps > 1 ? POLYMORPHIC : MONOMORPHIC; | 91 number_of_handled_maps > 1 ? POLYMORPHIC : MONOMORPHIC; |
92 return GetCode(kind(), type, name, state); | 92 return GetCode(kind(), type, name, state); |
93 } | 93 } |
94 | 94 |
95 | 95 |
96 Handle<Code> PropertyICCompiler::CompileKeyedStorePolymorphic( | 96 Handle<Code> PropertyICCompiler::CompileKeyedStorePolymorphic( |
97 MapHandleList* receiver_maps, CodeHandleList* handler_stubs, | 97 MapHandleList* receiver_maps, CodeHandleList* handler_stubs, |
98 MapHandleList* transitioned_maps) { | 98 MapHandleList* transitioned_maps) { |
99 Label miss; | 99 Label miss; |
100 __ JumpIfSmi(receiver(), &miss); | 100 __ JumpIfSmi(receiver(), &miss); |
101 | 101 |
102 int receiver_count = receiver_maps->length(); | 102 int receiver_count = receiver_maps->length(); |
103 __ ldr(scratch1(), FieldMemOperand(receiver(), HeapObject::kMapOffset)); | 103 Register map_reg = scratch1(); |
| 104 __ ldr(map_reg, FieldMemOperand(receiver(), HeapObject::kMapOffset)); |
104 for (int i = 0; i < receiver_count; ++i) { | 105 for (int i = 0; i < receiver_count; ++i) { |
105 __ mov(ip, Operand(receiver_maps->at(i))); | 106 Handle<WeakCell> cell = Map::WeakCellForMap(receiver_maps->at(i)); |
106 __ cmp(scratch1(), ip); | 107 __ CmpWeakValue(map_reg, cell, scratch2()); |
107 if (transitioned_maps->at(i).is_null()) { | 108 if (transitioned_maps->at(i).is_null()) { |
108 __ Jump(handler_stubs->at(i), RelocInfo::CODE_TARGET, eq); | 109 __ Jump(handler_stubs->at(i), RelocInfo::CODE_TARGET, eq); |
109 } else { | 110 } else { |
110 Label next_map; | 111 Label next_map; |
111 __ b(ne, &next_map); | 112 __ b(ne, &next_map); |
112 __ mov(transition_map(), Operand(transitioned_maps->at(i))); | 113 Handle<WeakCell> cell = Map::WeakCellForMap(transitioned_maps->at(i)); |
| 114 __ LoadWeakValue(transition_map(), cell, &miss); |
113 __ Jump(handler_stubs->at(i), RelocInfo::CODE_TARGET, al); | 115 __ Jump(handler_stubs->at(i), RelocInfo::CODE_TARGET, al); |
114 __ bind(&next_map); | 116 __ bind(&next_map); |
115 } | 117 } |
116 } | 118 } |
117 | 119 |
118 __ bind(&miss); | 120 __ bind(&miss); |
119 TailCallBuiltin(masm(), MissBuiltin(kind())); | 121 TailCallBuiltin(masm(), MissBuiltin(kind())); |
120 | 122 |
121 // Return the generated code. | 123 // Return the generated code. |
122 return GetCode(kind(), Code::NORMAL, factory()->empty_string(), POLYMORPHIC); | 124 return GetCode(kind(), Code::NORMAL, factory()->empty_string(), POLYMORPHIC); |
123 } | 125 } |
124 | 126 |
125 | 127 |
126 #undef __ | 128 #undef __ |
127 } | 129 } |
128 } // namespace v8::internal | 130 } // namespace v8::internal |
129 | 131 |
130 #endif // V8_TARGET_ARCH_ARM | 132 #endif // V8_TARGET_ARCH_ARM |
OLD | NEW |