OLD | NEW |
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 4912 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4923 int length() { return ByteArray::length() / sizeof(T); } | 4923 int length() { return ByteArray::length() / sizeof(T); } |
4924 DECLARE_CAST(PodArray<T>) | 4924 DECLARE_CAST(PodArray<T>) |
4925 | 4925 |
4926 private: | 4926 private: |
4927 DISALLOW_IMPLICIT_CONSTRUCTORS(PodArray<T>); | 4927 DISALLOW_IMPLICIT_CONSTRUCTORS(PodArray<T>); |
4928 }; | 4928 }; |
4929 | 4929 |
4930 // BytecodeArray represents a sequence of interpreter bytecodes. | 4930 // BytecodeArray represents a sequence of interpreter bytecodes. |
4931 class BytecodeArray : public FixedArrayBase { | 4931 class BytecodeArray : public FixedArrayBase { |
4932 public: | 4932 public: |
| 4933 #define DECLARE_BYTECODE_AGE_ENUM(X) k##X##BytecodeAge, |
| 4934 enum Age { |
| 4935 kNoAgeBytecodeAge = 0, |
| 4936 CODE_AGE_LIST(DECLARE_BYTECODE_AGE_ENUM) kAfterLastBytecodeAge, |
| 4937 kFirstBytecodeAge = kNoAgeBytecodeAge, |
| 4938 kLastBytecodeAge = kAfterLastBytecodeAge - 1, |
| 4939 kBytecodeAgeCount = kAfterLastBytecodeAge - kFirstBytecodeAge - 1, |
| 4940 kIsOldBytecodeAge = kSexagenarianBytecodeAge |
| 4941 }; |
| 4942 #undef DECLARE_BYTECODE_AGE_ENUM |
| 4943 |
4933 static int SizeFor(int length) { | 4944 static int SizeFor(int length) { |
4934 return OBJECT_POINTER_ALIGN(kHeaderSize + length); | 4945 return OBJECT_POINTER_ALIGN(kHeaderSize + length); |
4935 } | 4946 } |
4936 | 4947 |
4937 // Setter and getter | 4948 // Setter and getter |
4938 inline byte get(int index); | 4949 inline byte get(int index); |
4939 inline void set(int index, byte value); | 4950 inline void set(int index, byte value); |
4940 | 4951 |
4941 // Returns data start address. | 4952 // Returns data start address. |
4942 inline Address GetFirstBytecodeAddress(); | 4953 inline Address GetFirstBytecodeAddress(); |
(...skipping 10 matching lines...) Expand all Loading... |
4953 inline void set_parameter_count(int number_of_parameters); | 4964 inline void set_parameter_count(int number_of_parameters); |
4954 | 4965 |
4955 // Accessors for profiling count. | 4966 // Accessors for profiling count. |
4956 inline int interrupt_budget() const; | 4967 inline int interrupt_budget() const; |
4957 inline void set_interrupt_budget(int interrupt_budget); | 4968 inline void set_interrupt_budget(int interrupt_budget); |
4958 | 4969 |
4959 // Accessors for OSR loop nesting level. | 4970 // Accessors for OSR loop nesting level. |
4960 inline int osr_loop_nesting_level() const; | 4971 inline int osr_loop_nesting_level() const; |
4961 inline void set_osr_loop_nesting_level(int depth); | 4972 inline void set_osr_loop_nesting_level(int depth); |
4962 | 4973 |
| 4974 // Accessors for bytecode's code age. |
| 4975 inline Age bytecode_age() const; |
| 4976 inline void set_bytecode_age(Age age); |
| 4977 |
4963 // Accessors for the constant pool. | 4978 // Accessors for the constant pool. |
4964 DECL_ACCESSORS(constant_pool, FixedArray) | 4979 DECL_ACCESSORS(constant_pool, FixedArray) |
4965 | 4980 |
4966 // Accessors for handler table containing offsets of exception handlers. | 4981 // Accessors for handler table containing offsets of exception handlers. |
4967 DECL_ACCESSORS(handler_table, FixedArray) | 4982 DECL_ACCESSORS(handler_table, FixedArray) |
4968 | 4983 |
4969 // Accessors for source position table containing mappings between byte code | 4984 // Accessors for source position table containing mappings between byte code |
4970 // offset and source position. | 4985 // offset and source position. |
4971 DECL_ACCESSORS(source_position_table, ByteArray) | 4986 DECL_ACCESSORS(source_position_table, ByteArray) |
4972 | 4987 |
(...skipping 11 matching lines...) Expand all Loading... |
4984 int SourcePosition(int offset); | 4999 int SourcePosition(int offset); |
4985 int SourceStatementPosition(int offset); | 5000 int SourceStatementPosition(int offset); |
4986 | 5001 |
4987 DECLARE_PRINTER(BytecodeArray) | 5002 DECLARE_PRINTER(BytecodeArray) |
4988 DECLARE_VERIFIER(BytecodeArray) | 5003 DECLARE_VERIFIER(BytecodeArray) |
4989 | 5004 |
4990 void Disassemble(std::ostream& os); | 5005 void Disassemble(std::ostream& os); |
4991 | 5006 |
4992 void CopyBytecodesTo(BytecodeArray* to); | 5007 void CopyBytecodesTo(BytecodeArray* to); |
4993 | 5008 |
| 5009 // Bytecode aging |
| 5010 bool IsOld() const; |
| 5011 void MakeOlder(); |
| 5012 |
4994 // Layout description. | 5013 // Layout description. |
4995 static const int kConstantPoolOffset = FixedArrayBase::kHeaderSize; | 5014 static const int kConstantPoolOffset = FixedArrayBase::kHeaderSize; |
4996 static const int kHandlerTableOffset = kConstantPoolOffset + kPointerSize; | 5015 static const int kHandlerTableOffset = kConstantPoolOffset + kPointerSize; |
4997 static const int kSourcePositionTableOffset = | 5016 static const int kSourcePositionTableOffset = |
4998 kHandlerTableOffset + kPointerSize; | 5017 kHandlerTableOffset + kPointerSize; |
4999 static const int kFrameSizeOffset = kSourcePositionTableOffset + kPointerSize; | 5018 static const int kFrameSizeOffset = kSourcePositionTableOffset + kPointerSize; |
5000 static const int kParameterSizeOffset = kFrameSizeOffset + kIntSize; | 5019 static const int kParameterSizeOffset = kFrameSizeOffset + kIntSize; |
5001 static const int kInterruptBudgetOffset = kParameterSizeOffset + kIntSize; | 5020 static const int kInterruptBudgetOffset = kParameterSizeOffset + kIntSize; |
5002 static const int kOSRNestingLevelOffset = kInterruptBudgetOffset + kIntSize; | 5021 static const int kOSRNestingLevelOffset = kInterruptBudgetOffset + kIntSize; |
5003 static const int kHeaderSize = kOSRNestingLevelOffset + kCharSize; | 5022 static const int kBytecodeAgeOffset = kOSRNestingLevelOffset + kCharSize; |
| 5023 static const int kHeaderSize = kBytecodeAgeOffset + kCharSize; |
5004 | 5024 |
5005 // Maximal memory consumption for a single BytecodeArray. | 5025 // Maximal memory consumption for a single BytecodeArray. |
5006 static const int kMaxSize = 512 * MB; | 5026 static const int kMaxSize = 512 * MB; |
5007 // Maximal length of a single BytecodeArray. | 5027 // Maximal length of a single BytecodeArray. |
5008 static const int kMaxLength = kMaxSize - kHeaderSize; | 5028 static const int kMaxLength = kMaxSize - kHeaderSize; |
5009 | 5029 |
5010 static const int kPointerFieldsBeginOffset = kConstantPoolOffset; | 5030 static const int kPointerFieldsBeginOffset = kConstantPoolOffset; |
5011 static const int kPointerFieldsEndOffset = kFrameSizeOffset; | 5031 static const int kPointerFieldsEndOffset = kFrameSizeOffset; |
5012 | 5032 |
5013 typedef FixedBodyDescriptor<kPointerFieldsBeginOffset, | 5033 typedef FixedBodyDescriptor<kPointerFieldsBeginOffset, |
(...skipping 6888 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
11902 } | 11922 } |
11903 return value; | 11923 return value; |
11904 } | 11924 } |
11905 }; | 11925 }; |
11906 | 11926 |
11907 | 11927 |
11908 } // NOLINT, false-positive due to second-order macros. | 11928 } // NOLINT, false-positive due to second-order macros. |
11909 } // NOLINT, false-positive due to second-order macros. | 11929 } // NOLINT, false-positive due to second-order macros. |
11910 | 11930 |
11911 #endif // V8_OBJECTS_H_ | 11931 #endif // V8_OBJECTS_H_ |
OLD | NEW |