v8/test/mjsunit/regress/regress-1005400.js
Ross McIlroy 513c75116d [CSA] Ensure we only call ToName once in KeyedLoadICGeneric.
BUG=v8:6949,v8:9396,chromium:1005400

Change-Id: I18f50fc385dd83c8f1c551d1a3dc32714122eb00
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/1813022
Auto-Submit: Ross McIlroy <rmcilroy@chromium.org>
Commit-Queue: Mythri Alle <mythria@chromium.org>
Reviewed-by: Mythri Alle <mythria@chromium.org>
Cr-Commit-Position: refs/heads/master@{#63888}
2019-09-19 12:39:46 +00:00

24 lines
464 B
JavaScript

// Copyright 2019 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 foo(a, key) {
a[key];
}
let obj = {};
let count = 0;
var key_obj = {
toString: function() {
count++;
// Force string to be internalized during keyed lookup.
return 'foo' + count;
}
};
foo(obj, key_obj);
// We should only call toString once.
assertEquals(count, 1);