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 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
50 Name* key; | 50 Name* key; |
51 Code* value; | 51 Code* value; |
52 Map* map; | 52 Map* map; |
53 }; | 53 }; |
54 | 54 |
55 void Initialize(); | 55 void Initialize(); |
56 | 56 |
57 Handle<JSObject> StubHolder(Handle<JSObject> receiver, | 57 Handle<JSObject> StubHolder(Handle<JSObject> receiver, |
58 Handle<JSObject> holder); | 58 Handle<JSObject> holder); |
59 | 59 |
60 Handle<Code> FindIC(Handle<Name> name, | 60 Handle<Code> FindIC(Handle<Name> name, Handle<Map> stub_holder_map, |
61 Handle<Map> stub_holder_map, | |
62 Code::Kind kind, | 61 Code::Kind kind, |
63 ExtraICState extra_state = kNoExtraICState, | 62 ExtraICState extra_state = kNoExtraICState, |
64 InlineCacheHolderFlag cache_holder = OWN_MAP); | 63 CacheHolderFlag cache_holder = kCacheOnReceiver); |
65 | 64 |
66 Handle<Code> FindHandler(Handle<Name> name, | 65 Handle<Code> FindHandler(Handle<Name> name, Handle<Map> map, Code::Kind kind, |
67 Handle<Map> map, | 66 CacheHolderFlag cache_holder, Code::StubType type); |
68 Code::Kind kind, | |
69 InlineCacheHolderFlag cache_holder, | |
70 Code::StubType type); | |
71 | 67 |
72 Handle<Code> ComputeMonomorphicIC(Code::Kind kind, | 68 Handle<Code> ComputeMonomorphicIC(Code::Kind kind, |
73 Handle<Name> name, | 69 Handle<Name> name, |
74 Handle<HeapType> type, | 70 Handle<HeapType> type, |
75 Handle<Code> handler, | 71 Handle<Code> handler, |
76 ExtraICState extra_ic_state); | 72 ExtraICState extra_ic_state); |
77 | 73 |
78 Handle<Code> ComputeLoadNonexistent(Handle<Name> name, Handle<HeapType> type); | 74 Handle<Code> ComputeLoadNonexistent(Handle<Name> name, Handle<HeapType> type); |
79 | 75 |
80 Handle<Code> ComputeKeyedLoadElement(Handle<Map> receiver_map); | 76 Handle<Code> ComputeKeyedLoadElement(Handle<Map> receiver_map); |
(...skipping 26 matching lines...) Expand all Loading... |
107 int number_of_valid_maps, | 103 int number_of_valid_maps, |
108 Handle<Name> name, | 104 Handle<Name> name, |
109 ExtraICState extra_ic_state); | 105 ExtraICState extra_ic_state); |
110 | 106 |
111 // Finds the Code object stored in the Heap::non_monomorphic_cache(). | 107 // Finds the Code object stored in the Heap::non_monomorphic_cache(). |
112 Code* FindPreMonomorphicIC(Code::Kind kind, ExtraICState extra_ic_state); | 108 Code* FindPreMonomorphicIC(Code::Kind kind, ExtraICState extra_ic_state); |
113 | 109 |
114 // Update cache for entry hash(name, map). | 110 // Update cache for entry hash(name, map). |
115 Code* Set(Name* name, Map* map, Code* code); | 111 Code* Set(Name* name, Map* map, Code* code); |
116 | 112 |
| 113 Code* Get(Name* name, Map* map, Code::Flags flags); |
| 114 |
117 // Clear the lookup table (@ mark compact collection). | 115 // Clear the lookup table (@ mark compact collection). |
118 void Clear(); | 116 void Clear(); |
119 | 117 |
120 // Collect all maps that match the name and flags. | 118 // Collect all maps that match the name and flags. |
121 void CollectMatchingMaps(SmallMapList* types, | 119 void CollectMatchingMaps(SmallMapList* types, |
122 Handle<Name> name, | 120 Handle<Name> name, |
123 Code::Flags flags, | 121 Code::Flags flags, |
124 Handle<Context> native_context, | 122 Handle<Context> native_context, |
125 Zone* zone); | 123 Zone* zone); |
126 | 124 |
(...skipping 280 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
407 const ExtraICState extra_ic_state_; | 405 const ExtraICState extra_ic_state_; |
408 MacroAssembler masm_; | 406 MacroAssembler masm_; |
409 }; | 407 }; |
410 | 408 |
411 | 409 |
412 enum FrontendCheckType { PERFORM_INITIAL_CHECKS, SKIP_INITIAL_CHECKS }; | 410 enum FrontendCheckType { PERFORM_INITIAL_CHECKS, SKIP_INITIAL_CHECKS }; |
413 | 411 |
414 | 412 |
415 class BaseLoadStoreStubCompiler: public StubCompiler { | 413 class BaseLoadStoreStubCompiler: public StubCompiler { |
416 public: | 414 public: |
417 BaseLoadStoreStubCompiler(Isolate* isolate, | 415 BaseLoadStoreStubCompiler(Isolate* isolate, Code::Kind kind, |
418 Code::Kind kind, | |
419 ExtraICState extra_ic_state = kNoExtraICState, | 416 ExtraICState extra_ic_state = kNoExtraICState, |
420 InlineCacheHolderFlag cache_holder = OWN_MAP) | 417 CacheHolderFlag cache_holder = kCacheOnReceiver) |
421 : StubCompiler(isolate, extra_ic_state), | 418 : StubCompiler(isolate, extra_ic_state), |
422 kind_(kind), | 419 kind_(kind), |
423 cache_holder_(cache_holder) { | 420 cache_holder_(cache_holder) { |
424 InitializeRegisters(); | 421 InitializeRegisters(); |
425 } | 422 } |
426 virtual ~BaseLoadStoreStubCompiler() { } | 423 virtual ~BaseLoadStoreStubCompiler() { } |
427 | 424 |
428 Handle<Code> CompileMonomorphicIC(Handle<HeapType> type, | 425 Handle<Code> CompileMonomorphicIC(Handle<HeapType> type, |
429 Handle<Code> handler, | 426 Handle<Code> handler, |
430 Handle<Name> name); | 427 Handle<Name> name); |
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
491 Register name() { return registers_[1]; } | 488 Register name() { return registers_[1]; } |
492 Register scratch1() { return registers_[2]; } | 489 Register scratch1() { return registers_[2]; } |
493 Register scratch2() { return registers_[3]; } | 490 Register scratch2() { return registers_[3]; } |
494 Register scratch3() { return registers_[4]; } | 491 Register scratch3() { return registers_[4]; } |
495 | 492 |
496 void InitializeRegisters(); | 493 void InitializeRegisters(); |
497 | 494 |
498 bool IncludesNumberType(TypeHandleList* types); | 495 bool IncludesNumberType(TypeHandleList* types); |
499 | 496 |
500 Code::Kind kind_; | 497 Code::Kind kind_; |
501 InlineCacheHolderFlag cache_holder_; | 498 CacheHolderFlag cache_holder_; |
502 Register* registers_; | 499 Register* registers_; |
503 }; | 500 }; |
504 | 501 |
505 | 502 |
506 class LoadStubCompiler: public BaseLoadStoreStubCompiler { | 503 class LoadStubCompiler: public BaseLoadStoreStubCompiler { |
507 public: | 504 public: |
508 LoadStubCompiler(Isolate* isolate, | 505 LoadStubCompiler(Isolate* isolate, |
509 ExtraICState extra_ic_state = kNoExtraICState, | 506 ExtraICState extra_ic_state = kNoExtraICState, |
510 InlineCacheHolderFlag cache_holder = OWN_MAP, | 507 CacheHolderFlag cache_holder = kCacheOnReceiver, |
511 Code::Kind kind = Code::LOAD_IC) | 508 Code::Kind kind = Code::LOAD_IC) |
512 : BaseLoadStoreStubCompiler(isolate, kind, extra_ic_state, | 509 : BaseLoadStoreStubCompiler(isolate, kind, extra_ic_state, cache_holder) { |
513 cache_holder) { } | 510 } |
514 virtual ~LoadStubCompiler() { } | 511 virtual ~LoadStubCompiler() { } |
515 | 512 |
516 Handle<Code> CompileLoadField(Handle<HeapType> type, | 513 Handle<Code> CompileLoadField(Handle<HeapType> type, |
517 Handle<JSObject> holder, | 514 Handle<JSObject> holder, |
518 Handle<Name> name, | 515 Handle<Name> name, |
519 FieldIndex index, | 516 FieldIndex index, |
520 Representation representation); | 517 Representation representation); |
521 | 518 |
522 Handle<Code> CompileLoadCallback(Handle<HeapType> type, | 519 Handle<Code> CompileLoadCallback(Handle<HeapType> type, |
523 Handle<JSObject> holder, | 520 Handle<JSObject> holder, |
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
608 static Register* registers(); | 605 static Register* registers(); |
609 Register scratch4() { return registers_[5]; } | 606 Register scratch4() { return registers_[5]; } |
610 friend class BaseLoadStoreStubCompiler; | 607 friend class BaseLoadStoreStubCompiler; |
611 }; | 608 }; |
612 | 609 |
613 | 610 |
614 class KeyedLoadStubCompiler: public LoadStubCompiler { | 611 class KeyedLoadStubCompiler: public LoadStubCompiler { |
615 public: | 612 public: |
616 KeyedLoadStubCompiler(Isolate* isolate, | 613 KeyedLoadStubCompiler(Isolate* isolate, |
617 ExtraICState extra_ic_state = kNoExtraICState, | 614 ExtraICState extra_ic_state = kNoExtraICState, |
618 InlineCacheHolderFlag cache_holder = OWN_MAP) | 615 CacheHolderFlag cache_holder = kCacheOnReceiver) |
619 : LoadStubCompiler(isolate, extra_ic_state, cache_holder, | 616 : LoadStubCompiler(isolate, extra_ic_state, cache_holder, |
620 Code::KEYED_LOAD_IC) { } | 617 Code::KEYED_LOAD_IC) {} |
621 | 618 |
622 Handle<Code> CompileLoadElement(Handle<Map> receiver_map); | 619 Handle<Code> CompileLoadElement(Handle<Map> receiver_map); |
623 | 620 |
624 void CompileElementHandlers(MapHandleList* receiver_maps, | 621 void CompileElementHandlers(MapHandleList* receiver_maps, |
625 CodeHandleList* handlers); | 622 CodeHandleList* handlers); |
626 | 623 |
627 static void GenerateLoadDictionaryElement(MacroAssembler* masm); | 624 static void GenerateLoadDictionaryElement(MacroAssembler* masm); |
628 | 625 |
629 private: | 626 private: |
630 static Register* registers(); | 627 static Register* registers(); |
(...skipping 193 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
824 Handle<JSFunction> constant_function_; | 821 Handle<JSFunction> constant_function_; |
825 bool is_simple_api_call_; | 822 bool is_simple_api_call_; |
826 Handle<FunctionTemplateInfo> expected_receiver_type_; | 823 Handle<FunctionTemplateInfo> expected_receiver_type_; |
827 Handle<CallHandlerInfo> api_call_info_; | 824 Handle<CallHandlerInfo> api_call_info_; |
828 }; | 825 }; |
829 | 826 |
830 | 827 |
831 } } // namespace v8::internal | 828 } } // namespace v8::internal |
832 | 829 |
833 #endif // V8_STUB_CACHE_H_ | 830 #endif // V8_STUB_CACHE_H_ |
OLD | NEW |