| OLD | NEW |
| 1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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_STUB_CACHE_H_ | 5 #ifndef V8_STUB_CACHE_H_ |
| 6 #define V8_STUB_CACHE_H_ | 6 #define V8_STUB_CACHE_H_ |
| 7 | 7 |
| 8 #include "src/allocation.h" | 8 #include "src/allocation.h" |
| 9 #include "src/arguments.h" | 9 #include "src/arguments.h" |
| 10 #include "src/code-stubs.h" | 10 #include "src/code-stubs.h" |
| (...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 186 // ------------------------------------------------------------------------ | 186 // ------------------------------------------------------------------------ |
| 187 | 187 |
| 188 | 188 |
| 189 // Support functions for IC stubs for callbacks. | 189 // Support functions for IC stubs for callbacks. |
| 190 DECLARE_RUNTIME_FUNCTION(StoreCallbackProperty); | 190 DECLARE_RUNTIME_FUNCTION(StoreCallbackProperty); |
| 191 | 191 |
| 192 | 192 |
| 193 // Support functions for IC stubs for interceptors. | 193 // Support functions for IC stubs for interceptors. |
| 194 DECLARE_RUNTIME_FUNCTION(LoadPropertyWithInterceptorOnly); | 194 DECLARE_RUNTIME_FUNCTION(LoadPropertyWithInterceptorOnly); |
| 195 DECLARE_RUNTIME_FUNCTION(LoadPropertyWithInterceptor); | 195 DECLARE_RUNTIME_FUNCTION(LoadPropertyWithInterceptor); |
| 196 DECLARE_RUNTIME_FUNCTION(StoreInterceptorProperty); | 196 DECLARE_RUNTIME_FUNCTION(LoadElementWithInterceptor); |
| 197 DECLARE_RUNTIME_FUNCTION(KeyedLoadPropertyWithInterceptor); | 197 DECLARE_RUNTIME_FUNCTION(StorePropertyWithInterceptor); |
| 198 | 198 |
| 199 | 199 |
| 200 enum PrototypeCheckType { CHECK_ALL_MAPS, SKIP_RECEIVER }; | 200 enum PrototypeCheckType { CHECK_ALL_MAPS, SKIP_RECEIVER }; |
| 201 enum IcCheckType { ELEMENT, PROPERTY }; | 201 enum IcCheckType { ELEMENT, PROPERTY }; |
| 202 | 202 |
| 203 | 203 |
| 204 class PropertyAccessCompiler BASE_EMBEDDED { | 204 class PropertyAccessCompiler BASE_EMBEDDED { |
| 205 public: | 205 public: |
| 206 static Builtins::Name MissBuiltin(Code::Kind kind) { | 206 static Builtins::Name MissBuiltin(Code::Kind kind) { |
| 207 switch (kind) { | 207 switch (kind) { |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 263 CacheHolderFlag cache_holder_; | 263 CacheHolderFlag cache_holder_; |
| 264 | 264 |
| 265 Isolate* isolate_; | 265 Isolate* isolate_; |
| 266 MacroAssembler masm_; | 266 MacroAssembler masm_; |
| 267 }; | 267 }; |
| 268 | 268 |
| 269 | 269 |
| 270 class PropertyICCompiler : public PropertyAccessCompiler { | 270 class PropertyICCompiler : public PropertyAccessCompiler { |
| 271 public: | 271 public: |
| 272 // Finds the Code object stored in the Heap::non_monomorphic_cache(). | 272 // Finds the Code object stored in the Heap::non_monomorphic_cache(). |
| 273 static Code* FindPreMonomorphicIC(Isolate* isolate, Code::Kind kind, | 273 static Code* FindPreMonomorphic(Isolate* isolate, Code::Kind kind, |
| 274 ExtraICState extra_ic_state); | 274 ExtraICState extra_ic_state); |
| 275 | 275 |
| 276 // Named | 276 // Named |
| 277 static Handle<Code> ComputeLoad(Isolate* isolate, InlineCacheState ic_state, | 277 static Handle<Code> ComputeLoad(Isolate* isolate, InlineCacheState ic_state, |
| 278 ExtraICState extra_state); | 278 ExtraICState extra_state); |
| 279 static Handle<Code> ComputeStore(Isolate* isolate, InlineCacheState ic_state, | 279 static Handle<Code> ComputeStore(Isolate* isolate, InlineCacheState ic_state, |
| 280 ExtraICState extra_state); | 280 ExtraICState extra_state); |
| 281 | 281 |
| 282 static Handle<Code> ComputeMonomorphicIC(Code::Kind kind, Handle<Name> name, | 282 static Handle<Code> ComputeMonomorphic(Code::Kind kind, Handle<Name> name, |
| 283 Handle<HeapType> type, | 283 Handle<HeapType> type, |
| 284 Handle<Code> handler, | 284 Handle<Code> handler, |
| 285 ExtraICState extra_ic_state); | 285 ExtraICState extra_ic_state); |
| 286 static Handle<Code> ComputePolymorphicIC( | 286 static Handle<Code> ComputePolymorphic(Code::Kind kind, TypeHandleList* types, |
| 287 Code::Kind kind, TypeHandleList* types, CodeHandleList* handlers, | 287 CodeHandleList* handlers, |
| 288 int number_of_valid_maps, Handle<Name> name, ExtraICState extra_ic_state); | 288 int number_of_valid_maps, |
| 289 Handle<Name> name, |
| 290 ExtraICState extra_ic_state); |
| 289 | 291 |
| 290 // Keyed | 292 // Keyed |
| 291 static Handle<Code> ComputeKeyedLoadElement(Handle<Map> receiver_map); | 293 static Handle<Code> ComputeKeyedLoadMonomorphic(Handle<Map> receiver_map); |
| 292 | 294 |
| 293 static Handle<Code> ComputeKeyedStoreElement(Handle<Map> receiver_map, | 295 static Handle<Code> ComputeKeyedStoreMonomorphic( |
| 294 StrictMode strict_mode, | 296 Handle<Map> receiver_map, StrictMode strict_mode, |
| 295 KeyedAccessStoreMode store_mode); | 297 KeyedAccessStoreMode store_mode); |
| 296 static Handle<Code> ComputeLoadElementPolymorphic( | 298 static Handle<Code> ComputeKeyedLoadPolymorphic(MapHandleList* receiver_maps); |
| 297 MapHandleList* receiver_maps); | 299 static Handle<Code> ComputeKeyedStorePolymorphic( |
| 298 static Handle<Code> ComputeStoreElementPolymorphic( | |
| 299 MapHandleList* receiver_maps, KeyedAccessStoreMode store_mode, | 300 MapHandleList* receiver_maps, KeyedAccessStoreMode store_mode, |
| 300 StrictMode strict_mode); | 301 StrictMode strict_mode); |
| 301 | 302 |
| 302 // Compare nil | 303 // Compare nil |
| 303 static Handle<Code> ComputeCompareNil(Handle<Map> receiver_map, | 304 static Handle<Code> ComputeCompareNil(Handle<Map> receiver_map, |
| 304 CompareNilICStub* stub); | 305 CompareNilICStub* stub); |
| 305 | 306 |
| 306 | 307 |
| 307 private: | 308 private: |
| 308 PropertyICCompiler(Isolate* isolate, Code::Kind kind, | 309 PropertyICCompiler(Isolate* isolate, Code::Kind kind, |
| (...skipping 14 matching lines...) Expand all Loading... |
| 323 Handle<Code> CompileStorePreMonomorphic(Code::Flags flags); | 324 Handle<Code> CompileStorePreMonomorphic(Code::Flags flags); |
| 324 Handle<Code> CompileStoreGeneric(Code::Flags flags); | 325 Handle<Code> CompileStoreGeneric(Code::Flags flags); |
| 325 Handle<Code> CompileStoreMegamorphic(Code::Flags flags); | 326 Handle<Code> CompileStoreMegamorphic(Code::Flags flags); |
| 326 | 327 |
| 327 Handle<Code> CompileMonomorphic(Handle<HeapType> type, Handle<Code> handler, | 328 Handle<Code> CompileMonomorphic(Handle<HeapType> type, Handle<Code> handler, |
| 328 Handle<Name> name, IcCheckType check); | 329 Handle<Name> name, IcCheckType check); |
| 329 Handle<Code> CompilePolymorphic(TypeHandleList* types, | 330 Handle<Code> CompilePolymorphic(TypeHandleList* types, |
| 330 CodeHandleList* handlers, Handle<Name> name, | 331 CodeHandleList* handlers, Handle<Name> name, |
| 331 Code::StubType type, IcCheckType check); | 332 Code::StubType type, IcCheckType check); |
| 332 | 333 |
| 333 Handle<Code> CompileIndexedStoreMonomorphic(Handle<Map> receiver_map, | 334 Handle<Code> CompileKeyedStoreMonomorphic(Handle<Map> receiver_map, |
| 334 KeyedAccessStoreMode store_mode); | 335 KeyedAccessStoreMode store_mode); |
| 335 Handle<Code> CompileIndexedStorePolymorphic(MapHandleList* receiver_maps, | 336 Handle<Code> CompileKeyedStorePolymorphic(MapHandleList* receiver_maps, |
| 336 KeyedAccessStoreMode store_mode); | 337 KeyedAccessStoreMode store_mode); |
| 337 Handle<Code> CompileIndexedStorePolymorphic(MapHandleList* receiver_maps, | 338 Handle<Code> CompileKeyedStorePolymorphic(MapHandleList* receiver_maps, |
| 338 CodeHandleList* handler_stubs, | 339 CodeHandleList* handler_stubs, |
| 339 MapHandleList* transitioned_maps); | 340 MapHandleList* transitioned_maps); |
| 340 | 341 |
| 341 bool IncludesNumberType(TypeHandleList* types); | 342 bool IncludesNumberType(TypeHandleList* types); |
| 342 | 343 |
| 343 Handle<Code> GetCode(Code::Kind kind, Code::StubType type, Handle<Name> name, | 344 Handle<Code> GetCode(Code::Kind kind, Code::StubType type, Handle<Name> name, |
| 344 InlineCacheState state = MONOMORPHIC); | 345 InlineCacheState state = MONOMORPHIC); |
| 345 | 346 |
| 346 Logger::LogEventsAndTags log_kind(Handle<Code> code) { | 347 Logger::LogEventsAndTags log_kind(Handle<Code> code) { |
| 347 if (kind() == Code::LOAD_IC) { | 348 if (kind() == Code::LOAD_IC) { |
| 348 return code->ic_state() == MONOMORPHIC ? Logger::LOAD_IC_TAG | 349 return code->ic_state() == MONOMORPHIC ? Logger::LOAD_IC_TAG |
| 349 : Logger::LOAD_POLYMORPHIC_IC_TAG; | 350 : Logger::LOAD_POLYMORPHIC_IC_TAG; |
| (...skipping 310 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 660 case Code::KEYED_STORE_IC: return Builtins::kKeyedStoreIC_Slow; | 661 case Code::KEYED_STORE_IC: return Builtins::kKeyedStoreIC_Slow; |
| 661 default: UNREACHABLE(); | 662 default: UNREACHABLE(); |
| 662 } | 663 } |
| 663 return Builtins::kStoreIC_Slow; | 664 return Builtins::kStoreIC_Slow; |
| 664 } | 665 } |
| 665 | 666 |
| 666 static Register value(); | 667 static Register value(); |
| 667 }; | 668 }; |
| 668 | 669 |
| 669 | 670 |
| 670 class IndexedHandlerCompiler : public PropertyHandlerCompiler { | 671 class ElementHandlerCompiler : public PropertyHandlerCompiler { |
| 671 public: | 672 public: |
| 672 explicit IndexedHandlerCompiler(Isolate* isolate) | 673 explicit ElementHandlerCompiler(Isolate* isolate) |
| 673 : PropertyHandlerCompiler(isolate, Code::KEYED_LOAD_IC, | 674 : PropertyHandlerCompiler(isolate, Code::KEYED_LOAD_IC, |
| 674 kCacheOnReceiver) {} | 675 kCacheOnReceiver) {} |
| 675 | 676 |
| 676 virtual ~IndexedHandlerCompiler() {} | 677 virtual ~ElementHandlerCompiler() {} |
| 677 | 678 |
| 678 void CompileElementHandlers(MapHandleList* receiver_maps, | 679 void CompileElementHandlers(MapHandleList* receiver_maps, |
| 679 CodeHandleList* handlers); | 680 CodeHandleList* handlers); |
| 680 | 681 |
| 681 static void GenerateLoadDictionaryElement(MacroAssembler* masm); | 682 static void GenerateLoadDictionaryElement(MacroAssembler* masm); |
| 682 static void GenerateStoreDictionaryElement(MacroAssembler* masm); | 683 static void GenerateStoreDictionaryElement(MacroAssembler* masm); |
| 683 }; | 684 }; |
| 684 | 685 |
| 685 | 686 |
| 686 // Holds information about possible function call optimizations. | 687 // Holds information about possible function call optimizations. |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 736 Handle<JSFunction> constant_function_; | 737 Handle<JSFunction> constant_function_; |
| 737 bool is_simple_api_call_; | 738 bool is_simple_api_call_; |
| 738 Handle<FunctionTemplateInfo> expected_receiver_type_; | 739 Handle<FunctionTemplateInfo> expected_receiver_type_; |
| 739 Handle<CallHandlerInfo> api_call_info_; | 740 Handle<CallHandlerInfo> api_call_info_; |
| 740 }; | 741 }; |
| 741 | 742 |
| 742 | 743 |
| 743 } } // namespace v8::internal | 744 } } // namespace v8::internal |
| 744 | 745 |
| 745 #endif // V8_STUB_CACHE_H_ | 746 #endif // V8_STUB_CACHE_H_ |
| OLD | NEW |