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,
DEFINE_BOOL(use_idle_notification, true,
"Use idle notification to reduce memory footprint.")
// ic.cc
DEFINE_BOOL(use_ic, true, "use inline caching")
DEFINE_BOOL(trace_ic, false,
"trace inline cache state transitions for tools/ic-processor")
DEFINE_IMPLICATION(trace_ic, log_code)
......@@ -1137,6 +1136,9 @@ DEFINE_SIZE_T(mock_arraybuffer_allocator_limit, 0,
// Enable recompilation of function with optimized code.
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.
DEFINE_BOOL(optimize_for_size, V8_LITE_BOOL,
"Enables optimizations which favor memory size over execution "
......
......@@ -156,7 +156,6 @@ RUNTIME_FUNCTION(Runtime_DeoptimizeFunction) {
return ReadOnlyRoots(isolate).undefined_value();
}
RUNTIME_FUNCTION(Runtime_DeoptimizeNow) {
HandleScope scope(isolate);
DCHECK_EQ(0, args.length());
......@@ -176,7 +175,6 @@ RUNTIME_FUNCTION(Runtime_DeoptimizeNow) {
return ReadOnlyRoots(isolate).undefined_value();
}
RUNTIME_FUNCTION(Runtime_RunningInSimulator) {
SealHandleScope shs(isolate);
DCHECK_EQ(0, args.length());
......@@ -187,6 +185,11 @@ RUNTIME_FUNCTION(Runtime_RunningInSimulator) {
#endif
}
RUNTIME_FUNCTION(Runtime_ICsAreEnabled) {
SealHandleScope shs(isolate);
DCHECK_EQ(0, args.length());
return isolate->heap()->ToBoolean(FLAG_use_ic);
}
RUNTIME_FUNCTION(Runtime_IsConcurrentRecompilationSupported) {
SealHandleScope shs(isolate);
......
......@@ -489,6 +489,7 @@ namespace internal {
F(HasSmiOrObjectElements, 1, 1) \
F(HaveSameMap, 2, 1) \
F(HeapObjectVerify, 1, 1) \
F(ICsAreEnabled, 0, 1) \
F(InNewSpace, 1, 1) \
F(IsAsmWasmCode, 1, 1) \
F(IsConcurrentRecompilationSupported, 0, 1) \
......
......@@ -3068,6 +3068,7 @@ TEST(PrintSharedFunctionInfo) {
TEST(IncrementalMarkingPreservesMonomorphicCallIC) {
if (!FLAG_use_ic) return;
if (!FLAG_incremental_marking) return;
if (FLAG_always_opt) return;
CcTest::InitializeVM();
......@@ -3146,6 +3147,7 @@ TEST(IncrementalMarkingPreservesMonomorphicConstructor) {
}
TEST(IncrementalMarkingPreservesMonomorphicIC) {
if (!FLAG_use_ic) return;
if (!FLAG_incremental_marking) return;
if (FLAG_always_opt) return;
CcTest::InitializeVM();
......@@ -3168,6 +3170,7 @@ TEST(IncrementalMarkingPreservesMonomorphicIC) {
}
TEST(IncrementalMarkingPreservesPolymorphicIC) {
if (!FLAG_use_ic) return;
if (!FLAG_incremental_marking) return;
if (FLAG_always_opt) return;
CcTest::InitializeVM();
......@@ -3206,6 +3209,7 @@ TEST(IncrementalMarkingPreservesPolymorphicIC) {
}
TEST(ContextDisposeDoesntClearPolymorphicIC) {
if (!FLAG_use_ic) return;
if (!FLAG_incremental_marking) return;
if (FLAG_always_opt) return;
CcTest::InitializeVM();
......@@ -4349,6 +4353,7 @@ void CheckIC(Handle<JSFunction> function, int slot_index,
}
TEST(MonomorphicStaysMonomorphicAfterGC) {
if (!FLAG_use_ic) return;
if (FLAG_always_opt) return;
ManualGCScope manual_gc_scope;
CcTest::InitializeVM();
......@@ -4382,6 +4387,7 @@ TEST(MonomorphicStaysMonomorphicAfterGC) {
TEST(PolymorphicStaysPolymorphicAfterGC) {
if (!FLAG_use_ic) return;
if (FLAG_always_opt) return;
ManualGCScope manual_gc_scope;
CcTest::InitializeVM();
......
......@@ -22955,6 +22955,8 @@ TEST(ScopedMicrotasks) {
env->GetIsolate()->SetMicrotasksPolicy(v8::MicrotasksPolicy::kAuto);
}
#ifndef V8_LITE_MODE
namespace {
int probes_counter = 0;
......@@ -23080,6 +23082,7 @@ UNINITIALIZED_TEST(SecondaryStubCache) {
}
#endif // ENABLE_DISASSEMBLER
#endif // V8_LITE_MODE
namespace {
......@@ -23967,6 +23970,7 @@ TEST(AccessCheckThrows) {
}
TEST(AccessCheckInIC) {
#ifndef V8_LITE_MODE
i::FLAG_native_code_counters = true;
#ifndef V8_LITE_MODE
i::FLAG_opt = false;
......@@ -24070,6 +24074,7 @@ TEST(AccessCheckInIC) {
CHECK_EQ(13, updates_counter - initial_updates);
}
isolate->Dispose();
#endif // V8_LITE_MODE
}
class RequestInterruptTestBase {
......
......@@ -158,7 +158,9 @@ TEST(VectorICMetadata) {
TEST(VectorCallICStates) {
if (!i::FLAG_use_ic) return;
if (i::FLAG_always_opt) return;
CcTest::InitializeVM();
LocalContext context;
v8::HandleScope scope(context->GetIsolate());
......@@ -184,7 +186,9 @@ TEST(VectorCallICStates) {
}
TEST(VectorCallFeedback) {
if (!i::FLAG_use_ic) return;
if (i::FLAG_always_opt) return;
CcTest::InitializeVM();
LocalContext context;
v8::HandleScope scope(context->GetIsolate());
......@@ -212,7 +216,9 @@ TEST(VectorCallFeedback) {
}
TEST(VectorCallFeedbackForArray) {
if (!i::FLAG_use_ic) return;
if (i::FLAG_always_opt) return;
CcTest::InitializeVM();
LocalContext context;
v8::HandleScope scope(context->GetIsolate());
......@@ -247,7 +253,9 @@ size_t GetFeedbackVectorLength(Isolate* isolate, const char* src,
}
TEST(OneShotCallICSlotCount) {
if (!i::FLAG_use_ic) return;
if (i::FLAG_always_opt) return;
CcTest::InitializeVM();
LocalContext context;
v8::HandleScope scope(context->GetIsolate());
......@@ -299,7 +307,9 @@ TEST(OneShotCallICSlotCount) {
}
TEST(VectorCallCounts) {
if (!i::FLAG_use_ic) return;
if (i::FLAG_always_opt) return;
CcTest::InitializeVM();
LocalContext context;
v8::HandleScope scope(context->GetIsolate());
......@@ -328,7 +338,9 @@ TEST(VectorCallCounts) {
}
TEST(VectorConstructCounts) {
if (!i::FLAG_use_ic) return;
if (i::FLAG_always_opt) return;
CcTest::InitializeVM();
LocalContext context;
v8::HandleScope scope(context->GetIsolate());
......@@ -359,7 +371,9 @@ TEST(VectorConstructCounts) {
}
TEST(VectorSpeculationMode) {
if (!i::FLAG_use_ic) return;
if (i::FLAG_always_opt) return;
CcTest::InitializeVM();
LocalContext context;
v8::HandleScope scope(context->GetIsolate());
......@@ -391,7 +405,9 @@ TEST(VectorSpeculationMode) {
}
TEST(VectorLoadICStates) {
if (!i::FLAG_use_ic) return;
if (i::FLAG_always_opt) return;
CcTest::InitializeVM();
LocalContext context;
v8::HandleScope scope(context->GetIsolate());
......@@ -444,7 +460,9 @@ TEST(VectorLoadICStates) {
}
TEST(VectorLoadGlobalICSlotSharing) {
if (!i::FLAG_use_ic) return;
if (i::FLAG_always_opt) return;
CcTest::InitializeVM();
LocalContext context;
v8::HandleScope scope(context->GetIsolate());
......@@ -479,7 +497,9 @@ TEST(VectorLoadGlobalICSlotSharing) {
TEST(VectorLoadICOnSmi) {
if (!i::FLAG_use_ic) return;
if (i::FLAG_always_opt) return;
CcTest::InitializeVM();
LocalContext context;
v8::HandleScope scope(context->GetIsolate());
......@@ -537,7 +557,9 @@ TEST(VectorLoadICOnSmi) {
TEST(ReferenceContextAllocatesNoSlots) {
if (!i::FLAG_use_ic) return;
if (i::FLAG_always_opt) return;
CcTest::InitializeVM();
LocalContext context;
v8::HandleScope scope(context->GetIsolate());
......@@ -675,6 +697,7 @@ TEST(ReferenceContextAllocatesNoSlots) {
TEST(VectorStoreICBasic) {
if (!i::FLAG_use_ic) return;
if (i::FLAG_always_opt) return;
CcTest::InitializeVM();
......@@ -700,6 +723,7 @@ TEST(VectorStoreICBasic) {
}
TEST(StoreOwnIC) {
if (!i::FLAG_use_ic) return;
if (i::FLAG_always_opt) return;
CcTest::InitializeVM();
......
......@@ -241,12 +241,17 @@ for (var i = 0; i < 3; i++) {
}
convert_mixed(construct_smis(), "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);
smis = construct_smis();
doubles = construct_doubles();
convert_mixed(smis, 1, elements_kind.fast);
convert_mixed(doubles, 1, elements_kind.fast);
assertTrue(%HaveSameMap(smis, doubles));
smis = construct_smis();
doubles = construct_doubles();
convert_mixed(smis, 1, elements_kind.fast);
convert_mixed(doubles, 1, elements_kind.fast);
assertTrue(%HaveSameMap(smis, doubles));
}
// Crankshaft support for smi-only elements in dynamic array literals.
function get(foo) { return foo; } // Used to generate dynamic values.
......
......@@ -134,11 +134,15 @@ function test1() {
convert_mixed(construct_smis(), "three", elements_kind.fast);
convert_mixed(construct_doubles(), "three", elements_kind.fast);
smis = construct_smis();
doubles = construct_doubles();
convert_mixed(smis, 1, elements_kind.fast);
convert_mixed(doubles, 1, elements_kind.fast);
assertTrue(%HaveSameMap(smis, doubles));
if (%ICsAreEnabled()) {
// Test that allocation sites allocate correct elements kind initially based
// on previous transitions.
smis = construct_smis();
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() {
......
......@@ -132,11 +132,15 @@ convert_mixed(doubles, "three", elements_kind.fast);
convert_mixed(construct_smis(), "three", elements_kind.fast);
convert_mixed(construct_doubles(), "three", elements_kind.fast);
smis = construct_smis();
doubles = construct_doubles();
convert_mixed(smis, 1, elements_kind.fast);
convert_mixed(doubles, 1, elements_kind.fast);
assertTrue(%HaveSameMap(smis, doubles));
if (%ICsAreEnabled()) {
// Test that allocation sites allocate correct elements kind initially based
// on previous transitions.
smis = construct_smis();
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.
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