Commit 0c0847be authored by Jakob Kummerow's avatar Jakob Kummerow Committed by Commit Bot

[bigint] Fix Object::VerifyApiCallResultType

Add BigInt to the list of allowed result types.

Bug: v8:6791, chromium:819871
Change-Id: Ib636859da07b38c462ce7017d720e5370ba618d6
Reviewed-on: https://chromium-review.googlesource.com/957422Reviewed-by: 's avatarAdam Klein <adamk@chromium.org>
Commit-Queue: Jakob Kummerow <jkummerow@chromium.org>
Cr-Commit-Position: refs/heads/master@{#51859}
parent deb150db
...@@ -1661,8 +1661,8 @@ void Object::VerifyApiCallResultType() { ...@@ -1661,8 +1661,8 @@ void Object::VerifyApiCallResultType() {
DCHECK(IsHeapObject()); DCHECK(IsHeapObject());
Isolate* isolate = HeapObject::cast(this)->GetIsolate(); Isolate* isolate = HeapObject::cast(this)->GetIsolate();
if (!(IsString() || IsSymbol() || IsJSReceiver() || IsHeapNumber() || if (!(IsString() || IsSymbol() || IsJSReceiver() || IsHeapNumber() ||
IsUndefined(isolate) || IsTrue(isolate) || IsFalse(isolate) || IsBigInt() || IsUndefined(isolate) || IsTrue(isolate) ||
IsNull(isolate))) { IsFalse(isolate) || IsNull(isolate))) {
FATAL("API call returned invalid object"); FATAL("API call returned invalid object");
} }
#endif // DEBUG #endif // DEBUG
......
...@@ -33,3 +33,9 @@ var max64 = kMaxInt - 64n - 2n; ...@@ -33,3 +33,9 @@ var max64 = kMaxInt - 64n - 2n;
var max32 = kMaxInt - 32n - 2n; var max32 = kMaxInt - 32n - 2n;
// Platform independence trick: at least one of the two operations will throw! // Platform independence trick: at least one of the two operations will throw!
assertThrows(() => { var a = 2n ** max32; var b = 2n ** max64; }, RangeError); assertThrows(() => { var a = 2n ** max32; var b = 2n ** max64; }, RangeError);
(function() {
function Constructor() { }
Constructor.prototype = 5n;
assertThrows(() => ({}) instanceof Constructor, TypeError);
})();
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment