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

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

Issue 2572563004: Improve the casing of Stackmap and Stacktrace. (Closed)
Patch Set: Build fixes Created 4 years 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
« no previous file with comments | « runtime/vm/code_descriptors.h ('k') | runtime/vm/code_descriptors_test.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 #include "vm/code_descriptors.h" 5 #include "vm/code_descriptors.h"
6 6
7 namespace dart { 7 namespace dart {
8 8
9 void DescriptorList::AddDescriptor(RawPcDescriptors::Kind kind, 9 void DescriptorList::AddDescriptor(RawPcDescriptors::Kind kind,
10 intptr_t pc_offset, 10 intptr_t pc_offset,
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
53 prev_pc_offset = pc_offset; 53 prev_pc_offset = pc_offset;
54 prev_token_pos = token_pos.value(); 54 prev_token_pos = token_pos.value();
55 } 55 }
56 56
57 57
58 RawCodeSourceMap* CodeSourceMapBuilder::Finalize() { 58 RawCodeSourceMap* CodeSourceMapBuilder::Finalize() {
59 return CodeSourceMap::New(&encoded_data_); 59 return CodeSourceMap::New(&encoded_data_);
60 } 60 }
61 61
62 62
63 void StackmapTableBuilder::AddEntry(intptr_t pc_offset, 63 void StackMapTableBuilder::AddEntry(intptr_t pc_offset,
64 BitmapBuilder* bitmap, 64 BitmapBuilder* bitmap,
65 intptr_t register_bit_count) { 65 intptr_t register_bit_count) {
66 stack_map_ = Stackmap::New(pc_offset, bitmap, register_bit_count); 66 stack_map_ = StackMap::New(pc_offset, bitmap, register_bit_count);
67 list_.Add(stack_map_, Heap::kOld); 67 list_.Add(stack_map_, Heap::kOld);
68 } 68 }
69 69
70 70
71 bool StackmapTableBuilder::Verify() { 71 bool StackMapTableBuilder::Verify() {
72 intptr_t num_entries = Length(); 72 intptr_t num_entries = Length();
73 Stackmap& map1 = Stackmap::Handle(); 73 StackMap& map1 = StackMap::Handle();
74 Stackmap& map2 = Stackmap::Handle(); 74 StackMap& map2 = StackMap::Handle();
75 for (intptr_t i = 1; i < num_entries; i++) { 75 for (intptr_t i = 1; i < num_entries; i++) {
76 map1 = MapAt(i - 1); 76 map1 = MapAt(i - 1);
77 map2 = MapAt(i); 77 map2 = MapAt(i);
78 // Ensure there are no duplicates and the entries are sorted. 78 // Ensure there are no duplicates and the entries are sorted.
79 if (map1.PcOffset() >= map2.PcOffset()) { 79 if (map1.PcOffset() >= map2.PcOffset()) {
80 return false; 80 return false;
81 } 81 }
82 } 82 }
83 return true; 83 return true;
84 } 84 }
85 85
86 86
87 RawArray* StackmapTableBuilder::FinalizeStackmaps(const Code& code) { 87 RawArray* StackMapTableBuilder::FinalizeStackMaps(const Code& code) {
88 ASSERT(Verify()); 88 ASSERT(Verify());
89 intptr_t num_entries = Length(); 89 intptr_t num_entries = Length();
90 if (num_entries == 0) { 90 if (num_entries == 0) {
91 return Object::empty_array().raw(); 91 return Object::empty_array().raw();
92 } 92 }
93 return Array::MakeArray(list_); 93 return Array::MakeArray(list_);
94 } 94 }
95 95
96 96
97 RawStackmap* StackmapTableBuilder::MapAt(intptr_t index) const { 97 RawStackMap* StackMapTableBuilder::MapAt(intptr_t index) const {
98 Stackmap& map = Stackmap::Handle(); 98 StackMap& map = StackMap::Handle();
99 map ^= list_.At(index); 99 map ^= list_.At(index);
100 return map.raw(); 100 return map.raw();
101 } 101 }
102 102
103 103
104 RawExceptionHandlers* ExceptionHandlerList::FinalizeExceptionHandlers( 104 RawExceptionHandlers* ExceptionHandlerList::FinalizeExceptionHandlers(
105 uword entry_point) const { 105 uword entry_point) const {
106 intptr_t num_handlers = Length(); 106 intptr_t num_handlers = Length();
107 if (num_handlers == 0) { 107 if (num_handlers == 0) {
108 return Object::empty_exception_handlers().raw(); 108 return Object::empty_exception_handlers().raw();
(...skipping 17 matching lines...) Expand all
126 handlers.SetHandlerInfo(i, list_[i].outer_try_index, list_[i].pc_offset, 126 handlers.SetHandlerInfo(i, list_[i].outer_try_index, list_[i].pc_offset,
127 list_[i].needs_stacktrace, has_catch_all); 127 list_[i].needs_stacktrace, has_catch_all);
128 handlers.SetHandledTypes(i, *list_[i].handler_types); 128 handlers.SetHandledTypes(i, *list_[i].handler_types);
129 } 129 }
130 } 130 }
131 return handlers.raw(); 131 return handlers.raw();
132 } 132 }
133 133
134 134
135 } // namespace dart 135 } // namespace dart
OLDNEW
« no previous file with comments | « runtime/vm/code_descriptors.h ('k') | runtime/vm/code_descriptors_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698