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

Side by Side Diff: runtime/vm/raw_object.h

Issue 765743003: Support use of external strings as inputs to LoadCodeUnitsInstr. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years 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/atomic.h" 9 #include "vm/atomic.h"
10 #include "vm/globals.h" 10 #include "vm/globals.h"
(...skipping 1571 matching lines...) Expand 10 before | Expand all | Expand 10 after
1582 if (callback_ != NULL) (*callback_)(peer_); 1582 if (callback_ != NULL) (*callback_)(peer_);
1583 } 1583 }
1584 1584
1585 const T* data() { 1585 const T* data() {
1586 return data_; 1586 return data_;
1587 } 1587 }
1588 void* peer() { 1588 void* peer() {
1589 return peer_; 1589 return peer_;
1590 } 1590 }
1591 1591
1592 static intptr_t data_offset() {
1593 return OFFSET_OF(ExternalStringData<T>, data_);
1594 }
1595
1592 private: 1596 private:
1593 const T* data_; 1597 const T* data_;
1594 void* peer_; 1598 void* peer_;
1595 Dart_PeerFinalizer callback_; 1599 Dart_PeerFinalizer callback_;
1596 }; 1600 };
1597 1601
1598 1602
1599 class RawExternalOneByteString : public RawString { 1603 class RawExternalOneByteString : public RawString {
1600 RAW_HEAP_OBJECT_IMPLEMENTATION(ExternalOneByteString); 1604 RAW_HEAP_OBJECT_IMPLEMENTATION(ExternalOneByteString);
1605 public:
1606 typedef ExternalStringData<uint8_t> ExternalData;
1607 static intptr_t data_offset() {
Vyacheslav Egorov (Google) 2014/11/27 14:27:43 rename it to external_data_offset() and move the t
zerny-google 2014/12/01 15:33:30 Done.
1608 return OFFSET_OF(RawExternalOneByteString, external_data_);
1609 }
1601 1610
1602 ExternalStringData<uint8_t>* external_data_; 1611 private:
1612 ExternalData* external_data_;
1603 friend class Api; 1613 friend class Api;
1604 }; 1614 };
1605 1615
1606 1616
1607 class RawExternalTwoByteString : public RawString { 1617 class RawExternalTwoByteString : public RawString {
1608 RAW_HEAP_OBJECT_IMPLEMENTATION(ExternalTwoByteString); 1618 RAW_HEAP_OBJECT_IMPLEMENTATION(ExternalTwoByteString);
1619 public:
1620 typedef ExternalStringData<uint16_t> ExternalData;
1621 static intptr_t data_offset() {
1622 return OFFSET_OF(RawExternalTwoByteString, external_data_);
1623 }
1609 1624
1610 ExternalStringData<uint16_t>* external_data_; 1625 private:
1626 ExternalData* external_data_;
1611 friend class Api; 1627 friend class Api;
1612 }; 1628 };
1613 1629
1614 1630
1615 class RawBool : public RawInstance { 1631 class RawBool : public RawInstance {
1616 RAW_HEAP_OBJECT_IMPLEMENTATION(Bool); 1632 RAW_HEAP_OBJECT_IMPLEMENTATION(Bool);
1617 1633
1618 bool value_; 1634 bool value_;
1619 }; 1635 };
1620 1636
(...skipping 495 matching lines...) Expand 10 before | Expand all | Expand 10 after
2116 COMPILE_ASSERT(kExternalTypedDataInt8ArrayCid == 2132 COMPILE_ASSERT(kExternalTypedDataInt8ArrayCid ==
2117 kTypedDataInt8ArrayViewCid + 15); 2133 kTypedDataInt8ArrayViewCid + 15);
2118 COMPILE_ASSERT(kByteBufferCid == kExternalTypedDataInt8ArrayCid + 14); 2134 COMPILE_ASSERT(kByteBufferCid == kExternalTypedDataInt8ArrayCid + 14);
2119 COMPILE_ASSERT(kNullCid == kByteBufferCid + 1); 2135 COMPILE_ASSERT(kNullCid == kByteBufferCid + 1);
2120 return (kNullCid - kTypedDataInt8ArrayCid); 2136 return (kNullCid - kTypedDataInt8ArrayCid);
2121 } 2137 }
2122 2138
2123 } // namespace dart 2139 } // namespace dart
2124 2140
2125 #endif // VM_RAW_OBJECT_H_ 2141 #endif // VM_RAW_OBJECT_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698