From 80efc9d2fbff2a8d0a6e2c0c6cbc0fa7f9a14119 Mon Sep 17 00:00:00 2001 From: titzer Date: Mon, 3 Aug 2015 07:27:52 -0700 Subject: [PATCH] Fix presubmit errors in runtime-simd.cc. R=mstarzinger@chromium.org BUG= NOTREECHECKS=true Review URL: https://codereview.chromium.org/1263363002 Cr-Commit-Position: refs/heads/master@{#29977} --- src/runtime/runtime-simd.cc | 28 ++++++++++++++++------------ 1 file changed, 16 insertions(+), 12 deletions(-) diff --git a/src/runtime/runtime-simd.cc b/src/runtime/runtime-simd.cc index 90f1904..ffb29c0 100644 --- a/src/runtime/runtime-simd.cc +++ b/src/runtime/runtime-simd.cc @@ -19,10 +19,11 @@ #define SIMD_CREATE_NUMERIC_FUNCTION(type, lane_type, lane_count) \ RUNTIME_FUNCTION(Runtime_Create##type) { \ + static const int kLaneCount = lane_count; \ HandleScope scope(isolate); \ - DCHECK(args.length() == lane_count); \ - lane_type lanes[lane_count]; \ - for (int i = 0; i < lane_count; i++) { \ + DCHECK(args.length() == kLaneCount); \ + lane_type lanes[kLaneCount]; \ + for (int i = 0; i < kLaneCount; i++) { \ CONVERT_NUMBER_ARG_HANDLE_CHECKED(number, i); \ lanes[i] = ConvertNumber(number->Number()); \ } \ @@ -31,10 +32,11 @@ #define SIMD_CREATE_BOOLEAN_FUNCTION(type, lane_count) \ RUNTIME_FUNCTION(Runtime_Create##type) { \ + static const int kLaneCount = lane_count; \ HandleScope scope(isolate); \ - DCHECK(args.length() == lane_count); \ - bool lanes[lane_count]; \ - for (int i = 0; i < lane_count; i++) { \ + DCHECK(args.length() == kLaneCount); \ + bool lanes[kLaneCount]; \ + for (int i = 0; i < kLaneCount; i++) { \ lanes[i] = args[i]->BooleanValue(); \ } \ return *isolate->factory()->New##type(lanes); \ @@ -58,13 +60,14 @@ #define SIMD_REPLACE_NUMERIC_LANE_FUNCTION(type, lane_type, lane_count) \ RUNTIME_FUNCTION(Runtime_##type##ReplaceLane) { \ + static const int kLaneCount = lane_count; \ HandleScope scope(isolate); \ DCHECK(args.length() == 3); \ CONVERT_ARG_HANDLE_CHECKED(type, simd, 0); \ - CONVERT_SIMD_LANE_ARG_CHECKED(lane, 1, lane_count); \ + CONVERT_SIMD_LANE_ARG_CHECKED(lane, 1, kLaneCount); \ CONVERT_NUMBER_ARG_HANDLE_CHECKED(number, 2); \ - lane_type lanes[lane_count]; \ - for (int i = 0; i < lane_count; i++) { \ + lane_type lanes[kLaneCount]; \ + for (int i = 0; i < kLaneCount; i++) { \ lanes[i] = simd->get_lane(i); \ } \ lanes[lane] = ConvertNumber(number->Number()); \ @@ -74,12 +77,13 @@ #define SIMD_REPLACE_BOOLEAN_LANE_FUNCTION(type, lane_count) \ RUNTIME_FUNCTION(Runtime_##type##ReplaceLane) { \ + static const int kLaneCount = lane_count; \ HandleScope scope(isolate); \ DCHECK(args.length() == 3); \ CONVERT_ARG_HANDLE_CHECKED(type, simd, 0); \ - CONVERT_SIMD_LANE_ARG_CHECKED(lane, 1, lane_count); \ - bool lanes[lane_count]; \ - for (int i = 0; i < lane_count; i++) { \ + CONVERT_SIMD_LANE_ARG_CHECKED(lane, 1, kLaneCount); \ + bool lanes[kLaneCount]; \ + for (int i = 0; i < kLaneCount; i++) { \ lanes[i] = simd->get_lane(i); \ } \ lanes[lane] = args[2]->BooleanValue(); \ -- 2.7.4