4e6aa9767a
This CL fixes the behaviour of String.prototype.startsWith when undefined is passed as the search term. It also implements a small shorthand when the search term is empty (according to the spec). Bug: v8:11977 Change-Id: Iec2aa5f4301fcf444f20d5c1a80d3f634624d6f3 Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3035089 Commit-Queue: Maya Lekova <mslekova@chromium.org> Commit-Queue: Georg Neis <neis@chromium.org> Auto-Submit: Maya Lekova <mslekova@chromium.org> Reviewed-by: Georg Neis <neis@chromium.org> Cr-Commit-Position: refs/heads/master@{#75763}
15 lines
390 B
JavaScript
15 lines
390 B
JavaScript
// Copyright 2021 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
|
|
|
|
function f(str) {
|
|
return str.startsWith();
|
|
}
|
|
|
|
%PrepareFunctionForOptimization(f);
|
|
assertEquals(f('undefined'), true);
|
|
%OptimizeFunctionOnNextCall(f);
|
|
assertEquals(f('undefined'), true);
|