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/macro-assembler.h" | 8 #include "src/macro-assembler.h" |
9 | 9 |
10 namespace v8 { | 10 namespace v8 { |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
44 Code* Get(Name* name, Map* map, Code::Flags flags); | 44 Code* Get(Name* name, Map* map, Code::Flags flags); |
45 // Clear the lookup table (@ mark compact collection). | 45 // Clear the lookup table (@ mark compact collection). |
46 void Clear(); | 46 void Clear(); |
47 // Collect all maps that match the name and flags. | 47 // Collect all maps that match the name and flags. |
48 void CollectMatchingMaps(SmallMapList* types, Handle<Name> name, | 48 void CollectMatchingMaps(SmallMapList* types, Handle<Name> name, |
49 Code::Flags flags, Handle<Context> native_context, | 49 Code::Flags flags, Handle<Context> native_context, |
50 Zone* zone); | 50 Zone* zone); |
51 // Generate code for probing the stub cache table. | 51 // Generate code for probing the stub cache table. |
52 // Arguments extra, extra2 and extra3 may be used to pass additional scratch | 52 // Arguments extra, extra2 and extra3 may be used to pass additional scratch |
53 // registers. Set to no_reg if not needed. | 53 // registers. Set to no_reg if not needed. |
54 void GenerateProbe(MacroAssembler* masm, Code::Flags flags, Register receiver, | 54 // If leave_frame is true, then exit a frame before the tail call. |
55 Register name, Register scratch, Register extra, | 55 void GenerateProbe(MacroAssembler* masm, Code::Flags flags, bool leave_frame, |
56 Register extra2 = no_reg, Register extra3 = no_reg); | 56 Register receiver, Register name, Register scratch, |
| 57 Register extra, Register extra2 = no_reg, |
| 58 Register extra3 = no_reg); |
57 | 59 |
58 enum Table { kPrimary, kSecondary }; | 60 enum Table { kPrimary, kSecondary }; |
59 | 61 |
60 SCTableReference key_reference(StubCache::Table table) { | 62 SCTableReference key_reference(StubCache::Table table) { |
61 return SCTableReference( | 63 return SCTableReference( |
62 reinterpret_cast<Address>(&first_entry(table)->key)); | 64 reinterpret_cast<Address>(&first_entry(table)->key)); |
63 } | 65 } |
64 | 66 |
65 SCTableReference map_reference(StubCache::Table table) { | 67 SCTableReference map_reference(StubCache::Table table) { |
66 return SCTableReference( | 68 return SCTableReference( |
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
146 const int multiplier = sizeof(*table) >> Name::kHashShift; | 148 const int multiplier = sizeof(*table) >> Name::kHashShift; |
147 return reinterpret_cast<Entry*>(reinterpret_cast<Address>(table) + | 149 return reinterpret_cast<Entry*>(reinterpret_cast<Address>(table) + |
148 offset * multiplier); | 150 offset * multiplier); |
149 } | 151 } |
150 | 152 |
151 static const int kPrimaryTableBits = 11; | 153 static const int kPrimaryTableBits = 11; |
152 static const int kPrimaryTableSize = (1 << kPrimaryTableBits); | 154 static const int kPrimaryTableSize = (1 << kPrimaryTableBits); |
153 static const int kSecondaryTableBits = 9; | 155 static const int kSecondaryTableBits = 9; |
154 static const int kSecondaryTableSize = (1 << kSecondaryTableBits); | 156 static const int kSecondaryTableSize = (1 << kSecondaryTableBits); |
155 | 157 |
| 158 private: |
156 Entry primary_[kPrimaryTableSize]; | 159 Entry primary_[kPrimaryTableSize]; |
157 Entry secondary_[kSecondaryTableSize]; | 160 Entry secondary_[kSecondaryTableSize]; |
158 Isolate* isolate_; | 161 Isolate* isolate_; |
159 | 162 |
160 friend class Isolate; | 163 friend class Isolate; |
161 friend class SCTableReference; | 164 friend class SCTableReference; |
162 | 165 |
163 DISALLOW_COPY_AND_ASSIGN(StubCache); | 166 DISALLOW_COPY_AND_ASSIGN(StubCache); |
164 }; | 167 }; |
165 } | 168 } |
166 } // namespace v8::internal | 169 } // namespace v8::internal |
167 | 170 |
168 #endif // V8_STUB_CACHE_H_ | 171 #endif // V8_STUB_CACHE_H_ |
OLD | NEW |