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

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

Issue 10891036: Reworked previous CL (ExternalStringGetPeer speed up) to avoid the (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
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 | « runtime/vm/dart_api_impl.cc ('k') | no next file » | 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 1105 matching lines...) Expand 10 before | Expand all | Expand 10 after
1116 return peer_; 1116 return peer_;
1117 } 1117 }
1118 1118
1119 private: 1119 private:
1120 const T* data_; 1120 const T* data_;
1121 void* peer_; 1121 void* peer_;
1122 Dart_PeerFinalizer callback_; 1122 Dart_PeerFinalizer callback_;
1123 }; 1123 };
1124 1124
1125 1125
1126 DART_EXTERN_C {
1127 Dart_Handle Dart_ExternalStringGetPeer(Dart_Handle, void**);
1128 }
1129
1130
1131 class RawExternalOneByteString : public RawString { 1126 class RawExternalOneByteString : public RawString {
1132 RAW_HEAP_OBJECT_IMPLEMENTATION(ExternalOneByteString); 1127 RAW_HEAP_OBJECT_IMPLEMENTATION(ExternalOneByteString);
1133 1128
1134 ExternalStringData<uint8_t>* external_data_; 1129 ExternalStringData<uint8_t>* external_data_;
1135 friend Dart_Handle Dart_ExternalStringGetPeer(Dart_Handle, void**); 1130
1131 public:
1132 void* peer() {
1133 return external_data_->peer();
1134 }
siva 2012/08/29 19:39:11 We generally try to restrict this file to just hav
Tom Ball 2012/08/29 20:03:50 Ivan helped me rework the original code to avoid n
1136 }; 1135 };
1137 1136
1138 1137
1139 class RawExternalTwoByteString : public RawString { 1138 class RawExternalTwoByteString : public RawString {
1140 RAW_HEAP_OBJECT_IMPLEMENTATION(ExternalTwoByteString); 1139 RAW_HEAP_OBJECT_IMPLEMENTATION(ExternalTwoByteString);
1141 1140
1142 ExternalStringData<uint16_t>* external_data_; 1141 ExternalStringData<uint16_t>* external_data_;
1143 friend Dart_Handle Dart_ExternalStringGetPeer(Dart_Handle, void**); 1142
1143 public:
1144 void* peer() {
1145 return external_data_->peer();
1146 }
1144 }; 1147 };
1145 1148
1146 1149
1147 class RawExternalFourByteString : public RawString { 1150 class RawExternalFourByteString : public RawString {
1148 RAW_HEAP_OBJECT_IMPLEMENTATION(ExternalFourByteString); 1151 RAW_HEAP_OBJECT_IMPLEMENTATION(ExternalFourByteString);
1149 1152
1150 ExternalStringData<uint32_t>* external_data_; 1153 ExternalStringData<uint32_t>* external_data_;
1151 friend Dart_Handle Dart_ExternalStringGetPeer(Dart_Handle, void**); 1154
1155 public:
1156 void* peer() {
1157 return external_data_->peer();
1158 }
1152 }; 1159 };
1153 1160
1154 1161
1155 class RawBool : public RawInstance { 1162 class RawBool : public RawInstance {
1156 RAW_HEAP_OBJECT_IMPLEMENTATION(Bool); 1163 RAW_HEAP_OBJECT_IMPLEMENTATION(Bool);
1157 1164
1158 bool value_; 1165 bool value_;
1159 }; 1166 };
1160 1167
1161 1168
(...skipping 426 matching lines...) Expand 10 before | Expand all | Expand 10 after
1588 kExternalUint64ArrayCid == kByteArrayCid + 18 && 1595 kExternalUint64ArrayCid == kByteArrayCid + 18 &&
1589 kExternalFloat32ArrayCid == kByteArrayCid + 19 && 1596 kExternalFloat32ArrayCid == kByteArrayCid + 19 &&
1590 kExternalFloat64ArrayCid == kByteArrayCid + 20 && 1597 kExternalFloat64ArrayCid == kByteArrayCid + 20 &&
1591 kStacktraceCid == kByteArrayCid + 21); 1598 kStacktraceCid == kByteArrayCid + 21);
1592 return (index >= kByteArrayCid && index <= kExternalFloat64ArrayCid); 1599 return (index >= kByteArrayCid && index <= kExternalFloat64ArrayCid);
1593 } 1600 }
1594 1601
1595 } // namespace dart 1602 } // namespace dart
1596 1603
1597 #endif // VM_RAW_OBJECT_H_ 1604 #endif // VM_RAW_OBJECT_H_
OLDNEW
« no previous file with comments | « runtime/vm/dart_api_impl.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698