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