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