[Lite] Disable optimization for Lite mode.
BUG=v8:8293 Cq-Include-Trybots: luci.chromium.try:linux_chromium_headless_rel;master.tryserver.blink:linux_trusty_blink_rel Change-Id: Ic0e12cbcea76f76fce543714dee972c784095143 Reviewed-on: https://chromium-review.googlesource.com/c/1290795 Commit-Queue: Ross McIlroy <rmcilroy@chromium.org> Reviewed-by: Ross McIlroy <rmcilroy@chromium.org> Reviewed-by: Dan Elphick <delphick@chromium.org> Cr-Commit-Position: refs/heads/master@{#56852}
This commit is contained in:
parent
2dc302ae95
commit
0c9c0adf62
@ -903,7 +903,6 @@ DEFINE_BOOL(trace_deopt, false, "trace optimize function deoptimization")
|
||||
DEFINE_BOOL(trace_file_names, false,
|
||||
"include file names in trace-opt/trace-deopt output")
|
||||
DEFINE_BOOL(trace_interrupts, false, "trace interrupts when they are handled")
|
||||
DEFINE_BOOL(opt, true, "use adaptive optimizations")
|
||||
DEFINE_BOOL(always_opt, false, "always try to optimize functions")
|
||||
DEFINE_BOOL(always_osr, false, "always try to OSR functions")
|
||||
DEFINE_BOOL(prepare_always_opt, false, "prepare for turning on always opt")
|
||||
@ -1161,6 +1160,9 @@ DEFINE_SIZE_T(mock_arraybuffer_allocator_limit, 0,
|
||||
#define V8_LITE_BOOL false
|
||||
#endif
|
||||
|
||||
// Enable recompilation of function with optimized code.
|
||||
DEFINE_BOOL(opt, !V8_LITE_BOOL, "use adaptive optimizations")
|
||||
|
||||
// Favor memory over execution speed.
|
||||
DEFINE_BOOL(optimize_for_size, V8_LITE_BOOL,
|
||||
"Enables optimizations which favor memory size over execution "
|
||||
@ -1468,6 +1470,10 @@ DEFINE_BOOL(unbox_double_fields, V8_DOUBLE_FIELDS_UNBOXING,
|
||||
"enable in-object double fields unboxing (64-bit only)")
|
||||
DEFINE_IMPLICATION(unbox_double_fields, track_double_fields)
|
||||
|
||||
DEFINE_BOOL(lite_mode, V8_LITE_BOOL,
|
||||
"enables trade-off of performance for memory savings "
|
||||
"(Lite mode only)")
|
||||
|
||||
// Cleanup...
|
||||
#undef FLAG_FULL
|
||||
#undef FLAG_READONLY
|
||||
|
@ -322,6 +322,9 @@ RUNTIME_FUNCTION(Runtime_GetOptimizationStatus) {
|
||||
HandleScope scope(isolate);
|
||||
DCHECK(args.length() == 1 || args.length() == 2);
|
||||
int status = 0;
|
||||
if (FLAG_lite_mode) {
|
||||
status |= static_cast<int>(OptimizationStatus::kLiteMode);
|
||||
}
|
||||
if (!isolate->use_optimizer()) {
|
||||
status |= static_cast<int>(OptimizationStatus::kNeverOptimize);
|
||||
}
|
||||
|
@ -775,6 +775,7 @@ enum class OptimizationStatus {
|
||||
kOptimizingConcurrently = 1 << 9,
|
||||
kIsExecuting = 1 << 10,
|
||||
kTopmostFrameIsTurboFanned = 1 << 11,
|
||||
kLiteMode = 1 << 12,
|
||||
};
|
||||
|
||||
Smi* SmiLexicographicCompare(Smi* x_value, Smi* y_value);
|
||||
|
@ -2963,8 +2963,10 @@ TEST(ReleaseOverReservedPages) {
|
||||
if (FLAG_never_compact) return;
|
||||
FLAG_trace_gc = true;
|
||||
// The optimizer can allocate stuff, messing up the test.
|
||||
#ifndef V8_LITE_MODE
|
||||
FLAG_opt = false;
|
||||
FLAG_always_opt = false;
|
||||
#endif // V8_LITE_MODE
|
||||
// - Parallel compaction increases fragmentation, depending on how existing
|
||||
// memory is distributed. Since this is non-deterministic because of
|
||||
// concurrent sweeping, we disable it for this test.
|
||||
@ -3305,7 +3307,10 @@ UNINITIALIZED_TEST(ReleaseStackTraceData) {
|
||||
// See: https://codereview.chromium.org/181833004/
|
||||
return;
|
||||
}
|
||||
FLAG_use_ic = false; // ICs retain objects.
|
||||
#ifndef V8_LITE_MODE
|
||||
// ICs retain objects.
|
||||
FLAG_use_ic = false;
|
||||
#endif // V8_LITE_MODE
|
||||
FLAG_concurrent_recompilation = false;
|
||||
v8::Isolate::CreateParams create_params;
|
||||
create_params.array_buffer_allocator = CcTest::array_buffer_allocator();
|
||||
@ -3359,7 +3364,9 @@ UNINITIALIZED_TEST(ReleaseStackTraceData) {
|
||||
|
||||
TEST(Regress169928) {
|
||||
FLAG_allow_natives_syntax = true;
|
||||
#ifndef V8_LITE_MODE
|
||||
FLAG_opt = false;
|
||||
#endif // V8_LITE_MODE
|
||||
CcTest::InitializeVM();
|
||||
Isolate* isolate = CcTest::i_isolate();
|
||||
LocalContext env;
|
||||
|
@ -23024,7 +23024,9 @@ void TestStubCache(bool primary) {
|
||||
} else {
|
||||
i::FLAG_test_secondary_stub_cache = true;
|
||||
}
|
||||
#ifndef V8_LITE_MODE
|
||||
i::FLAG_opt = false;
|
||||
#endif // V8_LITE_MODE
|
||||
|
||||
v8::Isolate::CreateParams create_params;
|
||||
create_params.array_buffer_allocator = CcTest::array_buffer_allocator();
|
||||
@ -23964,7 +23966,9 @@ TEST(AccessCheckThrows) {
|
||||
|
||||
TEST(AccessCheckInIC) {
|
||||
i::FLAG_native_code_counters = true;
|
||||
#ifndef V8_LITE_MODE
|
||||
i::FLAG_opt = false;
|
||||
#endif // V8_LITE_MODE
|
||||
|
||||
v8::Isolate::CreateParams create_params;
|
||||
create_params.array_buffer_allocator = CcTest::array_buffer_allocator();
|
||||
@ -26599,6 +26603,7 @@ TEST(StringConcatOverflow) {
|
||||
}
|
||||
|
||||
TEST(TurboAsmDisablesNeuter) {
|
||||
#ifndef V8_LITE_MODE
|
||||
i::FLAG_opt = true;
|
||||
i::FLAG_allow_natives_syntax = true;
|
||||
v8::V8::Initialize();
|
||||
@ -26635,6 +26640,7 @@ TEST(TurboAsmDisablesNeuter) {
|
||||
|
||||
result = CompileRun(store).As<v8::ArrayBuffer>();
|
||||
CHECK(!result->IsNeuterable());
|
||||
#endif // V8_LITE_MODE
|
||||
}
|
||||
|
||||
|
||||
|
@ -1097,7 +1097,9 @@ TEST(BoundFunctionCall) {
|
||||
|
||||
// This tests checks distribution of the samples through the source lines.
|
||||
static void TickLines(bool optimize) {
|
||||
if (!optimize) i::FLAG_opt = false;
|
||||
#ifndef V8_LITE_MODE
|
||||
FLAG_opt = optimize;
|
||||
#endif // V8_LITE_MODE
|
||||
CcTest::InitializeVM();
|
||||
LocalContext env;
|
||||
i::FLAG_allow_natives_syntax = true;
|
||||
|
@ -252,7 +252,7 @@ TEST(FlagsRemoveIncomplete) {
|
||||
// if the list of arguments ends unexpectedly.
|
||||
SetFlagsToDefault();
|
||||
int argc = 3;
|
||||
const char* argv[] = {"", "--opt", "--expose-natives-as"};
|
||||
const char* argv[] = {"", "--testing-bool-flag", "--expose-natives-as"};
|
||||
CHECK_EQ(2, FlagList::SetFlagsFromCommandLine(&argc,
|
||||
const_cast<char **>(argv),
|
||||
true));
|
||||
|
@ -711,6 +711,7 @@ TEST(LineNumber) {
|
||||
}
|
||||
|
||||
TEST(BailoutReason) {
|
||||
#ifndef V8_LITE_MODE
|
||||
i::FLAG_allow_natives_syntax = true;
|
||||
i::FLAG_always_opt = false;
|
||||
i::FLAG_opt = true;
|
||||
@ -752,6 +753,7 @@ TEST(BailoutReason) {
|
||||
current = PickChild(current, "Debugger");
|
||||
CHECK(const_cast<v8::CpuProfileNode*>(current));
|
||||
CHECK(!strcmp("Optimization disabled for test", current->GetBailoutReason()));
|
||||
#endif // V8_LITE_MODE
|
||||
}
|
||||
|
||||
} // namespace test_profile_generator
|
||||
|
@ -2234,10 +2234,8 @@ TEST(CodeSerializerIsolatesEager) {
|
||||
TEST(CodeSerializerAfterExecute) {
|
||||
// We test that no compilations happen when running this code. Forcing
|
||||
// to always optimize breaks this test.
|
||||
bool prev_opt_value = FLAG_opt;
|
||||
bool prev_always_opt_value = FLAG_always_opt;
|
||||
FLAG_always_opt = false;
|
||||
FLAG_opt = false;
|
||||
const char* source = "function f() { return 'abc'; }; f() + 'def'";
|
||||
v8::ScriptCompiler::CachedData* cache =
|
||||
CompileRunAndProduceCache(source, CodeCacheType::kAfterExecute);
|
||||
@ -2290,7 +2288,6 @@ TEST(CodeSerializerAfterExecute) {
|
||||
|
||||
// Restore the flags.
|
||||
FLAG_always_opt = prev_always_opt_value;
|
||||
FLAG_opt = prev_opt_value;
|
||||
}
|
||||
|
||||
TEST(CodeSerializerFlagChange) {
|
||||
|
@ -9,6 +9,10 @@
|
||||
'debugger/wasm-imports': [SKIP],
|
||||
# https://crbug.com/v8/7932
|
||||
'runtime/command-line-api-without-side-effects': [SKIP],
|
||||
|
||||
# Require optimization, so can't be run on Lite mode.
|
||||
'cpu-profiler/coverage-block': [PASS, ['lite_mode == True', SKIP]],
|
||||
'cpu-profiler/coverage': [PASS, ['lite_mode == True', SKIP]],
|
||||
}], # ALWAYS
|
||||
|
||||
##############################################################################
|
||||
|
@ -5,6 +5,11 @@
|
||||
// Flags: --allow-natives-syntax --no-always-opt --opt
|
||||
// Files: test/mjsunit/code-coverage-utils.js
|
||||
|
||||
if (isNeverOptimizeLiteMode()) {
|
||||
print("Warning: skipping test that requires optimization in Lite mode.");
|
||||
quit(0);
|
||||
}
|
||||
|
||||
%DebugToggleBlockCoverage(true);
|
||||
|
||||
TestCoverage(
|
||||
|
@ -27,6 +27,11 @@
|
||||
|
||||
// Flags: --allow-natives-syntax --opt --no-always-opt
|
||||
|
||||
if (isNeverOptimizeLiteMode()) {
|
||||
print("Warning: skipping test that requires optimization in Lite mode.");
|
||||
quit(0);
|
||||
}
|
||||
|
||||
function f() {
|
||||
Array.prototype[10] = 2;
|
||||
var arr = new Array();
|
||||
|
@ -166,8 +166,12 @@ var V8OptimizationStatus = {
|
||||
kOptimizingConcurrently: 1 << 9,
|
||||
kIsExecuting: 1 << 10,
|
||||
kTopmostFrameIsTurboFanned: 1 << 11,
|
||||
kLiteMode: 1 << 12,
|
||||
};
|
||||
|
||||
// Returns true if --lite-mode is on and we can't ever turn on optimization.
|
||||
var isNeverOptimizeLiteMode;
|
||||
|
||||
// Returns true if --no-opt mode is on.
|
||||
var isNeverOptimize;
|
||||
|
||||
@ -653,6 +657,12 @@ var prettyPrinted;
|
||||
fun, sync_opt, name_opt, skip_if_maybe_deopted = true) {
|
||||
if (sync_opt === undefined) sync_opt = "";
|
||||
var opt_status = OptimizationStatus(fun, sync_opt);
|
||||
// Tests that use assertOptimized() do not make sense for Lite mode where
|
||||
// optimization is always disabled, explicitly exit the test with a warning.
|
||||
if (opt_status & V8OptimizationStatus.kLiteMode) {
|
||||
print("Warning: Test uses assertOptimized in Lite mode, skipping test.");
|
||||
quit(0);
|
||||
}
|
||||
// Tests that use assertOptimized() do not make sense if --no-opt
|
||||
// option is provided. Such tests must add --opt to flags comment.
|
||||
assertFalse((opt_status & V8OptimizationStatus.kNeverOptimize) !== 0,
|
||||
@ -668,6 +678,11 @@ var prettyPrinted;
|
||||
assertTrue((opt_status & V8OptimizationStatus.kOptimized) !== 0, name_opt);
|
||||
}
|
||||
|
||||
isNeverOptimizeLiteMode = function isNeverOptimizeLiteMode() {
|
||||
var opt_status = OptimizationStatus(undefined, "");
|
||||
return (opt_status & V8OptimizationStatus.kLiteMode) !== 0;
|
||||
}
|
||||
|
||||
isNeverOptimize = function isNeverOptimize() {
|
||||
var opt_status = OptimizationStatus(undefined, "");
|
||||
return (opt_status & V8OptimizationStatus.kNeverOptimize) !== 0;
|
||||
|
@ -145,7 +145,7 @@
|
||||
'regress/regress-634-debug': [PASS, ['mode == release', SKIP]],
|
||||
|
||||
# BUG(v8:2989).
|
||||
'regress/regress-2989': [FAIL, NO_VARIANTS],
|
||||
'regress/regress-2989': [FAIL, NO_VARIANTS, ['lite_mode == True', SKIP]],
|
||||
|
||||
# This test variant makes only sense on arm.
|
||||
'math-floor-of-div-nosudiv': [PASS, SLOW, ['arch not in [arm, arm64, android_arm, android_arm64]', SKIP]],
|
||||
|
@ -28,7 +28,11 @@
|
||||
// Flags: --use-osr --allow-natives-syntax --ignition-osr --opt
|
||||
// Flags: --no-always-opt
|
||||
|
||||
// Can't OSR with always-opt.
|
||||
// Can't OSR with always-opt or in Lite mode.
|
||||
if (isNeverOptimizeLiteMode()) {
|
||||
print("Warning: skipping test that requires optimization in Lite mode.");
|
||||
quit(0);
|
||||
}
|
||||
assertFalse(isAlwaysOptimize());
|
||||
|
||||
function f() {
|
||||
|
@ -21,7 +21,12 @@
|
||||
// (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
|
||||
// Flags: --allow-natives-syntax --opt
|
||||
|
||||
if (isNeverOptimizeLiteMode()) {
|
||||
print("Warning: skipping test that requires optimization in Lite mode.");
|
||||
quit(0);
|
||||
}
|
||||
|
||||
(function ArgumentsObjectChange() {
|
||||
function f(x) {
|
||||
|
@ -6,6 +6,10 @@
|
||||
// Flags: --opt --no-always-opt --turbo-filter=*
|
||||
|
||||
// If we are always or never optimizing it is useless.
|
||||
if (isNeverOptimizeLiteMode()) {
|
||||
print("Warning: skipping test that requires optimization in Lite mode.");
|
||||
quit(0);
|
||||
}
|
||||
assertFalse(isAlwaysOptimize());
|
||||
assertFalse(isNeverOptimize());
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user