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

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

Issue 10832410: Give a length field to stack bitmaps. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Incorporated 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 2324 matching lines...) Expand 10 before | Expand all | Expand 10 after
2335 friend class Class; 2335 friend class Class;
2336 }; 2336 };
2337 2337
2338 2338
2339 class Stackmap : public Object { 2339 class Stackmap : public Object {
2340 public: 2340 public:
2341 static const intptr_t kNoMaximum = -1; 2341 static const intptr_t kNoMaximum = -1;
2342 static const intptr_t kNoMinimum = -1; 2342 static const intptr_t kNoMinimum = -1;
2343 2343
2344 bool IsObject(intptr_t index) const { 2344 bool IsObject(intptr_t index) const {
2345 return InRange(index) && GetBit(index); 2345 ASSERT(InRange(index));
2346 return GetBit(index);
2346 } 2347 }
2347 2348
2348 RawCode* Code() const { return raw_ptr()->code_; } 2349 RawCode* Code() const { return raw_ptr()->code_; }
2349 void SetCode(const dart::Code& code) const; 2350 void SetCode(const dart::Code& code) const;
2350 2351
2351 intptr_t Length() const { return raw_ptr()->length_; } 2352 intptr_t Length() const { return raw_ptr()->length_; }
2352 2353
2353 uword PC() const { return raw_ptr()->pc_; } 2354 uword PC() const { return raw_ptr()->pc_; }
2354 void SetPC(uword value) const { raw_ptr()->pc_ = value; } 2355 void SetPC(uword value) const { raw_ptr()->pc_ = value; }
2355 2356
2356 static const intptr_t kMaxLengthInBytes = kSmiMax; 2357 static const intptr_t kMaxLengthInBytes = kSmiMax;
2357 2358
2358 static intptr_t InstanceSize() { 2359 static intptr_t InstanceSize() {
2359 ASSERT(sizeof(RawStackmap) == OFFSET_OF(RawStackmap, data_)); 2360 ASSERT(sizeof(RawStackmap) == OFFSET_OF(RawStackmap, data_));
2360 return 0; 2361 return 0;
2361 } 2362 }
2362 static intptr_t InstanceSize(intptr_t length) { 2363 static intptr_t InstanceSize(intptr_t length) {
2363 ASSERT(length >= 0); 2364 ASSERT(length >= 0);
2364 // The stackmap payload is in an array of bytes. 2365 // The stackmap payload is in an array of bytes.
2365 intptr_t payload_size = 2366 intptr_t payload_size =
2366 Utils::RoundUp(length, kBitsPerByte) / kBitsPerByte; 2367 Utils::RoundUp(length, kBitsPerByte) / kBitsPerByte;
2367 return RoundedAllocationSize(sizeof(RawStackmap) + payload_size); 2368 return RoundedAllocationSize(sizeof(RawStackmap) + payload_size);
2368 } 2369 }
2369 static RawStackmap* New(intptr_t pc_offset, 2370 static RawStackmap* New(intptr_t pc_offset, BitmapBuilder* bmap);
2370 intptr_t length,
2371 BitmapBuilder* bmap);
2372 2371
2373 private: 2372 private:
2374 void SetLength(intptr_t length) const { raw_ptr()->length_ = length; } 2373 void SetLength(intptr_t length) const { raw_ptr()->length_ = length; }
2375 2374
2376 bool InRange(intptr_t index) const { return index < Length(); } 2375 bool InRange(intptr_t index) const { return index < Length(); }
2377 2376
2378 bool GetBit(intptr_t bit_index) const; 2377 bool GetBit(intptr_t bit_index) const;
2379 void SetBit(intptr_t bit_index, bool value) const; 2378 void SetBit(intptr_t bit_index, bool value) const;
2380 2379
2381 HEAP_OBJECT_IMPLEMENTATION(Stackmap, Object); 2380 HEAP_OBJECT_IMPLEMENTATION(Stackmap, Object);
(...skipping 3135 matching lines...) Expand 10 before | Expand all | Expand 10 after
5517 if (this->CharAt(i) != str.CharAt(begin_index + i)) { 5516 if (this->CharAt(i) != str.CharAt(begin_index + i)) {
5518 return false; 5517 return false;
5519 } 5518 }
5520 } 5519 }
5521 return true; 5520 return true;
5522 } 5521 }
5523 5522
5524 } // namespace dart 5523 } // namespace dart
5525 5524
5526 #endif // VM_OBJECT_H_ 5525 #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