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

Side by Side Diff: vm/raw_object.h

Issue 10837247: use bit fields for class state and field type values. This shrinks the snapshot (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/runtime/
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
« no previous file with comments | « vm/object.cc ('k') | vm/raw_object_snapshot.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 #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 "platform/assert.h" 8 #include "platform/assert.h"
9 #include "vm/globals.h" 9 #include "vm/globals.h"
10 #include "vm/token.h" 10 #include "vm/token.h"
(...skipping 389 matching lines...) Expand 10 before | Expand all | Expand 10 after
400 return reinterpret_cast<RawObject**>(&ptr()->allocation_stub_); 400 return reinterpret_cast<RawObject**>(&ptr()->allocation_stub_);
401 } 401 }
402 402
403 cpp_vtable handle_vtable_; 403 cpp_vtable handle_vtable_;
404 intptr_t instance_size_; // Size if fixed length or 0 if variable length. 404 intptr_t instance_size_; // Size if fixed length or 0 if variable length.
405 intptr_t id_; // Class Id, also index in the class table. 405 intptr_t id_; // Class Id, also index in the class table.
406 intptr_t type_arguments_instance_field_offset_; // May be kNoTypeArguments. 406 intptr_t type_arguments_instance_field_offset_; // May be kNoTypeArguments.
407 intptr_t next_field_offset_; // Offset of the next instance field. 407 intptr_t next_field_offset_; // Offset of the next instance field.
408 intptr_t num_native_fields_; // Number of native fields in class. 408 intptr_t num_native_fields_; // Number of native fields in class.
409 intptr_t token_pos_; 409 intptr_t token_pos_;
410 int8_t class_state_; // Of type ClassState. 410 uint8_t state_bits_; // state, is_const, is_interface.
411 bool is_const_;
412 bool is_interface_;
413 411
414 friend class Object; 412 friend class Object;
415 friend class RawInstance; 413 friend class RawInstance;
416 friend class RawInstructions; 414 friend class RawInstructions;
417 friend class SnapshotReader; 415 friend class SnapshotReader;
418 }; 416 };
419 417
420 418
421 class RawUnresolvedClass : public RawObject { 419 class RawUnresolvedClass : public RawObject {
422 RAW_HEAP_OBJECT_IMPLEMENTATION(UnresolvedClass); 420 RAW_HEAP_OBJECT_IMPLEMENTATION(UnresolvedClass);
(...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after
604 RAW_HEAP_OBJECT_IMPLEMENTATION(Field); 602 RAW_HEAP_OBJECT_IMPLEMENTATION(Field);
605 603
606 RawObject** from() { return reinterpret_cast<RawObject**>(&ptr()->name_); } 604 RawObject** from() { return reinterpret_cast<RawObject**>(&ptr()->name_); }
607 RawString* name_; 605 RawString* name_;
608 RawClass* owner_; 606 RawClass* owner_;
609 RawAbstractType* type_; 607 RawAbstractType* type_;
610 RawInstance* value_; // Offset for instance and value for static fields. 608 RawInstance* value_; // Offset for instance and value for static fields.
611 RawObject** to() { return reinterpret_cast<RawObject**>(&ptr()->value_); } 609 RawObject** to() { return reinterpret_cast<RawObject**>(&ptr()->value_); }
612 610
613 intptr_t token_pos_; 611 intptr_t token_pos_;
614 bool is_static_; 612 uint8_t kind_bits_; // static, final, const, has initializer.
615 bool is_final_;
616 bool is_const_;
617 bool has_initializer_;
618 }; 613 };
619 614
620 615
621 class RawLiteralToken : public RawObject { 616 class RawLiteralToken : public RawObject {
622 RAW_HEAP_OBJECT_IMPLEMENTATION(LiteralToken); 617 RAW_HEAP_OBJECT_IMPLEMENTATION(LiteralToken);
623 618
624 RawObject** from() { 619 RawObject** from() {
625 return reinterpret_cast<RawObject**>(&ptr()->literal_); 620 return reinterpret_cast<RawObject**>(&ptr()->literal_);
626 } 621 }
627 RawString* literal_; // Literal characters as they appear in source text. 622 RawString* literal_; // Literal characters as they appear in source text.
(...skipping 925 matching lines...) Expand 10 before | Expand all | Expand 10 after
1553 kExternalUint64ArrayCid == kByteArrayCid + 18 && 1548 kExternalUint64ArrayCid == kByteArrayCid + 18 &&
1554 kExternalFloat32ArrayCid == kByteArrayCid + 19 && 1549 kExternalFloat32ArrayCid == kByteArrayCid + 19 &&
1555 kExternalFloat64ArrayCid == kByteArrayCid + 20 && 1550 kExternalFloat64ArrayCid == kByteArrayCid + 20 &&
1556 kStacktraceCid == kByteArrayCid + 21); 1551 kStacktraceCid == kByteArrayCid + 21);
1557 return (index >= kByteArrayCid && index <= kExternalFloat64ArrayCid); 1552 return (index >= kByteArrayCid && index <= kExternalFloat64ArrayCid);
1558 } 1553 }
1559 1554
1560 } // namespace dart 1555 } // namespace dart
1561 1556
1562 #endif // VM_RAW_OBJECT_H_ 1557 #endif // VM_RAW_OBJECT_H_
OLDNEW
« no previous file with comments | « vm/object.cc ('k') | vm/raw_object_snapshot.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698