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_ARM64 | 7 #if V8_TARGET_ARCH_ARM64 |
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 15 matching lines...) Expand all Loading... |
26 | 26 |
27 // Do tail-call to runtime routine. | 27 // Do tail-call to runtime routine. |
28 __ TailCallRuntime(Runtime::kSetProperty, 4, 1); | 28 __ TailCallRuntime(Runtime::kSetProperty, 4, 1); |
29 } | 29 } |
30 | 30 |
31 | 31 |
32 #undef __ | 32 #undef __ |
33 #define __ ACCESS_MASM(masm()) | 33 #define __ ACCESS_MASM(masm()) |
34 | 34 |
35 | 35 |
36 Handle<Code> PropertyICCompiler::CompilePolymorphic(TypeHandleList* types, | 36 Handle<Code> PropertyICCompiler::CompilePolymorphic(MapHandleList* maps, |
37 CodeHandleList* handlers, | 37 CodeHandleList* handlers, |
38 Handle<Name> name, | 38 Handle<Name> name, |
39 Code::StubType type, | 39 Code::StubType type, |
40 IcCheckType check) { | 40 IcCheckType check) { |
41 Label miss; | 41 Label miss; |
42 | 42 |
43 if (check == PROPERTY && | 43 if (check == PROPERTY && |
44 (kind() == Code::KEYED_LOAD_IC || kind() == Code::KEYED_STORE_IC)) { | 44 (kind() == Code::KEYED_LOAD_IC || kind() == Code::KEYED_STORE_IC)) { |
45 // In case we are compiling an IC for dictionary loads or stores, just | 45 // In case we are compiling an IC for dictionary loads or stores, just |
46 // check whether the name is unique. | 46 // check whether the name is unique. |
47 if (name.is_identical_to(isolate()->factory()->normal_ic_symbol())) { | 47 if (name.is_identical_to(isolate()->factory()->normal_ic_symbol())) { |
48 // Keyed loads with dictionaries shouldn't be here, they go generic. | 48 // Keyed loads with dictionaries shouldn't be here, they go generic. |
49 // The DCHECK is to protect assumptions when --vector-ics is on. | 49 // The DCHECK is to protect assumptions when --vector-ics is on. |
50 DCHECK(kind() != Code::KEYED_LOAD_IC); | 50 DCHECK(kind() != Code::KEYED_LOAD_IC); |
51 Register tmp = scratch1(); | 51 Register tmp = scratch1(); |
52 __ JumpIfSmi(this->name(), &miss); | 52 __ JumpIfSmi(this->name(), &miss); |
53 __ Ldr(tmp, FieldMemOperand(this->name(), HeapObject::kMapOffset)); | 53 __ Ldr(tmp, FieldMemOperand(this->name(), HeapObject::kMapOffset)); |
54 __ Ldrb(tmp, FieldMemOperand(tmp, Map::kInstanceTypeOffset)); | 54 __ Ldrb(tmp, FieldMemOperand(tmp, Map::kInstanceTypeOffset)); |
55 __ JumpIfNotUniqueNameInstanceType(tmp, &miss); | 55 __ JumpIfNotUniqueNameInstanceType(tmp, &miss); |
56 } else { | 56 } else { |
57 __ CompareAndBranch(this->name(), Operand(name), ne, &miss); | 57 __ CompareAndBranch(this->name(), Operand(name), 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 __ Ldr(map_reg, FieldMemOperand(receiver(), HeapObject::kMapOffset)); | 69 __ Ldr(map_reg, FieldMemOperand(receiver(), HeapObject::kMapOffset)); |
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 for (int current = 0; current < receiver_count; ++current) { | 72 for (int current = 0; current < receiver_count; ++current) { |
73 Handle<HeapType> type = types->at(current); | 73 Handle<Map> map = maps->at(current); |
74 Handle<Map> map = IC::TypeToMap(*type, isolate()); | |
75 if (!map->is_deprecated()) { | 74 if (!map->is_deprecated()) { |
76 number_of_handled_maps++; | 75 number_of_handled_maps++; |
77 Handle<WeakCell> cell = Map::WeakCellForMap(map); | 76 Handle<WeakCell> cell = Map::WeakCellForMap(map); |
78 __ CmpWeakValue(map_reg, cell, scratch2()); | 77 __ CmpWeakValue(map_reg, cell, scratch2()); |
79 Label try_next; | 78 Label try_next; |
80 __ B(ne, &try_next); | 79 __ B(ne, &try_next); |
81 if (type->Is(HeapType::Number())) { | 80 if (map->instance_type() == HEAP_NUMBER_TYPE) { |
82 DCHECK(!number_case.is_unused()); | 81 DCHECK(!number_case.is_unused()); |
83 __ Bind(&number_case); | 82 __ Bind(&number_case); |
84 } | 83 } |
85 __ Jump(handlers->at(current), RelocInfo::CODE_TARGET); | 84 __ Jump(handlers->at(current), RelocInfo::CODE_TARGET); |
86 __ Bind(&try_next); | 85 __ Bind(&try_next); |
87 } | 86 } |
88 } | 87 } |
89 DCHECK(number_of_handled_maps != 0); | 88 DCHECK(number_of_handled_maps != 0); |
90 | 89 |
91 __ Bind(&miss); | 90 __ Bind(&miss); |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
130 | 129 |
131 return GetCode(kind(), Code::NORMAL, factory()->empty_string(), POLYMORPHIC); | 130 return GetCode(kind(), Code::NORMAL, factory()->empty_string(), POLYMORPHIC); |
132 } | 131 } |
133 | 132 |
134 | 133 |
135 #undef __ | 134 #undef __ |
136 } | 135 } |
137 } // namespace v8::internal | 136 } // namespace v8::internal |
138 | 137 |
139 #endif // V8_TARGET_ARCH_ARM64 | 138 #endif // V8_TARGET_ARCH_ARM64 |
OLD | NEW |