| 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 14 matching lines...) Expand all Loading... |
| 25 | 25 |
| 26 // Do tail-call to runtime routine. | 26 // Do tail-call to runtime routine. |
| 27 __ TailCallRuntime(Runtime::kSetProperty, 4, 1); | 27 __ TailCallRuntime(Runtime::kSetProperty, 4, 1); |
| 28 } | 28 } |
| 29 | 29 |
| 30 | 30 |
| 31 #undef __ | 31 #undef __ |
| 32 #define __ ACCESS_MASM(masm()) | 32 #define __ ACCESS_MASM(masm()) |
| 33 | 33 |
| 34 | 34 |
| 35 Handle<Code> PropertyICCompiler::CompilePolymorphic(TypeHandleList* types, | 35 Handle<Code> PropertyICCompiler::CompilePolymorphic(MapHandleList* maps, |
| 36 CodeHandleList* handlers, | 36 CodeHandleList* handlers, |
| 37 Handle<Name> name, | 37 Handle<Name> name, |
| 38 Code::StubType type, | 38 Code::StubType type, |
| 39 IcCheckType check) { | 39 IcCheckType check) { |
| 40 Label miss; | 40 Label miss; |
| 41 | 41 |
| 42 if (check == PROPERTY && | 42 if (check == PROPERTY && |
| 43 (kind() == Code::KEYED_LOAD_IC || kind() == Code::KEYED_STORE_IC)) { | 43 (kind() == Code::KEYED_LOAD_IC || kind() == Code::KEYED_STORE_IC)) { |
| 44 // In case we are compiling an IC for dictionary loads or stores, just | 44 // In case we are compiling an IC for dictionary loads or stores, just |
| 45 // check whether the name is unique. | 45 // check whether the name is unique. |
| 46 if (name.is_identical_to(isolate()->factory()->normal_ic_symbol())) { | 46 if (name.is_identical_to(isolate()->factory()->normal_ic_symbol())) { |
| 47 // Keyed loads with dictionaries shouldn't be here, they go generic. | 47 // Keyed loads with dictionaries shouldn't be here, they go generic. |
| 48 // The DCHECK is to protect assumptions when --vector-ics is on. | 48 // The DCHECK is to protect assumptions when --vector-ics is on. |
| 49 DCHECK(kind() != Code::KEYED_LOAD_IC); | 49 DCHECK(kind() != Code::KEYED_LOAD_IC); |
| 50 Register tmp = scratch1(); | 50 Register tmp = scratch1(); |
| 51 __ JumpIfSmi(this->name(), &miss); | 51 __ JumpIfSmi(this->name(), &miss); |
| 52 __ ldr(tmp, FieldMemOperand(this->name(), HeapObject::kMapOffset)); | 52 __ ldr(tmp, FieldMemOperand(this->name(), HeapObject::kMapOffset)); |
| 53 __ ldrb(tmp, FieldMemOperand(tmp, Map::kInstanceTypeOffset)); | 53 __ ldrb(tmp, FieldMemOperand(tmp, Map::kInstanceTypeOffset)); |
| 54 __ JumpIfNotUniqueNameInstanceType(tmp, &miss); | 54 __ JumpIfNotUniqueNameInstanceType(tmp, &miss); |
| 55 } else { | 55 } else { |
| 56 __ cmp(this->name(), Operand(name)); | 56 __ cmp(this->name(), Operand(name)); |
| 57 __ b(ne, &miss); | 57 __ b(ne, &miss); |
| 58 } | 58 } |
| 59 } | 59 } |
| 60 | 60 |
| 61 Label number_case; | 61 Label number_case; |
| 62 Label* smi_target = IncludesNumberType(types) ? &number_case : &miss; | 62 Label* smi_target = IncludesNumberMap(maps) ? &number_case : &miss; |
| 63 __ JumpIfSmi(receiver(), smi_target); | 63 __ JumpIfSmi(receiver(), smi_target); |
| 64 | 64 |
| 65 // Polymorphic keyed stores may use the map register | 65 // Polymorphic keyed stores may use the map register |
| 66 Register map_reg = scratch1(); | 66 Register map_reg = scratch1(); |
| 67 DCHECK(kind() != Code::KEYED_STORE_IC || | 67 DCHECK(kind() != Code::KEYED_STORE_IC || |
| 68 map_reg.is(ElementTransitionAndStoreDescriptor::MapRegister())); | 68 map_reg.is(ElementTransitionAndStoreDescriptor::MapRegister())); |
| 69 | 69 |
| 70 int receiver_count = types->length(); | 70 int receiver_count = maps->length(); |
| 71 int number_of_handled_maps = 0; | 71 int number_of_handled_maps = 0; |
| 72 __ ldr(map_reg, FieldMemOperand(receiver(), HeapObject::kMapOffset)); | 72 __ ldr(map_reg, FieldMemOperand(receiver(), HeapObject::kMapOffset)); |
| 73 for (int current = 0; current < receiver_count; ++current) { | 73 for (int current = 0; current < receiver_count; ++current) { |
| 74 Handle<HeapType> type = types->at(current); | 74 Handle<Map> map = maps->at(current); |
| 75 Handle<Map> map = IC::TypeToMap(*type, isolate()); | |
| 76 if (!map->is_deprecated()) { | 75 if (!map->is_deprecated()) { |
| 77 number_of_handled_maps++; | 76 number_of_handled_maps++; |
| 78 Handle<WeakCell> cell = Map::WeakCellForMap(map); | 77 Handle<WeakCell> cell = Map::WeakCellForMap(map); |
| 79 __ CmpWeakValue(map_reg, cell, scratch2()); | 78 __ CmpWeakValue(map_reg, cell, scratch2()); |
| 80 if (type->Is(HeapType::Number())) { | 79 if (map->instance_type() == HEAP_NUMBER_TYPE) { |
| 81 DCHECK(!number_case.is_unused()); | 80 DCHECK(!number_case.is_unused()); |
| 82 __ bind(&number_case); | 81 __ bind(&number_case); |
| 83 } | 82 } |
| 84 __ Jump(handlers->at(current), RelocInfo::CODE_TARGET, eq); | 83 __ Jump(handlers->at(current), RelocInfo::CODE_TARGET, eq); |
| 85 } | 84 } |
| 86 } | 85 } |
| 87 DCHECK(number_of_handled_maps != 0); | 86 DCHECK(number_of_handled_maps != 0); |
| 88 | 87 |
| 89 __ bind(&miss); | 88 __ bind(&miss); |
| 90 TailCallBuiltin(masm(), MissBuiltin(kind())); | 89 TailCallBuiltin(masm(), MissBuiltin(kind())); |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 126 // Return the generated code. | 125 // Return the generated code. |
| 127 return GetCode(kind(), Code::NORMAL, factory()->empty_string(), POLYMORPHIC); | 126 return GetCode(kind(), Code::NORMAL, factory()->empty_string(), POLYMORPHIC); |
| 128 } | 127 } |
| 129 | 128 |
| 130 | 129 |
| 131 #undef __ | 130 #undef __ |
| 132 } | 131 } |
| 133 } // namespace v8::internal | 132 } // namespace v8::internal |
| 134 | 133 |
| 135 #endif // V8_TARGET_ARCH_ARM | 134 #endif // V8_TARGET_ARCH_ARM |
| OLD | NEW |