f8083d1425
.. which can return Undefined if reading out of bounds, so the return type is ObjectRef and not StringRef (if we had torque-like union types it'd be StringRef|OddballRef). Also change the function name to GetCharAsStringOrUndefined. Bug: v8:7790,chromium:1181246 Change-Id: Icf9e8fd03d11c3936e87a509b9117e547972d283 Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2712965 Reviewed-by: Georg Neis <neis@chromium.org> Commit-Queue: Jakob Gruber <jgruber@chromium.org> Cr-Commit-Position: refs/heads/master@{#72952}
20 lines
491 B
JavaScript
20 lines
491 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
|
|
|
|
Object.defineProperty(String.prototype, "0", { __v_1: 1});
|
|
var __f_2 = function() {
|
|
function __f_2() {
|
|
''[0];
|
|
};
|
|
%PrepareFunctionForOptimization(__f_2);
|
|
return __f_2;
|
|
}();
|
|
%PrepareFunctionForOptimization(__f_2);
|
|
__f_2();
|
|
__f_2();
|
|
%OptimizeFunctionOnNextCall(__f_2);
|
|
__f_2();
|