diff options
author | Myles Borins <mylesborins@google.com> | 2018-04-10 21:39:51 -0400 |
---|---|---|
committer | Myles Borins <mylesborins@google.com> | 2018-04-11 13:22:42 -0400 |
commit | 12a1b9b8049462e47181a298120243dc83e81c55 (patch) | |
tree | 8605276308c8b4e3597516961266bae1af57557a /deps/v8/test/mjsunit/optimized-reduceright.js | |
parent | 78cd8263354705b767ef8c6a651740efe4931ba0 (diff) | |
download | android-node-v8-12a1b9b8049462e47181a298120243dc83e81c55.tar.gz android-node-v8-12a1b9b8049462e47181a298120243dc83e81c55.tar.bz2 android-node-v8-12a1b9b8049462e47181a298120243dc83e81c55.zip |
deps: update V8 to 6.6.346.23
PR-URL: https://github.com/nodejs/node/pull/19201
Reviewed-By: Ali Ijaz Sheikh <ofrobots@google.com>
Reviewed-By: Myles Borins <myles.borins@gmail.com>
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Diffstat (limited to 'deps/v8/test/mjsunit/optimized-reduceright.js')
-rw-r--r-- | deps/v8/test/mjsunit/optimized-reduceright.js | 49 |
1 files changed, 49 insertions, 0 deletions
diff --git a/deps/v8/test/mjsunit/optimized-reduceright.js b/deps/v8/test/mjsunit/optimized-reduceright.js new file mode 100644 index 0000000000..2689a39de5 --- /dev/null +++ b/deps/v8/test/mjsunit/optimized-reduceright.js @@ -0,0 +1,49 @@ +// Copyright 2018 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +// Flags: --allow-natives-syntax --expose-gc --turbo-inline-array-builtins +// Flags: --opt --no-always-opt + +// Make sure we gracefully handle the case of an empty array in +// optimized code. +(function() { + var nothingThere = function(only_holes) { + var a = [1,2,,3]; // holey smi array. + if (only_holes) { + a = [,,,]; // also a holey smi array. + } + return a.reduceRight((r,v,i,o)=>r+v); + } + nothingThere(); + nothingThere(); + %OptimizeFunctionOnNextCall(nothingThere); + assertThrows(() => nothingThere(true)); +})(); + +// An error generated inside the callback includes reduce in it's +// stack trace. +(function() { + var re = /Array\.reduceRight/; + var alwaysThrows = function() { + var b = [,,,]; + var result = 0; + var callback = function(r,v,i,o) { + return r + v; + }; + b.reduceRight(callback); + } + try { + alwaysThrows(); + } catch (e) { + assertTrue(re.exec(e.stack) !== null); + } + try { alwaysThrows(); } catch (e) {} + try { alwaysThrows(); } catch (e) {} + %OptimizeFunctionOnNextCall(alwaysThrows); + try { + alwaysThrows(); + } catch (e) { + assertTrue(re.exec(e.stack) !== null); + } +})(); |