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

Side by Side Diff: vm/raw_object.h

Issue 9462003: Changes to shrink the token stream representation from two words to one word. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/runtime/
Patch Set: Created 8 years, 10 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
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/snapshot.h" 11 #include "vm/snapshot.h"
11 12
12 #include "include/dart_api.h" 13 #include "include/dart_api.h"
13 14
14 namespace dart { 15 namespace dart {
15 16
16 // Macrobatics to define the Object hierarchy of VM implementation classes. 17 // Macrobatics to define the Object hierarchy of VM implementation classes.
17 #define CLASS_LIST_NO_OBJECT(V) \ 18 #define CLASS_LIST_NO_OBJECT(V) \
18 V(Class) \ 19 V(Class) \
19 V(UnresolvedClass) \ 20 V(UnresolvedClass) \
20 V(AbstractType) \ 21 V(AbstractType) \
21 V(Type) \ 22 V(Type) \
22 V(TypeParameter) \ 23 V(TypeParameter) \
23 V(InstantiatedType) \ 24 V(InstantiatedType) \
24 V(AbstractTypeArguments) \ 25 V(AbstractTypeArguments) \
25 V(TypeArguments) \ 26 V(TypeArguments) \
26 V(InstantiatedTypeArguments) \ 27 V(InstantiatedTypeArguments) \
27 V(Function) \ 28 V(Function) \
28 V(Field) \ 29 V(Field) \
30 V(LiteralToken) \
29 V(TokenStream) \ 31 V(TokenStream) \
30 V(Script) \ 32 V(Script) \
31 V(Library) \ 33 V(Library) \
32 V(LibraryPrefix) \ 34 V(LibraryPrefix) \
33 V(Code) \ 35 V(Code) \
34 V(Instructions) \ 36 V(Instructions) \
35 V(PcDescriptors) \ 37 V(PcDescriptors) \
36 V(LocalVarDescriptors) \ 38 V(LocalVarDescriptors) \
37 V(ExceptionHandlers) \ 39 V(ExceptionHandlers) \
38 V(Context) \ 40 V(Context) \
(...skipping 481 matching lines...) Expand 10 before | Expand all | Expand 10 after
520 RawInstance* value_; // Offset for instance and value for static fields. 522 RawInstance* value_; // Offset for instance and value for static fields.
521 RawObject** to() { return reinterpret_cast<RawObject**>(&ptr()->value_); } 523 RawObject** to() { return reinterpret_cast<RawObject**>(&ptr()->value_); }
522 524
523 intptr_t token_index_; 525 intptr_t token_index_;
524 bool is_static_; 526 bool is_static_;
525 bool is_final_; 527 bool is_final_;
526 bool has_initializer_; 528 bool has_initializer_;
527 }; 529 };
528 530
529 531
532 class RawLiteralToken : public RawObject {
533 RAW_HEAP_OBJECT_IMPLEMENTATION(LiteralToken);
534
535 RawObject** from() {
536 return reinterpret_cast<RawObject**>(&ptr()->literal_);
537 }
538 RawString* literal_; // The actual token string.
hausner 2012/02/25 00:41:57 // literal characters as they appear in source tex
siva 2012/02/28 19:57:31 Done.
539 RawObject* value_; // The actual object corresponding to the token.
540 RawObject** to() {
541 return reinterpret_cast<RawObject**>(&ptr()->value_);
542 }
543 Token::Kind kind_; // The literal kind (string, integer, double).
544
545 friend class SnapshotReader;
546 };
547
548
530 class RawTokenStream : public RawObject { 549 class RawTokenStream : public RawObject {
531 RAW_HEAP_OBJECT_IMPLEMENTATION(TokenStream); 550 RAW_HEAP_OBJECT_IMPLEMENTATION(TokenStream);
532 551
533 enum { 552 enum {
534 kKindEntry = 0, 553 kTokenEntry = 0,
535 kLiteralEntry,
536 kNumberOfEntries 554 kNumberOfEntries
537 }; 555 };
538 556
539 RawObject** from() { 557 RawObject** from() {
540 return reinterpret_cast<RawObject**>(&ptr()->private_key_); 558 return reinterpret_cast<RawObject**>(&ptr()->private_key_);
541 } 559 }
542 RawString* private_key_; // Key used for private identifiers. 560 RawString* private_key_; // Key used for private identifiers.
543 RawSmi* length_; // Number of tokens. 561 RawSmi* length_; // Number of tokens.
544 562
545 // Variable length data follows here. 563 // Variable length data follows here.
(...skipping 552 matching lines...) Expand 10 before | Expand all | Expand 10 after
1098 RawString* target_name_; // Name of target function. 1116 RawString* target_name_; // Name of target function.
1099 RawArray* ic_data_; // Contains test classes and target function. 1117 RawArray* ic_data_; // Contains test classes and target function.
1100 intptr_t id_; // Parser node id corresponding to this IC. 1118 intptr_t id_; // Parser node id corresponding to this IC.
1101 intptr_t num_args_tested_; // Number of arguments tested in IC. 1119 intptr_t num_args_tested_; // Number of arguments tested in IC.
1102 }; 1120 };
1103 1121
1104 1122
1105 } // namespace dart 1123 } // namespace dart
1106 1124
1107 #endif // VM_RAW_OBJECT_H_ 1125 #endif // VM_RAW_OBJECT_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698