| 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_MIPS | 7 #if V8_TARGET_ARCH_MIPS |
| 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" |
| 11 | 11 |
| 12 namespace v8 { | 12 namespace v8 { |
| 13 namespace internal { | 13 namespace internal { |
| 14 | 14 |
| 15 #define __ ACCESS_MASM(masm()) | 15 #define __ ACCESS_MASM(masm()) |
| 16 | 16 |
| 17 | 17 |
| 18 Handle<Code> PropertyICCompiler::CompilePolymorphic(TypeHandleList* types, | 18 Handle<Code> PropertyICCompiler::CompilePolymorphic(MapHandleList* maps, |
| 19 CodeHandleList* handlers, | 19 CodeHandleList* handlers, |
| 20 Handle<Name> name, | 20 Handle<Name> name, |
| 21 Code::StubType type, | 21 Code::StubType type, |
| 22 IcCheckType check) { | 22 IcCheckType check) { |
| 23 Label miss; | 23 Label miss; |
| 24 | 24 |
| 25 if (check == PROPERTY && | 25 if (check == PROPERTY && |
| 26 (kind() == Code::KEYED_LOAD_IC || kind() == Code::KEYED_STORE_IC)) { | 26 (kind() == Code::KEYED_LOAD_IC || kind() == Code::KEYED_STORE_IC)) { |
| 27 // In case we are compiling an IC for dictionary loads or stores, just | 27 // In case we are compiling an IC for dictionary loads or stores, just |
| 28 // check whether the name is unique. | 28 // check whether the name is unique. |
| 29 if (name.is_identical_to(isolate()->factory()->normal_ic_symbol())) { | 29 if (name.is_identical_to(isolate()->factory()->normal_ic_symbol())) { |
| 30 // Keyed loads with dictionaries shouldn't be here, they go generic. | 30 // Keyed loads with dictionaries shouldn't be here, they go generic. |
| 31 // The DCHECK is to protect assumptions when --vector-ics is on. | 31 // The DCHECK is to protect assumptions when --vector-ics is on. |
| 32 DCHECK(kind() != Code::KEYED_LOAD_IC); | 32 DCHECK(kind() != Code::KEYED_LOAD_IC); |
| 33 Register tmp = scratch1(); | 33 Register tmp = scratch1(); |
| 34 __ JumpIfSmi(this->name(), &miss); | 34 __ JumpIfSmi(this->name(), &miss); |
| 35 __ lw(tmp, FieldMemOperand(this->name(), HeapObject::kMapOffset)); | 35 __ lw(tmp, FieldMemOperand(this->name(), HeapObject::kMapOffset)); |
| 36 __ lbu(tmp, FieldMemOperand(tmp, Map::kInstanceTypeOffset)); | 36 __ lbu(tmp, FieldMemOperand(tmp, Map::kInstanceTypeOffset)); |
| 37 __ JumpIfNotUniqueNameInstanceType(tmp, &miss); | 37 __ JumpIfNotUniqueNameInstanceType(tmp, &miss); |
| 38 } else { | 38 } else { |
| 39 __ Branch(&miss, ne, this->name(), Operand(name)); | 39 __ Branch(&miss, ne, this->name(), Operand(name)); |
| 40 } | 40 } |
| 41 } | 41 } |
| 42 | 42 |
| 43 Label number_case; | 43 Label number_case; |
| 44 Register match = scratch2(); | 44 Register match = scratch2(); |
| 45 Label* smi_target = IncludesNumberType(types) ? &number_case : &miss; | 45 Label* smi_target = IncludesNumberMap(maps) ? &number_case : &miss; |
| 46 __ JumpIfSmi(receiver(), smi_target, match); // Reg match is 0 if Smi. | 46 __ JumpIfSmi(receiver(), smi_target, match); // Reg match is 0 if Smi. |
| 47 | 47 |
| 48 // Polymorphic keyed stores may use the map register | 48 // Polymorphic keyed stores may use the map register |
| 49 Register map_reg = scratch1(); | 49 Register map_reg = scratch1(); |
| 50 DCHECK(kind() != Code::KEYED_STORE_IC || | 50 DCHECK(kind() != Code::KEYED_STORE_IC || |
| 51 map_reg.is(ElementTransitionAndStoreDescriptor::MapRegister())); | 51 map_reg.is(ElementTransitionAndStoreDescriptor::MapRegister())); |
| 52 | 52 |
| 53 int receiver_count = types->length(); | 53 int receiver_count = maps->length(); |
| 54 int number_of_handled_maps = 0; | 54 int number_of_handled_maps = 0; |
| 55 __ lw(map_reg, FieldMemOperand(receiver(), HeapObject::kMapOffset)); | 55 __ lw(map_reg, FieldMemOperand(receiver(), HeapObject::kMapOffset)); |
| 56 for (int current = 0; current < receiver_count; ++current) { | 56 for (int current = 0; current < receiver_count; ++current) { |
| 57 Handle<HeapType> type = types->at(current); | 57 Handle<Map> map = maps->at(current); |
| 58 Handle<Map> map = IC::TypeToMap(*type, isolate()); | |
| 59 if (!map->is_deprecated()) { | 58 if (!map->is_deprecated()) { |
| 60 number_of_handled_maps++; | 59 number_of_handled_maps++; |
| 61 // Check map and tail call if there's a match. | 60 // Check map and tail call if there's a match. |
| 62 // Separate compare from branch, to provide path for above JumpIfSmi(). | 61 // Separate compare from branch, to provide path for above JumpIfSmi(). |
| 63 Handle<WeakCell> cell = Map::WeakCellForMap(map); | 62 Handle<WeakCell> cell = Map::WeakCellForMap(map); |
| 64 __ GetWeakValue(match, cell); | 63 __ GetWeakValue(match, cell); |
| 65 __ Subu(match, match, Operand(map_reg)); | 64 __ Subu(match, match, Operand(map_reg)); |
| 66 if (type->Is(HeapType::Number())) { | 65 if (map->instance_type() == HEAP_NUMBER_TYPE) { |
| 67 DCHECK(!number_case.is_unused()); | 66 DCHECK(!number_case.is_unused()); |
| 68 __ bind(&number_case); | 67 __ bind(&number_case); |
| 69 } | 68 } |
| 70 __ Jump(handlers->at(current), RelocInfo::CODE_TARGET, eq, match, | 69 __ Jump(handlers->at(current), RelocInfo::CODE_TARGET, eq, match, |
| 71 Operand(zero_reg)); | 70 Operand(zero_reg)); |
| 72 } | 71 } |
| 73 } | 72 } |
| 74 DCHECK(number_of_handled_maps != 0); | 73 DCHECK(number_of_handled_maps != 0); |
| 75 | 74 |
| 76 __ bind(&miss); | 75 __ bind(&miss); |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 132 // Do tail-call to runtime routine. | 131 // Do tail-call to runtime routine. |
| 133 __ TailCallRuntime(Runtime::kSetProperty, 4, 1); | 132 __ TailCallRuntime(Runtime::kSetProperty, 4, 1); |
| 134 } | 133 } |
| 135 | 134 |
| 136 | 135 |
| 137 #undef __ | 136 #undef __ |
| 138 } | 137 } |
| 139 } // namespace v8::internal | 138 } // namespace v8::internal |
| 140 | 139 |
| 141 #endif // V8_TARGET_ARCH_MIPS | 140 #endif // V8_TARGET_ARCH_MIPS |
| OLD | NEW |