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

Side by Side Diff: vm/raw_object.h

Issue 10914050: Use external byte arrays for token stream, this moves the token stream out of the isolate heap. For… (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/runtime/
Patch Set: Created 8 years, 3 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.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 641 matching lines...) Expand 10 before | Expand all | Expand 10 after
652 }; 652 };
653 653
654 654
655 class RawTokenStream : public RawObject { 655 class RawTokenStream : public RawObject {
656 RAW_HEAP_OBJECT_IMPLEMENTATION(TokenStream); 656 RAW_HEAP_OBJECT_IMPLEMENTATION(TokenStream);
657 657
658 RawObject** from() { 658 RawObject** from() {
659 return reinterpret_cast<RawObject**>(&ptr()->private_key_); 659 return reinterpret_cast<RawObject**>(&ptr()->private_key_);
660 } 660 }
661 RawString* private_key_; // Key used for private identifiers. 661 RawString* private_key_; // Key used for private identifiers.
662 RawSmi* length_; // Length of token stream.
663 RawArray* token_objects_; 662 RawArray* token_objects_;
663 RawExternalUint8Array* stream_;
664 RawObject** to() { 664 RawObject** to() {
665 return reinterpret_cast<RawObject**>(&ptr()->token_objects_); 665 return reinterpret_cast<RawObject**>(&ptr()->stream_);
666 } 666 }
667 // Variable length data follows here.
668 uint8_t data_[0];
669 667
670 friend class SnapshotReader; 668 friend class SnapshotReader;
671 }; 669 };
672 670
673 671
674 class RawScript : public RawObject { 672 class RawScript : public RawObject {
675 public: 673 public:
676 enum Kind { 674 enum Kind {
677 kScriptTag = 0, 675 kScriptTag = 0,
678 kLibraryTag, 676 kLibraryTag,
(...skipping 650 matching lines...) Expand 10 before | Expand all | Expand 10 after
1329 RAW_HEAP_OBJECT_IMPLEMENTATION(ExternalInt8Array); 1327 RAW_HEAP_OBJECT_IMPLEMENTATION(ExternalInt8Array);
1330 1328
1331 ExternalByteArrayData<int8_t>* external_data_; 1329 ExternalByteArrayData<int8_t>* external_data_;
1332 }; 1330 };
1333 1331
1334 1332
1335 class RawExternalUint8Array : public RawByteArray { 1333 class RawExternalUint8Array : public RawByteArray {
1336 RAW_HEAP_OBJECT_IMPLEMENTATION(ExternalUint8Array); 1334 RAW_HEAP_OBJECT_IMPLEMENTATION(ExternalUint8Array);
1337 1335
1338 ExternalByteArrayData<uint8_t>* external_data_; 1336 ExternalByteArrayData<uint8_t>* external_data_;
1337
1338 friend class TokenStream;
1339 friend class RawTokenStream;
1339 }; 1340 };
1340 1341
1341 1342
1342 class RawExternalInt16Array : public RawByteArray { 1343 class RawExternalInt16Array : public RawByteArray {
1343 RAW_HEAP_OBJECT_IMPLEMENTATION(ExternalInt16Array); 1344 RAW_HEAP_OBJECT_IMPLEMENTATION(ExternalInt16Array);
1344 1345
1345 ExternalByteArrayData<int16_t>* external_data_; 1346 ExternalByteArrayData<int16_t>* external_data_;
1346 }; 1347 };
1347 1348
1348 1349
(...skipping 240 matching lines...) Expand 10 before | Expand all | Expand 10 after
1589 kExternalUint64ArrayCid == kByteArrayCid + 18 && 1590 kExternalUint64ArrayCid == kByteArrayCid + 18 &&
1590 kExternalFloat32ArrayCid == kByteArrayCid + 19 && 1591 kExternalFloat32ArrayCid == kByteArrayCid + 19 &&
1591 kExternalFloat64ArrayCid == kByteArrayCid + 20 && 1592 kExternalFloat64ArrayCid == kByteArrayCid + 20 &&
1592 kStacktraceCid == kByteArrayCid + 21); 1593 kStacktraceCid == kByteArrayCid + 21);
1593 return (index >= kByteArrayCid && index <= kExternalFloat64ArrayCid); 1594 return (index >= kByteArrayCid && index <= kExternalFloat64ArrayCid);
1594 } 1595 }
1595 1596
1596 } // namespace dart 1597 } // namespace dart
1597 1598
1598 #endif // VM_RAW_OBJECT_H_ 1599 #endif // VM_RAW_OBJECT_H_
OLDNEW
« no previous file with comments | « vm/object.cc ('k') | vm/raw_object.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698