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

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

Powered by Google App Engine
This is Rietveld 408576698