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/assembler.h" | 5 #include "src/assembler.h" |
6 #include "src/codegen.h" | 6 #include "src/codegen.h" |
7 #include "src/compiler/linkage.h" | 7 #include "src/compiler/linkage.h" |
8 #include "src/compiler/machine-type.h" | 8 #include "src/compiler/machine-type.h" |
9 #include "src/compiler/raw-machine-assembler.h" | 9 #include "src/compiler/raw-machine-assembler.h" |
10 | 10 |
(...skipping 347 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
358 int count_; | 358 int count_; |
359 int seed_; | 359 int seed_; |
360 CType input[kMaxParamCount]; | 360 CType input[kMaxParamCount]; |
361 CType output; | 361 CType output; |
362 }; | 362 }; |
363 | 363 |
364 | 364 |
365 template <> | 365 template <> |
366 void ArgsBuffer<int32_t>::Mutate() { | 366 void ArgsBuffer<int32_t>::Mutate() { |
367 uint32_t base = 1111111111u * seed_; | 367 uint32_t base = 1111111111u * seed_; |
368 for (int j = 0; j < count_; j++) { | 368 for (int j = 0; j < count_ && j < kMaxParamCount; j++) { |
369 input[j] = static_cast<int32_t>(256 + base + j + seed_ * 13); | 369 input[j] = static_cast<int32_t>(256 + base + j + seed_ * 13); |
370 } | 370 } |
371 output = -1; | 371 output = -1; |
372 seed_++; | 372 seed_++; |
373 } | 373 } |
374 | 374 |
375 | 375 |
376 template <> | 376 template <> |
377 void ArgsBuffer<int64_t>::Mutate() { | 377 void ArgsBuffer<int64_t>::Mutate() { |
378 uint64_t base = 11111111111111111ull * seed_; | 378 uint64_t base = 11111111111111111ull * seed_; |
379 for (int j = 0; j < count_; j++) { | 379 for (int j = 0; j < count_ && j < kMaxParamCount; j++) { |
380 input[j] = static_cast<int64_t>(256 + base + j + seed_ * 13); | 380 input[j] = static_cast<int64_t>(256 + base + j + seed_ * 13); |
381 } | 381 } |
382 output = -1; | 382 output = -1; |
383 seed_++; | 383 seed_++; |
384 } | 384 } |
385 | 385 |
386 | 386 |
387 template <> | 387 template <> |
388 void ArgsBuffer<float32>::Mutate() { | 388 void ArgsBuffer<float32>::Mutate() { |
389 float64 base = -33.25 * seed_; | 389 float64 base = -33.25 * seed_; |
390 for (int j = 0; j < count_; j++) { | 390 for (int j = 0; j < count_ && j < kMaxParamCount; j++) { |
391 input[j] = 256 + base + j + seed_ * 13; | 391 input[j] = 256 + base + j + seed_ * 13; |
392 } | 392 } |
393 output = std::numeric_limits<float32>::quiet_NaN(); | 393 output = std::numeric_limits<float32>::quiet_NaN(); |
394 seed_++; | 394 seed_++; |
395 } | 395 } |
396 | 396 |
397 | 397 |
398 template <> | 398 template <> |
399 void ArgsBuffer<float64>::Mutate() { | 399 void ArgsBuffer<float64>::Mutate() { |
400 float64 base = -111.25 * seed_; | 400 float64 base = -111.25 * seed_; |
401 for (int j = 0; j < count_; j++) { | 401 for (int j = 0; j < count_ && j < kMaxParamCount; j++) { |
402 input[j] = 256 + base + j + seed_ * 13; | 402 input[j] = 256 + base + j + seed_ * 13; |
403 } | 403 } |
404 output = std::numeric_limits<float64>::quiet_NaN(); | 404 output = std::numeric_limits<float64>::quiet_NaN(); |
405 seed_++; | 405 seed_++; |
406 } | 406 } |
407 | 407 |
408 | 408 |
409 int ParamCount(CallDescriptor* desc) { | 409 int ParamCount(CallDescriptor* desc) { |
410 return static_cast<int>(desc->GetMachineSignature()->parameter_count()); | 410 return static_cast<int>(desc->GetMachineSignature()->parameter_count()); |
411 } | 411 } |
(...skipping 564 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
976 ArgsBuffer<float64>::Sig sig(2); | 976 ArgsBuffer<float64>::Sig sig(2); |
977 RegisterConfig config(params, rets); | 977 RegisterConfig config(params, rets); |
978 CallDescriptor* desc = config.Create(&zone, &sig); | 978 CallDescriptor* desc = config.Create(&zone, &sig); |
979 | 979 |
980 Run_Computation<float64>(desc, Build_Select_With_Call<float64, 0>, | 980 Run_Computation<float64>(desc, Build_Select_With_Call<float64, 0>, |
981 Compute_Select<float64, 0>, 1098); | 981 Compute_Select<float64, 0>, 1098); |
982 | 982 |
983 Run_Computation<float64>(desc, Build_Select_With_Call<float64, 1>, | 983 Run_Computation<float64>(desc, Build_Select_With_Call<float64, 1>, |
984 Compute_Select<float64, 1>, 1099); | 984 Compute_Select<float64, 1>, 1099); |
985 } | 985 } |
OLD | NEW |