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 #ifndef V8_IC_HANDLER_COMPILER_H_ | 5 #ifndef V8_IC_HANDLER_COMPILER_H_ |
6 #define V8_IC_HANDLER_COMPILER_H_ | 6 #define V8_IC_HANDLER_COMPILER_H_ |
7 | 7 |
8 #include "src/ic/access-compiler.h" | 8 #include "src/ic/access-compiler.h" |
9 #include "src/ic/ic-state.h" | 9 #include "src/ic/ic-state.h" |
10 | 10 |
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
116 Handle<JSObject> holder, | 116 Handle<JSObject> holder, |
117 CacheHolderFlag cache_holder) | 117 CacheHolderFlag cache_holder) |
118 : PropertyHandlerCompiler(isolate, Code::LOAD_IC, map, holder, | 118 : PropertyHandlerCompiler(isolate, Code::LOAD_IC, map, holder, |
119 cache_holder) {} | 119 cache_holder) {} |
120 | 120 |
121 virtual ~NamedLoadHandlerCompiler() {} | 121 virtual ~NamedLoadHandlerCompiler() {} |
122 | 122 |
123 Handle<Code> CompileLoadField(Handle<Name> name, FieldIndex index); | 123 Handle<Code> CompileLoadField(Handle<Name> name, FieldIndex index); |
124 | 124 |
125 Handle<Code> CompileLoadCallback(Handle<Name> name, | 125 Handle<Code> CompileLoadCallback(Handle<Name> name, |
126 Handle<AccessorInfo> callback); | 126 Handle<AccessorInfo> callback, |
| 127 Handle<Code> slow_stub); |
127 | 128 |
128 Handle<Code> CompileLoadCallback(Handle<Name> name, | 129 Handle<Code> CompileLoadCallback(Handle<Name> name, |
129 const CallOptimization& call_optimization, | 130 const CallOptimization& call_optimization, |
130 int accessor_index); | 131 int accessor_index, Handle<Code> slow_stub); |
131 | 132 |
132 Handle<Code> CompileLoadConstant(Handle<Name> name, int constant_index); | 133 Handle<Code> CompileLoadConstant(Handle<Name> name, int constant_index); |
133 | 134 |
134 // The LookupIterator is used to perform a lookup behind the interceptor. If | 135 // The LookupIterator is used to perform a lookup behind the interceptor. If |
135 // the iterator points to a LookupIterator::PROPERTY, its access will be | 136 // the iterator points to a LookupIterator::PROPERTY, its access will be |
136 // inlined. | 137 // inlined. |
137 Handle<Code> CompileLoadInterceptor(LookupIterator* it); | 138 Handle<Code> CompileLoadInterceptor(LookupIterator* it); |
138 | 139 |
139 Handle<Code> CompileLoadViaGetter(Handle<Name> name, int accessor_index, | 140 Handle<Code> CompileLoadViaGetter(Handle<Name> name, int accessor_index, |
140 int expected_arguments); | 141 int expected_arguments); |
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
219 virtual ~NamedStoreHandlerCompiler() {} | 220 virtual ~NamedStoreHandlerCompiler() {} |
220 | 221 |
221 Handle<Code> CompileStoreTransition(Handle<Map> transition, | 222 Handle<Code> CompileStoreTransition(Handle<Map> transition, |
222 Handle<Name> name); | 223 Handle<Name> name); |
223 Handle<Code> CompileStoreField(LookupIterator* it); | 224 Handle<Code> CompileStoreField(LookupIterator* it); |
224 Handle<Code> CompileStoreCallback(Handle<JSObject> object, Handle<Name> name, | 225 Handle<Code> CompileStoreCallback(Handle<JSObject> object, Handle<Name> name, |
225 Handle<AccessorInfo> callback, | 226 Handle<AccessorInfo> callback, |
226 LanguageMode language_mode); | 227 LanguageMode language_mode); |
227 Handle<Code> CompileStoreCallback(Handle<JSObject> object, Handle<Name> name, | 228 Handle<Code> CompileStoreCallback(Handle<JSObject> object, Handle<Name> name, |
228 const CallOptimization& call_optimization, | 229 const CallOptimization& call_optimization, |
229 int accessor_index); | 230 int accessor_index, Handle<Code> slow_stub); |
230 Handle<Code> CompileStoreViaSetter(Handle<JSObject> object, Handle<Name> name, | 231 Handle<Code> CompileStoreViaSetter(Handle<JSObject> object, Handle<Name> name, |
231 int accessor_index, | 232 int accessor_index, |
232 int expected_arguments); | 233 int expected_arguments); |
233 | 234 |
234 static void GenerateStoreViaSetter(MacroAssembler* masm, Handle<Map> map, | 235 static void GenerateStoreViaSetter(MacroAssembler* masm, Handle<Map> map, |
235 Register receiver, Register holder, | 236 Register receiver, Register holder, |
236 int accessor_index, int expected_arguments, | 237 int accessor_index, int expected_arguments, |
237 Register scratch); | 238 Register scratch); |
238 | 239 |
239 static void GenerateStoreViaSetterForDeopt(MacroAssembler* masm) { | 240 static void GenerateStoreViaSetterForDeopt(MacroAssembler* masm) { |
240 GenerateStoreViaSetter(masm, Handle<Map>::null(), no_reg, no_reg, -1, -1, | 241 GenerateStoreViaSetter(masm, Handle<Map>::null(), no_reg, no_reg, -1, -1, |
241 no_reg); | 242 no_reg); |
242 } | 243 } |
243 | 244 |
244 static void GenerateSlow(MacroAssembler* masm); | |
245 | |
246 protected: | 245 protected: |
247 virtual Register FrontendHeader(Register object_reg, Handle<Name> name, | 246 virtual Register FrontendHeader(Register object_reg, Handle<Name> name, |
248 Label* miss, ReturnHolder return_what); | 247 Label* miss, ReturnHolder return_what); |
249 | 248 |
250 virtual void FrontendFooter(Handle<Name> name, Label* miss); | 249 virtual void FrontendFooter(Handle<Name> name, Label* miss); |
251 void GenerateRestoreName(Label* label, Handle<Name> name); | 250 void GenerateRestoreName(Label* label, Handle<Name> name); |
252 | 251 |
253 // Pop the vector and slot into appropriate registers, moving the map in | 252 // Pop the vector and slot into appropriate registers, moving the map in |
254 // the process. (This is an accomodation for register pressure on ia32). | 253 // the process. (This is an accomodation for register pressure on ia32). |
255 void RearrangeVectorAndSlot(Register current_map, Register destination_map); | 254 void RearrangeVectorAndSlot(Register current_map, Register destination_map); |
256 | 255 |
257 private: | 256 private: |
258 void GenerateRestoreName(Handle<Name> name); | 257 void GenerateRestoreName(Handle<Name> name); |
259 void GenerateRestoreMap(Handle<Map> transition, Register map_reg, | 258 void GenerateRestoreMap(Handle<Map> transition, Register map_reg, |
260 Register scratch, Label* miss); | 259 Register scratch, Label* miss); |
261 | 260 |
262 void GenerateConstantCheck(Register map_reg, int descriptor, | 261 void GenerateConstantCheck(Register map_reg, int descriptor, |
263 Register value_reg, Register scratch, | 262 Register value_reg, Register scratch, |
264 Label* miss_label); | 263 Label* miss_label); |
265 | 264 |
266 bool RequiresFieldTypeChecks(FieldType* field_type) const; | 265 bool RequiresFieldTypeChecks(FieldType* field_type) const; |
267 void GenerateFieldTypeChecks(FieldType* field_type, Register value_reg, | 266 void GenerateFieldTypeChecks(FieldType* field_type, Register value_reg, |
268 Label* miss_label); | 267 Label* miss_label); |
269 | 268 |
270 static Builtins::Name SlowBuiltin(Code::Kind kind) { | |
271 switch (kind) { | |
272 case Code::STORE_IC: | |
273 return Builtins::kStoreIC_Slow; | |
274 case Code::KEYED_STORE_IC: | |
275 return Builtins::kKeyedStoreIC_Slow; | |
276 default: | |
277 UNREACHABLE(); | |
278 } | |
279 return Builtins::kStoreIC_Slow; | |
280 } | |
281 | |
282 static Register value(); | 269 static Register value(); |
283 }; | 270 }; |
284 | 271 |
285 | 272 |
286 class ElementHandlerCompiler : public PropertyHandlerCompiler { | 273 class ElementHandlerCompiler : public PropertyHandlerCompiler { |
287 public: | 274 public: |
288 explicit ElementHandlerCompiler(Isolate* isolate) | 275 explicit ElementHandlerCompiler(Isolate* isolate) |
289 : PropertyHandlerCompiler(isolate, Code::KEYED_LOAD_IC, | 276 : PropertyHandlerCompiler(isolate, Code::KEYED_LOAD_IC, |
290 Handle<Map>::null(), Handle<JSObject>::null(), | 277 Handle<Map>::null(), Handle<JSObject>::null(), |
291 kCacheOnReceiver) {} | 278 kCacheOnReceiver) {} |
292 | 279 |
293 virtual ~ElementHandlerCompiler() {} | 280 virtual ~ElementHandlerCompiler() {} |
294 | 281 |
295 void CompileElementHandlers(MapHandleList* receiver_maps, | 282 void CompileElementHandlers(MapHandleList* receiver_maps, |
296 CodeHandleList* handlers); | 283 CodeHandleList* handlers); |
297 | 284 |
298 static void GenerateStoreSlow(MacroAssembler* masm); | 285 static void GenerateStoreSlow(MacroAssembler* masm); |
299 }; | 286 }; |
300 } // namespace internal | 287 } // namespace internal |
301 } // namespace v8 | 288 } // namespace v8 |
302 | 289 |
303 #endif // V8_IC_HANDLER_COMPILER_H_ | 290 #endif // V8_IC_HANDLER_COMPILER_H_ |
OLD | NEW |