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

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

Issue 8761011: Renaming type classes as discussed: (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: '' Created 9 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 | Annotate | Revision Log
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 #ifndef VM_RAW_OBJECT_H_ 5 #ifndef VM_RAW_OBJECT_H_
6 #define VM_RAW_OBJECT_H_ 6 #define VM_RAW_OBJECT_H_
7 7
8 #include "vm/assert.h" 8 #include "vm/assert.h"
9 #include "vm/globals.h" 9 #include "vm/globals.h"
10 #include "vm/snapshot.h" 10 #include "vm/snapshot.h"
11 11
12 #include "include/dart_api.h" 12 #include "include/dart_api.h"
13 13
14 namespace dart { 14 namespace dart {
15 15
16 // Macrobatics to define the Object hierarchy of VM implementation classes. 16 // Macrobatics to define the Object hierarchy of VM implementation classes.
17 #define CLASS_LIST_NO_OBJECT(V) \ 17 #define CLASS_LIST_NO_OBJECT(V) \
18 V(Class) \ 18 V(Class) \
19 V(UnresolvedClass) \ 19 V(UnresolvedClass) \
20 V(Type) \ 20 V(AbstractType) \
21 V(ParameterizedType) \ 21 V(Type) \
22 V(TypeParameter) \ 22 V(TypeParameter) \
23 V(InstantiatedType) \ 23 V(InstantiatedType) \
24 V(TypeArguments) \ 24 V(TypeArguments) \
25 V(TypeArray) \ 25 V(TypeArray) \
26 V(InstantiatedTypeArguments) \ 26 V(InstantiatedTypeArguments) \
27 V(Function) \ 27 V(Function) \
28 V(Field) \ 28 V(Field) \
29 V(TokenStream) \ 29 V(TokenStream) \
30 V(Script) \ 30 V(Script) \
31 V(Library) \ 31 V(Library) \
32 V(LibraryPrefix) \ 32 V(LibraryPrefix) \
33 V(Code) \ 33 V(Code) \
34 V(Instructions) \ 34 V(Instructions) \
35 V(PcDescriptors) \ 35 V(PcDescriptors) \
36 V(ExceptionHandlers) \ 36 V(ExceptionHandlers) \
37 V(Context) \ 37 V(Context) \
38 V(ContextScope) \ 38 V(ContextScope) \
39 V(UnhandledException) \ 39 V(UnhandledException) \
40 V(ApiError) \ 40 V(ApiError) \
41 V(Instance) \ 41 V(Instance) \
42 V(Number) \ 42 V(Number) \
43 V(Integer) \ 43 V(Integer) \
44 V(Smi) \ 44 V(Smi) \
45 V(Mint) \ 45 V(Mint) \
46 V(Bigint) \ 46 V(Bigint) \
47 V(Double) \ 47 V(Double) \
48 V(String) \ 48 V(String) \
49 V(OneByteString) \ 49 V(OneByteString) \
50 V(TwoByteString) \ 50 V(TwoByteString) \
(...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after
215 kFinalized, // All checks completed, class ready for use. 215 kFinalized, // All checks completed, class ready for use.
216 }; 216 };
217 217
218 private: 218 private:
219 RAW_HEAP_OBJECT_IMPLEMENTATION(Class); 219 RAW_HEAP_OBJECT_IMPLEMENTATION(Class);
220 220
221 RawObject** from() { return reinterpret_cast<RawObject**>(&ptr()->name_); } 221 RawObject** from() { return reinterpret_cast<RawObject**>(&ptr()->name_); }
222 RawString* name_; 222 RawString* name_;
223 RawArray* functions_; 223 RawArray* functions_;
224 RawArray* fields_; 224 RawArray* fields_;
225 RawArray* interfaces_; // Array of Type. 225 RawArray* interfaces_; // Array of AbstractType.
regis 2011/12/01 04:24:07 Could be RawTypeArguments*.
226 RawScript* script_; 226 RawScript* script_;
227 RawLibrary* library_; 227 RawLibrary* library_;
228 RawArray* type_parameters_; // Array of String. 228 RawArray* type_parameters_; // Array of String.
229 RawTypeArray* type_parameter_extends_; // DynamicType if no extends clause. 229 RawTypeArray* type_parameter_extends_; // DynamicType if no extends clause.
230 RawType* super_type_; 230 RawAbstractType* super_type_;
regis 2011/12/01 04:24:07 Could be RawType*.
srdjan 2011/12/01 17:48:42 Done in next CL.
231 RawObject* factory_class_; // UnresolvedClass (until finalization) or Class. 231 RawObject* factory_class_; // UnresolvedClass (until finalization) or Class.
232 RawFunction* signature_function_; // Associated function for signature class. 232 RawFunction* signature_function_; // Associated function for signature class.
233 RawArray* functions_cache_; // See class FunctionsCache. 233 RawArray* functions_cache_; // See class FunctionsCache.
234 RawArray* constants_; // Canonicalized values of this class. 234 RawArray* constants_; // Canonicalized values of this class.
235 RawArray* canonical_types_; // Canonicalized types of this class. 235 RawArray* canonical_types_; // Canonicalized types of this class.
236 RawCode* allocation_stub_; // Stub code for allocation of instances. 236 RawCode* allocation_stub_; // Stub code for allocation of instances.
237 RawObject** to() { 237 RawObject** to() {
238 return reinterpret_cast<RawObject**>(&ptr()->allocation_stub_); 238 return reinterpret_cast<RawObject**>(&ptr()->allocation_stub_);
239 } 239 }
240 240
(...skipping 21 matching lines...) Expand all
262 RawString* qualifier_; // Qualifier for the identifier. 262 RawString* qualifier_; // Qualifier for the identifier.
263 RawString* ident_; // Name of the unresolved identifier. 263 RawString* ident_; // Name of the unresolved identifier.
264 RawClass* factory_signature_class_; // Expected type parameters for factory. 264 RawClass* factory_signature_class_; // Expected type parameters for factory.
265 RawObject** to() { 265 RawObject** to() {
266 return reinterpret_cast<RawObject**>(&ptr()->factory_signature_class_); 266 return reinterpret_cast<RawObject**>(&ptr()->factory_signature_class_);
267 } 267 }
268 intptr_t token_index_; 268 intptr_t token_index_;
269 }; 269 };
270 270
271 271
272 class RawType : public RawObject { 272 class RawAbstractType : public RawObject {
273 RAW_HEAP_OBJECT_IMPLEMENTATION(Type); 273 RAW_HEAP_OBJECT_IMPLEMENTATION(AbstractType);
274 274
275 friend class ObjectStore; 275 friend class ObjectStore;
276 }; 276 };
277 277
278 278
279 class RawParameterizedType : public RawType { 279 class RawType : public RawAbstractType {
280 private: 280 private:
281 enum TypeState { 281 enum TypeState {
282 kAllocated, // Initial state. 282 kAllocated, // Initial state.
283 kBeingFinalized, // In the process of being finalized. 283 kBeingFinalized, // In the process of being finalized.
284 kFinalized, // Type ready for use. 284 kFinalized, // Type ready for use.
285 }; 285 };
286 286
287 RAW_HEAP_OBJECT_IMPLEMENTATION(ParameterizedType); 287 RAW_HEAP_OBJECT_IMPLEMENTATION(Type);
288 288
289 RawObject** from() { 289 RawObject** from() {
290 return reinterpret_cast<RawObject**>(&ptr()->type_class_); 290 return reinterpret_cast<RawObject**>(&ptr()->type_class_);
291 } 291 }
292 RawObject* type_class_; // Either resolved class or unresolved class. 292 RawObject* type_class_; // Either resolved class or unresolved class.
293 RawTypeArguments* arguments_; 293 RawTypeArguments* arguments_;
294 RawObject** to() { return reinterpret_cast<RawObject**>(&ptr()->arguments_); } 294 RawObject** to() { return reinterpret_cast<RawObject**>(&ptr()->arguments_); }
295 int8_t type_state_; 295 int8_t type_state_;
296 }; 296 };
297 297
298 298
299 class RawTypeParameter : public RawType { 299 class RawTypeParameter : public RawAbstractType {
300 private: 300 private:
301 RAW_HEAP_OBJECT_IMPLEMENTATION(TypeParameter); 301 RAW_HEAP_OBJECT_IMPLEMENTATION(TypeParameter);
302 302
303 RawObject** from() { return reinterpret_cast<RawObject**>(&ptr()->name_); } 303 RawObject** from() { return reinterpret_cast<RawObject**>(&ptr()->name_); }
304 RawString* name_; 304 RawString* name_;
305 RawObject** to() { return reinterpret_cast<RawObject**>(&ptr()->name_); } 305 RawObject** to() { return reinterpret_cast<RawObject**>(&ptr()->name_); }
306 intptr_t index_; 306 intptr_t index_;
307 }; 307 };
308 308
309 309
310 class RawInstantiatedType : public RawType { 310 class RawInstantiatedType : public RawAbstractType {
311 private: 311 private:
312 RAW_HEAP_OBJECT_IMPLEMENTATION(InstantiatedType); 312 RAW_HEAP_OBJECT_IMPLEMENTATION(InstantiatedType);
313 313
314 RawObject** from() { 314 RawObject** from() {
315 return reinterpret_cast<RawObject**>(&ptr()->uninstantiated_type_); 315 return reinterpret_cast<RawObject**>(&ptr()->uninstantiated_type_);
316 } 316 }
317 RawType* uninstantiated_type_; 317 RawAbstractType* uninstantiated_type_;
318 RawTypeArguments* instantiator_type_arguments_; 318 RawTypeArguments* instantiator_type_arguments_;
319 RawObject** to() { 319 RawObject** to() {
320 return reinterpret_cast<RawObject**>(&ptr()->instantiator_type_arguments_); 320 return reinterpret_cast<RawObject**>(&ptr()->instantiator_type_arguments_);
321 } 321 }
322 }; 322 };
323 323
324 324
325 class RawTypeArguments : public RawObject { 325 class RawTypeArguments : public RawObject {
326 RAW_HEAP_OBJECT_IMPLEMENTATION(TypeArguments); 326 RAW_HEAP_OBJECT_IMPLEMENTATION(TypeArguments);
327 }; 327 };
328 328
329 329
330 class RawTypeArray : public RawTypeArguments { 330 class RawTypeArray : public RawTypeArguments {
331 private: 331 private:
332 RAW_HEAP_OBJECT_IMPLEMENTATION(TypeArray); 332 RAW_HEAP_OBJECT_IMPLEMENTATION(TypeArray);
333 333
334 RawObject** from() { 334 RawObject** from() {
335 return reinterpret_cast<RawObject**>(&ptr()->length_); 335 return reinterpret_cast<RawObject**>(&ptr()->length_);
336 } 336 }
337 RawSmi* length_; 337 RawSmi* length_;
338 338
339 // Variable length data follows here. 339 // Variable length data follows here.
340 RawType* types_[0]; 340 RawAbstractType* types_[0];
341 RawObject** to(intptr_t length) { 341 RawObject** to(intptr_t length) {
342 return reinterpret_cast<RawObject**>(&ptr()->types_[length - 1]); 342 return reinterpret_cast<RawObject**>(&ptr()->types_[length - 1]);
343 } 343 }
344 }; 344 };
345 345
346 346
347 class RawInstantiatedTypeArguments : public RawTypeArguments { 347 class RawInstantiatedTypeArguments : public RawTypeArguments {
348 private: 348 private:
349 RAW_HEAP_OBJECT_IMPLEMENTATION(InstantiatedTypeArguments); 349 RAW_HEAP_OBJECT_IMPLEMENTATION(InstantiatedTypeArguments);
350 350
(...skipping 23 matching lines...) Expand all
374 kImplicitSetter, // represents an implicit setter for fields. 374 kImplicitSetter, // represents an implicit setter for fields.
375 kConstImplicitGetter, // represents an implicit const getter for fields. 375 kConstImplicitGetter, // represents an implicit const getter for fields.
376 }; 376 };
377 377
378 private: 378 private:
379 RAW_HEAP_OBJECT_IMPLEMENTATION(Function); 379 RAW_HEAP_OBJECT_IMPLEMENTATION(Function);
380 380
381 RawObject** from() { return reinterpret_cast<RawObject**>(&ptr()->name_); } 381 RawObject** from() { return reinterpret_cast<RawObject**>(&ptr()->name_); }
382 RawString* name_; 382 RawString* name_;
383 RawClass* owner_; 383 RawClass* owner_;
384 RawType* result_type_; 384 RawAbstractType* result_type_;
385 RawArray* parameter_types_; 385 RawArray* parameter_types_;
386 RawArray* parameter_names_; 386 RawArray* parameter_names_;
387 RawCode* code_; // Compiled code for the function. 387 RawCode* code_; // Compiled code for the function.
388 RawCode* unoptimized_code_; // Unoptimized code, keep it after optimization. 388 RawCode* unoptimized_code_; // Unoptimized code, keep it after optimization.
389 RawContextScope* context_scope_; 389 RawContextScope* context_scope_;
390 RawFunction* parent_function_; // Enclosing function of this local function. 390 RawFunction* parent_function_; // Enclosing function of this local function.
391 RawClass* signature_class_; // Only for closure or signature function. 391 RawClass* signature_class_; // Only for closure or signature function.
392 RawCode* closure_allocation_stub_; // Stub code for allocation of closures. 392 RawCode* closure_allocation_stub_; // Stub code for allocation of closures.
393 RawFunction* implicit_closure_function_; // Implicit closure function. 393 RawFunction* implicit_closure_function_; // Implicit closure function.
394 RawObject** to() { 394 RawObject** to() {
(...skipping 11 matching lines...) Expand all
406 bool is_optimizable_; 406 bool is_optimizable_;
407 }; 407 };
408 408
409 409
410 class RawField : public RawObject { 410 class RawField : public RawObject {
411 RAW_HEAP_OBJECT_IMPLEMENTATION(Field); 411 RAW_HEAP_OBJECT_IMPLEMENTATION(Field);
412 412
413 RawObject** from() { return reinterpret_cast<RawObject**>(&ptr()->name_); } 413 RawObject** from() { return reinterpret_cast<RawObject**>(&ptr()->name_); }
414 RawString* name_; 414 RawString* name_;
415 RawClass* owner_; 415 RawClass* owner_;
416 RawType* type_; 416 RawAbstractType* type_;
417 RawInstance* value_; // Offset for instance and value for static fields. 417 RawInstance* value_; // Offset for instance and value for static fields.
418 RawObject** to() { return reinterpret_cast<RawObject**>(&ptr()->value_); } 418 RawObject** to() { return reinterpret_cast<RawObject**>(&ptr()->value_); }
419 419
420 intptr_t token_index_; 420 intptr_t token_index_;
421 bool is_static_; 421 bool is_static_;
422 bool is_final_; 422 bool is_final_;
423 bool has_initializer_; 423 bool has_initializer_;
424 }; 424 };
425 425
426 426
(...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after
592 592
593 class RawContextScope : public RawObject { 593 class RawContextScope : public RawObject {
594 RAW_HEAP_OBJECT_IMPLEMENTATION(ContextScope); 594 RAW_HEAP_OBJECT_IMPLEMENTATION(ContextScope);
595 595
596 // TODO(iposva): Switch to convential enum offset based structure to avoid 596 // TODO(iposva): Switch to convential enum offset based structure to avoid
597 // alignment mishaps. 597 // alignment mishaps.
598 struct VariableDesc { 598 struct VariableDesc {
599 RawSmi* token_index; 599 RawSmi* token_index;
600 RawString* name; 600 RawString* name;
601 RawBool* is_final; 601 RawBool* is_final;
602 RawType* type; 602 RawAbstractType* type;
603 RawSmi* context_index; 603 RawSmi* context_index;
604 RawSmi* context_level; 604 RawSmi* context_level;
605 }; 605 };
606 606
607 intptr_t num_variables_; 607 intptr_t num_variables_;
608 608
609 // Variable length data follows here. 609 // Variable length data follows here.
610 RawObject** from() { return reinterpret_cast<RawObject**>(&ptr()->data_[0]); } 610 RawObject** from() { return reinterpret_cast<RawObject**>(&ptr()->data_[0]); }
611 RawObject* data_[0]; 611 RawObject* data_[0];
612 RawObject** to(intptr_t num_vars) { 612 RawObject** to(intptr_t num_vars) {
(...skipping 239 matching lines...) Expand 10 before | Expand all | Expand 10 after
852 intptr_t type_; // Uninitialized, simple or complex. 852 intptr_t type_; // Uninitialized, simple or complex.
853 intptr_t flags_; // Represents global/local, case insensitive, multiline. 853 intptr_t flags_; // Represents global/local, case insensitive, multiline.
854 854
855 // Variable length data follows here. 855 // Variable length data follows here.
856 uint8_t data_[0]; 856 uint8_t data_[0];
857 }; 857 };
858 858
859 } // namespace dart 859 } // namespace dart
860 860
861 #endif // VM_RAW_OBJECT_H_ 861 #endif // VM_RAW_OBJECT_H_
OLDNEW
« runtime/vm/parser.h ('K') | « runtime/vm/parser.cc ('k') | runtime/vm/raw_object.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698