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

Side by Side Diff: src/objects.h

Issue 1906823002: Move of the type feedback vector to the closure. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: REBASE. Created 4 years, 6 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/macro-assembler-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 9
10 #include "src/assert-scope.h" 10 #include "src/assert-scope.h"
(...skipping 838 matching lines...) Expand 10 before | Expand all | Expand 10 after
849 class LookupIterator; 849 class LookupIterator;
850 class FieldType; 850 class FieldType;
851 class ObjectHashTable; 851 class ObjectHashTable;
852 class ObjectVisitor; 852 class ObjectVisitor;
853 class PropertyCell; 853 class PropertyCell;
854 class PropertyDescriptor; 854 class PropertyDescriptor;
855 class SafepointEntry; 855 class SafepointEntry;
856 class SharedFunctionInfo; 856 class SharedFunctionInfo;
857 class StringStream; 857 class StringStream;
858 class TypeFeedbackInfo; 858 class TypeFeedbackInfo;
859 class TypeFeedbackMetadata;
859 class TypeFeedbackVector; 860 class TypeFeedbackVector;
860 class WeakCell; 861 class WeakCell;
861 class TransitionArray; 862 class TransitionArray;
862 863
863 864
864 // A template-ized version of the IsXXX functions. 865 // A template-ized version of the IsXXX functions.
865 template <class C> inline bool Is(Object* obj); 866 template <class C> inline bool Is(Object* obj);
866 867
867 #ifdef VERIFY_HEAP 868 #ifdef VERIFY_HEAP
868 #define DECLARE_VERIFIER(Name) void Name##Verify(); 869 #define DECLARE_VERIFIER(Name) void Name##Verify();
(...skipping 3860 matching lines...) Expand 10 before | Expand all | Expand 10 after
4729 #endif 4730 #endif
4730 }; 4731 };
4731 4732
4732 4733
4733 // A literals array contains the literals for a JSFunction. It also holds 4734 // A literals array contains the literals for a JSFunction. It also holds
4734 // the type feedback vector. 4735 // the type feedback vector.
4735 class LiteralsArray : public FixedArray { 4736 class LiteralsArray : public FixedArray {
4736 public: 4737 public:
4737 static const int kVectorIndex = 0; 4738 static const int kVectorIndex = 0;
4738 static const int kFirstLiteralIndex = 1; 4739 static const int kFirstLiteralIndex = 1;
4739 static const int kOffsetToFirstLiteral = 4740 static const int kFeedbackVectorOffset;
4740 FixedArray::kHeaderSize + kPointerSize; 4741 static const int kOffsetToFirstLiteral;
4741 4742
4742 static int OffsetOfLiteralAt(int index) { 4743 static int OffsetOfLiteralAt(int index) {
4743 return SizeFor(index + kFirstLiteralIndex); 4744 return OffsetOfElementAt(index + kFirstLiteralIndex);
4744 } 4745 }
4745 4746
4746 inline TypeFeedbackVector* feedback_vector() const; 4747 inline TypeFeedbackVector* feedback_vector() const;
4747 inline void set_feedback_vector(TypeFeedbackVector* vector); 4748 inline void set_feedback_vector(TypeFeedbackVector* vector);
4748 inline Object* literal(int literal_index) const; 4749 inline Object* literal(int literal_index) const;
4749 inline void set_literal(int literal_index, Object* literal); 4750 inline void set_literal(int literal_index, Object* literal);
4751 inline void set_literal_undefined(int literal_index);
4750 inline int literals_count() const; 4752 inline int literals_count() const;
4751 4753
4752 static Handle<LiteralsArray> New(Isolate* isolate, 4754 static Handle<LiteralsArray> New(Isolate* isolate,
4753 Handle<TypeFeedbackVector> vector, 4755 Handle<TypeFeedbackVector> vector,
4754 int number_of_literals, 4756 int number_of_literals,
4755 PretenureFlag pretenure); 4757 PretenureFlag pretenure);
4756 4758
4757 DECLARE_CAST(LiteralsArray) 4759 DECLARE_CAST(LiteralsArray)
4758 4760
4759 private: 4761 private:
(...skipping 1858 matching lines...) Expand 10 before | Expand all | Expand 10 after
6618 // Returns entry from optimized code map for specified context and OSR entry. 6620 // Returns entry from optimized code map for specified context and OSR entry.
6619 // Note that {code == nullptr, literals == nullptr} indicates no matching 6621 // Note that {code == nullptr, literals == nullptr} indicates no matching
6620 // entry has been found, whereas {code, literals == nullptr} indicates that 6622 // entry has been found, whereas {code, literals == nullptr} indicates that
6621 // code is context-independent. 6623 // code is context-independent.
6622 CodeAndLiterals SearchOptimizedCodeMap(Context* native_context, 6624 CodeAndLiterals SearchOptimizedCodeMap(Context* native_context,
6623 BailoutId osr_ast_id); 6625 BailoutId osr_ast_id);
6624 6626
6625 // Clear optimized code map. 6627 // Clear optimized code map.
6626 void ClearOptimizedCodeMap(); 6628 void ClearOptimizedCodeMap();
6627 6629
6630 // Like ClearOptimizedCodeMap, but preserves literals.
6631 void ClearCodeFromOptimizedCodeMap();
6632
6628 // We have a special root FixedArray with the right shape and values 6633 // We have a special root FixedArray with the right shape and values
6629 // to represent the cleared optimized code map. This predicate checks 6634 // to represent the cleared optimized code map. This predicate checks
6630 // if that root is installed. 6635 // if that root is installed.
6631 inline bool OptimizedCodeMapIsCleared() const; 6636 inline bool OptimizedCodeMapIsCleared() const;
6632 6637
6633 // Removes a specific optimized code object from the optimized code map. 6638 // Removes a specific optimized code object from the optimized code map.
6634 // In case of non-OSR the code reference is cleared from the cache entry but 6639 // In case of non-OSR the code reference is cleared from the cache entry but
6635 // the entry itself is left in the map in order to proceed sharing literals. 6640 // the entry itself is left in the map in order to proceed sharing literals.
6636 void EvictFromOptimizedCodeMap(Code* optimized_code, const char* reason); 6641 void EvictFromOptimizedCodeMap(Code* optimized_code, const char* reason);
6637 6642
6638 // Trims the optimized code map after entries have been removed. 6643 // Trims the optimized code map after entries have been removed.
6639 void TrimOptimizedCodeMap(int shrink_by); 6644 void TrimOptimizedCodeMap(int shrink_by);
6640 6645
6646 static Handle<LiteralsArray> FindOrCreateLiterals(
6647 Handle<SharedFunctionInfo> shared, Handle<Context> native_context);
6648
6641 // Add or update entry in the optimized code map for context-independent code. 6649 // Add or update entry in the optimized code map for context-independent code.
6642 static void AddSharedCodeToOptimizedCodeMap(Handle<SharedFunctionInfo> shared, 6650 static void AddSharedCodeToOptimizedCodeMap(Handle<SharedFunctionInfo> shared,
6643 Handle<Code> code); 6651 Handle<Code> code);
6644 6652
6645 // Add or update entry in the optimized code map for context-dependent code. 6653 // Add or update entry in the optimized code map for context-dependent code.
6646 // If {code} is not given, then an existing entry's code won't be overwritten. 6654 // If {code} is not given, then an existing entry's code won't be overwritten.
6647 static void AddToOptimizedCodeMap(Handle<SharedFunctionInfo> shared, 6655 static void AddToOptimizedCodeMap(Handle<SharedFunctionInfo> shared,
6648 Handle<Context> native_context, 6656 Handle<Context> native_context,
6649 MaybeHandle<Code> code, 6657 MaybeHandle<Code> code,
6650 Handle<LiteralsArray> literals, 6658 Handle<LiteralsArray> literals,
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
6700 inline void set_internal_formal_parameter_count(int value); 6708 inline void set_internal_formal_parameter_count(int value);
6701 6709
6702 // Set the formal parameter count so the function code will be 6710 // Set the formal parameter count so the function code will be
6703 // called without using argument adaptor frames. 6711 // called without using argument adaptor frames.
6704 inline void DontAdaptArguments(); 6712 inline void DontAdaptArguments();
6705 6713
6706 // [expected_nof_properties]: Expected number of properties for the function. 6714 // [expected_nof_properties]: Expected number of properties for the function.
6707 inline int expected_nof_properties() const; 6715 inline int expected_nof_properties() const;
6708 inline void set_expected_nof_properties(int value); 6716 inline void set_expected_nof_properties(int value);
6709 6717
6710 // [feedback_vector] - accumulates ast node feedback from full-codegen and 6718 // [feedback_metadata] - describes ast node feedback from full-codegen and
6711 // (increasingly) from crankshafted code where sufficient feedback isn't 6719 // (increasingly) from crankshafted code where sufficient feedback isn't
6712 // available. 6720 // available.
6713 DECL_ACCESSORS(feedback_vector, TypeFeedbackVector) 6721 DECL_ACCESSORS(feedback_metadata, TypeFeedbackMetadata)
6714
6715 // Unconditionally clear the type feedback vector (including vector ICs).
6716 void ClearTypeFeedbackInfo();
6717
6718 // Clear the type feedback vector with a more subtle policy at GC time.
6719 void ClearTypeFeedbackInfoAtGCTime();
6720 6722
6721 #if TRACE_MAPS 6723 #if TRACE_MAPS
6722 // [unique_id] - For --trace-maps purposes, an identifier that's persistent 6724 // [unique_id] - For --trace-maps purposes, an identifier that's persistent
6723 // even if the GC moves this SharedFunctionInfo. 6725 // even if the GC moves this SharedFunctionInfo.
6724 inline int unique_id() const; 6726 inline int unique_id() const;
6725 inline void set_unique_id(int value); 6727 inline void set_unique_id(int value);
6726 #endif 6728 #endif
6727 6729
6728 // [instance class name]: class name for instances. 6730 // [instance class name]: class name for instances.
6729 DECL_ACCESSORS(instance_class_name, Object) 6731 DECL_ACCESSORS(instance_class_name, Object)
(...skipping 298 matching lines...) Expand 10 before | Expand all | Expand 10 after
7028 static const int kOptimizedCodeMapOffset = kCodeOffset + kPointerSize; 7030 static const int kOptimizedCodeMapOffset = kCodeOffset + kPointerSize;
7029 static const int kScopeInfoOffset = kOptimizedCodeMapOffset + kPointerSize; 7031 static const int kScopeInfoOffset = kOptimizedCodeMapOffset + kPointerSize;
7030 static const int kConstructStubOffset = kScopeInfoOffset + kPointerSize; 7032 static const int kConstructStubOffset = kScopeInfoOffset + kPointerSize;
7031 static const int kInstanceClassNameOffset = 7033 static const int kInstanceClassNameOffset =
7032 kConstructStubOffset + kPointerSize; 7034 kConstructStubOffset + kPointerSize;
7033 static const int kFunctionDataOffset = 7035 static const int kFunctionDataOffset =
7034 kInstanceClassNameOffset + kPointerSize; 7036 kInstanceClassNameOffset + kPointerSize;
7035 static const int kScriptOffset = kFunctionDataOffset + kPointerSize; 7037 static const int kScriptOffset = kFunctionDataOffset + kPointerSize;
7036 static const int kDebugInfoOffset = kScriptOffset + kPointerSize; 7038 static const int kDebugInfoOffset = kScriptOffset + kPointerSize;
7037 static const int kFunctionIdentifierOffset = kDebugInfoOffset + kPointerSize; 7039 static const int kFunctionIdentifierOffset = kDebugInfoOffset + kPointerSize;
7038 static const int kFeedbackVectorOffset = 7040 static const int kFeedbackMetadataOffset =
7039 kFunctionIdentifierOffset + kPointerSize; 7041 kFunctionIdentifierOffset + kPointerSize;
7040 #if TRACE_MAPS 7042 #if TRACE_MAPS
7041 static const int kUniqueIdOffset = kFeedbackVectorOffset + kPointerSize; 7043 static const int kUniqueIdOffset = kFeedbackMetadataOffset + kPointerSize;
7042 static const int kLastPointerFieldOffset = kUniqueIdOffset; 7044 static const int kLastPointerFieldOffset = kUniqueIdOffset;
7043 #else 7045 #else
7044 // Just to not break the postmortrem support with conditional offsets 7046 // Just to not break the postmortrem support with conditional offsets
7045 static const int kUniqueIdOffset = kFeedbackVectorOffset; 7047 static const int kUniqueIdOffset = kFeedbackMetadataOffset;
7046 static const int kLastPointerFieldOffset = kFeedbackVectorOffset; 7048 static const int kLastPointerFieldOffset = kFeedbackMetadataOffset;
7047 #endif 7049 #endif
7048 7050
7049 #if V8_HOST_ARCH_32_BIT 7051 #if V8_HOST_ARCH_32_BIT
7050 // Smi fields. 7052 // Smi fields.
7051 static const int kLengthOffset = kLastPointerFieldOffset + kPointerSize; 7053 static const int kLengthOffset = kLastPointerFieldOffset + kPointerSize;
7052 static const int kFormalParameterCountOffset = kLengthOffset + kPointerSize; 7054 static const int kFormalParameterCountOffset = kLengthOffset + kPointerSize;
7053 static const int kExpectedNofPropertiesOffset = 7055 static const int kExpectedNofPropertiesOffset =
7054 kFormalParameterCountOffset + kPointerSize; 7056 kFormalParameterCountOffset + kPointerSize;
7055 static const int kNumLiteralsOffset = 7057 static const int kNumLiteralsOffset =
7056 kExpectedNofPropertiesOffset + kPointerSize; 7058 kExpectedNofPropertiesOffset + kPointerSize;
(...skipping 429 matching lines...) Expand 10 before | Expand all | Expand 10 after
7486 // 7488 //
7487 // If the function contains object, regexp or array literals, the 7489 // If the function contains object, regexp or array literals, the
7488 // literals array prefix contains the object, regexp, and array 7490 // literals array prefix contains the object, regexp, and array
7489 // function to be used when creating these literals. This is 7491 // function to be used when creating these literals. This is
7490 // necessary so that we do not dynamically lookup the object, regexp 7492 // necessary so that we do not dynamically lookup the object, regexp
7491 // or array functions. Performing a dynamic lookup, we might end up 7493 // or array functions. Performing a dynamic lookup, we might end up
7492 // using the functions from a new context that we should not have 7494 // using the functions from a new context that we should not have
7493 // access to. 7495 // access to.
7494 DECL_ACCESSORS(literals, LiteralsArray) 7496 DECL_ACCESSORS(literals, LiteralsArray)
7495 7497
7498 static void EnsureLiterals(Handle<JSFunction> function);
7499 inline TypeFeedbackVector* feedback_vector();
7500
7501 // Unconditionally clear the type feedback vector (including vector ICs).
7502 void ClearTypeFeedbackInfo();
7503
7504 // Clear the type feedback vector with a more subtle policy at GC time.
7505 void ClearTypeFeedbackInfoAtGCTime();
7506
7496 // The initial map for an object created by this constructor. 7507 // The initial map for an object created by this constructor.
7497 inline Map* initial_map(); 7508 inline Map* initial_map();
7498 static void SetInitialMap(Handle<JSFunction> function, Handle<Map> map, 7509 static void SetInitialMap(Handle<JSFunction> function, Handle<Map> map,
7499 Handle<Object> prototype); 7510 Handle<Object> prototype);
7500 inline bool has_initial_map(); 7511 inline bool has_initial_map();
7501 static void EnsureHasInitialMap(Handle<JSFunction> function); 7512 static void EnsureHasInitialMap(Handle<JSFunction> function);
7502 7513
7503 // Creates a map that matches the constructor's initial map, but with 7514 // Creates a map that matches the constructor's initial map, but with
7504 // [[prototype]] being new.target.prototype. Because new.target can be a 7515 // [[prototype]] being new.target.prototype. Because new.target can be a
7505 // JSProxy, this can call back into JavaScript. 7516 // JSProxy, this can call back into JavaScript.
(...skipping 3268 matching lines...) Expand 10 before | Expand all | Expand 10 after
10774 } 10785 }
10775 return value; 10786 return value;
10776 } 10787 }
10777 }; 10788 };
10778 10789
10779 10790
10780 } // NOLINT, false-positive due to second-order macros. 10791 } // NOLINT, false-positive due to second-order macros.
10781 } // NOLINT, false-positive due to second-order macros. 10792 } // NOLINT, false-positive due to second-order macros.
10782 10793
10783 #endif // V8_OBJECTS_H_ 10794 #endif // V8_OBJECTS_H_
OLDNEW
« no previous file with comments | « src/mips64/macro-assembler-mips64.cc ('k') | src/objects.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698