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

Side by Side Diff: src/runtime/runtime-simd.cc

Issue 2225013002: Remove unused isolate parameter from NumberToSize and TryNumberToSize (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 4 years, 4 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
« no previous file with comments | « src/runtime/runtime-futex.cc ('k') | src/runtime/runtime-strings.cc » ('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 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 876 matching lines...) Expand 10 before | Expand all | Expand 10 after
887 ASSIGN_RETURN_FAILURE_ON_EXCEPTION(isolate, number_object, \ 887 ASSIGN_RETURN_FAILURE_ON_EXCEPTION(isolate, number_object, \
888 Object::ToNumber(args.at<Object>(i))); \ 888 Object::ToNumber(args.at<Object>(i))); \
889 if (number_object->Number() != length_object->Number()) { \ 889 if (number_object->Number() != length_object->Number()) { \
890 THROW_NEW_ERROR_RETURN_FAILURE( \ 890 THROW_NEW_ERROR_RETURN_FAILURE( \
891 isolate, NewTypeError(MessageTemplate::kInvalidSimdIndex)); \ 891 isolate, NewTypeError(MessageTemplate::kInvalidSimdIndex)); \
892 } \ 892 } \
893 int32_t name = number_object->Number(); 893 int32_t name = number_object->Number();
894 894
895 // Common Load and Store Functions 895 // Common Load and Store Functions
896 896
897 #define SIMD_LOAD(type, lane_type, lane_count, count, result) \ 897 #define SIMD_LOAD(type, lane_type, lane_count, count, result) \
898 static const int kLaneCount = lane_count; \ 898 static const int kLaneCount = lane_count; \
899 DCHECK(args.length() == 2); \ 899 DCHECK(args.length() == 2); \
900 CONVERT_SIMD_ARG_HANDLE_THROW(JSTypedArray, tarray, 0); \ 900 CONVERT_SIMD_ARG_HANDLE_THROW(JSTypedArray, tarray, 0); \
901 SIMD_COERCE_INDEX(index, 1); \ 901 SIMD_COERCE_INDEX(index, 1); \
902 size_t bpe = tarray->element_size(); \ 902 size_t bpe = tarray->element_size(); \
903 uint32_t bytes = count * sizeof(lane_type); \ 903 uint32_t bytes = count * sizeof(lane_type); \
904 size_t byte_length = NumberToSize(isolate, tarray->byte_length()); \ 904 size_t byte_length = NumberToSize(tarray->byte_length()); \
905 if (index < 0 || index * bpe + bytes > byte_length) { \ 905 if (index < 0 || index * bpe + bytes > byte_length) { \
906 THROW_NEW_ERROR_RETURN_FAILURE( \ 906 THROW_NEW_ERROR_RETURN_FAILURE( \
907 isolate, NewRangeError(MessageTemplate::kInvalidSimdIndex)); \ 907 isolate, NewRangeError(MessageTemplate::kInvalidSimdIndex)); \
908 } \ 908 } \
909 size_t tarray_offset = NumberToSize(isolate, tarray->byte_offset()); \ 909 size_t tarray_offset = NumberToSize(tarray->byte_offset()); \
910 uint8_t* tarray_base = \ 910 uint8_t* tarray_base = \
911 static_cast<uint8_t*>(tarray->GetBuffer()->backing_store()) + \ 911 static_cast<uint8_t*>(tarray->GetBuffer()->backing_store()) + \
912 tarray_offset; \ 912 tarray_offset; \
913 lane_type lanes[kLaneCount] = {0}; \ 913 lane_type lanes[kLaneCount] = {0}; \
914 memcpy(lanes, tarray_base + index * bpe, bytes); \ 914 memcpy(lanes, tarray_base + index * bpe, bytes); \
915 Handle<type> result = isolate->factory()->New##type(lanes); 915 Handle<type> result = isolate->factory()->New##type(lanes);
916 916
917 #define SIMD_STORE(type, lane_type, lane_count, count, a) \ 917 #define SIMD_STORE(type, lane_type, lane_count, count, a) \
918 static const int kLaneCount = lane_count; \ 918 static const int kLaneCount = lane_count; \
919 DCHECK(args.length() == 3); \ 919 DCHECK(args.length() == 3); \
920 CONVERT_SIMD_ARG_HANDLE_THROW(JSTypedArray, tarray, 0); \ 920 CONVERT_SIMD_ARG_HANDLE_THROW(JSTypedArray, tarray, 0); \
921 CONVERT_SIMD_ARG_HANDLE_THROW(type, a, 2); \ 921 CONVERT_SIMD_ARG_HANDLE_THROW(type, a, 2); \
922 SIMD_COERCE_INDEX(index, 1); \ 922 SIMD_COERCE_INDEX(index, 1); \
923 size_t bpe = tarray->element_size(); \ 923 size_t bpe = tarray->element_size(); \
924 uint32_t bytes = count * sizeof(lane_type); \ 924 uint32_t bytes = count * sizeof(lane_type); \
925 size_t byte_length = NumberToSize(isolate, tarray->byte_length()); \ 925 size_t byte_length = NumberToSize(tarray->byte_length()); \
926 if (index < 0 || byte_length < index * bpe + bytes) { \ 926 if (index < 0 || byte_length < index * bpe + bytes) { \
927 THROW_NEW_ERROR_RETURN_FAILURE( \ 927 THROW_NEW_ERROR_RETURN_FAILURE( \
928 isolate, NewRangeError(MessageTemplate::kInvalidSimdIndex)); \ 928 isolate, NewRangeError(MessageTemplate::kInvalidSimdIndex)); \
929 } \ 929 } \
930 size_t tarray_offset = NumberToSize(isolate, tarray->byte_offset()); \ 930 size_t tarray_offset = NumberToSize(tarray->byte_offset()); \
931 uint8_t* tarray_base = \ 931 uint8_t* tarray_base = \
932 static_cast<uint8_t*>(tarray->GetBuffer()->backing_store()) + \ 932 static_cast<uint8_t*>(tarray->GetBuffer()->backing_store()) + \
933 tarray_offset; \ 933 tarray_offset; \
934 lane_type lanes[kLaneCount]; \ 934 lane_type lanes[kLaneCount]; \
935 for (int i = 0; i < kLaneCount; i++) { \ 935 for (int i = 0; i < kLaneCount; i++) { \
936 lanes[i] = a->get_lane(i); \ 936 lanes[i] = a->get_lane(i); \
937 } \ 937 } \
938 memcpy(tarray_base + index * bpe, lanes, bytes); 938 memcpy(tarray_base + index * bpe, lanes, bytes);
939 939
940 #define SIMD_LOAD_FUNCTION(type, lane_type, lane_count) \ 940 #define SIMD_LOAD_FUNCTION(type, lane_type, lane_count) \
941 RUNTIME_FUNCTION(Runtime_##type##Load) { \ 941 RUNTIME_FUNCTION(Runtime_##type##Load) { \
942 HandleScope scope(isolate); \ 942 HandleScope scope(isolate); \
943 SIMD_LOAD(type, lane_type, lane_count, lane_count, result); \ 943 SIMD_LOAD(type, lane_type, lane_count, lane_count, result); \
944 return *result; \ 944 return *result; \
945 } 945 }
946 946
947 947
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
1007 SIMD_LOADN_STOREN_TYPES(SIMD_LOAD3_FUNCTION) 1007 SIMD_LOADN_STOREN_TYPES(SIMD_LOAD3_FUNCTION)
1008 SIMD_NUMERIC_TYPES(SIMD_STORE_FUNCTION) 1008 SIMD_NUMERIC_TYPES(SIMD_STORE_FUNCTION)
1009 SIMD_LOADN_STOREN_TYPES(SIMD_STORE1_FUNCTION) 1009 SIMD_LOADN_STOREN_TYPES(SIMD_STORE1_FUNCTION)
1010 SIMD_LOADN_STOREN_TYPES(SIMD_STORE2_FUNCTION) 1010 SIMD_LOADN_STOREN_TYPES(SIMD_STORE2_FUNCTION)
1011 SIMD_LOADN_STOREN_TYPES(SIMD_STORE3_FUNCTION) 1011 SIMD_LOADN_STOREN_TYPES(SIMD_STORE3_FUNCTION)
1012 1012
1013 //------------------------------------------------------------------- 1013 //-------------------------------------------------------------------
1014 1014
1015 } // namespace internal 1015 } // namespace internal
1016 } // namespace v8 1016 } // namespace v8
OLDNEW
« no previous file with comments | « src/runtime/runtime-futex.cc ('k') | src/runtime/runtime-strings.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698