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

Side by Side Diff: src/objects.h

Issue 2534763003: [Interpreter] Add bytecode aging and use it enable CompilationCache for bytecode (Closed)
Patch Set: Created 4 years 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
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 4923 matching lines...) Expand 10 before | Expand all | Expand 10 after
4934 int length() { return ByteArray::length() / sizeof(T); } 4934 int length() { return ByteArray::length() / sizeof(T); }
4935 DECLARE_CAST(PodArray<T>) 4935 DECLARE_CAST(PodArray<T>)
4936 4936
4937 private: 4937 private:
4938 DISALLOW_IMPLICIT_CONSTRUCTORS(PodArray<T>); 4938 DISALLOW_IMPLICIT_CONSTRUCTORS(PodArray<T>);
4939 }; 4939 };
4940 4940
4941 // BytecodeArray represents a sequence of interpreter bytecodes. 4941 // BytecodeArray represents a sequence of interpreter bytecodes.
4942 class BytecodeArray : public FixedArrayBase { 4942 class BytecodeArray : public FixedArrayBase {
4943 public: 4943 public:
4944 #define DECLARE_BYTECODE_AGE_ENUM(X) k##X##BytecodeAge,
4945 enum Age {
4946 kNoAgeBytecodeAge = 0,
4947 CODE_AGE_LIST(DECLARE_BYTECODE_AGE_ENUM) kAfterLastBytecodeAge,
4948 kFirstBytecodeAge = kNoAgeBytecodeAge,
4949 kLastBytecodeAge = kAfterLastBytecodeAge - 1,
4950 kBytecodeAgeCount = kAfterLastBytecodeAge - kFirstBytecodeAge - 1,
4951 kIsOldBytecodeAge = kSexagenarianBytecodeAge
4952 };
4953 #undef DECLARE_BYTECODE_AGE_ENUM
4954
4944 static int SizeFor(int length) { 4955 static int SizeFor(int length) {
4945 return OBJECT_POINTER_ALIGN(kHeaderSize + length); 4956 return OBJECT_POINTER_ALIGN(kHeaderSize + length);
4946 } 4957 }
4947 4958
4948 // Setter and getter 4959 // Setter and getter
4949 inline byte get(int index); 4960 inline byte get(int index);
4950 inline void set(int index, byte value); 4961 inline void set(int index, byte value);
4951 4962
4952 // Returns data start address. 4963 // Returns data start address.
4953 inline Address GetFirstBytecodeAddress(); 4964 inline Address GetFirstBytecodeAddress();
(...skipping 10 matching lines...) Expand all
4964 inline void set_parameter_count(int number_of_parameters); 4975 inline void set_parameter_count(int number_of_parameters);
4965 4976
4966 // Accessors for profiling count. 4977 // Accessors for profiling count.
4967 inline int interrupt_budget() const; 4978 inline int interrupt_budget() const;
4968 inline void set_interrupt_budget(int interrupt_budget); 4979 inline void set_interrupt_budget(int interrupt_budget);
4969 4980
4970 // Accessors for OSR loop nesting level. 4981 // Accessors for OSR loop nesting level.
4971 inline int osr_loop_nesting_level() const; 4982 inline int osr_loop_nesting_level() const;
4972 inline void set_osr_loop_nesting_level(int depth); 4983 inline void set_osr_loop_nesting_level(int depth);
4973 4984
4985 // Accessors for bytecode's code age.
4986 inline Age bytecode_age() const;
4987 inline void set_bytecode_age(Age age);
4988
4974 // Accessors for the constant pool. 4989 // Accessors for the constant pool.
4975 DECL_ACCESSORS(constant_pool, FixedArray) 4990 DECL_ACCESSORS(constant_pool, FixedArray)
4976 4991
4977 // Accessors for handler table containing offsets of exception handlers. 4992 // Accessors for handler table containing offsets of exception handlers.
4978 DECL_ACCESSORS(handler_table, FixedArray) 4993 DECL_ACCESSORS(handler_table, FixedArray)
4979 4994
4980 // Accessors for source position table containing mappings between byte code 4995 // Accessors for source position table containing mappings between byte code
4981 // offset and source position. 4996 // offset and source position.
4982 DECL_ACCESSORS(source_position_table, ByteArray) 4997 DECL_ACCESSORS(source_position_table, ByteArray)
4983 4998
(...skipping 14 matching lines...) Expand all
4998 DECLARE_PRINTER(BytecodeArray) 5013 DECLARE_PRINTER(BytecodeArray)
4999 DECLARE_VERIFIER(BytecodeArray) 5014 DECLARE_VERIFIER(BytecodeArray)
5000 5015
5001 void Disassemble(std::ostream& os); 5016 void Disassemble(std::ostream& os);
5002 5017
5003 void CopyBytecodesTo(BytecodeArray* to); 5018 void CopyBytecodesTo(BytecodeArray* to);
5004 5019
5005 int LookupRangeInHandlerTable(int code_offset, int* data, 5020 int LookupRangeInHandlerTable(int code_offset, int* data,
5006 HandlerTable::CatchPrediction* prediction); 5021 HandlerTable::CatchPrediction* prediction);
5007 5022
5023 // Bytecode aging
5024 bool IsOld() const;
5025 void MakeOlder();
5026
5008 // Layout description. 5027 // Layout description.
5009 static const int kConstantPoolOffset = FixedArrayBase::kHeaderSize; 5028 static const int kConstantPoolOffset = FixedArrayBase::kHeaderSize;
5010 static const int kHandlerTableOffset = kConstantPoolOffset + kPointerSize; 5029 static const int kHandlerTableOffset = kConstantPoolOffset + kPointerSize;
5011 static const int kSourcePositionTableOffset = 5030 static const int kSourcePositionTableOffset =
5012 kHandlerTableOffset + kPointerSize; 5031 kHandlerTableOffset + kPointerSize;
5013 static const int kFrameSizeOffset = kSourcePositionTableOffset + kPointerSize; 5032 static const int kFrameSizeOffset = kSourcePositionTableOffset + kPointerSize;
5014 static const int kParameterSizeOffset = kFrameSizeOffset + kIntSize; 5033 static const int kParameterSizeOffset = kFrameSizeOffset + kIntSize;
5015 static const int kInterruptBudgetOffset = kParameterSizeOffset + kIntSize; 5034 static const int kInterruptBudgetOffset = kParameterSizeOffset + kIntSize;
5016 static const int kOSRNestingLevelOffset = kInterruptBudgetOffset + kIntSize; 5035 static const int kOSRNestingLevelOffset = kInterruptBudgetOffset + kIntSize;
5017 static const int kHeaderSize = kOSRNestingLevelOffset + kCharSize; 5036 static const int kBytecodeAgeOffset = kOSRNestingLevelOffset + kCharSize;
5037 static const int kHeaderSize = kBytecodeAgeOffset + kCharSize;
5018 5038
5019 // Maximal memory consumption for a single BytecodeArray. 5039 // Maximal memory consumption for a single BytecodeArray.
5020 static const int kMaxSize = 512 * MB; 5040 static const int kMaxSize = 512 * MB;
5021 // Maximal length of a single BytecodeArray. 5041 // Maximal length of a single BytecodeArray.
5022 static const int kMaxLength = kMaxSize - kHeaderSize; 5042 static const int kMaxLength = kMaxSize - kHeaderSize;
5023 5043
5024 static const int kPointerFieldsBeginOffset = kConstantPoolOffset; 5044 static const int kPointerFieldsBeginOffset = kConstantPoolOffset;
5025 static const int kPointerFieldsEndOffset = kFrameSizeOffset; 5045 static const int kPointerFieldsEndOffset = kFrameSizeOffset;
5026 5046
5027 typedef FixedBodyDescriptor<kPointerFieldsBeginOffset, 5047 typedef FixedBodyDescriptor<kPointerFieldsBeginOffset,
(...skipping 6849 matching lines...) Expand 10 before | Expand all | Expand 10 after
11877 } 11897 }
11878 return value; 11898 return value;
11879 } 11899 }
11880 }; 11900 };
11881 11901
11882 11902
11883 } // NOLINT, false-positive due to second-order macros. 11903 } // NOLINT, false-positive due to second-order macros.
11884 } // NOLINT, false-positive due to second-order macros. 11904 } // NOLINT, false-positive due to second-order macros.
11885 11905
11886 #endif // V8_OBJECTS_H_ 11906 #endif // V8_OBJECTS_H_
OLDNEW
« no previous file with comments | « src/heap/objects-visiting-inl.h ('k') | src/objects.cc » ('j') | src/objects.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698