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

Side by Side Diff: vm/raw_object.h

Issue 10697055: Represent tokens as a compressed stream instead of an array. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/runtime/
Patch Set: Created 8 years, 5 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/parser.cc ('k') | vm/raw_object.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 608 matching lines...) Expand 10 before | Expand all | Expand 10 after
619 }; 619 };
620 620
621 621
622 class RawTokenStream : public RawObject { 622 class RawTokenStream : public RawObject {
623 RAW_HEAP_OBJECT_IMPLEMENTATION(TokenStream); 623 RAW_HEAP_OBJECT_IMPLEMENTATION(TokenStream);
624 624
625 RawObject** from() { 625 RawObject** from() {
626 return reinterpret_cast<RawObject**>(&ptr()->private_key_); 626 return reinterpret_cast<RawObject**>(&ptr()->private_key_);
627 } 627 }
628 RawString* private_key_; // Key used for private identifiers. 628 RawString* private_key_; // Key used for private identifiers.
629 RawSmi* length_; // Number of tokens. 629 RawSmi* length_; // Length of token stream.
630 630 RawArray* token_objects_;
631 RawObject** to() {
632 return reinterpret_cast<RawObject**>(&ptr()->token_objects_);
633 }
631 // Variable length data follows here. 634 // Variable length data follows here.
632 RawObject* data_[0]; 635 uint8_t data_[0];
633 RawObject** to(intptr_t length) {
634 return reinterpret_cast<RawObject**>(&ptr()->data_[length - 1]);
635 }
636 636
637 friend class SnapshotReader; 637 friend class SnapshotReader;
638 }; 638 };
639 639
640 640
641 class RawScript : public RawObject { 641 class RawScript : public RawObject {
642 public: 642 public:
643 enum Kind { 643 enum Kind {
644 kScript = 0, 644 kScript = 0,
645 kLibrary, 645 kLibrary,
(...skipping 870 matching lines...) Expand 10 before | Expand all | Expand 10 after
1516 kExternalUint64Array == kByteArray + 18 && 1516 kExternalUint64Array == kByteArray + 18 &&
1517 kExternalFloat32Array == kByteArray + 19 && 1517 kExternalFloat32Array == kByteArray + 19 &&
1518 kExternalFloat64Array == kByteArray + 20 && 1518 kExternalFloat64Array == kByteArray + 20 &&
1519 kClosure == kByteArray + 21); 1519 kClosure == kByteArray + 21);
1520 return (index >= kByteArray && index <= kClosure); 1520 return (index >= kByteArray && index <= kClosure);
1521 } 1521 }
1522 1522
1523 } // namespace dart 1523 } // namespace dart
1524 1524
1525 #endif // VM_RAW_OBJECT_H_ 1525 #endif // VM_RAW_OBJECT_H_
OLDNEW
« no previous file with comments | « vm/parser.cc ('k') | vm/raw_object.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698