Skip to content

Commit

Permalink
[wasm][fuzzer] Support functions returning i64
Browse files Browse the repository at this point in the history
Those functions will return a BigInt, which we need to convert to int to
match the value returned by the interpreter.

[email protected]

Bug: chromium:1127717
Change-Id: I328660ab73776de2bd90b19d18e46663efe6b6cb
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2412177
Reviewed-by: Andreas Haas <[email protected]>
Commit-Queue: Clemens Backes <[email protected]>
Cr-Commit-Position: refs/heads/master@{#69922}
  • Loading branch information
backes authored and Commit Bot committed Sep 15, 2020
1 parent a97af0b commit a53c1e4
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/objects/bigint.h
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,7 @@ class BigInt : public BigIntBase {
static MaybeHandle<BigInt> FromWords64(Isolate* isolate, int sign_bit,
int words64_count,
const uint64_t* words);
int64_t AsInt64(bool* lossless = nullptr);
V8_EXPORT_PRIVATE int64_t AsInt64(bool* lossless = nullptr);
uint64_t AsUint64(bool* lossless = nullptr);
int Words64Count();
void ToWordsArray64(int* sign_bit, int* words64_count, uint64_t* words);
Expand Down
3 changes: 3 additions & 0 deletions test/common/wasm/wasm-module-runner.cc
Original file line number Diff line number Diff line change
Expand Up @@ -231,6 +231,9 @@ int32_t CallWasmFunctionForTesting(Isolate* isolate,
if (result->IsHeapNumber()) {
return static_cast<int32_t>(HeapNumber::cast(*result).value());
}
if (result->IsBigInt()) {
return static_cast<int32_t>(BigInt::cast(*result).AsInt64());
}
return -1;
}

Expand Down
Binary file added test/fuzzer/wasm/regress-1127717.wasm
Binary file not shown.

0 comments on commit a53c1e4

Please sign in to comment.