1277bb5c55
Until this CL, the JSHeapBroker::GetPropertyAccessInfo (GPAI) process was as follows: 1. GPAI is called on the main thread (MT) during the serialization phase to create and cache PAIs. 2. GPAI is called again from the background thread (BT); only cached PAIs from step 1 are usable. As part of concurrent inlining, the goal is to move GPAI fully to the background thread. This CL takes a major step in that direction by making GPAI itself callable from the BT without resorting solely to PAIs that were previously cached on the MT. There are two main reasons why GPAI previously had to run on the MT: a) Concurrent access to Maps and other heap objects. b) Serialization and creation of ObjectRefs for objects discovered during GPAI. This CL addresses only reason a) and leaves b) for future work. This is done by keeping the two-pass approach, s.t. the initial call of GPAI on the MT discovers and serializes objects. We then clear all cached PAIs. The second call of GPAI on the BT thus runs full logic in a concurrent setting. Once all relevant objects (= maps and prototypes) no longer require MT-serialization, reason b) is also addressed and the first pass can be removed. The new logic is implemented behind the runtime flag --turbo-concurrent-get-property-access-info (default true), intended to be removed in the future. Bug: v8:7790 Change-Id: Idbdbfe091d7316529246a686bb6d71c2a0f06f8b Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2817793 Commit-Queue: Jakob Gruber <jgruber@chromium.org> Auto-Submit: Jakob Gruber <jgruber@chromium.org> Reviewed-by: Igor Sheludko <ishell@chromium.org> Reviewed-by: Georg Neis <neis@chromium.org> Cr-Commit-Position: refs/heads/master@{#74120}
62 lines
2.7 KiB
JavaScript
62 lines
2.7 KiB
JavaScript
// Copyright 2013 the V8 project authors. All rights reserved.
|
|
// Redistribution and use in source and binary forms, with or without
|
|
// modification, are permitted provided that the following conditions are
|
|
// met:
|
|
//
|
|
// * Redistributions of source code must retain the above copyright
|
|
// notice, this list of conditions and the following disclaimer.
|
|
// * Redistributions in binary form must reproduce the above
|
|
// copyright notice, this list of conditions and the following
|
|
// disclaimer in the documentation and/or other materials provided
|
|
// with the distribution.
|
|
// * Neither the name of Google Inc. nor the names of its
|
|
// contributors may be used to endorse or promote products derived
|
|
// from this software without specific prior written permission.
|
|
//
|
|
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
|
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
|
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
|
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
|
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
|
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
|
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
|
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
|
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
|
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
|
|
// Flags: --allow-natives-syntax --no-always-opt
|
|
// Flags: --concurrent-recompilation --block-concurrent-recompilation
|
|
// Flags: --no-always-opt --no-turbo-concurrent-get-property-access-info
|
|
|
|
if (!%IsConcurrentRecompilationSupported()) {
|
|
print("Concurrent recompilation is disabled. Skipping this test.");
|
|
quit();
|
|
}
|
|
|
|
function f(foo) { return foo.bar(); }
|
|
|
|
%PrepareFunctionForOptimization(f);
|
|
|
|
var o = {};
|
|
o.__proto__ = { __proto__: { bar: function() { return 1; } } };
|
|
|
|
assertEquals(1, f(o));
|
|
assertEquals(1, f(o));
|
|
|
|
// Mark for concurrent optimization.
|
|
%OptimizeFunctionOnNextCall(f, "concurrent");
|
|
// Kick off recompilation.
|
|
assertEquals(1, f(o));
|
|
// Change the prototype chain after compile graph has been created.
|
|
o.__proto__.__proto__ = { bar: function() { return 2; } };
|
|
// At this point, concurrent recompilation thread has not yet done its job.
|
|
assertUnoptimized(f, "no sync");
|
|
// Let the background thread proceed.
|
|
%UnblockConcurrentRecompilation();
|
|
// Optimization eventually bails out due to map dependency.
|
|
assertUnoptimized(f, "sync");
|
|
assertEquals(2, f(o));
|
|
//Clear type info for stress runs.
|
|
%ClearFunctionFeedback(f);
|