v8/test/mjsunit/regress/regress-crbug-513507.js
Ross McIlroy 11a211ff1b Reland: [TypeFeedbackVector] Store optimized code in the vector
Since the feedback vector is itself a native context structure, why
not store optimized code for a function in there rather than in
a map from native context to code? This allows us to get rid of
the optimized code map in the SharedFunctionInfo, saving a pointer,
and making lookup of any optimized code quicker.

Original patch by Michael Stanton <mvstanton@chromium.org>

BUG=v8:6246,chromium:718891
TBR=yangguo@chromium.org,ulan@chromium.org

Change-Id: I3bb9ec0cfff32e667cca0e1403f964f33a6958a6
Reviewed-on: https://chromium-review.googlesource.com/500134
Reviewed-by: Ross McIlroy <rmcilroy@chromium.org>
Reviewed-by: Jaroslav Sevcik <jarin@chromium.org>
Reviewed-by: Ulan Degenbaev <ulan@chromium.org>
Commit-Queue: Ross McIlroy <rmcilroy@chromium.org>
Cr-Commit-Position: refs/heads/master@{#45234}
2017-05-10 15:04:35 +00:00

25 lines
640 B
JavaScript

// 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
// The following triggers a GC in Context::AddToOSROptimizedCodeCache.
// Flags: --gc-interval=1234 --gc-global
function makeFun() {
function fun(osr_fuse) {
for (var i = 0; i < 3; ++i) {
if (i == osr_fuse) %OptimizeOsr();
}
for (var i = 3; i < 6; ++i) {
if (i == osr_fuse) %OptimizeOsr();
}
}
return fun;
}
makeFun()(7); // Warm up.
makeFun()(4); // Optimize once.
makeFun()(1); // Optimize again.