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

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
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 647 matching lines...) Expand 10 before | Expand all | Expand 10 after
1326 RAW_HEAP_OBJECT_IMPLEMENTATION(ExternalInt8Array); 1324 RAW_HEAP_OBJECT_IMPLEMENTATION(ExternalInt8Array);
1327 1325
1328 ExternalByteArrayData<int8_t>* external_data_; 1326 ExternalByteArrayData<int8_t>* external_data_;
1329 }; 1327 };
1330 1328
1331 1329
1332 class RawExternalUint8Array : public RawByteArray { 1330 class RawExternalUint8Array : public RawByteArray {
1333 RAW_HEAP_OBJECT_IMPLEMENTATION(ExternalUint8Array); 1331 RAW_HEAP_OBJECT_IMPLEMENTATION(ExternalUint8Array);
1334 1332
1335 ExternalByteArrayData<uint8_t>* external_data_; 1333 ExternalByteArrayData<uint8_t>* external_data_;
1334
1335 friend class TokenStream;
1336 friend class RawTokenStream;
1336 }; 1337 };
1337 1338
1338 1339
1339 class RawExternalInt16Array : public RawByteArray { 1340 class RawExternalInt16Array : public RawByteArray {
1340 RAW_HEAP_OBJECT_IMPLEMENTATION(ExternalInt16Array); 1341 RAW_HEAP_OBJECT_IMPLEMENTATION(ExternalInt16Array);
1341 1342
1342 ExternalByteArrayData<int16_t>* external_data_; 1343 ExternalByteArrayData<int16_t>* external_data_;
1343 }; 1344 };
1344 1345
1345 1346
(...skipping 240 matching lines...) Expand 10 before | Expand all | Expand 10 after
1586 kExternalUint64ArrayCid == kByteArrayCid + 18 && 1587 kExternalUint64ArrayCid == kByteArrayCid + 18 &&
1587 kExternalFloat32ArrayCid == kByteArrayCid + 19 && 1588 kExternalFloat32ArrayCid == kByteArrayCid + 19 &&
1588 kExternalFloat64ArrayCid == kByteArrayCid + 20 && 1589 kExternalFloat64ArrayCid == kByteArrayCid + 20 &&
1589 kStacktraceCid == kByteArrayCid + 21); 1590 kStacktraceCid == kByteArrayCid + 21);
1590 return (index >= kByteArrayCid && index <= kExternalFloat64ArrayCid); 1591 return (index >= kByteArrayCid && index <= kExternalFloat64ArrayCid);
1591 } 1592 }
1592 1593
1593 } // namespace dart 1594 } // namespace dart
1594 1595
1595 #endif // VM_RAW_OBJECT_H_ 1596 #endif // VM_RAW_OBJECT_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698