952c097679
This also includes ports of Array.p.toString and Array.p.toLocaleString. Many parts of the old JS implementation are preserved, because TypedArray.p.join still relies on it. These will be removed once TypedArray.p.join is ported to Torque. To simplify implementation, special handling of extremely sparse arrays has been removed. Performance improvements vary by array size, elements, and sparse-ness. Some quick numbers and graphs are here: https://docs.google.com/spreadsheets/d/125VLmRMudk8XaomLCsZQ1ewc94WCqht-8GQwU3s9BW8/edit#gid=2087673710 Cq-Include-Trybots: luci.chromium.try:linux_chromium_headless_rel;luci.v8.try:v8_linux_noi18n_rel_ng;master.tryserver.blink:linux_trusty_blink_rel Change-Id: Ia4069a068403ce36676c37401d349aefc976b045 Reviewed-on: https://chromium-review.googlesource.com/c/1196693 Commit-Queue: Peter Wong <peter.wm.wong@gmail.com> Reviewed-by: Jakob Gruber <jgruber@chromium.org> Reviewed-by: Tobias Tebbi <tebbi@chromium.org> Cr-Commit-Position: refs/heads/master@{#56699}
30 lines
695 B
JavaScript
30 lines
695 B
JavaScript
// 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.
|
|
|
|
(function Throws() {
|
|
function TestError() {}
|
|
|
|
let callCount = 0;
|
|
const a = {
|
|
0: 1,
|
|
1: 2,
|
|
get length() {
|
|
callCount++;
|
|
throw new TestError();
|
|
}
|
|
};
|
|
assertThrows(() => Array.prototype.join.call(a), TestError);
|
|
assertSame(1, callCount);
|
|
|
|
// Verifies cycle detection still works properly after thrown error.
|
|
Object.defineProperty(a, 'length', {
|
|
get() {
|
|
callCount++;
|
|
return 2;
|
|
}
|
|
});
|
|
assertSame('1,2', Array.prototype.join.call(a));
|
|
assertSame(2, callCount);
|
|
})();
|