Commit 7a75d582 authored by Vlad Tsyrklevich's avatar Vlad Tsyrklevich Committed by Commit Bot

Refactor unreliable Proxy tests

While working on crrev.com/c/1141045 I caused 3 assertThrows() tests
under the 'Deeply nested target' tests to fail. The tests for
defineProperty, isExtensible, and preventExtensions began to fail under
a couple build configurations because my change modified the stack check
code such that it no longer inhibited tail call optimization. Under some
build configurations the methods responsible for causing a stack oveflow
for those 3 methods were tail call optimized and the tests no longer
threw an exception.

Other built-in implementations of proxy handler methods could also fail
in the future due to refactors moving variables off the stack. Change
the test to ensure v8 doesn't crash but don't rely on stack overflow
exceptions being thrown for the 'deeply nested target' test.

BUG=chromium:864705

Change-Id: Iefeaa1d5402986c1831d0f259f83025452756387
Reviewed-on: https://chromium-review.googlesource.com/1159356Reviewed-by: 's avatarGeorg Neis <neis@chromium.org>
Commit-Queue: Georg Neis <neis@chromium.org>
Cr-Commit-Position: refs/heads/master@{#54878}
parent 928e7b29
...@@ -10,22 +10,22 @@ for (let i = 0; i < 100000; i++) { ...@@ -10,22 +10,22 @@ for (let i = 0; i < 100000; i++) {
proxy = new Proxy(proxy, {}); proxy = new Proxy(proxy, {});
} }
// We get a stack overflow in all cases except for Reflect.apply, which here // Ensure these nested calls don't segfault. They may not all throw exceptions
// happens to run in constant space: Call jumps into CallProxy and CallProxy // depending on whether the compiler is able to perform tail call optimization
// jumps into the next Call. // on the affected routines.
assertDoesNotThrow(() => Reflect.apply(proxy, {}, [])); try { Reflect.apply(proxy, {}, []) } catch(_) {}
assertThrows(() => Reflect.construct(proxy, []), RangeError); try { Reflect.construct(proxy, []) } catch(_) {}
assertThrows(() => Reflect.defineProperty(proxy, "x", {}), RangeError); try { Reflect.defineProperty(proxy, "x", {}) } catch(_) {}
assertThrows(() => Reflect.deleteProperty(proxy, "x"), RangeError); try { Reflect.deleteProperty(proxy, "x") } catch(_) {}
assertThrows(() => Reflect.get(proxy, "x"), RangeError); try { Reflect.get(proxy, "x") } catch(_) {}
assertThrows(() => Reflect.getOwnPropertyDescriptor(proxy, "x"), RangeError); try { Reflect.getOwnPropertyDescriptor(proxy, "x") } catch(_) {}
assertThrows(() => Reflect.getPrototypeOf(proxy), RangeError); try { Reflect.getPrototypeOf(proxy) } catch(_) {}
assertThrows(() => Reflect.has(proxy, "x"), RangeError); try { Reflect.has(proxy, "x") } catch(_) {}
assertThrows(() => Reflect.isExtensible(proxy), RangeError); try { Reflect.isExtensible(proxy) } catch(_) {}
assertThrows(() => Reflect.ownKeys(proxy), RangeError); try { Reflect.ownKeys(proxy) } catch(_) {}
assertThrows(() => Reflect.preventExtensions(proxy), RangeError); try { Reflect.preventExtensions(proxy) } catch(_) {}
assertThrows(() => Reflect.setPrototypeOf(proxy, {}), RangeError); try { Reflect.setPrototypeOf(proxy, {}) } catch(_) {}
assertThrows(() => Reflect.set(proxy, "x", {}), RangeError); try { Reflect.set(proxy, "x", {}) } catch(_) {}
// Recursive handler. // Recursive handler.
......
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