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

Side by Side Diff: src/objects.h

Issue 356393003: [Arm]: Enable use of extended out-of-line constant pool for Arm. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Formatted with git cl format Created 6 years, 5 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 | Annotate | Revision Log
« no previous file with comments | « src/debug.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 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 3117 matching lines...) Expand 10 before | Expand all | Expand 10 after
3128 LAST_TYPE = INT32 3128 LAST_TYPE = INT32
3129 }; 3129 };
3130 3130
3131 enum LayoutSection { 3131 enum LayoutSection {
3132 SMALL_SECTION = 0, 3132 SMALL_SECTION = 0,
3133 EXTENDED_SECTION 3133 EXTENDED_SECTION
3134 }; 3134 };
3135 3135
3136 class NumberOfEntries BASE_EMBEDDED { 3136 class NumberOfEntries BASE_EMBEDDED {
3137 public: 3137 public:
3138 inline NumberOfEntries() {
3139 for (int i = 0; i < NUMBER_OF_TYPES; i++) {
3140 element_counts_[i] = 0;
3141 }
3142 }
3143
3138 inline NumberOfEntries(int int64_count, int code_ptr_count, 3144 inline NumberOfEntries(int int64_count, int code_ptr_count,
3139 int heap_ptr_count, int int32_count) { 3145 int heap_ptr_count, int int32_count) {
3140 element_counts_[INT64] = int64_count; 3146 element_counts_[INT64] = int64_count;
3141 element_counts_[CODE_PTR] = code_ptr_count; 3147 element_counts_[CODE_PTR] = code_ptr_count;
3142 element_counts_[HEAP_PTR] = heap_ptr_count; 3148 element_counts_[HEAP_PTR] = heap_ptr_count;
3143 element_counts_[INT32] = int32_count; 3149 element_counts_[INT32] = int32_count;
3144 } 3150 }
3145 3151
3146 inline NumberOfEntries(ConstantPoolArray* array, LayoutSection section) { 3152 inline NumberOfEntries(ConstantPoolArray* array, LayoutSection section) {
3147 element_counts_[INT64] = array->number_of_entries(INT64, section); 3153 element_counts_[INT64] = array->number_of_entries(INT64, section);
3148 element_counts_[CODE_PTR] = array->number_of_entries(CODE_PTR, section); 3154 element_counts_[CODE_PTR] = array->number_of_entries(CODE_PTR, section);
3149 element_counts_[HEAP_PTR] = array->number_of_entries(HEAP_PTR, section); 3155 element_counts_[HEAP_PTR] = array->number_of_entries(HEAP_PTR, section);
3150 element_counts_[INT32] = array->number_of_entries(INT32, section); 3156 element_counts_[INT32] = array->number_of_entries(INT32, section);
3151 } 3157 }
3152 3158
3153 inline int count_of(Type type) const { 3159 inline void increment(Type type);
3154 ASSERT(type < NUMBER_OF_TYPES); 3160 inline int equals(const NumberOfEntries& other) const;
3155 return element_counts_[type]; 3161 inline bool is_empty() const;
3156 } 3162 inline int count_of(Type type) const;
3157 3163 inline int base_of(Type type) const;
3158 inline int total_count() const { 3164 inline int total_count() const;
3159 int count = 0; 3165 inline int are_in_range(int min, int max) const;
3160 for (int i = 0; i < NUMBER_OF_TYPES; i++) {
3161 count += element_counts_[i];
3162 }
3163 return count;
3164 }
3165
3166 inline int are_in_range(int min, int max) const {
3167 for (int i = FIRST_TYPE; i < NUMBER_OF_TYPES; i++) {
3168 if (element_counts_[i] < min || element_counts_[i] > max) {
3169 return false;
3170 }
3171 }
3172 return true;
3173 }
3174 3166
3175 private: 3167 private:
3176 int element_counts_[NUMBER_OF_TYPES]; 3168 int element_counts_[NUMBER_OF_TYPES];
3177 }; 3169 };
3178 3170
3179 class Iterator BASE_EMBEDDED { 3171 class Iterator BASE_EMBEDDED {
3180 public: 3172 public:
3181 inline Iterator(ConstantPoolArray* array, Type type) 3173 inline Iterator(ConstantPoolArray* array, Type type)
3182 : array_(array), type_(type), final_section_(array->final_section()) { 3174 : array_(array),
3183 current_section_ = SMALL_SECTION; 3175 type_(type),
3184 next_index_ = array->first_index(type, SMALL_SECTION); 3176 final_section_(array->final_section()),
3177 current_section_(SMALL_SECTION),
3178 next_index_(array->first_index(type, SMALL_SECTION)) {
3179 update_section();
3180 }
3181
3182 inline Iterator(ConstantPoolArray* array, Type type, LayoutSection section)
3183 : array_(array),
3184 type_(type),
3185 final_section_(section),
3186 current_section_(section),
3187 next_index_(array->first_index(type, section)) {
3185 update_section(); 3188 update_section();
3186 } 3189 }
3187 3190
3188 inline int next_index(); 3191 inline int next_index();
3189 inline bool is_finished(); 3192 inline bool is_finished();
3193
3190 private: 3194 private:
3191 inline void update_section(); 3195 inline void update_section();
3192 ConstantPoolArray* array_; 3196 ConstantPoolArray* array_;
3193 const Type type_; 3197 const Type type_;
3194 const LayoutSection final_section_; 3198 const LayoutSection final_section_;
3195 3199
3196 LayoutSection current_section_; 3200 LayoutSection current_section_;
3197 int next_index_; 3201 int next_index_;
3198 }; 3202 };
3199 3203
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
3239 3243
3240 // Clears the pointer entries with GC safe values. 3244 // Clears the pointer entries with GC safe values.
3241 void ClearPtrEntries(Isolate* isolate); 3245 void ClearPtrEntries(Isolate* isolate);
3242 3246
3243 // returns the total number of entries in the constant pool array. 3247 // returns the total number of entries in the constant pool array.
3244 inline int length(); 3248 inline int length();
3245 3249
3246 // Garbage collection support. 3250 // Garbage collection support.
3247 inline int size(); 3251 inline int size();
3248 3252
3253
3254 inline static int MaxInt64Offset(int number_of_int64) {
3255 return kFirstEntryOffset + (number_of_int64 * kInt64Size);
3256 }
3257
3249 inline static int SizeFor(const NumberOfEntries& small) { 3258 inline static int SizeFor(const NumberOfEntries& small) {
3250 int size = kFirstEntryOffset + 3259 int size = kFirstEntryOffset +
3251 (small.count_of(INT64) * kInt64Size) + 3260 (small.count_of(INT64) * kInt64Size) +
3252 (small.count_of(CODE_PTR) * kPointerSize) + 3261 (small.count_of(CODE_PTR) * kPointerSize) +
3253 (small.count_of(HEAP_PTR) * kPointerSize) + 3262 (small.count_of(HEAP_PTR) * kPointerSize) +
3254 (small.count_of(INT32) * kInt32Size); 3263 (small.count_of(INT32) * kInt32Size);
3255 return RoundUp(size, kPointerSize); 3264 return RoundUp(size, kPointerSize);
3256 } 3265 }
3257 3266
3258 inline static int SizeForExtended(const NumberOfEntries& small, 3267 inline static int SizeForExtended(const NumberOfEntries& small,
(...skipping 7940 matching lines...) Expand 10 before | Expand all | Expand 10 after
11199 } else { 11208 } else {
11200 value &= ~(1 << bit_position); 11209 value &= ~(1 << bit_position);
11201 } 11210 }
11202 return value; 11211 return value;
11203 } 11212 }
11204 }; 11213 };
11205 11214
11206 } } // namespace v8::internal 11215 } } // namespace v8::internal
11207 11216
11208 #endif // V8_OBJECTS_H_ 11217 #endif // V8_OBJECTS_H_
OLDNEW
« no previous file with comments | « src/debug.cc ('k') | src/objects.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698