2015-01-21 08:52:00 +00:00
|
|
|
// Copyright 2015 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
|
2016-07-12 14:04:26 +00:00
|
|
|
|
|
|
|
function loader(dst, src, i) {
|
|
|
|
dst[i] = src[i];
|
2019-06-12 14:00:50 +00:00
|
|
|
};
|
|
|
|
%PrepareFunctionForOptimization(loader);
|
2015-01-21 08:52:00 +00:00
|
|
|
var ab = new ArrayBuffer(8);
|
|
|
|
var i_view = new Int32Array(ab);
|
2019-06-12 14:00:50 +00:00
|
|
|
i_view[0] = %GetHoleNaNUpper();
|
2015-12-10 10:05:44 +00:00
|
|
|
i_view[1] = %GetHoleNaNLower();
|
2015-01-21 08:52:00 +00:00
|
|
|
var f_view = new Float64Array(ab);
|
|
|
|
|
|
|
|
var fixed_double_elements = new Float64Array(1);
|
2015-01-22 08:36:01 +00:00
|
|
|
|
2019-06-12 14:00:50 +00:00
|
|
|
function opt_store() {
|
|
|
|
fixed_double_elements[0] = f_view[0];
|
|
|
|
};
|
2019-06-06 13:29:11 +00:00
|
|
|
%PrepareFunctionForOptimization(opt_store);
|
2015-01-22 08:36:01 +00:00
|
|
|
opt_store();
|
|
|
|
opt_store();
|
|
|
|
%OptimizeFunctionOnNextCall(opt_store);
|
|
|
|
opt_store();
|
|
|
|
|
|
|
|
var i32 = new Int32Array(fixed_double_elements.buffer);
|
|
|
|
assertEquals(i_view[0], i32[0]);
|
|
|
|
assertEquals(i_view[1], i32[1]);
|
2015-01-21 08:52:00 +00:00
|
|
|
|
|
|
|
var doubles = [0.5];
|
|
|
|
loader(doubles, fixed_double_elements, 0);
|
|
|
|
loader(doubles, fixed_double_elements, 0);
|
|
|
|
%OptimizeFunctionOnNextCall(loader);
|
|
|
|
loader(doubles, fixed_double_elements, 0);
|
|
|
|
assertTrue(doubles[0] !== undefined);
|