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

Side by Side Diff: src/objects.h

Issue 2597163002: Revert of [TypeFeedbackVector] Root literal arrays in function literals slots (Closed)
Patch Set: Created 3 years, 12 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/mips64/interface-descriptors-mips64.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 4979 matching lines...) Expand 10 before | Expand all | Expand 10 after
4990 public: 4990 public:
4991 static const int kVectorIndex = 0; 4991 static const int kVectorIndex = 0;
4992 static const int kFirstLiteralIndex = 1; 4992 static const int kFirstLiteralIndex = 1;
4993 V8_EXPORT_PRIVATE static const int kFeedbackVectorOffset; 4993 V8_EXPORT_PRIVATE static const int kFeedbackVectorOffset;
4994 static const int kOffsetToFirstLiteral; 4994 static const int kOffsetToFirstLiteral;
4995 4995
4996 static int OffsetOfLiteralAt(int index) { 4996 static int OffsetOfLiteralAt(int index) {
4997 return OffsetOfElementAt(index + kFirstLiteralIndex); 4997 return OffsetOfElementAt(index + kFirstLiteralIndex);
4998 } 4998 }
4999 4999
5000 // Returns true if the vector isn't yet installed.
5001 inline bool needs_feedback_vector() const;
5002 inline TypeFeedbackVector* feedback_vector() const; 5000 inline TypeFeedbackVector* feedback_vector() const;
5003 inline void set_feedback_vector(TypeFeedbackVector* vector); 5001 inline void set_feedback_vector(TypeFeedbackVector* vector);
5004
5005 inline Object* literal(int literal_index) const; 5002 inline Object* literal(int literal_index) const;
5006 inline void set_literal(int literal_index, Object* literal); 5003 inline void set_literal(int literal_index, Object* literal);
5007 inline void set_literal_undefined(int literal_index); 5004 inline void set_literal_undefined(int literal_index);
5008 inline int literals_count() const; 5005 inline int literals_count() const;
5009 5006
5010 static Handle<LiteralsArray> New(Isolate* isolate, 5007 static Handle<LiteralsArray> New(Isolate* isolate,
5011 Handle<TypeFeedbackVector> vector, 5008 Handle<TypeFeedbackVector> vector,
5012 int number_of_literals, 5009 int number_of_literals,
5013 PretenureFlag pretenure = TENURED); 5010 PretenureFlag pretenure = TENURED);
5014 5011
(...skipping 2106 matching lines...) Expand 10 before | Expand all | Expand 10 after
7121 kTypedArrayEntries, 7118 kTypedArrayEntries,
7122 kTypedArrayKeys, 7119 kTypedArrayKeys,
7123 kTypedArrayLength, 7120 kTypedArrayLength,
7124 kTypedArrayValues, 7121 kTypedArrayValues,
7125 kSharedArrayBufferByteLength, 7122 kSharedArrayBufferByteLength,
7126 kStringIterator, 7123 kStringIterator,
7127 kStringIteratorNext, 7124 kStringIteratorNext,
7128 }; 7125 };
7129 7126
7130 7127
7128 // Result of searching in an optimized code map of a SharedFunctionInfo. Note
7129 // that both {code} and {literals} can be NULL to pass search result status.
7130 struct CodeAndLiterals {
7131 Code* code; // Cached optimized code.
7132 LiteralsArray* literals; // Cached literals array.
7133 };
7134
7135
7131 // SharedFunctionInfo describes the JSFunction information that can be 7136 // SharedFunctionInfo describes the JSFunction information that can be
7132 // shared by multiple instances of the function. 7137 // shared by multiple instances of the function.
7133 class SharedFunctionInfo: public HeapObject { 7138 class SharedFunctionInfo: public HeapObject {
7134 public: 7139 public:
7135 // [name]: Function name. 7140 // [name]: Function name.
7136 DECL_ACCESSORS(name, Object) 7141 DECL_ACCESSORS(name, Object)
7137 7142
7138 // [code]: Function code. 7143 // [code]: Function code.
7139 DECL_ACCESSORS(code, Code) 7144 DECL_ACCESSORS(code, Code)
7140 7145
(...skipping 10 matching lines...) Expand all
7151 inline bool IsInterpreted() const; 7156 inline bool IsInterpreted() const;
7152 7157
7153 inline void ReplaceCode(Code* code); 7158 inline void ReplaceCode(Code* code);
7154 inline bool HasBaselineCode() const; 7159 inline bool HasBaselineCode() const;
7155 7160
7156 // [optimized_code_map]: Map from native context to optimized code 7161 // [optimized_code_map]: Map from native context to optimized code
7157 // and a shared literals array. 7162 // and a shared literals array.
7158 DECL_ACCESSORS(optimized_code_map, FixedArray) 7163 DECL_ACCESSORS(optimized_code_map, FixedArray)
7159 7164
7160 // Returns entry from optimized code map for specified context and OSR entry. 7165 // Returns entry from optimized code map for specified context and OSR entry.
7161 Code* SearchOptimizedCodeMap(Context* native_context, BailoutId osr_ast_id); 7166 // Note that {code == nullptr, literals == nullptr} indicates no matching
7167 // entry has been found, whereas {code, literals == nullptr} indicates that
7168 // code is context-independent.
7169 CodeAndLiterals SearchOptimizedCodeMap(Context* native_context,
7170 BailoutId osr_ast_id);
7162 7171
7163 // Clear optimized code map. 7172 // Clear optimized code map.
7164 void ClearOptimizedCodeMap(); 7173 void ClearOptimizedCodeMap();
7165 7174
7166 // Like ClearOptimizedCodeMap, but preserves literals. 7175 // Like ClearOptimizedCodeMap, but preserves literals.
7167 void ClearCodeFromOptimizedCodeMap(); 7176 void ClearCodeFromOptimizedCodeMap();
7168 7177
7169 // We have a special root FixedArray with the right shape and values 7178 // We have a special root FixedArray with the right shape and values
7170 // to represent the cleared optimized code map. This predicate checks 7179 // to represent the cleared optimized code map. This predicate checks
7171 // if that root is installed. 7180 // if that root is installed.
7172 inline bool OptimizedCodeMapIsCleared() const; 7181 inline bool OptimizedCodeMapIsCleared() const;
7173 7182
7174 // Removes a specific optimized code object from the optimized code map. 7183 // Removes a specific optimized code object from the optimized code map.
7175 // In case of non-OSR the code reference is cleared from the cache entry but 7184 // In case of non-OSR the code reference is cleared from the cache entry but
7176 // the entry itself is left in the map in order to proceed sharing literals. 7185 // the entry itself is left in the map in order to proceed sharing literals.
7177 void EvictFromOptimizedCodeMap(Code* optimized_code, const char* reason); 7186 void EvictFromOptimizedCodeMap(Code* optimized_code, const char* reason);
7178 7187
7179 static Handle<LiteralsArray> FindOrCreateLiterals( 7188 static Handle<LiteralsArray> FindOrCreateLiterals(
7180 Handle<SharedFunctionInfo> shared, Handle<Context> native_context); 7189 Handle<SharedFunctionInfo> shared, Handle<Context> native_context);
7181 7190
7182 // Add or update entry in the optimized code map for context-dependent code. 7191 // Add or update entry in the optimized code map for context-dependent code.
7183 // If {code} is not given, then an existing entry's code won't be overwritten. 7192 // If {code} is not given, then an existing entry's code won't be overwritten.
7184 static void AddToOptimizedCodeMap(Handle<SharedFunctionInfo> shared, 7193 static void AddToOptimizedCodeMap(Handle<SharedFunctionInfo> shared,
7185 Handle<Context> native_context, 7194 Handle<Context> native_context,
7186 MaybeHandle<Code> code, 7195 MaybeHandle<Code> code,
7196 Handle<LiteralsArray> literals,
7187 BailoutId osr_ast_id); 7197 BailoutId osr_ast_id);
7188 7198
7189 // Set up the link between shared function info and the script. The shared 7199 // Set up the link between shared function info and the script. The shared
7190 // function info is added to the list on the script. 7200 // function info is added to the list on the script.
7191 V8_EXPORT_PRIVATE static void SetScript(Handle<SharedFunctionInfo> shared, 7201 V8_EXPORT_PRIVATE static void SetScript(Handle<SharedFunctionInfo> shared,
7192 Handle<Object> script_object); 7202 Handle<Object> script_object);
7193 7203
7194 // Layout description of the optimized code map. 7204 // Layout description of the optimized code map.
7195 static const int kEntriesStart = 0; 7205 static const int kEntriesStart = 0;
7196 static const int kContextOffset = 0; 7206 static const int kContextOffset = 0;
7197 static const int kCachedCodeOffset = 1; 7207 static const int kCachedCodeOffset = 1;
7198 static const int kEntryLength = 2; 7208 static const int kLiteralsOffset = 2;
7209 static const int kEntryLength = 3;
7199 static const int kInitialLength = kEntriesStart + kEntryLength; 7210 static const int kInitialLength = kEntriesStart + kEntryLength;
7200 7211
7201 static const int kNotFound = -1; 7212 static const int kNotFound = -1;
7202 7213
7203 // Helpers for assembly code that does a backwards walk of the optimized code 7214 // Helpers for assembly code that does a backwards walk of the optimized code
7204 // map. 7215 // map.
7205 static const int kOffsetToPreviousContext = 7216 static const int kOffsetToPreviousContext =
7206 FixedArray::kHeaderSize + kPointerSize * (kContextOffset - kEntryLength); 7217 FixedArray::kHeaderSize + kPointerSize * (kContextOffset - kEntryLength);
7207 static const int kOffsetToPreviousCachedCode = 7218 static const int kOffsetToPreviousCachedCode =
7208 FixedArray::kHeaderSize + 7219 FixedArray::kHeaderSize +
7209 kPointerSize * (kCachedCodeOffset - kEntryLength); 7220 kPointerSize * (kCachedCodeOffset - kEntryLength);
7221 static const int kOffsetToPreviousLiterals =
7222 FixedArray::kHeaderSize + kPointerSize * (kLiteralsOffset - kEntryLength);
7210 7223
7211 // [scope_info]: Scope info. 7224 // [scope_info]: Scope info.
7212 DECL_ACCESSORS(scope_info, ScopeInfo) 7225 DECL_ACCESSORS(scope_info, ScopeInfo)
7213 7226
7214 // The outer scope info for the purpose of parsing this function, or the hole 7227 // The outer scope info for the purpose of parsing this function, or the hole
7215 // value if it isn't yet known. 7228 // value if it isn't yet known.
7216 DECL_ACCESSORS(outer_scope_info, HeapObject) 7229 DECL_ACCESSORS(outer_scope_info, HeapObject)
7217 7230
7218 // [construct stub]: Code stub for constructing instances of this function. 7231 // [construct stub]: Code stub for constructing instances of this function.
7219 DECL_ACCESSORS(construct_stub, Code) 7232 DECL_ACCESSORS(construct_stub, Code)
(...skipping 1126 matching lines...) Expand 10 before | Expand all | Expand 10 after
8346 static const int kSharedFunctionInfoOffset = 8359 static const int kSharedFunctionInfoOffset =
8347 kPrototypeOrInitialMapOffset + kPointerSize; 8360 kPrototypeOrInitialMapOffset + kPointerSize;
8348 static const int kContextOffset = kSharedFunctionInfoOffset + kPointerSize; 8361 static const int kContextOffset = kSharedFunctionInfoOffset + kPointerSize;
8349 static const int kLiteralsOffset = kContextOffset + kPointerSize; 8362 static const int kLiteralsOffset = kContextOffset + kPointerSize;
8350 static const int kNonWeakFieldsEndOffset = kLiteralsOffset + kPointerSize; 8363 static const int kNonWeakFieldsEndOffset = kLiteralsOffset + kPointerSize;
8351 static const int kCodeEntryOffset = kNonWeakFieldsEndOffset; 8364 static const int kCodeEntryOffset = kNonWeakFieldsEndOffset;
8352 static const int kNextFunctionLinkOffset = kCodeEntryOffset + kPointerSize; 8365 static const int kNextFunctionLinkOffset = kCodeEntryOffset + kPointerSize;
8353 static const int kSize = kNextFunctionLinkOffset + kPointerSize; 8366 static const int kSize = kNextFunctionLinkOffset + kPointerSize;
8354 8367
8355 private: 8368 private:
8356 inline bool needs_literals_array() const;
8357
8358 DISALLOW_IMPLICIT_CONSTRUCTORS(JSFunction); 8369 DISALLOW_IMPLICIT_CONSTRUCTORS(JSFunction);
8359 }; 8370 };
8360 8371
8361 8372
8362 // JSGlobalProxy's prototype must be a JSGlobalObject or null, 8373 // JSGlobalProxy's prototype must be a JSGlobalObject or null,
8363 // and the prototype is hidden. JSGlobalProxy always delegates 8374 // and the prototype is hidden. JSGlobalProxy always delegates
8364 // property accesses to its prototype if the prototype is not null. 8375 // property accesses to its prototype if the prototype is not null.
8365 // 8376 //
8366 // A JSGlobalProxy can be reinitialized which will preserve its identity. 8377 // A JSGlobalProxy can be reinitialized which will preserve its identity.
8367 // 8378 //
(...skipping 3327 matching lines...) Expand 10 before | Expand all | Expand 10 after
11695 } 11706 }
11696 }; 11707 };
11697 11708
11698 11709
11699 } // NOLINT, false-positive due to second-order macros. 11710 } // NOLINT, false-positive due to second-order macros.
11700 } // NOLINT, false-positive due to second-order macros. 11711 } // NOLINT, false-positive due to second-order macros.
11701 11712
11702 #include "src/objects/object-macros-undef.h" 11713 #include "src/objects/object-macros-undef.h"
11703 11714
11704 #endif // V8_OBJECTS_H_ 11715 #endif // V8_OBJECTS_H_
OLDNEW
« no previous file with comments | « src/mips64/interface-descriptors-mips64.cc ('k') | src/objects.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698