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

Side by Side Diff: src/objects.h

Issue 2626863004: Revert of [TypeFeedbackVector] Root literal arrays in function literals slots (Closed)
Patch Set: Created 3 years, 11 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/heap/object-stats.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 #include <memory> 9 #include <memory>
10 10
(...skipping 4998 matching lines...) Expand 10 before | Expand all | Expand 10 after
5009 public: 5009 public:
5010 static const int kVectorIndex = 0; 5010 static const int kVectorIndex = 0;
5011 static const int kFirstLiteralIndex = 1; 5011 static const int kFirstLiteralIndex = 1;
5012 V8_EXPORT_PRIVATE static const int kFeedbackVectorOffset; 5012 V8_EXPORT_PRIVATE static const int kFeedbackVectorOffset;
5013 static const int kOffsetToFirstLiteral; 5013 static const int kOffsetToFirstLiteral;
5014 5014
5015 static int OffsetOfLiteralAt(int index) { 5015 static int OffsetOfLiteralAt(int index) {
5016 return OffsetOfElementAt(index + kFirstLiteralIndex); 5016 return OffsetOfElementAt(index + kFirstLiteralIndex);
5017 } 5017 }
5018 5018
5019 inline bool has_feedback_vector() const;
5020 inline TypeFeedbackVector* feedback_vector() const; 5019 inline TypeFeedbackVector* feedback_vector() const;
5021 inline void set_feedback_vector(TypeFeedbackVector* vector); 5020 inline void set_feedback_vector(TypeFeedbackVector* vector);
5022
5023 inline Object* literal(int literal_index) const; 5021 inline Object* literal(int literal_index) const;
5024 inline void set_literal(int literal_index, Object* literal); 5022 inline void set_literal(int literal_index, Object* literal);
5025 inline void set_literal_undefined(int literal_index); 5023 inline void set_literal_undefined(int literal_index);
5026 inline int literals_count() const; 5024 inline int literals_count() const;
5027 5025
5028 static Handle<LiteralsArray> New(Isolate* isolate, 5026 static Handle<LiteralsArray> New(Isolate* isolate,
5029 Handle<TypeFeedbackVector> vector, 5027 Handle<TypeFeedbackVector> vector,
5030 int number_of_literals, 5028 int number_of_literals,
5031 PretenureFlag pretenure = TENURED); 5029 PretenureFlag pretenure = TENURED);
5032 5030
(...skipping 2119 matching lines...) Expand 10 before | Expand all | Expand 10 after
7152 kTypedArrayEntries, 7150 kTypedArrayEntries,
7153 kTypedArrayKeys, 7151 kTypedArrayKeys,
7154 kTypedArrayLength, 7152 kTypedArrayLength,
7155 kTypedArrayValues, 7153 kTypedArrayValues,
7156 kSharedArrayBufferByteLength, 7154 kSharedArrayBufferByteLength,
7157 kStringIterator, 7155 kStringIterator,
7158 kStringIteratorNext, 7156 kStringIteratorNext,
7159 }; 7157 };
7160 7158
7161 7159
7160 // Result of searching in an optimized code map of a SharedFunctionInfo. Note
7161 // that both {code} and {literals} can be NULL to pass search result status.
7162 struct CodeAndLiterals {
7163 Code* code; // Cached optimized code.
7164 LiteralsArray* literals; // Cached literals array.
7165 };
7166
7167
7162 // SharedFunctionInfo describes the JSFunction information that can be 7168 // SharedFunctionInfo describes the JSFunction information that can be
7163 // shared by multiple instances of the function. 7169 // shared by multiple instances of the function.
7164 class SharedFunctionInfo: public HeapObject { 7170 class SharedFunctionInfo: public HeapObject {
7165 public: 7171 public:
7166 // [name]: Function name. 7172 // [name]: Function name.
7167 DECL_ACCESSORS(name, Object) 7173 DECL_ACCESSORS(name, Object)
7168 7174
7169 // [code]: Function code. 7175 // [code]: Function code.
7170 DECL_ACCESSORS(code, Code) 7176 DECL_ACCESSORS(code, Code)
7171 7177
(...skipping 10 matching lines...) Expand all
7182 inline bool IsInterpreted() const; 7188 inline bool IsInterpreted() const;
7183 7189
7184 inline void ReplaceCode(Code* code); 7190 inline void ReplaceCode(Code* code);
7185 inline bool HasBaselineCode() const; 7191 inline bool HasBaselineCode() const;
7186 7192
7187 // [optimized_code_map]: Map from native context to optimized code 7193 // [optimized_code_map]: Map from native context to optimized code
7188 // and a shared literals array. 7194 // and a shared literals array.
7189 DECL_ACCESSORS(optimized_code_map, FixedArray) 7195 DECL_ACCESSORS(optimized_code_map, FixedArray)
7190 7196
7191 // Returns entry from optimized code map for specified context and OSR entry. 7197 // Returns entry from optimized code map for specified context and OSR entry.
7192 Code* SearchOptimizedCodeMap(Context* native_context, BailoutId osr_ast_id); 7198 // Note that {code == nullptr, literals == nullptr} indicates no matching
7199 // entry has been found, whereas {code, literals == nullptr} indicates that
7200 // code is context-independent.
7201 CodeAndLiterals SearchOptimizedCodeMap(Context* native_context,
7202 BailoutId osr_ast_id);
7193 7203
7194 // Clear optimized code map. 7204 // Clear optimized code map.
7195 void ClearOptimizedCodeMap(); 7205 void ClearOptimizedCodeMap();
7196 7206
7197 // Like ClearOptimizedCodeMap, but preserves literals. 7207 // Like ClearOptimizedCodeMap, but preserves literals.
7198 void ClearCodeFromOptimizedCodeMap(); 7208 void ClearCodeFromOptimizedCodeMap();
7199 7209
7200 // We have a special root FixedArray with the right shape and values 7210 // We have a special root FixedArray with the right shape and values
7201 // to represent the cleared optimized code map. This predicate checks 7211 // to represent the cleared optimized code map. This predicate checks
7202 // if that root is installed. 7212 // if that root is installed.
7203 inline bool OptimizedCodeMapIsCleared() const; 7213 inline bool OptimizedCodeMapIsCleared() const;
7204 7214
7205 // Removes a specific optimized code object from the optimized code map. 7215 // Removes a specific optimized code object from the optimized code map.
7206 // In case of non-OSR the code reference is cleared from the cache entry but 7216 // In case of non-OSR the code reference is cleared from the cache entry but
7207 // the entry itself is left in the map in order to proceed sharing literals. 7217 // the entry itself is left in the map in order to proceed sharing literals.
7208 void EvictFromOptimizedCodeMap(Code* optimized_code, const char* reason); 7218 void EvictFromOptimizedCodeMap(Code* optimized_code, const char* reason);
7209 7219
7210 static Handle<LiteralsArray> FindOrCreateLiterals( 7220 static Handle<LiteralsArray> FindOrCreateLiterals(
7211 Handle<SharedFunctionInfo> shared, Handle<Context> native_context); 7221 Handle<SharedFunctionInfo> shared, Handle<Context> native_context);
7212 7222
7213 // Add or update entry in the optimized code map for context-dependent code. 7223 // Add or update entry in the optimized code map for context-dependent code.
7224 // If {code} is not given, then an existing entry's code won't be overwritten.
7214 static void AddToOptimizedCodeMap(Handle<SharedFunctionInfo> shared, 7225 static void AddToOptimizedCodeMap(Handle<SharedFunctionInfo> shared,
7215 Handle<Context> native_context, 7226 Handle<Context> native_context,
7216 Handle<Code> code, BailoutId osr_ast_id); 7227 MaybeHandle<Code> code,
7228 Handle<LiteralsArray> literals,
7229 BailoutId osr_ast_id);
7217 7230
7218 // Set up the link between shared function info and the script. The shared 7231 // Set up the link between shared function info and the script. The shared
7219 // function info is added to the list on the script. 7232 // function info is added to the list on the script.
7220 V8_EXPORT_PRIVATE static void SetScript(Handle<SharedFunctionInfo> shared, 7233 V8_EXPORT_PRIVATE static void SetScript(Handle<SharedFunctionInfo> shared,
7221 Handle<Object> script_object); 7234 Handle<Object> script_object);
7222 7235
7223 // Layout description of the optimized code map. 7236 // Layout description of the optimized code map.
7224 static const int kEntriesStart = 0; 7237 static const int kEntriesStart = 0;
7225 static const int kContextOffset = 0; 7238 static const int kContextOffset = 0;
7226 static const int kCachedCodeOffset = 1; 7239 static const int kCachedCodeOffset = 1;
7227 static const int kEntryLength = 2; 7240 static const int kLiteralsOffset = 2;
7241 static const int kEntryLength = 3;
7228 static const int kInitialLength = kEntriesStart + kEntryLength; 7242 static const int kInitialLength = kEntriesStart + kEntryLength;
7229 7243
7230 static const int kNotFound = -1; 7244 static const int kNotFound = -1;
7231 7245
7232 // Helpers for assembly code that does a backwards walk of the optimized code 7246 // Helpers for assembly code that does a backwards walk of the optimized code
7233 // map. 7247 // map.
7234 static const int kOffsetToPreviousContext = 7248 static const int kOffsetToPreviousContext =
7235 FixedArray::kHeaderSize + kPointerSize * (kContextOffset - kEntryLength); 7249 FixedArray::kHeaderSize + kPointerSize * (kContextOffset - kEntryLength);
7236 static const int kOffsetToPreviousCachedCode = 7250 static const int kOffsetToPreviousCachedCode =
7237 FixedArray::kHeaderSize + 7251 FixedArray::kHeaderSize +
7238 kPointerSize * (kCachedCodeOffset - kEntryLength); 7252 kPointerSize * (kCachedCodeOffset - kEntryLength);
7253 static const int kOffsetToPreviousLiterals =
7254 FixedArray::kHeaderSize + kPointerSize * (kLiteralsOffset - kEntryLength);
7239 7255
7240 // [scope_info]: Scope info. 7256 // [scope_info]: Scope info.
7241 DECL_ACCESSORS(scope_info, ScopeInfo) 7257 DECL_ACCESSORS(scope_info, ScopeInfo)
7242 7258
7243 // The outer scope info for the purpose of parsing this function, or the hole 7259 // The outer scope info for the purpose of parsing this function, or the hole
7244 // value if it isn't yet known. 7260 // value if it isn't yet known.
7245 DECL_ACCESSORS(outer_scope_info, HeapObject) 7261 DECL_ACCESSORS(outer_scope_info, HeapObject)
7246 7262
7247 // [construct stub]: Code stub for constructing instances of this function. 7263 // [construct stub]: Code stub for constructing instances of this function.
7248 DECL_ACCESSORS(construct_stub, Code) 7264 DECL_ACCESSORS(construct_stub, Code)
(...skipping 948 matching lines...) Expand 10 before | Expand all | Expand 10 after
8197 // 8213 //
8198 // If the function contains object, regexp or array literals, the 8214 // If the function contains object, regexp or array literals, the
8199 // literals array prefix contains the object, regexp, and array 8215 // literals array prefix contains the object, regexp, and array
8200 // function to be used when creating these literals. This is 8216 // function to be used when creating these literals. This is
8201 // necessary so that we do not dynamically lookup the object, regexp 8217 // necessary so that we do not dynamically lookup the object, regexp
8202 // or array functions. Performing a dynamic lookup, we might end up 8218 // or array functions. Performing a dynamic lookup, we might end up
8203 // using the functions from a new context that we should not have 8219 // using the functions from a new context that we should not have
8204 // access to. For API objects we store the boilerplate in the literal array. 8220 // access to. For API objects we store the boilerplate in the literal array.
8205 DECL_ACCESSORS(literals, LiteralsArray) 8221 DECL_ACCESSORS(literals, LiteralsArray)
8206 8222
8207 inline bool has_literals_array() const;
8208 static void EnsureLiterals(Handle<JSFunction> function); 8223 static void EnsureLiterals(Handle<JSFunction> function);
8209 inline TypeFeedbackVector* feedback_vector(); 8224 inline TypeFeedbackVector* feedback_vector();
8210 8225
8211 // Unconditionally clear the type feedback vector (including vector ICs). 8226 // Unconditionally clear the type feedback vector (including vector ICs).
8212 void ClearTypeFeedbackInfo(); 8227 void ClearTypeFeedbackInfo();
8213 8228
8214 // Clear the type feedback vector with a more subtle policy at GC time. 8229 // Clear the type feedback vector with a more subtle policy at GC time.
8215 void ClearTypeFeedbackInfoAtGCTime(); 8230 void ClearTypeFeedbackInfoAtGCTime();
8216 8231
8217 // The initial map for an object created by this constructor. 8232 // The initial map for an object created by this constructor.
(...skipping 3515 matching lines...) Expand 10 before | Expand all | Expand 10 after
11733 } 11748 }
11734 }; 11749 };
11735 11750
11736 11751
11737 } // NOLINT, false-positive due to second-order macros. 11752 } // NOLINT, false-positive due to second-order macros.
11738 } // NOLINT, false-positive due to second-order macros. 11753 } // NOLINT, false-positive due to second-order macros.
11739 11754
11740 #include "src/objects/object-macros-undef.h" 11755 #include "src/objects/object-macros-undef.h"
11741 11756
11742 #endif // V8_OBJECTS_H_ 11757 #endif // V8_OBJECTS_H_
OLDNEW
« no previous file with comments | « src/heap/object-stats.cc ('k') | src/objects.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698