Commit 21784e3d authored by Ross McIlroy's avatar Ross McIlroy Committed by Commit Bot

[Lite] Disable ICs in lite mode

BUG=v8:8293

Change-Id: I1d0e75f8671d3ec1c899c65bb9a865f2358173de
Reviewed-on: https://chromium-review.googlesource.com/c/1280527
Commit-Queue: Ross McIlroy <rmcilroy@chromium.org>
Reviewed-by: 's avatarDan Elphick <delphick@chromium.org>
Cr-Commit-Position: refs/heads/master@{#57042}
parent 8741040e
...@@ -960,7 +960,6 @@ DEFINE_BOOL(sampling_heap_profiler_suppress_randomness, false, ...@@ -960,7 +960,6 @@ DEFINE_BOOL(sampling_heap_profiler_suppress_randomness, false,
DEFINE_BOOL(use_idle_notification, true, DEFINE_BOOL(use_idle_notification, true,
"Use idle notification to reduce memory footprint.") "Use idle notification to reduce memory footprint.")
// ic.cc // ic.cc
DEFINE_BOOL(use_ic, true, "use inline caching")
DEFINE_BOOL(trace_ic, false, DEFINE_BOOL(trace_ic, false,
"trace inline cache state transitions for tools/ic-processor") "trace inline cache state transitions for tools/ic-processor")
DEFINE_IMPLICATION(trace_ic, log_code) DEFINE_IMPLICATION(trace_ic, log_code)
...@@ -1137,6 +1136,9 @@ DEFINE_SIZE_T(mock_arraybuffer_allocator_limit, 0, ...@@ -1137,6 +1136,9 @@ DEFINE_SIZE_T(mock_arraybuffer_allocator_limit, 0,
// Enable recompilation of function with optimized code. // Enable recompilation of function with optimized code.
DEFINE_BOOL(opt, !V8_LITE_BOOL, "use adaptive optimizations") DEFINE_BOOL(opt, !V8_LITE_BOOL, "use adaptive optimizations")
// Enable use of inline caches to optimize object access operations.
DEFINE_BOOL(use_ic, !V8_LITE_BOOL, "use inline caching")
// Favor memory over execution speed. // Favor memory over execution speed.
DEFINE_BOOL(optimize_for_size, V8_LITE_BOOL, DEFINE_BOOL(optimize_for_size, V8_LITE_BOOL,
"Enables optimizations which favor memory size over execution " "Enables optimizations which favor memory size over execution "
......
...@@ -156,7 +156,6 @@ RUNTIME_FUNCTION(Runtime_DeoptimizeFunction) { ...@@ -156,7 +156,6 @@ RUNTIME_FUNCTION(Runtime_DeoptimizeFunction) {
return ReadOnlyRoots(isolate).undefined_value(); return ReadOnlyRoots(isolate).undefined_value();
} }
RUNTIME_FUNCTION(Runtime_DeoptimizeNow) { RUNTIME_FUNCTION(Runtime_DeoptimizeNow) {
HandleScope scope(isolate); HandleScope scope(isolate);
DCHECK_EQ(0, args.length()); DCHECK_EQ(0, args.length());
...@@ -176,7 +175,6 @@ RUNTIME_FUNCTION(Runtime_DeoptimizeNow) { ...@@ -176,7 +175,6 @@ RUNTIME_FUNCTION(Runtime_DeoptimizeNow) {
return ReadOnlyRoots(isolate).undefined_value(); return ReadOnlyRoots(isolate).undefined_value();
} }
RUNTIME_FUNCTION(Runtime_RunningInSimulator) { RUNTIME_FUNCTION(Runtime_RunningInSimulator) {
SealHandleScope shs(isolate); SealHandleScope shs(isolate);
DCHECK_EQ(0, args.length()); DCHECK_EQ(0, args.length());
...@@ -187,6 +185,11 @@ RUNTIME_FUNCTION(Runtime_RunningInSimulator) { ...@@ -187,6 +185,11 @@ RUNTIME_FUNCTION(Runtime_RunningInSimulator) {
#endif #endif
} }
RUNTIME_FUNCTION(Runtime_ICsAreEnabled) {
SealHandleScope shs(isolate);
DCHECK_EQ(0, args.length());
return isolate->heap()->ToBoolean(FLAG_use_ic);
}
RUNTIME_FUNCTION(Runtime_IsConcurrentRecompilationSupported) { RUNTIME_FUNCTION(Runtime_IsConcurrentRecompilationSupported) {
SealHandleScope shs(isolate); SealHandleScope shs(isolate);
......
...@@ -489,6 +489,7 @@ namespace internal { ...@@ -489,6 +489,7 @@ namespace internal {
F(HasSmiOrObjectElements, 1, 1) \ F(HasSmiOrObjectElements, 1, 1) \
F(HaveSameMap, 2, 1) \ F(HaveSameMap, 2, 1) \
F(HeapObjectVerify, 1, 1) \ F(HeapObjectVerify, 1, 1) \
F(ICsAreEnabled, 0, 1) \
F(InNewSpace, 1, 1) \ F(InNewSpace, 1, 1) \
F(IsAsmWasmCode, 1, 1) \ F(IsAsmWasmCode, 1, 1) \
F(IsConcurrentRecompilationSupported, 0, 1) \ F(IsConcurrentRecompilationSupported, 0, 1) \
......
...@@ -3068,6 +3068,7 @@ TEST(PrintSharedFunctionInfo) { ...@@ -3068,6 +3068,7 @@ TEST(PrintSharedFunctionInfo) {
TEST(IncrementalMarkingPreservesMonomorphicCallIC) { TEST(IncrementalMarkingPreservesMonomorphicCallIC) {
if (!FLAG_use_ic) return;
if (!FLAG_incremental_marking) return; if (!FLAG_incremental_marking) return;
if (FLAG_always_opt) return; if (FLAG_always_opt) return;
CcTest::InitializeVM(); CcTest::InitializeVM();
...@@ -3146,6 +3147,7 @@ TEST(IncrementalMarkingPreservesMonomorphicConstructor) { ...@@ -3146,6 +3147,7 @@ TEST(IncrementalMarkingPreservesMonomorphicConstructor) {
} }
TEST(IncrementalMarkingPreservesMonomorphicIC) { TEST(IncrementalMarkingPreservesMonomorphicIC) {
if (!FLAG_use_ic) return;
if (!FLAG_incremental_marking) return; if (!FLAG_incremental_marking) return;
if (FLAG_always_opt) return; if (FLAG_always_opt) return;
CcTest::InitializeVM(); CcTest::InitializeVM();
...@@ -3168,6 +3170,7 @@ TEST(IncrementalMarkingPreservesMonomorphicIC) { ...@@ -3168,6 +3170,7 @@ TEST(IncrementalMarkingPreservesMonomorphicIC) {
} }
TEST(IncrementalMarkingPreservesPolymorphicIC) { TEST(IncrementalMarkingPreservesPolymorphicIC) {
if (!FLAG_use_ic) return;
if (!FLAG_incremental_marking) return; if (!FLAG_incremental_marking) return;
if (FLAG_always_opt) return; if (FLAG_always_opt) return;
CcTest::InitializeVM(); CcTest::InitializeVM();
...@@ -3206,6 +3209,7 @@ TEST(IncrementalMarkingPreservesPolymorphicIC) { ...@@ -3206,6 +3209,7 @@ TEST(IncrementalMarkingPreservesPolymorphicIC) {
} }
TEST(ContextDisposeDoesntClearPolymorphicIC) { TEST(ContextDisposeDoesntClearPolymorphicIC) {
if (!FLAG_use_ic) return;
if (!FLAG_incremental_marking) return; if (!FLAG_incremental_marking) return;
if (FLAG_always_opt) return; if (FLAG_always_opt) return;
CcTest::InitializeVM(); CcTest::InitializeVM();
...@@ -4349,6 +4353,7 @@ void CheckIC(Handle<JSFunction> function, int slot_index, ...@@ -4349,6 +4353,7 @@ void CheckIC(Handle<JSFunction> function, int slot_index,
} }
TEST(MonomorphicStaysMonomorphicAfterGC) { TEST(MonomorphicStaysMonomorphicAfterGC) {
if (!FLAG_use_ic) return;
if (FLAG_always_opt) return; if (FLAG_always_opt) return;
ManualGCScope manual_gc_scope; ManualGCScope manual_gc_scope;
CcTest::InitializeVM(); CcTest::InitializeVM();
...@@ -4382,6 +4387,7 @@ TEST(MonomorphicStaysMonomorphicAfterGC) { ...@@ -4382,6 +4387,7 @@ TEST(MonomorphicStaysMonomorphicAfterGC) {
TEST(PolymorphicStaysPolymorphicAfterGC) { TEST(PolymorphicStaysPolymorphicAfterGC) {
if (!FLAG_use_ic) return;
if (FLAG_always_opt) return; if (FLAG_always_opt) return;
ManualGCScope manual_gc_scope; ManualGCScope manual_gc_scope;
CcTest::InitializeVM(); CcTest::InitializeVM();
......
...@@ -22955,6 +22955,8 @@ TEST(ScopedMicrotasks) { ...@@ -22955,6 +22955,8 @@ TEST(ScopedMicrotasks) {
env->GetIsolate()->SetMicrotasksPolicy(v8::MicrotasksPolicy::kAuto); env->GetIsolate()->SetMicrotasksPolicy(v8::MicrotasksPolicy::kAuto);
} }
#ifndef V8_LITE_MODE
namespace { namespace {
int probes_counter = 0; int probes_counter = 0;
...@@ -23080,6 +23082,7 @@ UNINITIALIZED_TEST(SecondaryStubCache) { ...@@ -23080,6 +23082,7 @@ UNINITIALIZED_TEST(SecondaryStubCache) {
} }
#endif // ENABLE_DISASSEMBLER #endif // ENABLE_DISASSEMBLER
#endif // V8_LITE_MODE
namespace { namespace {
...@@ -23967,6 +23970,7 @@ TEST(AccessCheckThrows) { ...@@ -23967,6 +23970,7 @@ TEST(AccessCheckThrows) {
} }
TEST(AccessCheckInIC) { TEST(AccessCheckInIC) {
#ifndef V8_LITE_MODE
i::FLAG_native_code_counters = true; i::FLAG_native_code_counters = true;
#ifndef V8_LITE_MODE #ifndef V8_LITE_MODE
i::FLAG_opt = false; i::FLAG_opt = false;
...@@ -24070,6 +24074,7 @@ TEST(AccessCheckInIC) { ...@@ -24070,6 +24074,7 @@ TEST(AccessCheckInIC) {
CHECK_EQ(13, updates_counter - initial_updates); CHECK_EQ(13, updates_counter - initial_updates);
} }
isolate->Dispose(); isolate->Dispose();
#endif // V8_LITE_MODE
} }
class RequestInterruptTestBase { class RequestInterruptTestBase {
......
...@@ -158,7 +158,9 @@ TEST(VectorICMetadata) { ...@@ -158,7 +158,9 @@ TEST(VectorICMetadata) {
TEST(VectorCallICStates) { TEST(VectorCallICStates) {
if (!i::FLAG_use_ic) return;
if (i::FLAG_always_opt) return; if (i::FLAG_always_opt) return;
CcTest::InitializeVM(); CcTest::InitializeVM();
LocalContext context; LocalContext context;
v8::HandleScope scope(context->GetIsolate()); v8::HandleScope scope(context->GetIsolate());
...@@ -184,7 +186,9 @@ TEST(VectorCallICStates) { ...@@ -184,7 +186,9 @@ TEST(VectorCallICStates) {
} }
TEST(VectorCallFeedback) { TEST(VectorCallFeedback) {
if (!i::FLAG_use_ic) return;
if (i::FLAG_always_opt) return; if (i::FLAG_always_opt) return;
CcTest::InitializeVM(); CcTest::InitializeVM();
LocalContext context; LocalContext context;
v8::HandleScope scope(context->GetIsolate()); v8::HandleScope scope(context->GetIsolate());
...@@ -212,7 +216,9 @@ TEST(VectorCallFeedback) { ...@@ -212,7 +216,9 @@ TEST(VectorCallFeedback) {
} }
TEST(VectorCallFeedbackForArray) { TEST(VectorCallFeedbackForArray) {
if (!i::FLAG_use_ic) return;
if (i::FLAG_always_opt) return; if (i::FLAG_always_opt) return;
CcTest::InitializeVM(); CcTest::InitializeVM();
LocalContext context; LocalContext context;
v8::HandleScope scope(context->GetIsolate()); v8::HandleScope scope(context->GetIsolate());
...@@ -247,7 +253,9 @@ size_t GetFeedbackVectorLength(Isolate* isolate, const char* src, ...@@ -247,7 +253,9 @@ size_t GetFeedbackVectorLength(Isolate* isolate, const char* src,
} }
TEST(OneShotCallICSlotCount) { TEST(OneShotCallICSlotCount) {
if (!i::FLAG_use_ic) return;
if (i::FLAG_always_opt) return; if (i::FLAG_always_opt) return;
CcTest::InitializeVM(); CcTest::InitializeVM();
LocalContext context; LocalContext context;
v8::HandleScope scope(context->GetIsolate()); v8::HandleScope scope(context->GetIsolate());
...@@ -299,7 +307,9 @@ TEST(OneShotCallICSlotCount) { ...@@ -299,7 +307,9 @@ TEST(OneShotCallICSlotCount) {
} }
TEST(VectorCallCounts) { TEST(VectorCallCounts) {
if (!i::FLAG_use_ic) return;
if (i::FLAG_always_opt) return; if (i::FLAG_always_opt) return;
CcTest::InitializeVM(); CcTest::InitializeVM();
LocalContext context; LocalContext context;
v8::HandleScope scope(context->GetIsolate()); v8::HandleScope scope(context->GetIsolate());
...@@ -328,7 +338,9 @@ TEST(VectorCallCounts) { ...@@ -328,7 +338,9 @@ TEST(VectorCallCounts) {
} }
TEST(VectorConstructCounts) { TEST(VectorConstructCounts) {
if (!i::FLAG_use_ic) return;
if (i::FLAG_always_opt) return; if (i::FLAG_always_opt) return;
CcTest::InitializeVM(); CcTest::InitializeVM();
LocalContext context; LocalContext context;
v8::HandleScope scope(context->GetIsolate()); v8::HandleScope scope(context->GetIsolate());
...@@ -359,7 +371,9 @@ TEST(VectorConstructCounts) { ...@@ -359,7 +371,9 @@ TEST(VectorConstructCounts) {
} }
TEST(VectorSpeculationMode) { TEST(VectorSpeculationMode) {
if (!i::FLAG_use_ic) return;
if (i::FLAG_always_opt) return; if (i::FLAG_always_opt) return;
CcTest::InitializeVM(); CcTest::InitializeVM();
LocalContext context; LocalContext context;
v8::HandleScope scope(context->GetIsolate()); v8::HandleScope scope(context->GetIsolate());
...@@ -391,7 +405,9 @@ TEST(VectorSpeculationMode) { ...@@ -391,7 +405,9 @@ TEST(VectorSpeculationMode) {
} }
TEST(VectorLoadICStates) { TEST(VectorLoadICStates) {
if (!i::FLAG_use_ic) return;
if (i::FLAG_always_opt) return; if (i::FLAG_always_opt) return;
CcTest::InitializeVM(); CcTest::InitializeVM();
LocalContext context; LocalContext context;
v8::HandleScope scope(context->GetIsolate()); v8::HandleScope scope(context->GetIsolate());
...@@ -444,7 +460,9 @@ TEST(VectorLoadICStates) { ...@@ -444,7 +460,9 @@ TEST(VectorLoadICStates) {
} }
TEST(VectorLoadGlobalICSlotSharing) { TEST(VectorLoadGlobalICSlotSharing) {
if (!i::FLAG_use_ic) return;
if (i::FLAG_always_opt) return; if (i::FLAG_always_opt) return;
CcTest::InitializeVM(); CcTest::InitializeVM();
LocalContext context; LocalContext context;
v8::HandleScope scope(context->GetIsolate()); v8::HandleScope scope(context->GetIsolate());
...@@ -479,7 +497,9 @@ TEST(VectorLoadGlobalICSlotSharing) { ...@@ -479,7 +497,9 @@ TEST(VectorLoadGlobalICSlotSharing) {
TEST(VectorLoadICOnSmi) { TEST(VectorLoadICOnSmi) {
if (!i::FLAG_use_ic) return;
if (i::FLAG_always_opt) return; if (i::FLAG_always_opt) return;
CcTest::InitializeVM(); CcTest::InitializeVM();
LocalContext context; LocalContext context;
v8::HandleScope scope(context->GetIsolate()); v8::HandleScope scope(context->GetIsolate());
...@@ -537,7 +557,9 @@ TEST(VectorLoadICOnSmi) { ...@@ -537,7 +557,9 @@ TEST(VectorLoadICOnSmi) {
TEST(ReferenceContextAllocatesNoSlots) { TEST(ReferenceContextAllocatesNoSlots) {
if (!i::FLAG_use_ic) return;
if (i::FLAG_always_opt) return; if (i::FLAG_always_opt) return;
CcTest::InitializeVM(); CcTest::InitializeVM();
LocalContext context; LocalContext context;
v8::HandleScope scope(context->GetIsolate()); v8::HandleScope scope(context->GetIsolate());
...@@ -675,6 +697,7 @@ TEST(ReferenceContextAllocatesNoSlots) { ...@@ -675,6 +697,7 @@ TEST(ReferenceContextAllocatesNoSlots) {
TEST(VectorStoreICBasic) { TEST(VectorStoreICBasic) {
if (!i::FLAG_use_ic) return;
if (i::FLAG_always_opt) return; if (i::FLAG_always_opt) return;
CcTest::InitializeVM(); CcTest::InitializeVM();
...@@ -700,6 +723,7 @@ TEST(VectorStoreICBasic) { ...@@ -700,6 +723,7 @@ TEST(VectorStoreICBasic) {
} }
TEST(StoreOwnIC) { TEST(StoreOwnIC) {
if (!i::FLAG_use_ic) return;
if (i::FLAG_always_opt) return; if (i::FLAG_always_opt) return;
CcTest::InitializeVM(); CcTest::InitializeVM();
......
...@@ -241,12 +241,17 @@ for (var i = 0; i < 3; i++) { ...@@ -241,12 +241,17 @@ for (var i = 0; i < 3; i++) {
} }
convert_mixed(construct_smis(), "three", elements_kind.fast); convert_mixed(construct_smis(), "three", elements_kind.fast);
convert_mixed(construct_doubles(), "three", elements_kind.fast); convert_mixed(construct_doubles(), "three", elements_kind.fast);
if (%ICsAreEnabled()) {
// Test that allocation sites allocate correct elements kind initially based
// on previous transitions.
%OptimizeFunctionOnNextCall(convert_mixed); %OptimizeFunctionOnNextCall(convert_mixed);
smis = construct_smis(); smis = construct_smis();
doubles = construct_doubles(); doubles = construct_doubles();
convert_mixed(smis, 1, elements_kind.fast); convert_mixed(smis, 1, elements_kind.fast);
convert_mixed(doubles, 1, elements_kind.fast); convert_mixed(doubles, 1, elements_kind.fast);
assertTrue(%HaveSameMap(smis, doubles)); assertTrue(%HaveSameMap(smis, doubles));
}
// Crankshaft support for smi-only elements in dynamic array literals. // Crankshaft support for smi-only elements in dynamic array literals.
function get(foo) { return foo; } // Used to generate dynamic values. function get(foo) { return foo; } // Used to generate dynamic values.
......
...@@ -134,11 +134,15 @@ function test1() { ...@@ -134,11 +134,15 @@ function test1() {
convert_mixed(construct_smis(), "three", elements_kind.fast); convert_mixed(construct_smis(), "three", elements_kind.fast);
convert_mixed(construct_doubles(), "three", elements_kind.fast); convert_mixed(construct_doubles(), "three", elements_kind.fast);
smis = construct_smis(); if (%ICsAreEnabled()) {
doubles = construct_doubles(); // Test that allocation sites allocate correct elements kind initially based
convert_mixed(smis, 1, elements_kind.fast); // on previous transitions.
convert_mixed(doubles, 1, elements_kind.fast); smis = construct_smis();
assertTrue(%HaveSameMap(smis, doubles)); doubles = construct_doubles();
convert_mixed(smis, 1, elements_kind.fast);
convert_mixed(doubles, 1, elements_kind.fast);
assertTrue(%HaveSameMap(smis, doubles));
}
} }
function clear_ic_state() { function clear_ic_state() {
......
...@@ -132,11 +132,15 @@ convert_mixed(doubles, "three", elements_kind.fast); ...@@ -132,11 +132,15 @@ convert_mixed(doubles, "three", elements_kind.fast);
convert_mixed(construct_smis(), "three", elements_kind.fast); convert_mixed(construct_smis(), "three", elements_kind.fast);
convert_mixed(construct_doubles(), "three", elements_kind.fast); convert_mixed(construct_doubles(), "three", elements_kind.fast);
smis = construct_smis(); if (%ICsAreEnabled()) {
doubles = construct_doubles(); // Test that allocation sites allocate correct elements kind initially based
convert_mixed(smis, 1, elements_kind.fast); // on previous transitions.
convert_mixed(doubles, 1, elements_kind.fast); smis = construct_smis();
assertTrue(%HaveSameMap(smis, doubles)); doubles = construct_doubles();
convert_mixed(smis, 1, elements_kind.fast);
convert_mixed(doubles, 1, elements_kind.fast);
assertTrue(%HaveSameMap(smis, doubles));
}
// Throw away type information in the ICs for next stress run. // Throw away type information in the ICs for next stress run.
gc(); gc();
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment