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

Side by Side Diff: runtime/lib/typed_data.dart

Issue 860963002: Refactor _ByteDataView.[set|get]* methods to improve their performance. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 5 years, 11 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/lib/typed_data.cc ('k') | runtime/vm/flow_graph_builder.h » ('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) 2013, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2013, 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 // patch classes for Int8List ..... Float64List and ByteData implementations. 5 // patch classes for Int8List ..... Float64List and ByteData implementations.
6 6
7 import "dart:_internal"; 7 import "dart:_internal";
8 import 'dart:math' show Random; 8 import 'dart:math' show Random;
9 9
10 patch class Int8List { 10 patch class Int8List {
(...skipping 3150 matching lines...) Expand 10 before | Expand all | Expand 10 after
3161 int getInt8(int byteOffset) { 3161 int getInt8(int byteOffset) {
3162 if (byteOffset < 0 || byteOffset >= length) { 3162 if (byteOffset < 0 || byteOffset >= length) {
3163 throw _newRangeError(byteOffset, length); 3163 throw _newRangeError(byteOffset, length);
3164 } 3164 }
3165 return _typedData._getInt8(_offset + byteOffset); 3165 return _typedData._getInt8(_offset + byteOffset);
3166 } 3166 }
3167 void setInt8(int byteOffset, int value) { 3167 void setInt8(int byteOffset, int value) {
3168 if (byteOffset < 0 || byteOffset >= length) { 3168 if (byteOffset < 0 || byteOffset >= length) {
3169 throw _newRangeError(byteOffset, length); 3169 throw _newRangeError(byteOffset, length);
3170 } 3170 }
3171 _typedData._setInt8(_offset + byteOffset, _toInt8(value)); 3171 _typedData._setInt8(_offset + byteOffset, value);
3172 } 3172 }
3173 3173
3174 int getUint8(int byteOffset) { 3174 int getUint8(int byteOffset) {
3175 if (byteOffset < 0 || byteOffset >= length) { 3175 if (byteOffset < 0 || byteOffset >= length) {
3176 throw _newRangeError(byteOffset, length); 3176 throw _newRangeError(byteOffset, length);
3177 } 3177 }
3178 return _typedData._getUint8(_offset + byteOffset); 3178 return _typedData._getUint8(_offset + byteOffset);
3179 } 3179 }
3180 void setUint8(int byteOffset, int value) { 3180 void setUint8(int byteOffset, int value) {
3181 if (byteOffset < 0 || byteOffset >= length) { 3181 if (byteOffset < 0 || byteOffset >= length) {
3182 throw _newRangeError(byteOffset, length); 3182 throw _newRangeError(byteOffset, length);
3183 } 3183 }
3184 _typedData._setUint8(_offset + byteOffset, _toUint8(value)); 3184 _typedData._setUint8(_offset + byteOffset, value);
3185 } 3185 }
3186 3186
3187 int getInt16(int byteOffset, [Endianness endian = Endianness.BIG_ENDIAN]) { 3187 int getInt16(int byteOffset, [Endianness endian = Endianness.BIG_ENDIAN]) {
3188 if (byteOffset < 0 || byteOffset + 1 >= length) { 3188 if (byteOffset < 0 || byteOffset + 1 >= length) {
3189 throw _newRangeError(byteOffset + 1, length); 3189 throw _newRangeError(byteOffset + 1, length);
3190 } 3190 }
3191 var result = _typedData._getInt16(_offset + byteOffset); 3191 var result = _typedData._getInt16(_offset + byteOffset);
3192 if (identical(endian, Endianness.HOST_ENDIAN)) { 3192 if (identical(endian, Endianness.HOST_ENDIAN)) {
3193 return result; 3193 return result;
3194 } 3194 }
3195 return _toEndianInt16(result, endian._littleEndian); 3195 return _byteSwap16(result).toSigned(16);
3196 } 3196 }
3197 void setInt16(int byteOffset, 3197 void setInt16(int byteOffset,
3198 int value, 3198 int value,
3199 [Endianness endian = Endianness.BIG_ENDIAN]) { 3199 [Endianness endian = Endianness.BIG_ENDIAN]) {
3200 if (byteOffset < 0 || byteOffset + 1 >= length) { 3200 if (byteOffset < 0 || byteOffset + 1 >= length) {
3201 throw _newRangeError(byteOffset + 1, length); 3201 throw _newRangeError(byteOffset + 1, length);
3202 } 3202 }
3203 var set_value = _toInt16(value); 3203 _typedData._setInt16(_offset + byteOffset,
3204 if (!identical(endian, Endianness.HOST_ENDIAN)) { 3204 identical(endian, Endianness.HOST_ENDIAN) ? value : _byteSwap16(value));
3205 set_value = _toEndianInt16(set_value, endian._littleEndian);
3206 }
3207 _typedData._setInt16(_offset + byteOffset, set_value);
3208 } 3205 }
3209 3206
3210 int getUint16(int byteOffset, [Endianness endian = Endianness.BIG_ENDIAN]) { 3207 int getUint16(int byteOffset, [Endianness endian = Endianness.BIG_ENDIAN]) {
3211 if (byteOffset < 0 || byteOffset + 1 >= length) { 3208 if (byteOffset < 0 || byteOffset + 1 >= length) {
3212 throw _newRangeError(byteOffset + 1, length); 3209 throw _newRangeError(byteOffset + 1, length);
3213 } 3210 }
3214 var result = _typedData._getUint16(_offset + byteOffset); 3211 var result = _typedData._getUint16(_offset + byteOffset);
3215 if (identical(endian, Endianness.HOST_ENDIAN)) { 3212 if (identical(endian, Endianness.HOST_ENDIAN)) {
3216 return result; 3213 return result;
3217 } 3214 }
3218 return _toEndianUint16(result, endian._littleEndian); 3215 return _byteSwap16(result);
3219 } 3216 }
3220 void setUint16(int byteOffset, 3217 void setUint16(int byteOffset,
3221 int value, 3218 int value,
3222 [Endianness endian = Endianness.BIG_ENDIAN]) { 3219 [Endianness endian = Endianness.BIG_ENDIAN]) {
3223 if (byteOffset < 0 || byteOffset + 1 >= length) { 3220 if (byteOffset < 0 || byteOffset + 1 >= length) {
3224 throw _newRangeError(byteOffset + 1, length); 3221 throw _newRangeError(byteOffset + 1, length);
3225 } 3222 }
3226 var set_value = _toUint16(value); 3223 _typedData._setUint16(_offset + byteOffset,
3227 if (!identical(endian, Endianness.HOST_ENDIAN)) { 3224 identical(endian, Endianness.HOST_ENDIAN) ? value : _byteSwap16(value));
3228 set_value = _toEndianUint16(set_value, endian._littleEndian);
3229 }
3230 _typedData._setUint16(_offset + byteOffset, set_value);
3231 } 3225 }
3232 3226
3233 int getInt32(int byteOffset, [Endianness endian = Endianness.BIG_ENDIAN]) { 3227 int getInt32(int byteOffset, [Endianness endian = Endianness.BIG_ENDIAN]) {
3234 if (byteOffset < 0 || byteOffset + 3 >= length) { 3228 if (byteOffset < 0 || byteOffset + 3 >= length) {
3235 throw _newRangeError(byteOffset + 3, length); 3229 throw _newRangeError(byteOffset + 3, length);
3236 } 3230 }
3237 var result = _typedData._getInt32(_offset + byteOffset); 3231 var result = _typedData._getInt32(_offset + byteOffset);
3238 if (identical(endian, Endianness.HOST_ENDIAN)) { 3232 if (identical(endian, Endianness.HOST_ENDIAN)) {
3239 return result; 3233 return result;
3240 } 3234 }
3241 return _toEndianInt32(result, endian._littleEndian); 3235 return _byteSwap32(result).toSigned(32);
3242 } 3236 }
3243 void setInt32(int byteOffset, 3237 void setInt32(int byteOffset,
3244 int value, 3238 int value,
3245 [Endianness endian = Endianness.BIG_ENDIAN]) { 3239 [Endianness endian = Endianness.BIG_ENDIAN]) {
3246 if (byteOffset < 0 || byteOffset + 3 >= length) { 3240 if (byteOffset < 0 || byteOffset + 3 >= length) {
3247 throw _newRangeError(byteOffset + 3, length); 3241 throw _newRangeError(byteOffset + 3, length);
3248 } 3242 }
3249 var set_value = _toInt32(value); 3243 _typedData._setInt32(_offset + byteOffset,
3250 if (!identical(endian, Endianness.HOST_ENDIAN)) { 3244 identical(endian, Endianness.HOST_ENDIAN) ? value : _byteSwap32(value));
3251 set_value = _toEndianInt32(set_value, endian._littleEndian);
3252 }
3253 _typedData._setInt32(_offset + byteOffset, set_value);
3254 } 3245 }
3255 3246
3256 int getUint32(int byteOffset, [Endianness endian = Endianness.BIG_ENDIAN]) { 3247 int getUint32(int byteOffset, [Endianness endian = Endianness.BIG_ENDIAN]) {
3257 if (byteOffset < 0 || byteOffset + 3 >= length) { 3248 if (byteOffset < 0 || byteOffset + 3 >= length) {
3258 throw _newRangeError(byteOffset + 3, length); 3249 throw _newRangeError(byteOffset + 3, length);
3259 } 3250 }
3260 var result = _typedData._getUint32(_offset + byteOffset); 3251 var result = _typedData._getUint32(_offset + byteOffset);
3261 if (identical(endian, Endianness.HOST_ENDIAN)) { 3252 if (identical(endian, Endianness.HOST_ENDIAN)) {
3262 return result; 3253 return result;
3263 } 3254 }
3264 return _toEndianUint32(result, endian._littleEndian); 3255 return _byteSwap32(result);
3265 } 3256 }
3266 void setUint32(int byteOffset, 3257 void setUint32(int byteOffset,
3267 int value, 3258 int value,
3268 [Endianness endian = Endianness.BIG_ENDIAN]) { 3259 [Endianness endian = Endianness.BIG_ENDIAN]) {
3269 if (byteOffset < 0 || byteOffset + 3 >= length) { 3260 if (byteOffset < 0 || byteOffset + 3 >= length) {
3270 throw _newRangeError(byteOffset + 3, length); 3261 throw _newRangeError(byteOffset + 3, length);
3271 } 3262 }
3272 var set_value = _toUint32(value); 3263 _typedData._setUint32(_offset + byteOffset,
3273 if (!identical(endian, Endianness.HOST_ENDIAN)) { 3264 identical(endian, Endianness.HOST_ENDIAN) ? value : _byteSwap32(value));
3274 set_value = _toEndianUint32(set_value, endian._littleEndian);
3275 }
3276 _typedData._setUint32(_offset + byteOffset, set_value);
3277 } 3265 }
3278 3266
3279 int getInt64(int byteOffset, [Endianness endian = Endianness.BIG_ENDIAN]) { 3267 int getInt64(int byteOffset, [Endianness endian = Endianness.BIG_ENDIAN]) {
3280 if (byteOffset < 0 || byteOffset + 7 >= length) { 3268 if (byteOffset < 0 || byteOffset + 7 >= length) {
3281 throw _newRangeError(byteOffset + 7, length); 3269 throw _newRangeError(byteOffset + 7, length);
3282 } 3270 }
3283 var result = _typedData._getInt64(_offset + byteOffset); 3271 var result = _typedData._getInt64(_offset + byteOffset);
3284 if (identical(endian, Endianness.HOST_ENDIAN)) { 3272 if (identical(endian, Endianness.HOST_ENDIAN)) {
3285 return result; 3273 return result;
3286 } 3274 }
3287 return _toEndianInt64(result, endian._littleEndian); 3275 return _byteSwap64(result).toSigned(64);
3288 } 3276 }
3289 void setInt64(int byteOffset, 3277 void setInt64(int byteOffset,
3290 int value, 3278 int value,
3291 [Endianness endian = Endianness.BIG_ENDIAN]) { 3279 [Endianness endian = Endianness.BIG_ENDIAN]) {
3292 if (byteOffset < 0 || byteOffset + 7 >= length) { 3280 if (byteOffset < 0 || byteOffset + 7 >= length) {
3293 throw _newRangeError(byteOffset + 7, length); 3281 throw _newRangeError(byteOffset + 7, length);
3294 } 3282 }
3295 var set_value = _toInt64(value); 3283 _typedData._setInt64(_offset + byteOffset,
3296 if (!identical(endian, Endianness.HOST_ENDIAN)) { 3284 identical(endian, Endianness.HOST_ENDIAN) ? value : _byteSwap64(value));
3297 set_value = _toEndianInt64(set_value, endian._littleEndian);
3298 }
3299 _typedData._setInt64(_offset + byteOffset, set_value);
3300 } 3285 }
3301 3286
3302 int getUint64(int byteOffset, [Endianness endian = Endianness.BIG_ENDIAN]) { 3287 int getUint64(int byteOffset, [Endianness endian = Endianness.BIG_ENDIAN]) {
3303 if (byteOffset < 0 || byteOffset + 7 >= length) { 3288 if (byteOffset < 0 || byteOffset + 7 >= length) {
3304 throw _newRangeError(byteOffset + 7, length); 3289 throw _newRangeError(byteOffset + 7, length);
3305 } 3290 }
3306 var result = _typedData._getUint64(_offset + byteOffset); 3291 var result = _typedData._getUint64(_offset + byteOffset);
3307 if (identical(endian, Endianness.HOST_ENDIAN)) { 3292 if (identical(endian, Endianness.HOST_ENDIAN)) {
3308 return result; 3293 return result;
3309 } 3294 }
3310 return _toEndianUint64(result, endian._littleEndian); 3295 return _byteSwap64(result);
3311 } 3296 }
3312 void setUint64(int byteOffset, 3297 void setUint64(int byteOffset,
3313 int value, 3298 int value,
3314 [Endianness endian = Endianness.BIG_ENDIAN]) { 3299 [Endianness endian = Endianness.BIG_ENDIAN]) {
3315 if (byteOffset < 0 || byteOffset + 7 >= length) { 3300 if (byteOffset < 0 || byteOffset + 7 >= length) {
3316 throw _newRangeError(byteOffset + 7, length); 3301 throw _newRangeError(byteOffset + 7, length);
3317 } 3302 }
3318 var set_value = _toUint64(value); 3303 _typedData._setUint64(_offset + byteOffset,
3319 if (!identical(endian, Endianness.HOST_ENDIAN)) { 3304 identical(endian, Endianness.HOST_ENDIAN) ? value : _byteSwap64(value));
3320 set_value = _toEndianUint64(set_value, endian._littleEndian);
3321 }
3322 _typedData._setUint64(_offset + byteOffset, set_value);
3323 } 3305 }
3324 3306
3325 double getFloat32(int byteOffset, 3307 double getFloat32(int byteOffset,
3326 [Endianness endian = Endianness.BIG_ENDIAN]) { 3308 [Endianness endian = Endianness.BIG_ENDIAN]) {
3327 if (byteOffset < 0 || byteOffset + 3 >= length) { 3309 if (byteOffset < 0 || byteOffset + 3 >= length) {
3328 throw _newRangeError(byteOffset + 3, length); 3310 throw _newRangeError(byteOffset + 3, length);
3329 } 3311 }
3330 var result = _typedData._getFloat32(_offset + byteOffset); 3312 var result = _typedData._getFloat32(_offset + byteOffset);
3331 if (identical(endian, Endianness.HOST_ENDIAN)) { 3313 if (identical(endian, Endianness.HOST_ENDIAN)) {
3332 return result; 3314 return result;
3333 } 3315 }
3334 return _toEndianFloat32(result, endian._littleEndian); 3316 return _byteSwapFloat32(result);
3335 } 3317 }
3336 void setFloat32(int byteOffset, 3318 void setFloat32(int byteOffset,
3337 double value, 3319 double value,
3338 [Endianness endian = Endianness.BIG_ENDIAN]) { 3320 [Endianness endian = Endianness.BIG_ENDIAN]) {
3339 if (byteOffset < 0 || byteOffset + 3 >= length) { 3321 if (byteOffset < 0 || byteOffset + 3 >= length) {
3340 throw _newRangeError(byteOffset + 3, length); 3322 throw _newRangeError(byteOffset + 3, length);
3341 } 3323 }
3342 var set_value = value; 3324 _typedData._setFloat32(_offset + byteOffset,
3343 if (!identical(endian, Endianness.HOST_ENDIAN)) { 3325 identical(endian, Endianness.HOST_ENDIAN) ? value
3344 set_value = _toEndianFloat32(set_value, endian._littleEndian); 3326 : _byteSwapFloat32(value));
3345 }
3346 _typedData._setFloat32(_offset + byteOffset, set_value);
3347 } 3327 }
3348 3328
3349 double getFloat64(int byteOffset, 3329 double getFloat64(int byteOffset,
3350 [Endianness endian = Endianness.BIG_ENDIAN]) { 3330 [Endianness endian = Endianness.BIG_ENDIAN]) {
3351 if (byteOffset < 0 || byteOffset + 7 >= length) { 3331 if (byteOffset < 0 || byteOffset + 7 >= length) {
3352 throw _newRangeError(byteOffset + 7, length); 3332 throw _newRangeError(byteOffset + 7, length);
3353 } 3333 }
3354 var result = _typedData._getFloat64(_offset + byteOffset); 3334 var result = _typedData._getFloat64(_offset + byteOffset);
3355 if (identical(endian, Endianness.HOST_ENDIAN)) { 3335 if (identical(endian, Endianness.HOST_ENDIAN)) {
3356 return result; 3336 return result;
3357 } 3337 }
3358 return _toEndianFloat64(result, endian._littleEndian); 3338 return _byteSwapFloat64(result);
3359 } 3339 }
3360 void setFloat64(int byteOffset, 3340 void setFloat64(int byteOffset,
3361 double value, 3341 double value,
3362 [Endianness endian = Endianness.BIG_ENDIAN]) { 3342 [Endianness endian = Endianness.BIG_ENDIAN]) {
3363 if (byteOffset < 0 || byteOffset + 7 >= length) { 3343 if (byteOffset < 0 || byteOffset + 7 >= length) {
3364 throw _newRangeError(byteOffset + 7, length); 3344 throw _newRangeError(byteOffset + 7, length);
3365 } 3345 }
3366 var set_value = value; 3346 _typedData._setFloat64(_offset + byteOffset,
3367 if (!identical(endian, Endianness.HOST_ENDIAN)) { 3347 identical(endian, Endianness.HOST_ENDIAN) ? value
3368 set_value = _toEndianFloat64(set_value, endian._littleEndian); 3348 : _byteSwapFloat64(value));
3369 }
3370 _typedData._setFloat64(_offset + byteOffset, set_value);
3371 } 3349 }
3372 3350
3373 Float32x4 getFloat32x4(int byteOffset, 3351 Float32x4 getFloat32x4(int byteOffset,
3374 [Endianness endian = Endianness.BIG_ENDIAN]) { 3352 [Endianness endian = Endianness.BIG_ENDIAN]) {
3375 if (byteOffset < 0 || byteOffset + 3 >= length) { 3353 if (byteOffset < 0 || byteOffset + 3 >= length) {
3376 throw _newRangeError(byteOffset + 3, length); 3354 throw _newRangeError(byteOffset + 3, length);
3377 } 3355 }
3378 // TODO(johnmccutchan) : Need to resolve this for endianity. 3356 // TODO(johnmccutchan) : Need to resolve this for endianity.
3379 return _typedData._getFloat32x4(_offset + byteOffset); 3357 return _typedData._getFloat32x4(_offset + byteOffset);
3380 } 3358 }
3381 void setFloat32x4(int byteOffset, 3359 void setFloat32x4(int byteOffset,
3382 Float32x4 value, 3360 Float32x4 value,
3383 [Endianness endian = Endianness.BIG_ENDIAN]) { 3361 [Endianness endian = Endianness.BIG_ENDIAN]) {
3384 if (byteOffset < 0 || byteOffset + 3 >= length) { 3362 if (byteOffset < 0 || byteOffset + 3 >= length) {
3385 throw _newRangeError(byteOffset + 3, length); 3363 throw _newRangeError(byteOffset + 3, length);
3386 } 3364 }
3387 // TODO(johnmccutchan) : Need to resolve this for endianity. 3365 // TODO(johnmccutchan) : Need to resolve this for endianity.
3388 _typedData._setFloat32x4(_offset + byteOffset, value); 3366 _typedData._setFloat32x4(_offset + byteOffset, value);
3389 3367
3390 } 3368 }
3391 3369
3392
3393 // Internal utility methods.
3394
3395 static int _toEndianInt16(int host_value, bool little_endian)
3396 native "ByteData_ToEndianInt16";
3397 static int _toEndianUint16(int host_value, bool little_endian)
3398 native "ByteData_ToEndianUint16";
3399 static int _toEndianInt32(int host_value, bool little_endian)
3400 native "ByteData_ToEndianInt32";
3401 static int _toEndianUint32(int host_value, bool little_endian)
3402 native "ByteData_ToEndianUint32";
3403 static int _toEndianInt64(int host_value, bool little_endian)
3404 native "ByteData_ToEndianInt64";
3405 static int _toEndianUint64(int host_value, bool little_endian)
3406 native "ByteData_ToEndianUint64";
3407 static double _toEndianFloat32(double host_value, bool little_endian)
3408 native "ByteData_ToEndianFloat32";
3409 static double _toEndianFloat64(double host_value, bool little_endian)
3410 native "ByteData_ToEndianFloat64";
3411
3412
3413 final TypedData _typedData; 3370 final TypedData _typedData;
3414 final int _offset; 3371 final int _offset;
3415 final int length; 3372 final int length;
3416 } 3373 }
3417 3374
3375 int _byteSwap16(int value) {
3376 return ((value & 0xFF00) >> 8) |
3377 ((value & 0x00FF) << 8);
3378 }
3379
3380 int _byteSwap32(int value) {
3381 value = ((value & 0xFF00FF00) >> 8) | ((value & 0x00FF00FF) << 8);
3382 value = ((value & 0xFFFF0000) >> 16) | ((value & 0x0000FFFF) << 16);
3383 return value;
3384 }
3385
3386 int _byteSwap64(int value) {
3387 return (_byteSwap32(value) << 32) | _byteSwap32(value >> 32);
3388 }
3389
3390 final _convU32 = new Uint32List(2);
Florian Schneider 2015/01/21 09:34:38 Once we have allocation sinking for fixed size arr
Vyacheslav Egorov (Google) 2015/01/21 12:17:56 Our load forwarding only supports forwarding for l
3391 final _convF32 = new Float32List.view(_convU32.buffer);
3392 final _convF64 = new Float64List.view(_convU32.buffer);
3393
3394 double _byteSwapFloat32(double value) {
3395 _convF32[0] = value;
Florian Schneider 2015/01/21 09:34:38 How about making the view a local variable? If eve
Vyacheslav Egorov (Google) 2015/01/21 12:17:56 See above. We are not powerful enough yet.
3396 _convU32[0] = _byteSwap32(_convU32[0]);
3397 return _convF32[0];
Florian Schneider 2015/01/21 09:34:38 Does it help to force inline [] and []= on typed d
Vyacheslav Egorov (Google) 2015/01/21 12:17:56 They are inlined here. However if we have polymorp
3398 }
3399
3400 double _byteSwapFloat64(double value) {
3401 _convF64[0] = value;
Florian Schneider 2015/01/21 09:34:38 Same for the view object here.
Vyacheslav Egorov (Google) 2015/01/21 12:17:56 See above for the reasons why it is global.
3402 var lo = _convU32[0];
3403 _convU32[0] = _byteSwap32(_convU32[1]);
3404 _convU32[1] = _byteSwap32(lo);
3405 return _convF64[0];
3406 }
3418 3407
3419 // Top level utility methods. 3408 // Top level utility methods.
3420 int _toInt(int value, int mask) { 3409 int _toInt(int value, int mask) {
3421 value &= mask; 3410 value &= mask;
3422 if (value > (mask >> 1)) value -= mask + 1; 3411 if (value > (mask >> 1)) value -= mask + 1;
3423 return value; 3412 return value;
3424 } 3413 }
3425 3414
3426 3415
3427 int _toInt8(int value) { 3416 int _toInt8(int value) {
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
3497 return value; 3486 return value;
3498 } 3487 }
3499 return object; 3488 return object;
3500 } 3489 }
3501 3490
3502 3491
3503 _newRangeError(int index, int length) { 3492 _newRangeError(int index, int length) {
3504 String message = "$index must be in the range [0..$length)"; 3493 String message = "$index must be in the range [0..$length)";
3505 return new RangeError(message); 3494 return new RangeError(message);
3506 } 3495 }
OLDNEW
« no previous file with comments | « runtime/lib/typed_data.cc ('k') | runtime/vm/flow_graph_builder.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698