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_MIPS64 | 7 #if V8_TARGET_ARCH_MIPS64 |
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 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
50 int receiver_count = types->length(); | 50 int receiver_count = types->length(); |
51 int number_of_handled_maps = 0; | 51 int number_of_handled_maps = 0; |
52 __ ld(map_reg, FieldMemOperand(receiver(), HeapObject::kMapOffset)); | 52 __ ld(map_reg, FieldMemOperand(receiver(), HeapObject::kMapOffset)); |
53 for (int current = 0; current < receiver_count; ++current) { | 53 for (int current = 0; current < receiver_count; ++current) { |
54 Handle<HeapType> type = types->at(current); | 54 Handle<HeapType> type = types->at(current); |
55 Handle<Map> map = IC::TypeToMap(*type, isolate()); | 55 Handle<Map> map = IC::TypeToMap(*type, isolate()); |
56 if (!map->is_deprecated()) { | 56 if (!map->is_deprecated()) { |
57 number_of_handled_maps++; | 57 number_of_handled_maps++; |
58 // Check map and tail call if there's a match. | 58 // Check map and tail call if there's a match. |
59 // Separate compare from branch, to provide path for above JumpIfSmi(). | 59 // Separate compare from branch, to provide path for above JumpIfSmi(). |
60 __ Dsubu(match, map_reg, Operand(map)); | 60 Handle<WeakCell> cell = Map::WeakCellForMap(map); |
| 61 __ CmpWeakValue(match, map_reg, cell); |
61 if (type->Is(HeapType::Number())) { | 62 if (type->Is(HeapType::Number())) { |
62 DCHECK(!number_case.is_unused()); | 63 DCHECK(!number_case.is_unused()); |
63 __ bind(&number_case); | 64 __ bind(&number_case); |
64 } | 65 } |
65 __ Jump(handlers->at(current), RelocInfo::CODE_TARGET, eq, match, | 66 __ Jump(handlers->at(current), RelocInfo::CODE_TARGET, eq, match, |
66 Operand(zero_reg)); | 67 Operand(zero_reg)); |
67 } | 68 } |
68 } | 69 } |
69 DCHECK(number_of_handled_maps != 0); | 70 DCHECK(number_of_handled_maps != 0); |
70 | 71 |
71 __ bind(&miss); | 72 __ bind(&miss); |
72 TailCallBuiltin(masm(), MissBuiltin(kind())); | 73 TailCallBuiltin(masm(), MissBuiltin(kind())); |
73 | 74 |
74 // Return the generated code. | 75 // Return the generated code. |
75 InlineCacheState state = | 76 InlineCacheState state = |
76 number_of_handled_maps > 1 ? POLYMORPHIC : MONOMORPHIC; | 77 number_of_handled_maps > 1 ? POLYMORPHIC : MONOMORPHIC; |
77 return GetCode(kind(), type, name, state); | 78 return GetCode(kind(), type, name, state); |
78 } | 79 } |
79 | 80 |
80 | 81 |
81 Handle<Code> PropertyICCompiler::CompileKeyedStorePolymorphic( | 82 Handle<Code> PropertyICCompiler::CompileKeyedStorePolymorphic( |
82 MapHandleList* receiver_maps, CodeHandleList* handler_stubs, | 83 MapHandleList* receiver_maps, CodeHandleList* handler_stubs, |
83 MapHandleList* transitioned_maps) { | 84 MapHandleList* transitioned_maps) { |
84 Label miss; | 85 Label miss; |
85 __ JumpIfSmi(receiver(), &miss); | 86 __ JumpIfSmi(receiver(), &miss); |
86 | 87 |
87 int receiver_count = receiver_maps->length(); | 88 int receiver_count = receiver_maps->length(); |
88 __ ld(scratch1(), FieldMemOperand(receiver(), HeapObject::kMapOffset)); | 89 Register map_reg = scratch1(); |
| 90 Register match = scratch2(); |
| 91 __ ld(map_reg, FieldMemOperand(receiver(), HeapObject::kMapOffset)); |
89 for (int i = 0; i < receiver_count; ++i) { | 92 for (int i = 0; i < receiver_count; ++i) { |
| 93 Handle<WeakCell> cell = Map::WeakCellForMap(receiver_maps->at(i)); |
| 94 __ CmpWeakValue(match, map_reg, cell); |
90 if (transitioned_maps->at(i).is_null()) { | 95 if (transitioned_maps->at(i).is_null()) { |
91 __ Jump(handler_stubs->at(i), RelocInfo::CODE_TARGET, eq, scratch1(), | 96 __ Jump(handler_stubs->at(i), RelocInfo::CODE_TARGET, eq, match, |
92 Operand(receiver_maps->at(i))); | 97 Operand(zero_reg)); |
93 } else { | 98 } else { |
94 Label next_map; | 99 Label next_map; |
95 __ Branch(&next_map, ne, scratch1(), Operand(receiver_maps->at(i))); | 100 __ Branch(&next_map, ne, match, Operand(zero_reg)); |
96 __ li(transition_map(), Operand(transitioned_maps->at(i))); | 101 Handle<WeakCell> cell = Map::WeakCellForMap(transitioned_maps->at(i)); |
| 102 __ LoadWeakValue(transition_map(), cell, &miss); |
97 __ Jump(handler_stubs->at(i), RelocInfo::CODE_TARGET); | 103 __ Jump(handler_stubs->at(i), RelocInfo::CODE_TARGET); |
98 __ bind(&next_map); | 104 __ bind(&next_map); |
99 } | 105 } |
100 } | 106 } |
101 | 107 |
102 __ bind(&miss); | 108 __ bind(&miss); |
103 TailCallBuiltin(masm(), MissBuiltin(kind())); | 109 TailCallBuiltin(masm(), MissBuiltin(kind())); |
104 | 110 |
105 // Return the generated code. | 111 // Return the generated code. |
106 return GetCode(kind(), Code::NORMAL, factory()->empty_string(), POLYMORPHIC); | 112 return GetCode(kind(), Code::NORMAL, factory()->empty_string(), POLYMORPHIC); |
(...skipping 15 matching lines...) Expand all Loading... |
122 // Do tail-call to runtime routine. | 128 // Do tail-call to runtime routine. |
123 __ TailCallRuntime(Runtime::kSetProperty, 4, 1); | 129 __ TailCallRuntime(Runtime::kSetProperty, 4, 1); |
124 } | 130 } |
125 | 131 |
126 | 132 |
127 #undef __ | 133 #undef __ |
128 } | 134 } |
129 } // namespace v8::internal | 135 } // namespace v8::internal |
130 | 136 |
131 #endif // V8_TARGET_ARCH_MIPS64 | 137 #endif // V8_TARGET_ARCH_MIPS64 |
OLD | NEW |