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

Side by Side Diff: runtime/vm/object.h

Issue 10835034: Fix an off-by-one error in the stack frame iteration. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Renaming per review comments. Created 8 years, 4 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 | « runtime/vm/code_descriptors_test.cc ('k') | runtime/vm/object.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 (c) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 #ifndef VM_OBJECT_H_ 5 #ifndef VM_OBJECT_H_
6 #define VM_OBJECT_H_ 6 #define VM_OBJECT_H_
7 7
8 #include "include/dart_api.h" 8 #include "include/dart_api.h"
9 #include "platform/assert.h" 9 #include "platform/assert.h"
10 #include "platform/utils.h" 10 #include "platform/utils.h"
(...skipping 2240 matching lines...) Expand 10 before | Expand all | Expand 10 after
2251 HEAP_OBJECT_IMPLEMENTATION(PcDescriptors, Object); 2251 HEAP_OBJECT_IMPLEMENTATION(PcDescriptors, Object);
2252 friend class Class; 2252 friend class Class;
2253 }; 2253 };
2254 2254
2255 2255
2256 class Stackmap : public Object { 2256 class Stackmap : public Object {
2257 public: 2257 public:
2258 static const intptr_t kNoMaximum = -1; 2258 static const intptr_t kNoMaximum = -1;
2259 static const intptr_t kNoMinimum = -1; 2259 static const intptr_t kNoMinimum = -1;
2260 2260
2261 bool IsObject(intptr_t offset) const { 2261 bool IsObject(intptr_t index) const {
2262 return InRange(offset) && GetBit(offset); 2262 return InRange(index) && GetBit(index);
2263 } 2263 }
2264 uword PC() const { return raw_ptr()->pc_; } 2264 uword PC() const { return raw_ptr()->pc_; }
2265 void SetPC(uword value) const { raw_ptr()->pc_ = value; } 2265 void SetPC(uword value) const { raw_ptr()->pc_ = value; }
2266 2266
2267 RawCode* GetCode() const { return raw_ptr()->code_; } 2267 RawCode* GetCode() const { return raw_ptr()->code_; }
2268 void SetCode(const Code& code) const; 2268 void SetCode(const Code& code) const;
2269 2269
2270 // Return the offset of the highest stack slot that has an object. 2270 // Return the index of the highest stack slot that has an object.
2271 intptr_t MaximumBitOffset() const { return raw_ptr()->max_set_bit_offset_; } 2271 intptr_t MaximumBitIndex() const { return raw_ptr()->max_set_bit_index_; }
2272 2272
2273 // Return the offset of the lowest stack slot that has an object. 2273 // Return the index of the lowest stack slot that has an object.
2274 intptr_t MinimumBitOffset() const { return raw_ptr()->min_set_bit_offset_; } 2274 intptr_t MinimumBitIndex() const { return raw_ptr()->min_set_bit_index_; }
2275 2275
2276 static intptr_t InstanceSize() { 2276 static intptr_t InstanceSize() {
2277 ASSERT(sizeof(RawStackmap) == OFFSET_OF(RawStackmap, data_)); 2277 ASSERT(sizeof(RawStackmap) == OFFSET_OF(RawStackmap, data_));
2278 return 0; 2278 return 0;
2279 } 2279 }
2280 static intptr_t InstanceSize(intptr_t size) { 2280 static intptr_t InstanceSize(intptr_t size) {
2281 return RoundedAllocationSize(sizeof(RawStackmap) + (size * kWordSize)); 2281 return RoundedAllocationSize(sizeof(RawStackmap) + (size * kWordSize));
2282 } 2282 }
2283 static RawStackmap* New(uword pc, BitmapBuilder* bmap); 2283 static RawStackmap* New(uword pc, BitmapBuilder* bmap);
2284 2284
2285 private: 2285 private:
2286 inline intptr_t SizeInBits() const; 2286 inline intptr_t SizeInBits() const;
2287 2287
2288 void SetMinBitOffset(intptr_t value) const { 2288 void SetMinBitIndex(intptr_t value) const {
2289 raw_ptr()->min_set_bit_offset_ = value; 2289 raw_ptr()->min_set_bit_index_ = value;
2290 } 2290 }
2291 void SetMaxBitOffset(intptr_t value) const { 2291 void SetMaxBitIndex(intptr_t value) const {
2292 raw_ptr()->max_set_bit_offset_ = value; 2292 raw_ptr()->max_set_bit_index_ = value;
2293 } 2293 }
2294 2294
2295 bool InRange(intptr_t offset) const { return offset < SizeInBits(); } 2295 bool InRange(intptr_t index) const { return index < SizeInBits(); }
2296 2296
2297 bool GetBit(intptr_t bit_offset) const; 2297 bool GetBit(intptr_t bit_index) const;
2298 void SetBit(intptr_t bit_offset, bool value) const; 2298 void SetBit(intptr_t bit_index, bool value) const;
2299 2299
2300 void set_bitmap_size_in_bytes(intptr_t value) const; 2300 void set_bitmap_size_in_bytes(intptr_t value) const;
2301 2301
2302 HEAP_OBJECT_IMPLEMENTATION(Stackmap, Object); 2302 HEAP_OBJECT_IMPLEMENTATION(Stackmap, Object);
2303 friend class BitmapBuilder; 2303 friend class BitmapBuilder;
2304 friend class Class; 2304 friend class Class;
2305 }; 2305 };
2306 2306
2307 2307
2308 class ExceptionHandlers : public Object { 2308 class ExceptionHandlers : public Object {
(...skipping 2899 matching lines...) Expand 10 before | Expand all | Expand 10 after
5208 if (this->CharAt(i) != str.CharAt(begin_index + i)) { 5208 if (this->CharAt(i) != str.CharAt(begin_index + i)) {
5209 return false; 5209 return false;
5210 } 5210 }
5211 } 5211 }
5212 return true; 5212 return true;
5213 } 5213 }
5214 5214
5215 } // namespace dart 5215 } // namespace dart
5216 5216
5217 #endif // VM_OBJECT_H_ 5217 #endif // VM_OBJECT_H_
OLDNEW
« no previous file with comments | « runtime/vm/code_descriptors_test.cc ('k') | runtime/vm/object.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698