diff options
Diffstat (limited to 'deps/v8/test/mjsunit/regress/regress-997989.js')
-rw-r--r-- | deps/v8/test/mjsunit/regress/regress-997989.js | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/deps/v8/test/mjsunit/regress/regress-997989.js b/deps/v8/test/mjsunit/regress/regress-997989.js new file mode 100644 index 0000000000..f049a31724 --- /dev/null +++ b/deps/v8/test/mjsunit/regress/regress-997989.js @@ -0,0 +1,27 @@ +// 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. +// +// Flags: --allow-natives-syntax + +// A function with a for-in loop, that will be optimized. +function foo(o) { + for (var i in o) { + return o[i]; + } +} + +var o = { x: 0.5 }; + +// Warm up foo with Double values in the enum cache. +%PrepareFunctionForOptimization(foo); +assertEquals(foo(o), 0.5); +assertEquals(foo(o), 0.5); +%OptimizeFunctionOnNextCall(foo); +assertEquals(foo(o), 0.5); + +// Transition the double field to a tagged field +o.x = "abc"; + +// Make sure that the optimized code correctly loads the tagged field. +assertEquals(foo(o), "abc"); |