[js-function] Remove deprecated predicates
Updated: IsOptimized -> HasAttachedOptimizedCode HasOptimizedCode -> HasAvailableOptimizedCode IsInterpreted -> ActiveTierIsIgnition Bug: v8:8888 Change-Id: I96363622b67b53371a974f1c17cef387093f053c Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2346404 Auto-Submit: Jakob Gruber <jgruber@chromium.org> Reviewed-by: Mythri Alle <mythria@chromium.org> Reviewed-by: Leszek Swirski <leszeks@chromium.org> Commit-Queue: Jakob Gruber <jgruber@chromium.org> Cr-Commit-Position: refs/heads/master@{#69326}
This commit is contained in:
parent
ee9e94238c
commit
b3a6b58630
@ -1006,8 +1006,7 @@ bool GetOptimizedCodeLater(std::unique_ptr<OptimizedCompilationJob> job,
|
||||
// Cached NCI code currently does not use the optimization marker field.
|
||||
function->SetOptimizationMarker(OptimizationMarker::kInOptimizationQueue);
|
||||
}
|
||||
DCHECK(function->IsInterpreted() ||
|
||||
(!function->is_compiled() && function->shared().IsInterpreted()));
|
||||
DCHECK(function->ActiveTierIsIgnition());
|
||||
DCHECK(function->shared().HasBytecodeArray());
|
||||
return true;
|
||||
}
|
||||
@ -1734,11 +1733,11 @@ bool Compiler::Compile(Handle<SharedFunctionInfo> shared_info,
|
||||
// static
|
||||
bool Compiler::Compile(Handle<JSFunction> function, ClearExceptionFlag flag,
|
||||
IsCompiledScope* is_compiled_scope) {
|
||||
// We should never reach here if the function is already compiled or optimized
|
||||
// We should never reach here if the function is already compiled or
|
||||
// optimized.
|
||||
DCHECK(!function->is_compiled());
|
||||
DCHECK(!function->IsOptimized());
|
||||
DCHECK(!function->HasOptimizationMarker());
|
||||
DCHECK(!function->HasOptimizedCode());
|
||||
DCHECK(!function->HasAvailableOptimizedCode());
|
||||
|
||||
// Reset the JSFunction if we are recompiling due to the bytecode having been
|
||||
// flushed.
|
||||
@ -1829,7 +1828,7 @@ bool Compiler::CompileOptimized(Handle<JSFunction> function,
|
||||
ConcurrencyMode mode, CodeKind code_kind) {
|
||||
DCHECK(CodeKindIsOptimizedJSFunction(code_kind));
|
||||
|
||||
if (function->IsOptimized()) return true;
|
||||
if (function->HasAttachedOptimizedCode()) return true;
|
||||
|
||||
Isolate* isolate = function->GetIsolate();
|
||||
DCHECK(AllowCompilation::IsAllowed(isolate));
|
||||
@ -2984,8 +2983,8 @@ void Compiler::PostInstantiation(Handle<JSFunction> function) {
|
||||
}
|
||||
|
||||
if (FLAG_always_opt && shared->allows_lazy_compilation() &&
|
||||
!shared->optimization_disabled() && !function->IsOptimized() &&
|
||||
!function->HasOptimizedCode()) {
|
||||
!shared->optimization_disabled() &&
|
||||
!function->HasAvailableOptimizedCode()) {
|
||||
JSFunction::EnsureFeedbackVector(function, &is_compiled_scope);
|
||||
function->MarkForOptimization(ConcurrencyMode::kNotConcurrent);
|
||||
}
|
||||
|
@ -214,7 +214,7 @@ void OptimizingCompileDispatcher::InstallOptimizedFunctions() {
|
||||
}
|
||||
OptimizedCompilationInfo* info = job->compilation_info();
|
||||
Handle<JSFunction> function(*info->closure(), isolate_);
|
||||
if (function->HasOptimizedCode()) {
|
||||
if (function->HasAvailableOptimizedCode()) {
|
||||
if (FLAG_trace_concurrent_recompilation) {
|
||||
PrintF(" ** Aborting compilation for ");
|
||||
function->ShortPrint();
|
||||
|
@ -320,7 +320,7 @@ class V8_EXPORT_PRIVATE JSFunctionRef : public JSObjectRef {
|
||||
bool has_feedback_vector() const;
|
||||
bool has_initial_map() const;
|
||||
bool has_prototype() const;
|
||||
bool IsOptimized() const;
|
||||
bool HasAttachedOptimizedCode() const;
|
||||
bool PrototypeRequiresRuntimeLookup() const;
|
||||
|
||||
void Serialize();
|
||||
|
@ -615,7 +615,7 @@ class JSFunctionData : public JSObjectData {
|
||||
bool has_feedback_vector() const { return has_feedback_vector_; }
|
||||
bool has_initial_map() const { return has_initial_map_; }
|
||||
bool has_prototype() const { return has_prototype_; }
|
||||
bool IsOptimized() const { return is_optimized_; }
|
||||
bool HasAttachedOptimizedCode() const { return has_attached_optimized_code_; }
|
||||
bool PrototypeRequiresRuntimeLookup() const {
|
||||
return PrototypeRequiresRuntimeLookup_;
|
||||
}
|
||||
@ -639,7 +639,7 @@ class JSFunctionData : public JSObjectData {
|
||||
bool has_feedback_vector_;
|
||||
bool has_initial_map_;
|
||||
bool has_prototype_;
|
||||
bool is_optimized_;
|
||||
bool has_attached_optimized_code_;
|
||||
bool PrototypeRequiresRuntimeLookup_;
|
||||
|
||||
bool serialized_ = false;
|
||||
@ -1270,7 +1270,7 @@ JSFunctionData::JSFunctionData(JSHeapBroker* broker, ObjectData** storage,
|
||||
has_initial_map_(object->has_prototype_slot() &&
|
||||
object->has_initial_map()),
|
||||
has_prototype_(object->has_prototype_slot() && object->has_prototype()),
|
||||
is_optimized_(object->IsOptimized()),
|
||||
has_attached_optimized_code_(object->HasAttachedOptimizedCode()),
|
||||
PrototypeRequiresRuntimeLookup_(
|
||||
object->PrototypeRequiresRuntimeLookup()) {}
|
||||
|
||||
@ -3402,7 +3402,7 @@ BIMODAL_ACCESSOR_C(JSDataView, size_t, byte_offset)
|
||||
BIMODAL_ACCESSOR_C(JSFunction, bool, has_feedback_vector)
|
||||
BIMODAL_ACCESSOR_C(JSFunction, bool, has_initial_map)
|
||||
BIMODAL_ACCESSOR_C(JSFunction, bool, has_prototype)
|
||||
BIMODAL_ACCESSOR_C(JSFunction, bool, IsOptimized)
|
||||
BIMODAL_ACCESSOR_C(JSFunction, bool, HasAttachedOptimizedCode)
|
||||
BIMODAL_ACCESSOR_C(JSFunction, bool, PrototypeRequiresRuntimeLookup)
|
||||
BIMODAL_ACCESSOR(JSFunction, Context, context)
|
||||
BIMODAL_ACCESSOR(JSFunction, NativeContext, native_context)
|
||||
|
@ -204,7 +204,7 @@ Reduction JSInliningHeuristic::Reduce(Node* node) {
|
||||
unsigned inlined_bytecode_size = 0;
|
||||
if (candidate.functions[i].has_value()) {
|
||||
JSFunctionRef function = candidate.functions[i].value();
|
||||
if (function.IsOptimized()) {
|
||||
if (function.HasAttachedOptimizedCode()) {
|
||||
inlined_bytecode_size = function.code().inlined_bytecode_size();
|
||||
candidate.total_size += inlined_bytecode_size;
|
||||
}
|
||||
@ -793,7 +793,7 @@ void JSInliningHeuristic::PrintCandidates() {
|
||||
os << ", bytecode size: " << candidate.bytecode[i]->length();
|
||||
if (candidate.functions[i].has_value()) {
|
||||
JSFunctionRef function = candidate.functions[i].value();
|
||||
if (function.IsOptimized()) {
|
||||
if (function.HasAttachedOptimizedCode()) {
|
||||
os << ", existing opt code's inlined bytecode size: "
|
||||
<< function.code().inlined_bytecode_size();
|
||||
}
|
||||
|
@ -1272,7 +1272,7 @@ void JSFunction::JSFunctionPrint(std::ostream& os) { // NOLINT
|
||||
|
||||
// Print Builtin name for builtin functions
|
||||
int builtin_index = code().builtin_index();
|
||||
if (Builtins::IsBuiltinId(builtin_index) && !IsInterpreted()) {
|
||||
if (Builtins::IsBuiltinId(builtin_index)) {
|
||||
os << "\n - builtin: " << isolate->builtins()->name(builtin_index);
|
||||
}
|
||||
|
||||
@ -1284,7 +1284,7 @@ void JSFunction::JSFunctionPrint(std::ostream& os) { // NOLINT
|
||||
os << "\n - kind: " << shared().kind();
|
||||
os << "\n - context: " << Brief(context());
|
||||
os << "\n - code: " << Brief(code());
|
||||
if (IsInterpreted()) {
|
||||
if (ActiveTierIsIgnition()) {
|
||||
os << "\n - interpreted";
|
||||
if (shared().HasBytecodeArray()) {
|
||||
os << "\n - bytecode: " << shared().GetBytecodeArray();
|
||||
|
@ -1188,7 +1188,7 @@ void JavaScriptFrame::PrintFunctionAndOffset(JSFunction function,
|
||||
AbstractCode code, int code_offset,
|
||||
FILE* file,
|
||||
bool print_line_number) {
|
||||
PrintF(file, "%s", function.IsOptimized() ? "*" : "~");
|
||||
PrintF(file, "%s", CodeKindIsOptimizedJSFunction(code.kind()) ? "*" : "~");
|
||||
function.PrintName(file);
|
||||
PrintF(file, "+%d", code_offset);
|
||||
if (print_line_number) {
|
||||
|
@ -174,7 +174,7 @@ bool RuntimeProfiler::MaybeOSR(JSFunction function, InterpretedFrame* frame) {
|
||||
|
||||
if (function.IsMarkedForOptimization() ||
|
||||
function.IsMarkedForConcurrentOptimization() ||
|
||||
function.HasOptimizedCode()) {
|
||||
function.HasAvailableOptimizedCode()) {
|
||||
// Attempt OSR if we are still running interpreted code even though the
|
||||
// the function has long been marked or even already been optimized.
|
||||
int64_t allowance =
|
||||
@ -190,7 +190,9 @@ bool RuntimeProfiler::MaybeOSR(JSFunction function, InterpretedFrame* frame) {
|
||||
|
||||
OptimizationReason RuntimeProfiler::ShouldOptimize(JSFunction function,
|
||||
BytecodeArray bytecode) {
|
||||
if (function.HasOptimizedCode()) return OptimizationReason::kDoNotOptimize;
|
||||
if (function.HasAvailableOptimizedCode()) {
|
||||
return OptimizationReason::kDoNotOptimize;
|
||||
}
|
||||
int ticks = function.feedback_vector().profiler_ticks();
|
||||
int ticks_for_optimization =
|
||||
kProfilerTicksBeforeOptimization +
|
||||
|
@ -82,7 +82,7 @@ const char* ICStats::GetOrCacheFunctionName(JSFunction function) {
|
||||
return function_name_map_[function_ptr].get();
|
||||
}
|
||||
SharedFunctionInfo shared = function.shared();
|
||||
ic_infos_[pos_].is_optimized = function.IsOptimized();
|
||||
ic_infos_[pos_].is_optimized = function.HasAttachedOptimizedCode();
|
||||
char* function_name = shared.DebugName().ToCString().release();
|
||||
function_name_map_.insert(
|
||||
std::make_pair(function_ptr, std::unique_ptr<char[]>(function_name)));
|
||||
|
@ -132,7 +132,7 @@ void IC::TraceIC(const char* type, Handle<Object> name, State old_state,
|
||||
ic_info.type += type;
|
||||
|
||||
int code_offset = 0;
|
||||
if (function.IsInterpreted()) {
|
||||
if (function.ActiveTierIsIgnition()) {
|
||||
code_offset = InterpretedFrame::GetBytecodeOffset(frame->fp());
|
||||
} else {
|
||||
code_offset =
|
||||
|
@ -1791,8 +1791,8 @@ static int EnumerateCompiledFunctions(Heap* heap,
|
||||
}
|
||||
// TODO(jarin) This leaves out deoptimized code that might still be on the
|
||||
// stack. Also note that we will not log optimized code objects that are
|
||||
// only on a type feedback vector. We should make this mroe precise.
|
||||
if (function.IsOptimized()) {
|
||||
// only on a type feedback vector. We should make this more precise.
|
||||
if (function.HasAttachedOptimizedCode()) {
|
||||
AddFunctionAndCode(sfi, AbstractCode::cast(function.code()), sfis,
|
||||
code_objects, compiled_funcs_count);
|
||||
++compiled_funcs_count;
|
||||
|
@ -145,11 +145,6 @@ bool JSFunction::ActiveTierIsNCI() const {
|
||||
return result;
|
||||
}
|
||||
|
||||
// TODO(jgruber): Replace these functions with the called functions.
|
||||
bool JSFunction::IsOptimized() { return HasAttachedOptimizedCode(); }
|
||||
bool JSFunction::HasOptimizedCode() { return HasAvailableOptimizedCode(); }
|
||||
bool JSFunction::IsInterpreted() { return ActiveTierIsIgnition(); }
|
||||
|
||||
bool JSFunction::HasOptimizationMarker() {
|
||||
return has_feedback_vector() && feedback_vector().has_optimization_marker();
|
||||
}
|
||||
@ -187,7 +182,7 @@ void JSFunction::CompleteInobjectSlackTrackingIfActive() {
|
||||
}
|
||||
|
||||
AbstractCode JSFunction::abstract_code() {
|
||||
if (IsInterpreted()) {
|
||||
if (ActiveTierIsIgnition()) {
|
||||
return AbstractCode::cast(shared().GetBytecodeArray());
|
||||
} else {
|
||||
return AbstractCode::cast(code());
|
||||
@ -242,7 +237,7 @@ void JSFunction::ClearOptimizedCodeSlot(const char* reason) {
|
||||
void JSFunction::SetOptimizationMarker(OptimizationMarker marker) {
|
||||
DCHECK(has_feedback_vector());
|
||||
DCHECK(ChecksOptimizationMarker());
|
||||
DCHECK(!HasOptimizedCode());
|
||||
DCHECK(!HasAvailableOptimizedCode());
|
||||
|
||||
feedback_vector().SetOptimizationMarker(marker);
|
||||
}
|
||||
@ -463,10 +458,9 @@ void JSFunction::MarkForOptimization(ConcurrencyMode mode) {
|
||||
mode = ConcurrencyMode::kNotConcurrent;
|
||||
}
|
||||
|
||||
DCHECK(!is_compiled() || IsInterpreted());
|
||||
DCHECK(!is_compiled() || ActiveTierIsIgnition());
|
||||
DCHECK(shared().IsInterpreted());
|
||||
DCHECK(!IsOptimized());
|
||||
DCHECK(!HasOptimizedCode());
|
||||
DCHECK(!HasAvailableOptimizedCode());
|
||||
DCHECK(shared().allows_lazy_compilation() ||
|
||||
!shared().optimization_disabled());
|
||||
|
||||
|
@ -107,31 +107,13 @@ class JSFunction : public JSFunctionOrBoundFunction {
|
||||
// will happen on its next activation.
|
||||
|
||||
// True, iff any generated code kind is attached/available to this function.
|
||||
bool HasAttachedOptimizedCode() const;
|
||||
V8_EXPORT_PRIVATE bool HasAttachedOptimizedCode() const;
|
||||
bool HasAvailableOptimizedCode() const;
|
||||
|
||||
bool ActiveTierIsIgnition() const;
|
||||
V8_EXPORT_PRIVATE bool ActiveTierIsIgnition() const;
|
||||
bool ActiveTierIsTurbofan() const;
|
||||
bool ActiveTierIsNCI() const;
|
||||
|
||||
// Tells whether or not this function is interpreted.
|
||||
//
|
||||
// Note: function->IsInterpreted() does not necessarily return the same value
|
||||
// as function->shared()->IsInterpreted() because the closure might have been
|
||||
// optimized.
|
||||
V8_EXPORT_PRIVATE bool IsInterpreted();
|
||||
|
||||
// Tells whether or not this function holds optimized code.
|
||||
//
|
||||
// Note: Returning false does not necessarily mean that this function hasn't
|
||||
// been optimized, as it may have optimized code on its feedback vector.
|
||||
V8_EXPORT_PRIVATE bool IsOptimized();
|
||||
|
||||
// Tells whether or not this function has optimized code available to it,
|
||||
// either because it is optimized or because it has optimized code in its
|
||||
// feedback vector.
|
||||
bool HasOptimizedCode();
|
||||
|
||||
// Tells whether or not this function checks its optimization marker in its
|
||||
// feedback vector.
|
||||
bool ChecksOptimizationMarker();
|
||||
|
@ -316,7 +316,7 @@ RUNTIME_FUNCTION(Runtime_CompileForOnStackReplacement) {
|
||||
// the function for non-concurrent compilation. We could arm the loops
|
||||
// early so the second execution uses the already compiled OSR code and
|
||||
// the optimization occurs concurrently off main thread.
|
||||
if (!function->HasOptimizedCode() &&
|
||||
if (!function->HasAvailableOptimizedCode() &&
|
||||
function->feedback_vector().invocation_count() > 1) {
|
||||
// If we're not already optimized, set to optimize non-concurrently on
|
||||
// the next call, otherwise we'd run unoptimized once more and
|
||||
@ -341,7 +341,7 @@ RUNTIME_FUNCTION(Runtime_CompileForOnStackReplacement) {
|
||||
PrintF(scope.file(), " at AST id %d]\n", ast_id.ToInt());
|
||||
}
|
||||
|
||||
if (!function->IsOptimized()) {
|
||||
if (!function->HasAttachedOptimizedCode()) {
|
||||
function->set_code(function->shared().GetCode());
|
||||
}
|
||||
return Object();
|
||||
|
@ -188,7 +188,7 @@ RUNTIME_FUNCTION(Runtime_DeoptimizeFunction) {
|
||||
if (!function_object->IsJSFunction()) return CrashUnlessFuzzing(isolate);
|
||||
Handle<JSFunction> function = Handle<JSFunction>::cast(function_object);
|
||||
|
||||
if (function->IsOptimized()) {
|
||||
if (function->HasAttachedOptimizedCode()) {
|
||||
Deoptimizer::DeoptimizeFunction(*function);
|
||||
}
|
||||
|
||||
@ -206,7 +206,7 @@ RUNTIME_FUNCTION(Runtime_DeoptimizeNow) {
|
||||
if (!it.done()) function = handle(it.frame()->function(), isolate);
|
||||
if (function.is_null()) return CrashUnlessFuzzing(isolate);
|
||||
|
||||
if (function->IsOptimized()) {
|
||||
if (function->HasAttachedOptimizedCode()) {
|
||||
Deoptimizer::DeoptimizeFunction(*function);
|
||||
}
|
||||
|
||||
@ -297,8 +297,9 @@ RUNTIME_FUNCTION(Runtime_OptimizeFunctionOnNextCall) {
|
||||
PendingOptimizationTable::MarkedForOptimization(isolate, function);
|
||||
}
|
||||
|
||||
if (function->HasOptimizedCode()) {
|
||||
DCHECK(function->IsOptimized() || function->ChecksOptimizationMarker());
|
||||
if (function->HasAvailableOptimizedCode()) {
|
||||
DCHECK(function->HasAttachedOptimizedCode() ||
|
||||
function->ChecksOptimizationMarker());
|
||||
if (FLAG_testing_d8_test_runner) {
|
||||
PendingOptimizationTable::FunctionWasOptimized(isolate, function);
|
||||
}
|
||||
@ -448,8 +449,9 @@ RUNTIME_FUNCTION(Runtime_OptimizeOsr) {
|
||||
PendingOptimizationTable::MarkedForOptimization(isolate, function);
|
||||
}
|
||||
|
||||
if (function->HasOptimizedCode()) {
|
||||
DCHECK(function->IsOptimized() || function->ChecksOptimizationMarker());
|
||||
if (function->HasAvailableOptimizedCode()) {
|
||||
DCHECK(function->HasAttachedOptimizedCode() ||
|
||||
function->ChecksOptimizationMarker());
|
||||
// If function is already optimized, remove the bytecode array from the
|
||||
// pending optimize for test table and return.
|
||||
if (FLAG_testing_d8_test_runner) {
|
||||
@ -555,7 +557,7 @@ RUNTIME_FUNCTION(Runtime_GetOptimizationStatus) {
|
||||
status |= static_cast<int>(OptimizationStatus::kOptimizingConcurrently);
|
||||
}
|
||||
|
||||
if (function->IsOptimized()) {
|
||||
if (function->HasAttachedOptimizedCode()) {
|
||||
if (function->code().marked_for_deoptimization()) {
|
||||
status |= static_cast<int>(OptimizationStatus::kMarkedForDeoptimization);
|
||||
} else {
|
||||
@ -565,7 +567,7 @@ RUNTIME_FUNCTION(Runtime_GetOptimizationStatus) {
|
||||
status |= static_cast<int>(OptimizationStatus::kTurboFanned);
|
||||
}
|
||||
}
|
||||
if (function->IsInterpreted()) {
|
||||
if (function->ActiveTierIsIgnition()) {
|
||||
status |= static_cast<int>(OptimizationStatus::kInterpreted);
|
||||
}
|
||||
|
||||
|
@ -2259,7 +2259,7 @@ TEST(InstanceOfStubWriteBarrier) {
|
||||
v8::Utils::OpenHandle(*v8::Local<v8::Function>::Cast(
|
||||
CcTest::global()->Get(ctx, v8_str("f")).ToLocalChecked())));
|
||||
|
||||
CHECK(f->IsOptimized());
|
||||
CHECK(f->HasAttachedOptimizedCode());
|
||||
|
||||
IncrementalMarking::MarkingState* marking_state = marking->marking_state();
|
||||
|
||||
|
@ -27696,7 +27696,7 @@ void CallAndDeopt() {
|
||||
CHECK(function->IsFunction());
|
||||
i::Handle<i::JSFunction> ifunction =
|
||||
i::Handle<i::JSFunction>::cast(v8::Utils::OpenHandle(*function));
|
||||
CHECK(ifunction->IsOptimized());
|
||||
CHECK(ifunction->HasAttachedOptimizedCode());
|
||||
}
|
||||
|
||||
void CallNoFallback(int32_t expected_value) {
|
||||
|
@ -333,7 +333,7 @@ TEST(FeedbackVectorPreservedAcrossRecompiles) {
|
||||
|
||||
// Verify that the feedback is still "gathered" despite a recompilation
|
||||
// of the full code.
|
||||
CHECK(f->IsOptimized());
|
||||
CHECK(f->HasAttachedOptimizedCode());
|
||||
object = f->feedback_vector().Get(slot_for_a);
|
||||
{
|
||||
HeapObject heap_object;
|
||||
@ -413,8 +413,10 @@ TEST(OptimizedCodeSharing1) {
|
||||
env->Global()
|
||||
->Get(env.local(), v8_str("closure2"))
|
||||
.ToLocalChecked())));
|
||||
CHECK(fun1->IsOptimized() || !CcTest::i_isolate()->use_optimizer());
|
||||
CHECK(fun2->IsOptimized() || !CcTest::i_isolate()->use_optimizer());
|
||||
CHECK(fun1->HasAttachedOptimizedCode() ||
|
||||
!CcTest::i_isolate()->use_optimizer());
|
||||
CHECK(fun2->HasAttachedOptimizedCode() ||
|
||||
!CcTest::i_isolate()->use_optimizer());
|
||||
CHECK_EQ(fun1->code(), fun2->code());
|
||||
}
|
||||
}
|
||||
@ -1053,7 +1055,7 @@ TEST(DecideToPretenureDuringCompilation) {
|
||||
.ToHandleChecked();
|
||||
Handle<JSFunction> bar = Handle<JSFunction>::cast(foo_obj);
|
||||
|
||||
CHECK(bar->IsOptimized());
|
||||
CHECK(bar->HasAttachedOptimizedCode());
|
||||
}
|
||||
}
|
||||
isolate->Exit();
|
||||
|
@ -1150,7 +1150,7 @@ static void TickLines(bool optimize) {
|
||||
v8::Utils::OpenHandle(*GetFunction(env.local(), func_name)));
|
||||
CHECK(!func->shared().is_null());
|
||||
CHECK(!func->shared().abstract_code().is_null());
|
||||
CHECK(!optimize || func->IsOptimized() ||
|
||||
CHECK(!optimize || func->HasAttachedOptimizedCode() ||
|
||||
!CcTest::i_isolate()->use_optimizer());
|
||||
i::Handle<i::AbstractCode> code(func->abstract_code(), isolate);
|
||||
CHECK(!code->is_null());
|
||||
@ -3592,7 +3592,7 @@ int GetSourcePositionEntryCount(i::Isolate* isolate, const char* source,
|
||||
std::unordered_set<int64_t> raw_position_set;
|
||||
i::Handle<i::JSFunction> function = i::Handle<i::JSFunction>::cast(
|
||||
v8::Utils::OpenHandle(*CompileRun(source)));
|
||||
if (function->IsInterpreted()) return -1;
|
||||
if (function->ActiveTierIsIgnition()) return -1;
|
||||
i::Handle<i::Code> code(function->code(), isolate);
|
||||
i::SourcePositionTableIterator iterator(
|
||||
ByteArray::cast(code->source_position_table()));
|
||||
|
@ -125,7 +125,7 @@ TEST(DeoptimizeSimple) {
|
||||
.ToLocalChecked()
|
||||
->Int32Value(env.local())
|
||||
.FromJust());
|
||||
CHECK(!GetJSFunction(env.local(), "f")->IsOptimized());
|
||||
CHECK(!GetJSFunction(env.local(), "f")->HasAttachedOptimizedCode());
|
||||
CHECK_EQ(0, Deoptimizer::GetDeoptimizedCodeCount(CcTest::i_isolate()));
|
||||
|
||||
// Test lazy deoptimization of a simple function. Call the function after the
|
||||
@ -145,7 +145,7 @@ TEST(DeoptimizeSimple) {
|
||||
.ToLocalChecked()
|
||||
->Int32Value(env.local())
|
||||
.FromJust());
|
||||
CHECK(!GetJSFunction(env.local(), "f")->IsOptimized());
|
||||
CHECK(!GetJSFunction(env.local(), "f")->HasAttachedOptimizedCode());
|
||||
CHECK_EQ(0, Deoptimizer::GetDeoptimizedCodeCount(CcTest::i_isolate()));
|
||||
}
|
||||
|
||||
@ -172,7 +172,7 @@ TEST(DeoptimizeSimpleWithArguments) {
|
||||
.ToLocalChecked()
|
||||
->Int32Value(env.local())
|
||||
.FromJust());
|
||||
CHECK(!GetJSFunction(env.local(), "f")->IsOptimized());
|
||||
CHECK(!GetJSFunction(env.local(), "f")->HasAttachedOptimizedCode());
|
||||
CHECK_EQ(0, Deoptimizer::GetDeoptimizedCodeCount(CcTest::i_isolate()));
|
||||
|
||||
// Test lazy deoptimization of a simple function with some arguments. Call the
|
||||
@ -193,7 +193,7 @@ TEST(DeoptimizeSimpleWithArguments) {
|
||||
.ToLocalChecked()
|
||||
->Int32Value(env.local())
|
||||
.FromJust());
|
||||
CHECK(!GetJSFunction(env.local(), "f")->IsOptimized());
|
||||
CHECK(!GetJSFunction(env.local(), "f")->HasAttachedOptimizedCode());
|
||||
CHECK_EQ(0, Deoptimizer::GetDeoptimizedCodeCount(CcTest::i_isolate()));
|
||||
}
|
||||
|
||||
@ -226,7 +226,7 @@ TEST(DeoptimizeSimpleNested) {
|
||||
.ToLocalChecked()
|
||||
->Int32Value(env.local())
|
||||
.FromJust());
|
||||
CHECK(!GetJSFunction(env.local(), "f")->IsOptimized());
|
||||
CHECK(!GetJSFunction(env.local(), "f")->HasAttachedOptimizedCode());
|
||||
CHECK_EQ(0, Deoptimizer::GetDeoptimizedCodeCount(CcTest::i_isolate()));
|
||||
}
|
||||
}
|
||||
@ -437,7 +437,7 @@ UNINITIALIZED_TEST(DeoptimizeBinaryOperationADDString) {
|
||||
CompileRun(f_source);
|
||||
CompileRun("f('a+', new X());");
|
||||
CHECK(!i_isolate->use_optimizer() ||
|
||||
GetJSFunction(env.local(), "f")->IsOptimized());
|
||||
GetJSFunction(env.local(), "f")->HasAttachedOptimizedCode());
|
||||
|
||||
// Call f and force deoptimization while processing the binary operation.
|
||||
CompileRun(
|
||||
@ -446,7 +446,7 @@ UNINITIALIZED_TEST(DeoptimizeBinaryOperationADDString) {
|
||||
}
|
||||
CcTest::CollectAllGarbage(i_isolate);
|
||||
|
||||
CHECK(!GetJSFunction(env.local(), "f")->IsOptimized());
|
||||
CHECK(!GetJSFunction(env.local(), "f")->HasAttachedOptimizedCode());
|
||||
CHECK_EQ(1, env->Global()
|
||||
->Get(env.local(), v8_str("count"))
|
||||
.ToLocalChecked()
|
||||
@ -499,13 +499,13 @@ static void TestDeoptimizeBinaryOpHelper(LocalContext* env,
|
||||
CompileRun(f_source);
|
||||
CompileRun("f(7, new X());");
|
||||
CHECK(!i_isolate->use_optimizer() ||
|
||||
GetJSFunction((*env).local(), "f")->IsOptimized());
|
||||
GetJSFunction((*env).local(), "f")->HasAttachedOptimizedCode());
|
||||
|
||||
// Call f and force deoptimization while processing the binary operation.
|
||||
CompileRun("deopt = true;"
|
||||
"var result = f(7, new X());");
|
||||
CcTest::CollectAllGarbage(i_isolate);
|
||||
CHECK(!GetJSFunction((*env).local(), "f")->IsOptimized());
|
||||
CHECK(!GetJSFunction((*env).local(), "f")->HasAttachedOptimizedCode());
|
||||
}
|
||||
|
||||
|
||||
@ -702,7 +702,7 @@ UNINITIALIZED_TEST(DeoptimizeCompare) {
|
||||
CompileRun(f_source);
|
||||
CompileRun("f('a', new X());");
|
||||
CHECK(!i_isolate->use_optimizer() ||
|
||||
GetJSFunction(env.local(), "f")->IsOptimized());
|
||||
GetJSFunction(env.local(), "f")->HasAttachedOptimizedCode());
|
||||
|
||||
// Call f and force deoptimization while processing the comparison.
|
||||
CompileRun(
|
||||
@ -711,7 +711,7 @@ UNINITIALIZED_TEST(DeoptimizeCompare) {
|
||||
}
|
||||
CcTest::CollectAllGarbage(i_isolate);
|
||||
|
||||
CHECK(!GetJSFunction(env.local(), "f")->IsOptimized());
|
||||
CHECK(!GetJSFunction(env.local(), "f")->HasAttachedOptimizedCode());
|
||||
CHECK_EQ(1, env->Global()
|
||||
->Get(env.local(), v8_str("count"))
|
||||
.ToLocalChecked()
|
||||
@ -793,10 +793,10 @@ UNINITIALIZED_TEST(DeoptimizeLoadICStoreIC) {
|
||||
CompileRun("f2(new X(), 'z');");
|
||||
CompileRun("g2(new X(), 'z');");
|
||||
if (i_isolate->use_optimizer()) {
|
||||
CHECK(GetJSFunction(env.local(), "f1")->IsOptimized());
|
||||
CHECK(GetJSFunction(env.local(), "g1")->IsOptimized());
|
||||
CHECK(GetJSFunction(env.local(), "f2")->IsOptimized());
|
||||
CHECK(GetJSFunction(env.local(), "g2")->IsOptimized());
|
||||
CHECK(GetJSFunction(env.local(), "f1")->HasAttachedOptimizedCode());
|
||||
CHECK(GetJSFunction(env.local(), "g1")->HasAttachedOptimizedCode());
|
||||
CHECK(GetJSFunction(env.local(), "f2")->HasAttachedOptimizedCode());
|
||||
CHECK(GetJSFunction(env.local(), "g2")->HasAttachedOptimizedCode());
|
||||
}
|
||||
|
||||
// Call functions and force deoptimization while processing the ics.
|
||||
@ -809,10 +809,10 @@ UNINITIALIZED_TEST(DeoptimizeLoadICStoreIC) {
|
||||
}
|
||||
CcTest::CollectAllGarbage(i_isolate);
|
||||
|
||||
CHECK(!GetJSFunction(env.local(), "f1")->IsOptimized());
|
||||
CHECK(!GetJSFunction(env.local(), "g1")->IsOptimized());
|
||||
CHECK(!GetJSFunction(env.local(), "f2")->IsOptimized());
|
||||
CHECK(!GetJSFunction(env.local(), "g2")->IsOptimized());
|
||||
CHECK(!GetJSFunction(env.local(), "f1")->HasAttachedOptimizedCode());
|
||||
CHECK(!GetJSFunction(env.local(), "g1")->HasAttachedOptimizedCode());
|
||||
CHECK(!GetJSFunction(env.local(), "f2")->HasAttachedOptimizedCode());
|
||||
CHECK(!GetJSFunction(env.local(), "g2")->HasAttachedOptimizedCode());
|
||||
CHECK_EQ(4, env->Global()
|
||||
->Get(env.local(), v8_str("count"))
|
||||
.ToLocalChecked()
|
||||
@ -898,10 +898,10 @@ UNINITIALIZED_TEST(DeoptimizeLoadICStoreICNested) {
|
||||
CompileRun("f2(new X(), 'z');");
|
||||
CompileRun("g2(new X(), 'z');");
|
||||
if (i_isolate->use_optimizer()) {
|
||||
CHECK(GetJSFunction(env.local(), "f1")->IsOptimized());
|
||||
CHECK(GetJSFunction(env.local(), "g1")->IsOptimized());
|
||||
CHECK(GetJSFunction(env.local(), "f2")->IsOptimized());
|
||||
CHECK(GetJSFunction(env.local(), "g2")->IsOptimized());
|
||||
CHECK(GetJSFunction(env.local(), "f1")->HasAttachedOptimizedCode());
|
||||
CHECK(GetJSFunction(env.local(), "g1")->HasAttachedOptimizedCode());
|
||||
CHECK(GetJSFunction(env.local(), "f2")->HasAttachedOptimizedCode());
|
||||
CHECK(GetJSFunction(env.local(), "g2")->HasAttachedOptimizedCode());
|
||||
}
|
||||
|
||||
// Call functions and force deoptimization while processing the ics.
|
||||
@ -911,10 +911,10 @@ UNINITIALIZED_TEST(DeoptimizeLoadICStoreICNested) {
|
||||
}
|
||||
CcTest::CollectAllGarbage(i_isolate);
|
||||
|
||||
CHECK(!GetJSFunction(env.local(), "f1")->IsOptimized());
|
||||
CHECK(!GetJSFunction(env.local(), "g1")->IsOptimized());
|
||||
CHECK(!GetJSFunction(env.local(), "f2")->IsOptimized());
|
||||
CHECK(!GetJSFunction(env.local(), "g2")->IsOptimized());
|
||||
CHECK(!GetJSFunction(env.local(), "f1")->HasAttachedOptimizedCode());
|
||||
CHECK(!GetJSFunction(env.local(), "g1")->HasAttachedOptimizedCode());
|
||||
CHECK(!GetJSFunction(env.local(), "f2")->HasAttachedOptimizedCode());
|
||||
CHECK(!GetJSFunction(env.local(), "g2")->HasAttachedOptimizedCode());
|
||||
CHECK_EQ(1, env->Global()
|
||||
->Get(env.local(), v8_str("count"))
|
||||
.ToLocalChecked()
|
||||
|
Loading…
Reference in New Issue
Block a user