Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(656)

Unified Diff: src/objects.h

Issue 1353363002: Share literals arrays per <NativeContext, SharedFunctionInfo> pair. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Addressing comments Created 5 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/heap/mark-compact.cc ('k') | src/objects.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/objects.h
diff --git a/src/objects.h b/src/objects.h
index e28081c33f4cd8bb48dfee82dbfb9aa9e86dfbd4..97be78468ca9b253367cb296a61c49b48c001131 100644
--- a/src/objects.h
+++ b/src/objects.h
@@ -6288,15 +6288,18 @@ class SharedFunctionInfo: public HeapObject {
DECL_ACCESSORS(optimized_code_map, Object)
// Returns entry from optimized code map for specified context and OSR entry.
- // Note that {code == nullptr} indicates no matching entry has been found,
- // whereas {literals == nullptr} indicates the code is context-independent.
+ // Note that {code == nullptr, literals == nullptr} indicates no matching
+ // entry has been found, whereas {code, literals == nullptr} indicates that
+ // code is context-independent.
CodeAndLiterals SearchOptimizedCodeMap(Context* native_context,
BailoutId osr_ast_id);
// Clear optimized code map.
void ClearOptimizedCodeMap();
- // Removed a specific optimized code object from the optimized code map.
+ // Removes a specific optimized code object from the optimized code map.
+ // In case of non-OSR the code reference is cleared from the cache entry but
+ // the entry itself is left in the map in order to proceed sharing literals.
void EvictFromOptimizedCodeMap(Code* optimized_code, const char* reason);
// Trims the optimized code map after entries have been removed.
@@ -6307,9 +6310,11 @@ class SharedFunctionInfo: public HeapObject {
Handle<Code> code);
// Add a new entry to the optimized code map for context-dependent code.
+ // |code| is either a code object or an undefined value. In the latter case
+ // the entry just maps |native_context, osr_ast_id| pair to |literals| array.
static void AddToOptimizedCodeMap(Handle<SharedFunctionInfo> shared,
Handle<Context> native_context,
- Handle<Code> code,
+ Handle<HeapObject> code,
Handle<FixedArray> literals,
BailoutId osr_ast_id);
@@ -6329,6 +6334,8 @@ class SharedFunctionInfo: public HeapObject {
static const int kEntryLength = 4;
static const int kInitialLength = kEntriesStart + kEntryLength;
+ static const int kNotFound = -1;
+
// [scope_info]: Scope info.
DECL_ACCESSORS(scope_info, ScopeInfo)
@@ -6897,6 +6904,12 @@ class SharedFunctionInfo: public HeapObject {
#endif
private:
+ // Returns entry from optimized code map for specified context and OSR entry.
+ // The result is either kNotFound, kSharedCodeIndex for context-independent
+ // entry or a start index of the context-dependent entry.
+ int SearchOptimizedCodeMapEntry(Context* native_context,
+ BailoutId osr_ast_id);
+
DISALLOW_IMPLICIT_CONSTRUCTORS(SharedFunctionInfo);
};
« no previous file with comments | « src/heap/mark-compact.cc ('k') | src/objects.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698