v8/test/mjsunit/maglev/17.js
Victor Gomes 53f20f3db7 [maglev] Implement StoreField
Bug: v8:7700
Change-Id: I5827612419b938758b25d1f504e4576016583d4c
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3497364
Reviewed-by: Jakob Gruber <jgruber@chromium.org>
Auto-Submit: Victor Gomes <victorgomes@chromium.org>
Commit-Queue: Victor Gomes <victorgomes@chromium.org>
Cr-Commit-Position: refs/heads/main@{#79404}
2022-03-08 15:09:53 +00:00

28 lines
491 B
JavaScript

// Copyright 2022 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 setA(o, val) {
o.a = val;
}
function Foo() {
this.a = 0;
}
var foo = new Foo();
%PrepareFunctionForOptimization(setA);
setA(foo, 1);
assertEquals(foo.a, 1);
setA(foo, 2);
assertEquals(foo.a, 2);
%OptimizeMaglevOnNextCall(setA);
setA(foo, 42);
assertEquals(foo.a, 42);