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

Side by Side Diff: src/objects.h

Issue 1753213002: [interpreter] Make optimized code map more flexible. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 4 years, 9 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 unified diff | Download patch
« no previous file with comments | « src/factory.cc ('k') | src/objects.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 9
10 #include "src/assert-scope.h" 10 #include "src/assert-scope.h"
(...skipping 6643 matching lines...) Expand 10 before | Expand all | Expand 10 after
6654 inline bool OptimizedCodeMapIsCleared() const; 6654 inline bool OptimizedCodeMapIsCleared() const;
6655 6655
6656 // Removes a specific optimized code object from the optimized code map. 6656 // Removes a specific optimized code object from the optimized code map.
6657 // In case of non-OSR the code reference is cleared from the cache entry but 6657 // In case of non-OSR the code reference is cleared from the cache entry but
6658 // the entry itself is left in the map in order to proceed sharing literals. 6658 // the entry itself is left in the map in order to proceed sharing literals.
6659 void EvictFromOptimizedCodeMap(Code* optimized_code, const char* reason); 6659 void EvictFromOptimizedCodeMap(Code* optimized_code, const char* reason);
6660 6660
6661 // Trims the optimized code map after entries have been removed. 6661 // Trims the optimized code map after entries have been removed.
6662 void TrimOptimizedCodeMap(int shrink_by); 6662 void TrimOptimizedCodeMap(int shrink_by);
6663 6663
6664 // Add a new entry to the optimized code map for context-independent code. 6664 // Add or update entry in the optimized code map for context-independent code.
6665 static void AddSharedCodeToOptimizedCodeMap(Handle<SharedFunctionInfo> shared, 6665 static void AddSharedCodeToOptimizedCodeMap(Handle<SharedFunctionInfo> shared,
6666 Handle<Code> code); 6666 Handle<Code> code);
6667 6667
6668 // Add a new entry to the optimized code map for context-dependent code. 6668 // Add or update entry in the optimized code map for context-dependent code.
6669 inline static void AddToOptimizedCodeMap(Handle<SharedFunctionInfo> shared, 6669 // If {code} is not given, then an existing entry's code won't be overwritten.
6670 Handle<Context> native_context, 6670 static void AddToOptimizedCodeMap(Handle<SharedFunctionInfo> shared,
6671 Handle<Code> code, 6671 Handle<Context> native_context,
6672 Handle<LiteralsArray> literals, 6672 MaybeHandle<Code> code,
6673 BailoutId osr_ast_id); 6673 Handle<LiteralsArray> literals,
6674 6674 BailoutId osr_ast_id);
6675 // We may already have cached the code, but want to store literals in the
6676 // cache.
6677 inline static void AddLiteralsToOptimizedCodeMap(
6678 Handle<SharedFunctionInfo> shared, Handle<Context> native_context,
6679 Handle<LiteralsArray> literals);
6680 6675
6681 // Set up the link between shared function info and the script. The shared 6676 // Set up the link between shared function info and the script. The shared
6682 // function info is added to the list on the script. 6677 // function info is added to the list on the script.
6683 static void SetScript(Handle<SharedFunctionInfo> shared, 6678 static void SetScript(Handle<SharedFunctionInfo> shared,
6684 Handle<Object> script_object); 6679 Handle<Object> script_object);
6685 6680
6686 // Layout description of the optimized code map. 6681 // Layout description of the optimized code map.
6687 static const int kSharedCodeIndex = 0; 6682 static const int kSharedCodeIndex = 0;
6688 static const int kEntriesStart = 1; 6683 static const int kEntriesStart = 1;
6689 static const int kContextOffset = 0; 6684 static const int kContextOffset = 0;
(...skipping 591 matching lines...) Expand 10 before | Expand all | Expand 10 after
7281 static const int kFunctionKindByteOffset = BYTE_OFFSET(kFunctionKind); 7276 static const int kFunctionKindByteOffset = BYTE_OFFSET(kFunctionKind);
7282 #undef BYTE_OFFSET 7277 #undef BYTE_OFFSET
7283 7278
7284 private: 7279 private:
7285 // Returns entry from optimized code map for specified context and OSR entry. 7280 // Returns entry from optimized code map for specified context and OSR entry.
7286 // The result is either kNotFound, kSharedCodeIndex for context-independent 7281 // The result is either kNotFound, kSharedCodeIndex for context-independent
7287 // entry or a start index of the context-dependent entry. 7282 // entry or a start index of the context-dependent entry.
7288 int SearchOptimizedCodeMapEntry(Context* native_context, 7283 int SearchOptimizedCodeMapEntry(Context* native_context,
7289 BailoutId osr_ast_id); 7284 BailoutId osr_ast_id);
7290 7285
7291 // If code is undefined, then existing code won't be overwritten.
7292 static void AddToOptimizedCodeMapInternal(Handle<SharedFunctionInfo> shared,
7293 Handle<Context> native_context,
7294 Handle<HeapObject> code,
7295 Handle<LiteralsArray> literals,
7296 BailoutId osr_ast_id);
7297
7298 DISALLOW_IMPLICIT_CONSTRUCTORS(SharedFunctionInfo); 7286 DISALLOW_IMPLICIT_CONSTRUCTORS(SharedFunctionInfo);
7299 }; 7287 };
7300 7288
7301 7289
7302 // Printing support. 7290 // Printing support.
7303 struct SourceCodeOf { 7291 struct SourceCodeOf {
7304 explicit SourceCodeOf(SharedFunctionInfo* v, int max = -1) 7292 explicit SourceCodeOf(SharedFunctionInfo* v, int max = -1)
7305 : value(v), max_length(max) {} 7293 : value(v), max_length(max) {}
7306 const SharedFunctionInfo* value; 7294 const SharedFunctionInfo* value;
7307 int max_length; 7295 int max_length;
(...skipping 3565 matching lines...) Expand 10 before | Expand all | Expand 10 after
10873 } 10861 }
10874 return value; 10862 return value;
10875 } 10863 }
10876 }; 10864 };
10877 10865
10878 10866
10879 } // NOLINT, false-positive due to second-order macros. 10867 } // NOLINT, false-positive due to second-order macros.
10880 } // NOLINT, false-positive due to second-order macros. 10868 } // NOLINT, false-positive due to second-order macros.
10881 10869
10882 #endif // V8_OBJECTS_H_ 10870 #endif // V8_OBJECTS_H_
OLDNEW
« no previous file with comments | « src/factory.cc ('k') | src/objects.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698