OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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 "src/allocation.h" | 8 #include "src/allocation.h" |
9 #include "src/assert-scope.h" | 9 #include "src/assert-scope.h" |
10 #include "src/builtins.h" | 10 #include "src/builtins.h" |
(...skipping 3107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3118 HEAP_PTR, | 3118 HEAP_PTR, |
3119 INT32, | 3119 INT32, |
3120 // Number of types stored by the ConstantPoolArrays. | 3120 // Number of types stored by the ConstantPoolArrays. |
3121 NUMBER_OF_TYPES, | 3121 NUMBER_OF_TYPES, |
3122 FIRST_TYPE = INT64, | 3122 FIRST_TYPE = INT64, |
3123 LAST_TYPE = INT32 | 3123 LAST_TYPE = INT32 |
3124 }; | 3124 }; |
3125 | 3125 |
3126 enum LayoutSection { | 3126 enum LayoutSection { |
3127 SMALL_SECTION = 0, | 3127 SMALL_SECTION = 0, |
3128 EXTENDED_SECTION | 3128 EXTENDED_SECTION, |
| 3129 NUMBER_OF_LAYOUT_SECTIONS |
3129 }; | 3130 }; |
3130 | 3131 |
3131 class NumberOfEntries BASE_EMBEDDED { | 3132 class NumberOfEntries BASE_EMBEDDED { |
3132 public: | 3133 public: |
3133 inline NumberOfEntries() { | 3134 inline NumberOfEntries() { |
3134 for (int i = 0; i < NUMBER_OF_TYPES; i++) { | 3135 for (int i = 0; i < NUMBER_OF_TYPES; i++) { |
3135 element_counts_[i] = 0; | 3136 element_counts_[i] = 0; |
3136 } | 3137 } |
3137 } | 3138 } |
3138 | 3139 |
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3197 }; | 3198 }; |
3198 | 3199 |
3199 // Getters for the first index, the last index and the count of entries of | 3200 // Getters for the first index, the last index and the count of entries of |
3200 // a given type for a given layout section. | 3201 // a given type for a given layout section. |
3201 inline int first_index(Type type, LayoutSection layout_section); | 3202 inline int first_index(Type type, LayoutSection layout_section); |
3202 inline int last_index(Type type, LayoutSection layout_section); | 3203 inline int last_index(Type type, LayoutSection layout_section); |
3203 inline int number_of_entries(Type type, LayoutSection layout_section); | 3204 inline int number_of_entries(Type type, LayoutSection layout_section); |
3204 | 3205 |
3205 // Returns the type of the entry at the given index. | 3206 // Returns the type of the entry at the given index. |
3206 inline Type get_type(int index); | 3207 inline Type get_type(int index); |
| 3208 inline bool offset_is_type(int offset, Type type); |
3207 | 3209 |
3208 // Setter and getter for pool elements. | 3210 // Setter and getter for pool elements. |
3209 inline Address get_code_ptr_entry(int index); | 3211 inline Address get_code_ptr_entry(int index); |
3210 inline Object* get_heap_ptr_entry(int index); | 3212 inline Object* get_heap_ptr_entry(int index); |
3211 inline int64_t get_int64_entry(int index); | 3213 inline int64_t get_int64_entry(int index); |
3212 inline int32_t get_int32_entry(int index); | 3214 inline int32_t get_int32_entry(int index); |
3213 inline double get_int64_entry_as_double(int index); | 3215 inline double get_int64_entry_as_double(int index); |
3214 | 3216 |
3215 inline void set(int index, Address value); | 3217 inline void set(int index, Address value); |
3216 inline void set(int index, Object* value); | 3218 inline void set(int index, Object* value); |
3217 inline void set(int index, int64_t value); | 3219 inline void set(int index, int64_t value); |
3218 inline void set(int index, double value); | 3220 inline void set(int index, double value); |
3219 inline void set(int index, int32_t value); | 3221 inline void set(int index, int32_t value); |
3220 | 3222 |
| 3223 // Setters which take a raw offset rather than an index (for code generation). |
| 3224 inline void set_at_offset(int offset, int32_t value); |
| 3225 inline void set_at_offset(int offset, int64_t value); |
| 3226 inline void set_at_offset(int offset, double value); |
| 3227 inline void set_at_offset(int offset, Address value); |
| 3228 inline void set_at_offset(int offset, Object* value); |
| 3229 |
3221 // Setter and getter for weak objects state | 3230 // Setter and getter for weak objects state |
3222 inline void set_weak_object_state(WeakObjectState state); | 3231 inline void set_weak_object_state(WeakObjectState state); |
3223 inline WeakObjectState get_weak_object_state(); | 3232 inline WeakObjectState get_weak_object_state(); |
3224 | 3233 |
3225 // Returns true if the constant pool has an extended layout, false if it has | 3234 // Returns true if the constant pool has an extended layout, false if it has |
3226 // only the small layout. | 3235 // only the small layout. |
3227 inline bool is_extended_layout(); | 3236 inline bool is_extended_layout(); |
3228 | 3237 |
3229 // Returns the last LayoutSection in this constant pool array. | 3238 // Returns the last LayoutSection in this constant pool array. |
3230 inline LayoutSection final_section(); | 3239 inline LayoutSection final_section(); |
(...skipping 7984 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
11215 } else { | 11224 } else { |
11216 value &= ~(1 << bit_position); | 11225 value &= ~(1 << bit_position); |
11217 } | 11226 } |
11218 return value; | 11227 return value; |
11219 } | 11228 } |
11220 }; | 11229 }; |
11221 | 11230 |
11222 } } // namespace v8::internal | 11231 } } // namespace v8::internal |
11223 | 11232 |
11224 #endif // V8_OBJECTS_H_ | 11233 #endif // V8_OBJECTS_H_ |
OLD | NEW |