Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2015 the V8 project authors. All rights reserved. | 1 // Copyright 2015 the V8 project authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "src/runtime/runtime-utils.h" | 5 #include "src/runtime/runtime-utils.h" |
| 6 | 6 |
| 7 #include "src/arguments.h" | 7 #include "src/arguments.h" |
| 8 #include "src/base/macros.h" | 8 #include "src/base/macros.h" |
| 9 #include "src/conversions.h" | 9 #include "src/conversions.h" |
| 10 #include "src/factory.h" | 10 #include "src/factory.h" |
| (...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 161 HandleScope scope(isolate); | 161 HandleScope scope(isolate); |
| 162 DCHECK(args.length() == 1); | 162 DCHECK(args.length() == 1); |
| 163 return isolate->heap()->ToBoolean(args[0]->IsSimd128Value()); | 163 return isolate->heap()->ToBoolean(args[0]->IsSimd128Value()); |
| 164 } | 164 } |
| 165 | 165 |
| 166 | 166 |
| 167 //------------------------------------------------------------------- | 167 //------------------------------------------------------------------- |
| 168 | 168 |
| 169 // Utility macros. | 169 // Utility macros. |
| 170 | 170 |
| 171 #define CONVERT_SIMD_LANE_ARG_CHECKED(name, index, lanes) \ | 171 // TODO(gdeepti): Fix to use ToNumber conversion once polyfill is updated. |
| 172 CONVERT_INT32_ARG_CHECKED(name, index); \ | 172 #define CONVERT_SIMD_LANE_ARG_CHECKED(name, index, lanes) \ |
| 173 RUNTIME_ASSERT(name >= 0 && name < lanes); | 173 Handle<Object> name_object = args.at<Object>(index); \ |
| 174 if (!name_object->IsNumber() || !IsInt32Double(name_object->Number())) { \ | |
| 175 THROW_NEW_ERROR_RETURN_FAILURE( \ | |
| 176 isolate, NewTypeError(MessageTemplate::kInvalidSimdIndex)); \ | |
| 177 } \ | |
| 178 uint32_t name = name_object->Number(); \ | |
|
bbudge
2016/05/19 14:14:44
It would be better if you didn't have to call name
gdeepti
2016/05/20 09:30:40
Done.
| |
| 179 if (name < 0 || name >= lanes) { \ | |
| 180 THROW_NEW_ERROR_RETURN_FAILURE( \ | |
| 181 isolate, NewRangeError(MessageTemplate::kInvalidSimdIndex)); \ | |
| 182 } | |
| 174 | 183 |
| 175 #define CONVERT_SIMD_ARG_HANDLE_THROW(Type, name, index) \ | 184 #define CONVERT_SIMD_ARG_HANDLE_THROW(Type, name, index) \ |
| 176 Handle<Type> name; \ | 185 Handle<Type> name; \ |
| 177 if (args[index]->Is##Type()) { \ | 186 if (args[index]->Is##Type()) { \ |
| 178 name = args.at<Type>(index); \ | 187 name = args.at<Type>(index); \ |
| 179 } else { \ | 188 } else { \ |
| 180 THROW_NEW_ERROR_RETURN_FAILURE( \ | 189 THROW_NEW_ERROR_RETURN_FAILURE( \ |
| 181 isolate, NewTypeError(MessageTemplate::kInvalidSimdOperation)); \ | 190 isolate, NewTypeError(MessageTemplate::kInvalidSimdOperation)); \ |
| 182 } | 191 } |
| 183 | 192 |
| (...skipping 26 matching lines...) Expand all Loading... | |
| 210 bool lanes[kLaneCount]; \ | 219 bool lanes[kLaneCount]; \ |
| 211 for (int i = 0; i < kLaneCount; i++) { \ | 220 for (int i = 0; i < kLaneCount; i++) { \ |
| 212 lanes[i] = a->get_lane(i) op b->get_lane(i); \ | 221 lanes[i] = a->get_lane(i) op b->get_lane(i); \ |
| 213 } \ | 222 } \ |
| 214 Handle<bool_type> result = isolate->factory()->New##bool_type(lanes); | 223 Handle<bool_type> result = isolate->factory()->New##bool_type(lanes); |
| 215 | 224 |
| 216 //------------------------------------------------------------------- | 225 //------------------------------------------------------------------- |
| 217 | 226 |
| 218 // Common functions. | 227 // Common functions. |
| 219 | 228 |
| 220 #define GET_NUMERIC_ARG(lane_type, name, index) \ | 229 #define GET_NUMERIC_ARG(lane_type, name, index) \ |
| 221 CONVERT_NUMBER_ARG_HANDLE_CHECKED(a, index); \ | 230 Handle<Object> a; \ |
| 231 ASSIGN_RETURN_FAILURE_ON_EXCEPTION( \ | |
| 232 isolate, a, Object::ToNumber(args.at<Object>(index))); \ | |
| 222 name = ConvertNumber<lane_type>(a->Number()); | 233 name = ConvertNumber<lane_type>(a->Number()); |
| 223 | 234 |
| 224 #define GET_BOOLEAN_ARG(lane_type, name, index) \ | 235 #define GET_BOOLEAN_ARG(lane_type, name, index) \ |
| 225 name = args[index]->BooleanValue(); | 236 name = args[index]->BooleanValue(); |
| 226 | 237 |
| 227 #define SIMD_ALL_TYPES(FUNCTION) \ | 238 #define SIMD_ALL_TYPES(FUNCTION) \ |
| 228 FUNCTION(Float32x4, float, 4, NewNumber, GET_NUMERIC_ARG) \ | 239 FUNCTION(Float32x4, float, 4, NewNumber, GET_NUMERIC_ARG) \ |
| 229 FUNCTION(Int32x4, int32_t, 4, NewNumber, GET_NUMERIC_ARG) \ | 240 FUNCTION(Int32x4, int32_t, 4, NewNumber, GET_NUMERIC_ARG) \ |
| 230 FUNCTION(Uint32x4, uint32_t, 4, NewNumber, GET_NUMERIC_ARG) \ | 241 FUNCTION(Uint32x4, uint32_t, 4, NewNumber, GET_NUMERIC_ARG) \ |
| 231 FUNCTION(Bool32x4, bool, 4, ToBoolean, GET_BOOLEAN_ARG) \ | 242 FUNCTION(Bool32x4, bool, 4, ToBoolean, GET_BOOLEAN_ARG) \ |
| (...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 388 #define SIMD_INT_TYPES(FUNCTION) \ | 399 #define SIMD_INT_TYPES(FUNCTION) \ |
| 389 FUNCTION(Int32x4, int32_t, 32, 4) \ | 400 FUNCTION(Int32x4, int32_t, 32, 4) \ |
| 390 FUNCTION(Int16x8, int16_t, 16, 8) \ | 401 FUNCTION(Int16x8, int16_t, 16, 8) \ |
| 391 FUNCTION(Int8x16, int8_t, 8, 16) | 402 FUNCTION(Int8x16, int8_t, 8, 16) |
| 392 | 403 |
| 393 #define SIMD_UINT_TYPES(FUNCTION) \ | 404 #define SIMD_UINT_TYPES(FUNCTION) \ |
| 394 FUNCTION(Uint32x4, uint32_t, 32, 4) \ | 405 FUNCTION(Uint32x4, uint32_t, 32, 4) \ |
| 395 FUNCTION(Uint16x8, uint16_t, 16, 8) \ | 406 FUNCTION(Uint16x8, uint16_t, 16, 8) \ |
| 396 FUNCTION(Uint8x16, uint8_t, 8, 16) | 407 FUNCTION(Uint8x16, uint8_t, 8, 16) |
| 397 | 408 |
| 398 #define CONVERT_SHIFT_ARG_CHECKED(name, index) \ | 409 #define CONVERT_SHIFT_ARG_CHECKED(name, index) \ |
| 399 RUNTIME_ASSERT(args[index]->IsNumber()); \ | 410 Handle<Object> name_object = args.at<Object>(index); \ |
| 400 int32_t signed_shift = 0; \ | 411 if (!name_object->IsNumber()) { \ |
| 401 RUNTIME_ASSERT(args[index]->ToInt32(&signed_shift)); \ | 412 THROW_NEW_ERROR_RETURN_FAILURE( \ |
| 413 isolate, NewTypeError(MessageTemplate::kInvalidSimdOperation)); \ | |
| 414 } \ | |
| 415 int32_t signed_shift = 0; \ | |
| 416 args[index]->ToInt32(&signed_shift); \ | |
| 402 uint32_t name = bit_cast<uint32_t>(signed_shift); | 417 uint32_t name = bit_cast<uint32_t>(signed_shift); |
| 403 | 418 |
| 404 #define SIMD_LSL_FUNCTION(type, lane_type, lane_bits, lane_count) \ | 419 #define SIMD_LSL_FUNCTION(type, lane_type, lane_bits, lane_count) \ |
| 405 RUNTIME_FUNCTION(Runtime_##type##ShiftLeftByScalar) { \ | 420 RUNTIME_FUNCTION(Runtime_##type##ShiftLeftByScalar) { \ |
| 406 static const int kLaneCount = lane_count; \ | 421 static const int kLaneCount = lane_count; \ |
| 407 HandleScope scope(isolate); \ | 422 HandleScope scope(isolate); \ |
| 408 DCHECK(args.length() == 2); \ | 423 DCHECK(args.length() == 2); \ |
| 409 CONVERT_SIMD_ARG_HANDLE_THROW(type, a, 0); \ | 424 CONVERT_SIMD_ARG_HANDLE_THROW(type, a, 0); \ |
| 410 CONVERT_SHIFT_ARG_CHECKED(shift, 1); \ | 425 CONVERT_SHIFT_ARG_CHECKED(shift, 1); \ |
| 411 lane_type lanes[kLaneCount] = {0}; \ | 426 lane_type lanes[kLaneCount] = {0}; \ |
| 412 if (shift < lane_bits) { \ | 427 shift &= lane_bits - 1; \ |
| 413 for (int i = 0; i < kLaneCount; i++) { \ | 428 for (int i = 0; i < kLaneCount; i++) { \ |
| 414 lanes[i] = a->get_lane(i) << shift; \ | 429 lanes[i] = a->get_lane(i) << shift; \ |
| 415 } \ | |
| 416 } \ | 430 } \ |
| 417 Handle<type> result = isolate->factory()->New##type(lanes); \ | 431 Handle<type> result = isolate->factory()->New##type(lanes); \ |
| 418 return *result; \ | 432 return *result; \ |
| 419 } | 433 } |
| 420 | 434 |
| 421 #define SIMD_LSR_FUNCTION(type, lane_type, lane_bits, lane_count) \ | 435 #define SIMD_LSR_FUNCTION(type, lane_type, lane_bits, lane_count) \ |
| 422 RUNTIME_FUNCTION(Runtime_##type##ShiftRightByScalar) { \ | 436 RUNTIME_FUNCTION(Runtime_##type##ShiftRightByScalar) { \ |
| 423 static const int kLaneCount = lane_count; \ | 437 static const int kLaneCount = lane_count; \ |
| 424 HandleScope scope(isolate); \ | 438 HandleScope scope(isolate); \ |
| 425 DCHECK(args.length() == 2); \ | 439 DCHECK(args.length() == 2); \ |
| 426 CONVERT_SIMD_ARG_HANDLE_THROW(type, a, 0); \ | 440 CONVERT_SIMD_ARG_HANDLE_THROW(type, a, 0); \ |
| 427 CONVERT_SHIFT_ARG_CHECKED(shift, 1); \ | 441 CONVERT_SHIFT_ARG_CHECKED(shift, 1); \ |
| 428 lane_type lanes[kLaneCount] = {0}; \ | 442 lane_type lanes[kLaneCount] = {0}; \ |
| 429 if (shift < lane_bits) { \ | 443 shift &= lane_bits - 1; \ |
| 430 for (int i = 0; i < kLaneCount; i++) { \ | 444 for (int i = 0; i < kLaneCount; i++) { \ |
| 431 lanes[i] = static_cast<lane_type>( \ | 445 lanes[i] = static_cast<lane_type>(bit_cast<lane_type>(a->get_lane(i)) >> \ |
| 432 bit_cast<lane_type>(a->get_lane(i)) >> shift); \ | 446 shift); \ |
| 433 } \ | 447 } \ |
| 434 } \ | 448 Handle<type> result = isolate->factory()->New##type(lanes); \ |
| 435 Handle<type> result = isolate->factory()->New##type(lanes); \ | 449 return *result; \ |
| 436 return *result; \ | |
| 437 } | 450 } |
| 438 | 451 |
| 439 #define SIMD_ASR_FUNCTION(type, lane_type, lane_bits, lane_count) \ | 452 #define SIMD_ASR_FUNCTION(type, lane_type, lane_bits, lane_count) \ |
| 440 RUNTIME_FUNCTION(Runtime_##type##ShiftRightByScalar) { \ | 453 RUNTIME_FUNCTION(Runtime_##type##ShiftRightByScalar) { \ |
| 441 static const int kLaneCount = lane_count; \ | 454 static const int kLaneCount = lane_count; \ |
| 442 HandleScope scope(isolate); \ | 455 HandleScope scope(isolate); \ |
| 443 DCHECK(args.length() == 2); \ | 456 DCHECK(args.length() == 2); \ |
| 444 CONVERT_SIMD_ARG_HANDLE_THROW(type, a, 0); \ | 457 CONVERT_SIMD_ARG_HANDLE_THROW(type, a, 0); \ |
| 445 CONVERT_SHIFT_ARG_CHECKED(shift, 1); \ | 458 CONVERT_SHIFT_ARG_CHECKED(shift, 1); \ |
| 446 if (shift >= lane_bits) shift = lane_bits - 1; \ | 459 shift &= lane_bits - 1; \ |
| 447 lane_type lanes[kLaneCount]; \ | 460 lane_type lanes[kLaneCount]; \ |
| 448 for (int i = 0; i < kLaneCount; i++) { \ | 461 for (int i = 0; i < kLaneCount; i++) { \ |
| 449 int64_t shifted = static_cast<int64_t>(a->get_lane(i)) >> shift; \ | 462 int64_t shifted = static_cast<int64_t>(a->get_lane(i)) >> shift; \ |
| 450 lanes[i] = static_cast<lane_type>(shifted); \ | 463 lanes[i] = static_cast<lane_type>(shifted); \ |
| 451 } \ | 464 } \ |
| 452 Handle<type> result = isolate->factory()->New##type(lanes); \ | 465 Handle<type> result = isolate->factory()->New##type(lanes); \ |
| 453 return *result; \ | 466 return *result; \ |
| 454 } | 467 } |
| 455 | 468 |
| 456 SIMD_INT_TYPES(SIMD_LSL_FUNCTION) | 469 SIMD_INT_TYPES(SIMD_LSL_FUNCTION) |
| (...skipping 320 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 777 FUNCTION(Uint8x16, uint8_t, 16, Int8x16, int8_t) | 790 FUNCTION(Uint8x16, uint8_t, 16, Int8x16, int8_t) |
| 778 | 791 |
| 779 #define SIMD_FROM_FUNCTION(type, lane_type, lane_count, from_type, from_ctype) \ | 792 #define SIMD_FROM_FUNCTION(type, lane_type, lane_count, from_type, from_ctype) \ |
| 780 RUNTIME_FUNCTION(Runtime_##type##From##from_type) { \ | 793 RUNTIME_FUNCTION(Runtime_##type##From##from_type) { \ |
| 781 static const int kLaneCount = lane_count; \ | 794 static const int kLaneCount = lane_count; \ |
| 782 HandleScope scope(isolate); \ | 795 HandleScope scope(isolate); \ |
| 783 DCHECK(args.length() == 1); \ | 796 DCHECK(args.length() == 1); \ |
| 784 CONVERT_SIMD_ARG_HANDLE_THROW(from_type, a, 0); \ | 797 CONVERT_SIMD_ARG_HANDLE_THROW(from_type, a, 0); \ |
| 785 lane_type lanes[kLaneCount]; \ | 798 lane_type lanes[kLaneCount]; \ |
| 786 for (int i = 0; i < kLaneCount; i++) { \ | 799 for (int i = 0; i < kLaneCount; i++) { \ |
| 787 from_ctype a_value = a->get_lane(i); \ | 800 from_ctype a_value = std::trunc(a->get_lane(i)); \ |
|
bbudge
2016/05/19 14:14:44
Can you move std::trunc into the appropriate CanCa
gdeepti
2016/05/20 09:30:40
Done.
| |
| 788 if (a_value != a_value) a_value = 0; \ | 801 if (a_value != a_value || !CanCast<lane_type>(a_value)) { \ |
| 789 RUNTIME_ASSERT(CanCast<lane_type>(a_value)); \ | 802 THROW_NEW_ERROR_RETURN_FAILURE( \ |
| 803 isolate, NewRangeError(MessageTemplate::kInvalidSimdLaneValue)); \ | |
| 804 } \ | |
| 790 lanes[i] = static_cast<lane_type>(a_value); \ | 805 lanes[i] = static_cast<lane_type>(a_value); \ |
| 791 } \ | 806 } \ |
| 792 Handle<type> result = isolate->factory()->New##type(lanes); \ | 807 Handle<type> result = isolate->factory()->New##type(lanes); \ |
| 793 return *result; \ | 808 return *result; \ |
| 794 } | 809 } |
| 795 | 810 |
| 796 SIMD_FROM_TYPES(SIMD_FROM_FUNCTION) | 811 SIMD_FROM_TYPES(SIMD_FROM_FUNCTION) |
| 797 | 812 |
| 798 #define SIMD_FROM_BITS_TYPES(FUNCTION) \ | 813 #define SIMD_FROM_BITS_TYPES(FUNCTION) \ |
| 799 FUNCTION(Float32x4, float, 4, Int32x4) \ | 814 FUNCTION(Float32x4, float, 4, Int32x4) \ |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 856 | 871 |
| 857 //------------------------------------------------------------------- | 872 //------------------------------------------------------------------- |
| 858 | 873 |
| 859 // Load and Store functions. | 874 // Load and Store functions. |
| 860 | 875 |
| 861 #define SIMD_LOADN_STOREN_TYPES(FUNCTION) \ | 876 #define SIMD_LOADN_STOREN_TYPES(FUNCTION) \ |
| 862 FUNCTION(Float32x4, float, 4) \ | 877 FUNCTION(Float32x4, float, 4) \ |
| 863 FUNCTION(Int32x4, int32_t, 4) \ | 878 FUNCTION(Int32x4, int32_t, 4) \ |
| 864 FUNCTION(Uint32x4, uint32_t, 4) | 879 FUNCTION(Uint32x4, uint32_t, 4) |
| 865 | 880 |
| 881 #define SIMD_COERCE_INDEX(name, i) \ | |
| 882 Handle<Object> length_object, number_object; \ | |
| 883 ASSIGN_RETURN_FAILURE_ON_EXCEPTION( \ | |
| 884 isolate, length_object, Object::ToLength(isolate, args.at<Object>(i))); \ | |
| 885 ASSIGN_RETURN_FAILURE_ON_EXCEPTION(isolate, number_object, \ | |
| 886 Object::ToNumber(args.at<Object>(i))); \ | |
| 887 if (number_object->Number() != length_object->Number()) { \ | |
| 888 THROW_NEW_ERROR_RETURN_FAILURE( \ | |
| 889 isolate, NewTypeError(MessageTemplate::kInvalidSimdIndex)); \ | |
| 890 } \ | |
| 891 int32_t name = number_object->Number(); | |
| 866 | 892 |
| 867 // Common Load and Store Functions | 893 // Common Load and Store Functions |
| 868 | 894 |
| 869 #define SIMD_LOAD(type, lane_type, lane_count, count, result) \ | 895 #define SIMD_LOAD(type, lane_type, lane_count, count, result) \ |
| 870 static const int kLaneCount = lane_count; \ | 896 static const int kLaneCount = lane_count; \ |
| 871 DCHECK(args.length() == 2); \ | 897 DCHECK(args.length() == 2); \ |
| 872 CONVERT_SIMD_ARG_HANDLE_THROW(JSTypedArray, tarray, 0); \ | 898 CONVERT_SIMD_ARG_HANDLE_THROW(JSTypedArray, tarray, 0); \ |
| 873 CONVERT_INT32_ARG_CHECKED(index, 1) \ | 899 SIMD_COERCE_INDEX(index, 1); \ |
| 874 size_t bpe = tarray->element_size(); \ | 900 size_t bpe = tarray->element_size(); \ |
| 875 uint32_t bytes = count * sizeof(lane_type); \ | 901 uint32_t bytes = count * sizeof(lane_type); \ |
| 876 size_t byte_length = NumberToSize(isolate, tarray->byte_length()); \ | 902 size_t byte_length = NumberToSize(isolate, tarray->byte_length()); \ |
| 877 RUNTIME_ASSERT(index >= 0 && index * bpe + bytes <= byte_length); \ | 903 if (index < 0 || index * bpe + bytes > byte_length) { \ |
| 904 THROW_NEW_ERROR_RETURN_FAILURE( \ | |
| 905 isolate, NewRangeError(MessageTemplate::kInvalidSimdIndex)); \ | |
| 906 } \ | |
| 878 size_t tarray_offset = NumberToSize(isolate, tarray->byte_offset()); \ | 907 size_t tarray_offset = NumberToSize(isolate, tarray->byte_offset()); \ |
| 879 uint8_t* tarray_base = \ | 908 uint8_t* tarray_base = \ |
| 880 static_cast<uint8_t*>(tarray->GetBuffer()->backing_store()) + \ | 909 static_cast<uint8_t*>(tarray->GetBuffer()->backing_store()) + \ |
| 881 tarray_offset; \ | 910 tarray_offset; \ |
| 882 lane_type lanes[kLaneCount] = {0}; \ | 911 lane_type lanes[kLaneCount] = {0}; \ |
| 883 memcpy(lanes, tarray_base + index * bpe, bytes); \ | 912 memcpy(lanes, tarray_base + index * bpe, bytes); \ |
| 884 Handle<type> result = isolate->factory()->New##type(lanes); | 913 Handle<type> result = isolate->factory()->New##type(lanes); |
| 885 | 914 |
| 886 | |
| 887 #define SIMD_STORE(type, lane_type, lane_count, count, a) \ | 915 #define SIMD_STORE(type, lane_type, lane_count, count, a) \ |
| 888 static const int kLaneCount = lane_count; \ | 916 static const int kLaneCount = lane_count; \ |
| 889 DCHECK(args.length() == 3); \ | 917 DCHECK(args.length() == 3); \ |
| 890 CONVERT_SIMD_ARG_HANDLE_THROW(JSTypedArray, tarray, 0); \ | 918 CONVERT_SIMD_ARG_HANDLE_THROW(JSTypedArray, tarray, 0); \ |
| 891 CONVERT_SIMD_ARG_HANDLE_THROW(type, a, 2); \ | 919 CONVERT_SIMD_ARG_HANDLE_THROW(type, a, 2); \ |
| 892 CONVERT_INT32_ARG_CHECKED(index, 1) \ | 920 SIMD_COERCE_INDEX(index, 1); \ |
| 893 size_t bpe = tarray->element_size(); \ | 921 size_t bpe = tarray->element_size(); \ |
| 894 uint32_t bytes = count * sizeof(lane_type); \ | 922 uint32_t bytes = count * sizeof(lane_type); \ |
| 895 size_t byte_length = NumberToSize(isolate, tarray->byte_length()); \ | 923 size_t byte_length = NumberToSize(isolate, tarray->byte_length()); \ |
| 896 RUNTIME_ASSERT(index >= 0 && index * bpe + bytes <= byte_length); \ | 924 if (index < 0 || byte_length < index * bpe + bytes) { \ |
| 925 THROW_NEW_ERROR_RETURN_FAILURE( \ | |
| 926 isolate, NewRangeError(MessageTemplate::kInvalidSimdIndex)); \ | |
| 927 } \ | |
| 897 size_t tarray_offset = NumberToSize(isolate, tarray->byte_offset()); \ | 928 size_t tarray_offset = NumberToSize(isolate, tarray->byte_offset()); \ |
| 898 uint8_t* tarray_base = \ | 929 uint8_t* tarray_base = \ |
| 899 static_cast<uint8_t*>(tarray->GetBuffer()->backing_store()) + \ | 930 static_cast<uint8_t*>(tarray->GetBuffer()->backing_store()) + \ |
| 900 tarray_offset; \ | 931 tarray_offset; \ |
| 901 lane_type lanes[kLaneCount]; \ | 932 lane_type lanes[kLaneCount]; \ |
| 902 for (int i = 0; i < kLaneCount; i++) { \ | 933 for (int i = 0; i < kLaneCount; i++) { \ |
| 903 lanes[i] = a->get_lane(i); \ | 934 lanes[i] = a->get_lane(i); \ |
| 904 } \ | 935 } \ |
| 905 memcpy(tarray_base + index * bpe, lanes, bytes); | 936 memcpy(tarray_base + index * bpe, lanes, bytes); |
| 906 | 937 |
| 907 | |
| 908 #define SIMD_LOAD_FUNCTION(type, lane_type, lane_count) \ | 938 #define SIMD_LOAD_FUNCTION(type, lane_type, lane_count) \ |
| 909 RUNTIME_FUNCTION(Runtime_##type##Load) { \ | 939 RUNTIME_FUNCTION(Runtime_##type##Load) { \ |
| 910 HandleScope scope(isolate); \ | 940 HandleScope scope(isolate); \ |
| 911 SIMD_LOAD(type, lane_type, lane_count, lane_count, result); \ | 941 SIMD_LOAD(type, lane_type, lane_count, lane_count, result); \ |
| 912 return *result; \ | 942 return *result; \ |
| 913 } | 943 } |
| 914 | 944 |
| 915 | 945 |
| 916 #define SIMD_LOAD1_FUNCTION(type, lane_type, lane_count) \ | 946 #define SIMD_LOAD1_FUNCTION(type, lane_type, lane_count) \ |
| 917 RUNTIME_FUNCTION(Runtime_##type##Load1) { \ | 947 RUNTIME_FUNCTION(Runtime_##type##Load1) { \ |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 975 SIMD_LOADN_STOREN_TYPES(SIMD_LOAD3_FUNCTION) | 1005 SIMD_LOADN_STOREN_TYPES(SIMD_LOAD3_FUNCTION) |
| 976 SIMD_NUMERIC_TYPES(SIMD_STORE_FUNCTION) | 1006 SIMD_NUMERIC_TYPES(SIMD_STORE_FUNCTION) |
| 977 SIMD_LOADN_STOREN_TYPES(SIMD_STORE1_FUNCTION) | 1007 SIMD_LOADN_STOREN_TYPES(SIMD_STORE1_FUNCTION) |
| 978 SIMD_LOADN_STOREN_TYPES(SIMD_STORE2_FUNCTION) | 1008 SIMD_LOADN_STOREN_TYPES(SIMD_STORE2_FUNCTION) |
| 979 SIMD_LOADN_STOREN_TYPES(SIMD_STORE3_FUNCTION) | 1009 SIMD_LOADN_STOREN_TYPES(SIMD_STORE3_FUNCTION) |
| 980 | 1010 |
| 981 //------------------------------------------------------------------- | 1011 //------------------------------------------------------------------- |
| 982 | 1012 |
| 983 } // namespace internal | 1013 } // namespace internal |
| 984 } // namespace v8 | 1014 } // namespace v8 |
| OLD | NEW |