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

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

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/object.h ('k') | no next file » | 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 #include "vm/object.h" 5 #include "vm/object.h"
6 6
7 #include "include/dart_api.h" 7 #include "include/dart_api.h"
8 #include "platform/assert.h" 8 #include "platform/assert.h"
9 #include "vm/assembler.h" 9 #include "vm/assembler.h"
10 #include "vm/bigint_operations.h" 10 #include "vm/bigint_operations.h"
(...skipping 6748 matching lines...) Expand 10 before | Expand all | Expand 10 after
6759 uint8_t byte_mask = 1U << bit_remainder; 6759 uint8_t byte_mask = 1U << bit_remainder;
6760 uint8_t* byte_addr = &(raw_ptr()->data_[byte_index]); 6760 uint8_t* byte_addr = &(raw_ptr()->data_[byte_index]);
6761 if (value) { 6761 if (value) {
6762 *byte_addr |= byte_mask; 6762 *byte_addr |= byte_mask;
6763 } else { 6763 } else {
6764 *byte_addr &= ~byte_mask; 6764 *byte_addr &= ~byte_mask;
6765 } 6765 }
6766 } 6766 }
6767 6767
6768 6768
6769 RawStackmap* Stackmap::New(intptr_t pc_offset, 6769 RawStackmap* Stackmap::New(intptr_t pc_offset, BitmapBuilder* bmap) {
6770 intptr_t length,
6771 BitmapBuilder* bmap) {
6772 ASSERT(Object::stackmap_class() != Class::null()); 6770 ASSERT(Object::stackmap_class() != Class::null());
6773 ASSERT(bmap != NULL); 6771 ASSERT(bmap != NULL);
6774 Stackmap& result = Stackmap::Handle(); 6772 Stackmap& result = Stackmap::Handle();
6775 // Guard against integer overflow of the instance size computation. 6773 // Guard against integer overflow of the instance size computation.
6774 intptr_t length = bmap->Length();
6776 intptr_t payload_size = 6775 intptr_t payload_size =
6777 Utils::RoundUp(length, kBitsPerByte) / kBitsPerByte; 6776 Utils::RoundUp(length, kBitsPerByte) / kBitsPerByte;
6778 if (payload_size < 0 || 6777 if ((payload_size < 0) ||
6779 payload_size > 6778 (payload_size >
6780 (kSmiMax - static_cast<intptr_t>(sizeof(RawStackmap)))) { 6779 (kSmiMax - static_cast<intptr_t>(sizeof(RawStackmap))))) {
6781 // This should be caught before we reach here. 6780 // This should be caught before we reach here.
6782 FATAL1("Fatal error in Stackmap::New: invalid length %" PRIdPTR "\n", 6781 FATAL1("Fatal error in Stackmap::New: invalid length %" PRIdPTR "\n",
6783 length); 6782 length);
6784 } 6783 }
6785 { 6784 {
6786 // Stackmap data objects are associated with a code object, allocate them 6785 // Stackmap data objects are associated with a code object, allocate them
6787 // in old generation. 6786 // in old generation.
6788 RawObject* raw = Object::Allocate(Stackmap::kClassId, 6787 RawObject* raw = Object::Allocate(Stackmap::kClassId,
6789 Stackmap::InstanceSize(length), 6788 Stackmap::InstanceSize(length),
6790 Heap::kOld); 6789 Heap::kOld);
6791 NoGCScope no_gc; 6790 NoGCScope no_gc;
6792 result ^= raw; 6791 result ^= raw;
6793 result.SetLength(length); 6792 result.SetLength(length);
6794 } 6793 }
6795 // When constructing a stackmap we store the pc offset in the stackmap's 6794 // When constructing a stackmap we store the pc offset in the stackmap's
6796 // PC. StackmapTableBuilder::FinalizeStackmaps will replace it with the pc 6795 // PC. StackmapTableBuilder::FinalizeStackmaps will replace it with the pc
6797 // address. 6796 // address.
6798 ASSERT(pc_offset >= 0); 6797 ASSERT(pc_offset >= 0);
6799 result.SetPC(pc_offset); 6798 result.SetPC(pc_offset);
6800 for (intptr_t i = 0; i < length; ++i) { 6799 for (intptr_t i = 0; i < length; ++i) {
6801 result.SetBit(i, bmap->Get(i)); 6800 result.SetBit(i, bmap->Get(i));
6802 } 6801 }
6803 ASSERT(bmap->Maximum() < length);
6804 return result.raw(); 6802 return result.raw();
6805 } 6803 }
6806 6804
6807 6805
6808 const char* Stackmap::ToCString() const { 6806 const char* Stackmap::ToCString() const {
6809 if (IsNull()) { 6807 if (IsNull()) {
6810 return "{null}"; 6808 return "{null}";
6811 } else { 6809 } else {
6812 const char* kFormat = "0x%" PRIxPTR ": "; 6810 const char* kFormat = "0x%" PRIxPTR ": ";
6813 intptr_t fixed_length = OS::SNPrint(NULL, 0, kFormat, PC()) + 1; 6811 intptr_t fixed_length = OS::SNPrint(NULL, 0, kFormat, PC()) + 1;
(...skipping 4320 matching lines...) Expand 10 before | Expand all | Expand 10 after
11134 } 11132 }
11135 return result.raw(); 11133 return result.raw();
11136 } 11134 }
11137 11135
11138 11136
11139 const char* WeakProperty::ToCString() const { 11137 const char* WeakProperty::ToCString() const {
11140 return "WeakProperty"; 11138 return "WeakProperty";
11141 } 11139 }
11142 11140
11143 } // namespace dart 11141 } // namespace dart
OLDNEW
« no previous file with comments | « runtime/vm/object.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698