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

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

Issue 9195031: Add ByteArray interface and provide internal and external implementations. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: address remaining review comments Created 8 years, 11 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_store.h ('k') | runtime/vm/object_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) 2011, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2011, 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_store.h" 5 #include "vm/object_store.h"
6 6
7 #include "vm/exceptions.h" 7 #include "vm/exceptions.h"
8 #include "vm/isolate.h" 8 #include "vm/isolate.h"
9 #include "vm/longjump.h" 9 #include "vm/longjump.h"
10 #include "vm/object.h" 10 #include "vm/object.h"
(...skipping 17 matching lines...) Expand all
28 two_byte_string_class_(Class::null()), 28 two_byte_string_class_(Class::null()),
29 four_byte_string_class_(Class::null()), 29 four_byte_string_class_(Class::null()),
30 external_one_byte_string_class_(Class::null()), 30 external_one_byte_string_class_(Class::null()),
31 external_two_byte_string_class_(Class::null()), 31 external_two_byte_string_class_(Class::null()),
32 external_four_byte_string_class_(Class::null()), 32 external_four_byte_string_class_(Class::null()),
33 bool_interface_(Type::null()), 33 bool_interface_(Type::null()),
34 bool_class_(Class::null()), 34 bool_class_(Class::null()),
35 list_interface_(Type::null()), 35 list_interface_(Type::null()),
36 array_class_(Class::null()), 36 array_class_(Class::null()),
37 immutable_array_class_(Class::null()), 37 immutable_array_class_(Class::null()),
38 byte_buffer_class_(Class::null()), 38 byte_array_interface_(Type::null()),
39 internal_byte_array_class_(Class::null()),
40 external_byte_array_class_(Class::null()),
39 stacktrace_class_(Class::null()), 41 stacktrace_class_(Class::null()),
40 jsregexp_class_(Class::null()), 42 jsregexp_class_(Class::null()),
41 true_value_(Bool::null()), 43 true_value_(Bool::null()),
42 false_value_(Bool::null()), 44 false_value_(Bool::null()),
43 empty_array_(Array::null()), 45 empty_array_(Array::null()),
44 symbol_table_(Array::null()), 46 symbol_table_(Array::null()),
45 canonical_type_arguments_(Array::null()), 47 canonical_type_arguments_(Array::null()),
46 core_library_(Library::null()), 48 core_library_(Library::null()),
47 core_impl_library_(Library::null()), 49 core_impl_library_(Library::null()),
48 native_wrappers_library_(Library::null()), 50 native_wrappers_library_(Library::null()),
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
109 case kDoubleClass: return double_class_; 111 case kDoubleClass: return double_class_;
110 case kOneByteStringClass: return one_byte_string_class_; 112 case kOneByteStringClass: return one_byte_string_class_;
111 case kTwoByteStringClass: return two_byte_string_class_; 113 case kTwoByteStringClass: return two_byte_string_class_;
112 case kFourByteStringClass: return four_byte_string_class_; 114 case kFourByteStringClass: return four_byte_string_class_;
113 case kExternalOneByteStringClass: return external_one_byte_string_class_; 115 case kExternalOneByteStringClass: return external_one_byte_string_class_;
114 case kExternalTwoByteStringClass: return external_two_byte_string_class_; 116 case kExternalTwoByteStringClass: return external_two_byte_string_class_;
115 case kExternalFourByteStringClass: return external_four_byte_string_class_; 117 case kExternalFourByteStringClass: return external_four_byte_string_class_;
116 case kBoolClass: return bool_class_; 118 case kBoolClass: return bool_class_;
117 case kArrayClass: return array_class_; 119 case kArrayClass: return array_class_;
118 case kImmutableArrayClass: return immutable_array_class_; 120 case kImmutableArrayClass: return immutable_array_class_;
119 case kByteBufferClass: return byte_buffer_class_; 121 case kInternalByteArrayClass: return internal_byte_array_class_;
122 case kExternalByteArrayClass: return external_byte_array_class_;
120 case kStacktraceClass: return stacktrace_class_; 123 case kStacktraceClass: return stacktrace_class_;
121 case kJSRegExpClass: return jsregexp_class_; 124 case kJSRegExpClass: return jsregexp_class_;
122 default: break; 125 default: break;
123 } 126 }
124 UNREACHABLE(); 127 UNREACHABLE();
125 return Class::null(); 128 return Class::null();
126 } 129 }
127 130
128 131
129 int ObjectStore::GetClassIndex(const RawClass* raw_class) { 132 int ObjectStore::GetClassIndex(const RawClass* raw_class) {
(...skipping 19 matching lines...) Expand all
149 } else if (raw_class == external_two_byte_string_class_) { 152 } else if (raw_class == external_two_byte_string_class_) {
150 return kExternalTwoByteStringClass; 153 return kExternalTwoByteStringClass;
151 } else if (raw_class == external_four_byte_string_class_) { 154 } else if (raw_class == external_four_byte_string_class_) {
152 return kExternalFourByteStringClass; 155 return kExternalFourByteStringClass;
153 } else if (raw_class == bool_class_) { 156 } else if (raw_class == bool_class_) {
154 return kBoolClass; 157 return kBoolClass;
155 } else if (raw_class == array_class_) { 158 } else if (raw_class == array_class_) {
156 return kArrayClass; 159 return kArrayClass;
157 } else if (raw_class == immutable_array_class_) { 160 } else if (raw_class == immutable_array_class_) {
158 return kImmutableArrayClass; 161 return kImmutableArrayClass;
159 } else if (raw_class == byte_buffer_class_) { 162 } else if (raw_class == internal_byte_array_class_) {
160 return kByteBufferClass; 163 return kInternalByteArrayClass;
164 } else if (raw_class == external_byte_array_class_) {
165 return kExternalByteArrayClass;
161 } else if (raw_class == stacktrace_class_) { 166 } else if (raw_class == stacktrace_class_) {
162 return kStacktraceClass; 167 return kStacktraceClass;
163 } else if (raw_class == jsregexp_class_) { 168 } else if (raw_class == jsregexp_class_) {
164 return kJSRegExpClass; 169 return kJSRegExpClass;
165 } 170 }
166 return kInvalidIndex; 171 return kInvalidIndex;
167 } 172 }
168 173
169 174
170 RawType* ObjectStore::GetType(int index) { 175 RawType* ObjectStore::GetType(int index) {
171 switch (index) { 176 switch (index) {
172 case kObjectType: return object_type(); 177 case kObjectType: return object_type();
173 case kNullType: return null_type(); 178 case kNullType: return null_type();
174 case kDynamicType: return dynamic_type(); 179 case kDynamicType: return dynamic_type();
175 case kVoidType: return void_type(); 180 case kVoidType: return void_type();
176 case kFunctionInterface: return function_interface(); 181 case kFunctionInterface: return function_interface();
177 case kNumberInterface: return number_interface(); 182 case kNumberInterface: return number_interface();
178 case kDoubleInterface: return double_interface(); 183 case kDoubleInterface: return double_interface();
179 case kIntInterface: return int_interface(); 184 case kIntInterface: return int_interface();
180 case kBoolInterface: return bool_interface(); 185 case kBoolInterface: return bool_interface();
181 case kStringInterface: return string_interface(); 186 case kStringInterface: return string_interface();
182 case kListInterface: return list_interface(); 187 case kListInterface: return list_interface();
188 case kByteArrayInterface: return byte_array_interface();
183 default: break; 189 default: break;
184 } 190 }
185 UNREACHABLE(); 191 UNREACHABLE();
186 return Type::null(); 192 return Type::null();
187 } 193 }
188 194
189 195
190 int ObjectStore::GetTypeIndex(const RawType* raw_type) { 196 int ObjectStore::GetTypeIndex(const RawType* raw_type) {
191 ASSERT(raw_type->IsHeapObject()); 197 ASSERT(raw_type->IsHeapObject());
192 if (raw_type == object_type()) { 198 if (raw_type == object_type()) {
(...skipping 11 matching lines...) Expand all
204 } else if (raw_type == double_interface()) { 210 } else if (raw_type == double_interface()) {
205 return kDoubleInterface; 211 return kDoubleInterface;
206 } else if (raw_type == int_interface()) { 212 } else if (raw_type == int_interface()) {
207 return kIntInterface; 213 return kIntInterface;
208 } else if (raw_type == bool_interface()) { 214 } else if (raw_type == bool_interface()) {
209 return kBoolInterface; 215 return kBoolInterface;
210 } else if (raw_type == string_interface()) { 216 } else if (raw_type == string_interface()) {
211 return kStringInterface; 217 return kStringInterface;
212 } else if (raw_type == list_interface()) { 218 } else if (raw_type == list_interface()) {
213 return kListInterface; 219 return kListInterface;
220 } else if (raw_type == byte_array_interface()) {
221 return kByteArrayInterface;
214 } 222 }
215 return kInvalidIndex; 223 return kInvalidIndex;
216 } 224 }
217 225
218 } // namespace dart 226 } // namespace dart
OLDNEW
« no previous file with comments | « runtime/vm/object_store.h ('k') | runtime/vm/object_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698