| OLD | NEW |
| 1 // Copyright 2015 the V8 project authors. All rights reserved. | 1 // Copyright 2015 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_OBJECTS_H_ | 5 #ifndef V8_OBJECTS_H_ |
| 6 #define V8_OBJECTS_H_ | 6 #define V8_OBJECTS_H_ |
| 7 | 7 |
| 8 #include <iosfwd> | 8 #include <iosfwd> |
| 9 #include <memory> | 9 #include <memory> |
| 10 | 10 |
| (...skipping 7150 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 7161 // In case of non-OSR the code reference is cleared from the cache entry but | 7161 // In case of non-OSR the code reference is cleared from the cache entry but |
| 7162 // the entry itself is left in the map in order to proceed sharing literals. | 7162 // the entry itself is left in the map in order to proceed sharing literals. |
| 7163 void EvictFromOptimizedCodeMap(Code* optimized_code, const char* reason); | 7163 void EvictFromOptimizedCodeMap(Code* optimized_code, const char* reason); |
| 7164 | 7164 |
| 7165 // Trims the optimized code map after entries have been removed. | 7165 // Trims the optimized code map after entries have been removed. |
| 7166 void TrimOptimizedCodeMap(int shrink_by); | 7166 void TrimOptimizedCodeMap(int shrink_by); |
| 7167 | 7167 |
| 7168 static Handle<LiteralsArray> FindOrCreateLiterals( | 7168 static Handle<LiteralsArray> FindOrCreateLiterals( |
| 7169 Handle<SharedFunctionInfo> shared, Handle<Context> native_context); | 7169 Handle<SharedFunctionInfo> shared, Handle<Context> native_context); |
| 7170 | 7170 |
| 7171 // Add or update entry in the optimized code map for context-independent code. | |
| 7172 static void AddSharedCodeToOptimizedCodeMap(Handle<SharedFunctionInfo> shared, | |
| 7173 Handle<Code> code); | |
| 7174 | |
| 7175 // Add or update entry in the optimized code map for context-dependent code. | 7171 // Add or update entry in the optimized code map for context-dependent code. |
| 7176 // If {code} is not given, then an existing entry's code won't be overwritten. | 7172 // If {code} is not given, then an existing entry's code won't be overwritten. |
| 7177 static void AddToOptimizedCodeMap(Handle<SharedFunctionInfo> shared, | 7173 static void AddToOptimizedCodeMap(Handle<SharedFunctionInfo> shared, |
| 7178 Handle<Context> native_context, | 7174 Handle<Context> native_context, |
| 7179 MaybeHandle<Code> code, | 7175 MaybeHandle<Code> code, |
| 7180 Handle<LiteralsArray> literals, | 7176 Handle<LiteralsArray> literals, |
| 7181 BailoutId osr_ast_id); | 7177 BailoutId osr_ast_id); |
| 7182 | 7178 |
| 7183 // Set up the link between shared function info and the script. The shared | 7179 // Set up the link between shared function info and the script. The shared |
| 7184 // function info is added to the list on the script. | 7180 // function info is added to the list on the script. |
| 7185 static void SetScript(Handle<SharedFunctionInfo> shared, | 7181 static void SetScript(Handle<SharedFunctionInfo> shared, |
| 7186 Handle<Object> script_object); | 7182 Handle<Object> script_object); |
| 7187 | 7183 |
| 7188 // Layout description of the optimized code map. | 7184 // Layout description of the optimized code map. |
| 7189 static const int kSharedCodeIndex = 0; | 7185 static const int kEntriesStart = 0; |
| 7190 static const int kEntriesStart = 1; | |
| 7191 static const int kContextOffset = 0; | 7186 static const int kContextOffset = 0; |
| 7192 static const int kCachedCodeOffset = 1; | 7187 static const int kCachedCodeOffset = 1; |
| 7193 static const int kLiteralsOffset = 2; | 7188 static const int kLiteralsOffset = 2; |
| 7194 static const int kOsrAstIdOffset = 3; | 7189 static const int kOsrAstIdOffset = 3; |
| 7195 static const int kEntryLength = 4; | 7190 static const int kEntryLength = 4; |
| 7196 static const int kInitialLength = kEntriesStart + kEntryLength; | 7191 static const int kInitialLength = kEntriesStart + kEntryLength; |
| 7197 | 7192 |
| 7198 static const int kNotFound = -1; | 7193 static const int kNotFound = -1; |
| 7199 | 7194 |
| 7200 // Helpers for assembly code that does a backwards walk of the optimized code | 7195 // Helpers for assembly code that does a backwards walk of the optimized code |
| (...skipping 581 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 7782 #endif | 7777 #endif |
| 7783 static const int kStrictModeByteOffset = BYTE_OFFSET(kStrictModeFunction); | 7778 static const int kStrictModeByteOffset = BYTE_OFFSET(kStrictModeFunction); |
| 7784 static const int kNativeByteOffset = BYTE_OFFSET(kNative); | 7779 static const int kNativeByteOffset = BYTE_OFFSET(kNative); |
| 7785 static const int kFunctionKindByteOffset = BYTE_OFFSET(kFunctionKind); | 7780 static const int kFunctionKindByteOffset = BYTE_OFFSET(kFunctionKind); |
| 7786 static const int kHasDuplicateParametersByteOffset = | 7781 static const int kHasDuplicateParametersByteOffset = |
| 7787 BYTE_OFFSET(kHasDuplicateParameters); | 7782 BYTE_OFFSET(kHasDuplicateParameters); |
| 7788 #undef BYTE_OFFSET | 7783 #undef BYTE_OFFSET |
| 7789 | 7784 |
| 7790 private: | 7785 private: |
| 7791 // Returns entry from optimized code map for specified context and OSR entry. | 7786 // Returns entry from optimized code map for specified context and OSR entry. |
| 7792 // The result is either kNotFound, kSharedCodeIndex for context-independent | 7787 // The result is either kNotFound, or a start index of the context-dependent |
| 7793 // entry or a start index of the context-dependent entry. | 7788 // entry. |
| 7794 int SearchOptimizedCodeMapEntry(Context* native_context, | 7789 int SearchOptimizedCodeMapEntry(Context* native_context, |
| 7795 BailoutId osr_ast_id); | 7790 BailoutId osr_ast_id); |
| 7796 | 7791 |
| 7797 DISALLOW_IMPLICIT_CONSTRUCTORS(SharedFunctionInfo); | 7792 DISALLOW_IMPLICIT_CONSTRUCTORS(SharedFunctionInfo); |
| 7798 }; | 7793 }; |
| 7799 | 7794 |
| 7800 | 7795 |
| 7801 // Printing support. | 7796 // Printing support. |
| 7802 struct SourceCodeOf { | 7797 struct SourceCodeOf { |
| 7803 explicit SourceCodeOf(SharedFunctionInfo* v, int max = -1) | 7798 explicit SourceCodeOf(SharedFunctionInfo* v, int max = -1) |
| (...skipping 3602 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 11406 } | 11401 } |
| 11407 return value; | 11402 return value; |
| 11408 } | 11403 } |
| 11409 }; | 11404 }; |
| 11410 | 11405 |
| 11411 | 11406 |
| 11412 } // NOLINT, false-positive due to second-order macros. | 11407 } // NOLINT, false-positive due to second-order macros. |
| 11413 } // NOLINT, false-positive due to second-order macros. | 11408 } // NOLINT, false-positive due to second-order macros. |
| 11414 | 11409 |
| 11415 #endif // V8_OBJECTS_H_ | 11410 #endif // V8_OBJECTS_H_ |
| OLD | NEW |