[sparkplug] CompileWithBaseline to Compiler::CompileBaseline
Move the CompileWithBaseline interface to the Compiler class, as CompileBaseline, which will do the additional work of pre-compiling to bytecode, ensuring there is a feedback vector, and setting the code on the function closure. As a drive-by, fix v8_enable_trace_unoptimized to have a blank default value, so that v8_enable_trace_ignition/v8_enable_trace_baseline_exec can set it. Bug: v8:11420, v8:11429 Change-Id: If715161de71f7d9300f3fdcbb50cc678b1fcdfdf Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2697352 Reviewed-by: Ross McIlroy <rmcilroy@chromium.org> Commit-Queue: Leszek Swirski <leszeks@chromium.org> Auto-Submit: Leszek Swirski <leszeks@chromium.org> Cr-Commit-Position: refs/heads/master@{#72819}
This commit is contained in:
parent
effb071867
commit
d0136a5caa
8
BUILD.gn
8
BUILD.gn
@ -125,9 +125,9 @@ declare_args() {
|
|||||||
v8_enable_v8_checks = ""
|
v8_enable_v8_checks = ""
|
||||||
|
|
||||||
# Sets -dV8_TRACE_UNOPTIMIZED.
|
# Sets -dV8_TRACE_UNOPTIMIZED.
|
||||||
v8_enable_trace_unoptimized = false
|
v8_enable_trace_unoptimized = ""
|
||||||
v8_enable_trace_ignition = false
|
v8_enable_trace_ignition = false
|
||||||
v8_enable_trace_baseline = false
|
v8_enable_trace_baseline_exec = false
|
||||||
|
|
||||||
# Sets -dV8_TRACE_FEEDBACK_UPDATES.
|
# Sets -dV8_TRACE_FEEDBACK_UPDATES.
|
||||||
v8_enable_trace_feedback_updates = false
|
v8_enable_trace_feedback_updates = false
|
||||||
@ -358,11 +358,11 @@ assert(!v8_enable_concurrent_marking || v8_enable_atomic_marking_state,
|
|||||||
"Concurrent marking requires atomic marking state.")
|
"Concurrent marking requires atomic marking state.")
|
||||||
if (v8_enable_trace_unoptimized == "") {
|
if (v8_enable_trace_unoptimized == "") {
|
||||||
v8_enable_trace_unoptimized =
|
v8_enable_trace_unoptimized =
|
||||||
v8_enable_trace_ignition || v8_enable_trace_baseline
|
v8_enable_trace_ignition || v8_enable_trace_baseline_exec
|
||||||
}
|
}
|
||||||
assert(!v8_enable_trace_ignition || v8_enable_trace_unoptimized,
|
assert(!v8_enable_trace_ignition || v8_enable_trace_unoptimized,
|
||||||
"Ignition tracing requires unoptimized tracing to be enabled.")
|
"Ignition tracing requires unoptimized tracing to be enabled.")
|
||||||
assert(!v8_enable_trace_baseline || v8_enable_trace_unoptimized,
|
assert(!v8_enable_trace_baseline_exec || v8_enable_trace_unoptimized,
|
||||||
"Baseline tracing requires unoptimized tracing to be enabled.")
|
"Baseline tracing requires unoptimized tracing to be enabled.")
|
||||||
|
|
||||||
# Toggle pointer compression for correctness fuzzing when building the
|
# Toggle pointer compression for correctness fuzzing when building the
|
||||||
|
@ -551,7 +551,7 @@ void BaselineCompiler::VerifyFrame() {
|
|||||||
|
|
||||||
#ifdef V8_TRACE_UNOPTIMIZED
|
#ifdef V8_TRACE_UNOPTIMIZED
|
||||||
void BaselineCompiler::TraceBytecode(Runtime::FunctionId function_id) {
|
void BaselineCompiler::TraceBytecode(Runtime::FunctionId function_id) {
|
||||||
if (!FLAG_trace_baseline) return;
|
if (!FLAG_trace_baseline_exec) return;
|
||||||
|
|
||||||
__ RecordComment(function_id == Runtime::kTraceUnoptimizedBytecodeEntry
|
__ RecordComment(function_id == Runtime::kTraceUnoptimizedBytecodeEntry
|
||||||
? "[ Trace bytecode entry"
|
? "[ Trace bytecode entry"
|
||||||
|
@ -17,62 +17,18 @@
|
|||||||
namespace v8 {
|
namespace v8 {
|
||||||
namespace internal {
|
namespace internal {
|
||||||
|
|
||||||
Handle<Code> CompileWithBaseline(
|
Handle<Code> GenerateBaselineCode(Isolate* isolate,
|
||||||
Isolate* isolate, Handle<SharedFunctionInfo> shared_function_info,
|
Handle<SharedFunctionInfo> shared) {
|
||||||
Handle<BytecodeArray> bytecode) {
|
|
||||||
RuntimeCallTimerScope runtimeTimer(isolate,
|
RuntimeCallTimerScope runtimeTimer(isolate,
|
||||||
RuntimeCallCounterId::kCompileBaseline);
|
RuntimeCallCounterId::kCompileBaseline);
|
||||||
baseline::BaselineCompiler compiler(isolate, shared_function_info, bytecode);
|
baseline::BaselineCompiler compiler(
|
||||||
|
isolate, shared, handle(shared->GetBytecodeArray(isolate), isolate));
|
||||||
|
|
||||||
compiler.GenerateCode();
|
compiler.GenerateCode();
|
||||||
|
Handle<Code> code = compiler.Build(isolate);
|
||||||
return compiler.Build(isolate);
|
|
||||||
}
|
|
||||||
|
|
||||||
// TODO(v8:11429): This can be the basis of Compiler::CompileBaseline
|
|
||||||
Handle<Code> CompileWithBaseline(Isolate* isolate,
|
|
||||||
Handle<SharedFunctionInfo> shared) {
|
|
||||||
if (shared->HasBaselineData()) {
|
|
||||||
return handle(shared->baseline_data().baseline_code(), isolate);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (FLAG_trace_opt) {
|
|
||||||
PrintF("[compiling method ");
|
|
||||||
shared->ShortPrint();
|
|
||||||
PrintF(" using Baseline]\n");
|
|
||||||
}
|
|
||||||
|
|
||||||
base::ElapsedTimer timer;
|
|
||||||
timer.Start();
|
|
||||||
|
|
||||||
Handle<Code> code = CompileWithBaseline(
|
|
||||||
isolate, shared, handle(shared->GetBytecodeArray(isolate), isolate));
|
|
||||||
Handle<HeapObject> function_data =
|
|
||||||
handle(HeapObject::cast(shared->function_data(kAcquireLoad)), isolate);
|
|
||||||
Handle<BaselineData> baseline_data =
|
|
||||||
isolate->factory()->NewBaselineData(code, function_data);
|
|
||||||
shared->set_baseline_data(*baseline_data);
|
|
||||||
|
|
||||||
if (FLAG_print_code) {
|
if (FLAG_print_code) {
|
||||||
code->Print();
|
code->Print();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (shared->script().IsScript()) {
|
|
||||||
Compiler::LogFunctionCompilation(
|
|
||||||
isolate, CodeEventListener::FUNCTION_TAG, shared,
|
|
||||||
handle(Script::cast(shared->script()), isolate),
|
|
||||||
Handle<AbstractCode>::cast(code), CodeKind::BASELINE,
|
|
||||||
timer.Elapsed().InMillisecondsF());
|
|
||||||
}
|
|
||||||
|
|
||||||
if (FLAG_trace_opt) {
|
|
||||||
// TODO(v8:11429): Move to Compiler.
|
|
||||||
PrintF("[completed compiling ");
|
|
||||||
shared->ShortPrint();
|
|
||||||
PrintF(" using Sparkplug - took %0.3f ms]\n",
|
|
||||||
timer.Elapsed().InMillisecondsF());
|
|
||||||
}
|
|
||||||
|
|
||||||
return code;
|
return code;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -84,8 +40,8 @@ Handle<Code> CompileWithBaseline(Isolate* isolate,
|
|||||||
namespace v8 {
|
namespace v8 {
|
||||||
namespace internal {
|
namespace internal {
|
||||||
|
|
||||||
Handle<Code> CompileWithBaseline(Isolate* isolate,
|
Handle<Code> GenerateBaselineCode(Isolate* isolate,
|
||||||
Handle<SharedFunctionInfo> shared) {
|
Handle<SharedFunctionInfo> shared) {
|
||||||
UNREACHABLE();
|
UNREACHABLE();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -15,8 +15,8 @@ class SharedFunctionInfo;
|
|||||||
class BytecodeArray;
|
class BytecodeArray;
|
||||||
|
|
||||||
// TODO(v8:11429): Restrict header visibility to just this file.
|
// TODO(v8:11429): Restrict header visibility to just this file.
|
||||||
Handle<Code> CompileWithBaseline(Isolate* isolate,
|
Handle<Code> GenerateBaselineCode(Isolate* isolate,
|
||||||
Handle<SharedFunctionInfo> shared);
|
Handle<SharedFunctionInfo> shared);
|
||||||
|
|
||||||
} // namespace internal
|
} // namespace internal
|
||||||
} // namespace v8
|
} // namespace v8
|
||||||
|
@ -13,6 +13,7 @@
|
|||||||
#include "src/ast/scopes.h"
|
#include "src/ast/scopes.h"
|
||||||
#include "src/base/logging.h"
|
#include "src/base/logging.h"
|
||||||
#include "src/base/optional.h"
|
#include "src/base/optional.h"
|
||||||
|
#include "src/base/platform/time.h"
|
||||||
#include "src/baseline/baseline.h"
|
#include "src/baseline/baseline.h"
|
||||||
#include "src/codegen/assembler-inl.h"
|
#include "src/codegen/assembler-inl.h"
|
||||||
#include "src/codegen/compilation-cache.h"
|
#include "src/codegen/compilation-cache.h"
|
||||||
@ -65,24 +66,6 @@ namespace {
|
|||||||
|
|
||||||
class CompilerTracer : public AllStatic {
|
class CompilerTracer : public AllStatic {
|
||||||
public:
|
public:
|
||||||
static void PrintTracePrefix(const CodeTracer::Scope& scope,
|
|
||||||
const char* header,
|
|
||||||
OptimizedCompilationInfo* info) {
|
|
||||||
PrintTracePrefix(scope, header, info->closure(), info->code_kind());
|
|
||||||
}
|
|
||||||
|
|
||||||
static void PrintTracePrefix(const CodeTracer::Scope& scope,
|
|
||||||
const char* header, Handle<JSFunction> function,
|
|
||||||
CodeKind code_kind) {
|
|
||||||
PrintF(scope.file(), "[%s ", header);
|
|
||||||
function->ShortPrint(scope.file());
|
|
||||||
PrintF(scope.file(), " (target %s)", CodeKindToString(code_kind));
|
|
||||||
}
|
|
||||||
|
|
||||||
static void PrintTraceSuffix(const CodeTracer::Scope& scope) {
|
|
||||||
PrintF(scope.file(), "]\n");
|
|
||||||
}
|
|
||||||
|
|
||||||
static void TracePrepareJob(Isolate* isolate, OptimizedCompilationInfo* info,
|
static void TracePrepareJob(Isolate* isolate, OptimizedCompilationInfo* info,
|
||||||
const char* compiler_name) {
|
const char* compiler_name) {
|
||||||
if (!FLAG_trace_opt || !info->IsOptimizing()) return;
|
if (!FLAG_trace_opt || !info->IsOptimizing()) return;
|
||||||
@ -93,6 +76,15 @@ class CompilerTracer : public AllStatic {
|
|||||||
PrintTraceSuffix(scope);
|
PrintTraceSuffix(scope);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void TraceStartBaselineCompile(Isolate* isolate,
|
||||||
|
Handle<SharedFunctionInfo> shared) {
|
||||||
|
if (!FLAG_trace_baseline) return;
|
||||||
|
CodeTracer::Scope scope(isolate->GetCodeTracer());
|
||||||
|
PrintTracePrefix(scope, "compiling method", shared, CodeKind::BASELINE);
|
||||||
|
PrintF(scope.file(), " using Sparkplug");
|
||||||
|
PrintTraceSuffix(scope);
|
||||||
|
}
|
||||||
|
|
||||||
static void TraceCompilationStats(Isolate* isolate,
|
static void TraceCompilationStats(Isolate* isolate,
|
||||||
OptimizedCompilationInfo* info,
|
OptimizedCompilationInfo* info,
|
||||||
double ms_creategraph, double ms_optimize,
|
double ms_creategraph, double ms_optimize,
|
||||||
@ -105,6 +97,16 @@ class CompilerTracer : public AllStatic {
|
|||||||
PrintTraceSuffix(scope);
|
PrintTraceSuffix(scope);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void TraceFinishBaselineCompile(Isolate* isolate,
|
||||||
|
Handle<SharedFunctionInfo> shared,
|
||||||
|
double ms_timetaken) {
|
||||||
|
if (!FLAG_trace_baseline) return;
|
||||||
|
CodeTracer::Scope scope(isolate->GetCodeTracer());
|
||||||
|
PrintTracePrefix(scope, "compiling", shared, CodeKind::BASELINE);
|
||||||
|
PrintF(scope.file(), " - took %0.3f ms", ms_timetaken);
|
||||||
|
PrintTraceSuffix(scope);
|
||||||
|
}
|
||||||
|
|
||||||
static void TraceCompletedJob(Isolate* isolate,
|
static void TraceCompletedJob(Isolate* isolate,
|
||||||
OptimizedCompilationInfo* info) {
|
OptimizedCompilationInfo* info) {
|
||||||
if (!FLAG_trace_opt) return;
|
if (!FLAG_trace_opt) return;
|
||||||
@ -155,6 +157,34 @@ class CompilerTracer : public AllStatic {
|
|||||||
PrintF(scope.file(), " for optimized recompilation because --always-opt");
|
PrintF(scope.file(), " for optimized recompilation because --always-opt");
|
||||||
PrintF(scope.file(), "]\n");
|
PrintF(scope.file(), "]\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private:
|
||||||
|
static void PrintTracePrefix(const CodeTracer::Scope& scope,
|
||||||
|
const char* header,
|
||||||
|
OptimizedCompilationInfo* info) {
|
||||||
|
PrintTracePrefix(scope, header, info->closure(), info->code_kind());
|
||||||
|
}
|
||||||
|
|
||||||
|
static void PrintTracePrefix(const CodeTracer::Scope& scope,
|
||||||
|
const char* header, Handle<JSFunction> function,
|
||||||
|
CodeKind code_kind) {
|
||||||
|
PrintF(scope.file(), "[%s ", header);
|
||||||
|
function->ShortPrint(scope.file());
|
||||||
|
PrintF(scope.file(), " (target %s)", CodeKindToString(code_kind));
|
||||||
|
}
|
||||||
|
|
||||||
|
static void PrintTracePrefix(const CodeTracer::Scope& scope,
|
||||||
|
const char* header,
|
||||||
|
Handle<SharedFunctionInfo> shared,
|
||||||
|
CodeKind code_kind) {
|
||||||
|
PrintF(scope.file(), "[%s ", header);
|
||||||
|
shared->ShortPrint(scope.file());
|
||||||
|
PrintF(scope.file(), " (target %s)", CodeKindToString(code_kind));
|
||||||
|
}
|
||||||
|
|
||||||
|
static void PrintTraceSuffix(const CodeTracer::Scope& scope) {
|
||||||
|
PrintF(scope.file(), "]\n");
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace
|
} // namespace
|
||||||
@ -606,6 +636,58 @@ void UpdateSharedFunctionFlagsAfterCompilation(FunctionLiteral* literal,
|
|||||||
shared_info.SetScopeInfo(*literal->scope()->scope_info());
|
shared_info.SetScopeInfo(*literal->scope()->scope_info());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool CompileSharedWithBaseline(Isolate* isolate,
|
||||||
|
Handle<SharedFunctionInfo> shared,
|
||||||
|
Compiler::ClearExceptionFlag flag,
|
||||||
|
IsCompiledScope* is_compiled_scope) {
|
||||||
|
DCHECK(FLAG_sparkplug);
|
||||||
|
DCHECK(is_compiled_scope->is_compiled());
|
||||||
|
|
||||||
|
if (shared->HasBaselineData()) return true;
|
||||||
|
|
||||||
|
StackLimitCheck check(isolate);
|
||||||
|
if (check.JsHasOverflowed(kStackSpaceRequiredForCompilation * KB)) {
|
||||||
|
if (flag == Compiler::KEEP_EXCEPTION) {
|
||||||
|
isolate->StackOverflow();
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Check if we actually have bytecode.
|
||||||
|
if (!shared->HasBytecodeArray()) return false;
|
||||||
|
|
||||||
|
// Do not optimize when debugger needs to hook into every call.
|
||||||
|
if (isolate->debug()->needs_check_on_function_call()) return false;
|
||||||
|
|
||||||
|
// Functions with breakpoints have to stay interpreted.
|
||||||
|
if (shared->HasBreakInfo()) return false;
|
||||||
|
|
||||||
|
CompilerTracer::TraceStartBaselineCompile(isolate, shared);
|
||||||
|
Handle<Code> code;
|
||||||
|
base::TimeDelta time_taken;
|
||||||
|
{
|
||||||
|
ScopedTimer timer(&time_taken);
|
||||||
|
code = GenerateBaselineCode(isolate, shared);
|
||||||
|
|
||||||
|
Handle<HeapObject> function_data =
|
||||||
|
handle(HeapObject::cast(shared->function_data(kAcquireLoad)), isolate);
|
||||||
|
Handle<BaselineData> baseline_data =
|
||||||
|
isolate->factory()->NewBaselineData(code, function_data);
|
||||||
|
shared->set_baseline_data(*baseline_data);
|
||||||
|
}
|
||||||
|
double time_taken_ms = time_taken.InMillisecondsF();
|
||||||
|
|
||||||
|
CompilerTracer::TraceFinishBaselineCompile(isolate, shared, time_taken_ms);
|
||||||
|
|
||||||
|
if (shared->script().IsScript()) {
|
||||||
|
Compiler::LogFunctionCompilation(
|
||||||
|
isolate, CodeEventListener::FUNCTION_TAG, shared,
|
||||||
|
handle(Script::cast(shared->script()), isolate),
|
||||||
|
Handle<AbstractCode>::cast(code), CodeKind::BASELINE, time_taken_ms);
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
// Finalize a single compilation job. This function can return
|
// Finalize a single compilation job. This function can return
|
||||||
// RETRY_ON_MAIN_THREAD if the job cannot be finalized off-thread, in which case
|
// RETRY_ON_MAIN_THREAD if the job cannot be finalized off-thread, in which case
|
||||||
// it should be safe to call it again on the main thread with the same job.
|
// it should be safe to call it again on the main thread with the same job.
|
||||||
@ -1237,10 +1319,9 @@ void FinalizeUnoptimizedCompilation(
|
|||||||
if (FLAG_interpreted_frames_native_stack) {
|
if (FLAG_interpreted_frames_native_stack) {
|
||||||
InstallInterpreterTrampolineCopy(isolate, shared_info);
|
InstallInterpreterTrampolineCopy(isolate, shared_info);
|
||||||
}
|
}
|
||||||
if (FLAG_always_sparkplug && shared_info->HasBytecodeArray() &&
|
if (FLAG_always_sparkplug) {
|
||||||
!shared_info->HasBreakInfo()) {
|
CompileSharedWithBaseline(isolate, shared_info, Compiler::KEEP_EXCEPTION,
|
||||||
// TODO(v8:11429) Extract to Compiler::CompileX
|
&is_compiled_scope);
|
||||||
CompileWithBaseline(isolate, shared_info);
|
|
||||||
}
|
}
|
||||||
Handle<CoverageInfo> coverage_info;
|
Handle<CoverageInfo> coverage_info;
|
||||||
if (finalize_data.coverage_info().ToHandle(&coverage_info)) {
|
if (finalize_data.coverage_info().ToHandle(&coverage_info)) {
|
||||||
@ -1888,6 +1969,25 @@ bool Compiler::Compile(Isolate* isolate, Handle<JSFunction> function,
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// static
|
||||||
|
bool Compiler::CompileBaseline(Isolate* isolate, Handle<JSFunction> function,
|
||||||
|
ClearExceptionFlag flag,
|
||||||
|
IsCompiledScope* is_compiled_scope) {
|
||||||
|
Handle<SharedFunctionInfo> shared(function->shared(isolate), isolate);
|
||||||
|
if (!CompileSharedWithBaseline(isolate, shared, flag, is_compiled_scope)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Baseline code needs a feedback vector.
|
||||||
|
JSFunction::EnsureFeedbackVector(function, is_compiled_scope);
|
||||||
|
|
||||||
|
Code baseline_code = shared->baseline_data().baseline_code(isolate);
|
||||||
|
DCHECK_EQ(baseline_code.kind(), CodeKind::BASELINE);
|
||||||
|
function->set_code(baseline_code);
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
// static
|
// static
|
||||||
MaybeHandle<SharedFunctionInfo> Compiler::CompileToplevel(
|
MaybeHandle<SharedFunctionInfo> Compiler::CompileToplevel(
|
||||||
ParseInfo* parse_info, Handle<Script> script, Isolate* isolate,
|
ParseInfo* parse_info, Handle<Script> script, Isolate* isolate,
|
||||||
|
@ -71,6 +71,9 @@ class V8_EXPORT_PRIVATE Compiler : public AllStatic {
|
|||||||
static bool Compile(Isolate* isolate, Handle<JSFunction> function,
|
static bool Compile(Isolate* isolate, Handle<JSFunction> function,
|
||||||
ClearExceptionFlag flag,
|
ClearExceptionFlag flag,
|
||||||
IsCompiledScope* is_compiled_scope);
|
IsCompiledScope* is_compiled_scope);
|
||||||
|
static bool CompileBaseline(Isolate* isolate, Handle<JSFunction> function,
|
||||||
|
ClearExceptionFlag flag,
|
||||||
|
IsCompiledScope* is_compiled_scope);
|
||||||
static bool CompileOptimized(Isolate* isolate, Handle<JSFunction> function,
|
static bool CompileOptimized(Isolate* isolate, Handle<JSFunction> function,
|
||||||
ConcurrencyMode mode, CodeKind code_kind);
|
ConcurrencyMode mode, CodeKind code_kind);
|
||||||
static MaybeHandle<SharedFunctionInfo> CompileToplevel(
|
static MaybeHandle<SharedFunctionInfo> CompileToplevel(
|
||||||
|
@ -538,10 +538,10 @@ DEFINE_BOOL(trace_unoptimized, false,
|
|||||||
"trace the bytecodes executed by all unoptimized execution")
|
"trace the bytecodes executed by all unoptimized execution")
|
||||||
DEFINE_BOOL(trace_ignition, false,
|
DEFINE_BOOL(trace_ignition, false,
|
||||||
"trace the bytecodes executed by the ignition interpreter")
|
"trace the bytecodes executed by the ignition interpreter")
|
||||||
DEFINE_BOOL(trace_baseline, false,
|
DEFINE_BOOL(trace_baseline_exec, false,
|
||||||
"trace the bytecodes executed by the baseline code")
|
"trace the bytecodes executed by the baseline code")
|
||||||
DEFINE_WEAK_IMPLICATION(trace_unoptimized, trace_ignition)
|
DEFINE_WEAK_IMPLICATION(trace_unoptimized, trace_ignition)
|
||||||
DEFINE_WEAK_IMPLICATION(trace_unoptimized, trace_baseline)
|
DEFINE_WEAK_IMPLICATION(trace_unoptimized, trace_baseline_exec)
|
||||||
#endif
|
#endif
|
||||||
#ifdef V8_TRACE_FEEDBACK_UPDATES
|
#ifdef V8_TRACE_FEEDBACK_UPDATES
|
||||||
DEFINE_BOOL(
|
DEFINE_BOOL(
|
||||||
@ -584,6 +584,7 @@ DEFINE_INT(ticks_scale_factor_for_top_tier, 10,
|
|||||||
// Flags for Sparkplug
|
// Flags for Sparkplug
|
||||||
DEFINE_BOOL(sparkplug, false, "enable experimental sparkplug baseline compiler")
|
DEFINE_BOOL(sparkplug, false, "enable experimental sparkplug baseline compiler")
|
||||||
DEFINE_BOOL(always_sparkplug, false, "directly tier up to sparkplug")
|
DEFINE_BOOL(always_sparkplug, false, "directly tier up to sparkplug")
|
||||||
|
DEFINE_BOOL(trace_baseline, false, "trace baseline compilation")
|
||||||
DEFINE_NEG_IMPLICATION(sparkplug, write_protect_code_memory)
|
DEFINE_NEG_IMPLICATION(sparkplug, write_protect_code_memory)
|
||||||
DEFINE_IMPLICATION(always_sparkplug, sparkplug)
|
DEFINE_IMPLICATION(always_sparkplug, sparkplug)
|
||||||
|
|
||||||
|
@ -433,40 +433,6 @@ RUNTIME_FUNCTION(Runtime_CompileForOnStackReplacement) {
|
|||||||
return Object();
|
return Object();
|
||||||
}
|
}
|
||||||
|
|
||||||
RUNTIME_FUNCTION(Runtime_CompileBaseline) {
|
|
||||||
HandleScope scope(isolate);
|
|
||||||
DCHECK_EQ(1, args.length());
|
|
||||||
CONVERT_ARG_HANDLE_CHECKED(JSFunction, function, 0);
|
|
||||||
|
|
||||||
Handle<SharedFunctionInfo> shared(function->shared(isolate), isolate);
|
|
||||||
IsCompiledScope is_compiled_scope = shared->is_compiled_scope(isolate);
|
|
||||||
|
|
||||||
StackLimitCheck check(isolate);
|
|
||||||
if (check.JsHasOverflowed(kStackSpaceRequiredForCompilation * KB)) {
|
|
||||||
return isolate->StackOverflow();
|
|
||||||
}
|
|
||||||
if (!shared->IsUserJavaScript()) {
|
|
||||||
return *function;
|
|
||||||
}
|
|
||||||
if (!is_compiled_scope.is_compiled()) {
|
|
||||||
if (!Compiler::Compile(isolate, function, Compiler::KEEP_EXCEPTION,
|
|
||||||
&is_compiled_scope)) {
|
|
||||||
return ReadOnlyRoots(isolate).exception();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// TODO(v8:11429): Add a Compiler::Compile* method for this.
|
|
||||||
JSFunction::EnsureFeedbackVector(function, &is_compiled_scope);
|
|
||||||
|
|
||||||
if (!shared->HasBaselineData()) {
|
|
||||||
Handle<Code> code = CompileWithBaseline(isolate, shared);
|
|
||||||
function->set_code(*code);
|
|
||||||
} else {
|
|
||||||
function->set_code(shared->baseline_data().baseline_code(isolate));
|
|
||||||
}
|
|
||||||
return *function;
|
|
||||||
}
|
|
||||||
|
|
||||||
static Object CompileGlobalEval(Isolate* isolate,
|
static Object CompileGlobalEval(Isolate* isolate,
|
||||||
Handle<i::Object> source_object,
|
Handle<i::Object> source_object,
|
||||||
Handle<SharedFunctionInfo> outer_info,
|
Handle<SharedFunctionInfo> outer_info,
|
||||||
|
@ -336,12 +336,10 @@ RUNTIME_FUNCTION(Runtime_BytecodeBudgetInterruptFromBytecode) {
|
|||||||
IsCompiledScope is_compiled_scope(
|
IsCompiledScope is_compiled_scope(
|
||||||
function->shared().is_compiled_scope(isolate));
|
function->shared().is_compiled_scope(isolate));
|
||||||
JSFunction::EnsureFeedbackVector(function, &is_compiled_scope);
|
JSFunction::EnsureFeedbackVector(function, &is_compiled_scope);
|
||||||
if (FLAG_sparkplug && !function->shared().HasBaselineData() &&
|
DCHECK(is_compiled_scope.is_compiled());
|
||||||
!function->shared().HasBreakInfo()) {
|
if (FLAG_sparkplug) {
|
||||||
// TODO(v8:11429): Expose via Compiler, do set_code there.
|
Compiler::CompileBaseline(isolate, function, Compiler::CLEAR_EXCEPTION,
|
||||||
Handle<SharedFunctionInfo> shared(function->shared(), isolate);
|
&is_compiled_scope);
|
||||||
Handle<Code> code = CompileWithBaseline(isolate, shared);
|
|
||||||
function->set_code(*code);
|
|
||||||
}
|
}
|
||||||
// Also initialize the invocation count here. This is only really needed for
|
// Also initialize the invocation count here. This is only really needed for
|
||||||
// OSR. When we OSR functions with lazy feedback allocation we want to have
|
// OSR. When we OSR functions with lazy feedback allocation we want to have
|
||||||
|
@ -385,6 +385,33 @@ bool EnsureFeedbackVector(Isolate* isolate, Handle<JSFunction> function) {
|
|||||||
|
|
||||||
} // namespace
|
} // namespace
|
||||||
|
|
||||||
|
RUNTIME_FUNCTION(Runtime_CompileBaseline) {
|
||||||
|
HandleScope scope(isolate);
|
||||||
|
DCHECK_EQ(1, args.length());
|
||||||
|
CONVERT_ARG_HANDLE_CHECKED(JSFunction, function, 0);
|
||||||
|
|
||||||
|
IsCompiledScope is_compiled_scope =
|
||||||
|
function->shared(isolate).is_compiled_scope(isolate);
|
||||||
|
|
||||||
|
if (!function->shared(isolate).IsUserJavaScript()) {
|
||||||
|
return CrashUnlessFuzzing(isolate);
|
||||||
|
}
|
||||||
|
|
||||||
|
// First compile the bytecode, if we have to.
|
||||||
|
if (!is_compiled_scope.is_compiled() &&
|
||||||
|
!Compiler::Compile(isolate, function, Compiler::KEEP_EXCEPTION,
|
||||||
|
&is_compiled_scope)) {
|
||||||
|
return CrashUnlessFuzzing(isolate);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!Compiler::CompileBaseline(isolate, function, Compiler::KEEP_EXCEPTION,
|
||||||
|
&is_compiled_scope)) {
|
||||||
|
return CrashUnlessFuzzing(isolate);
|
||||||
|
}
|
||||||
|
|
||||||
|
return *function;
|
||||||
|
}
|
||||||
|
|
||||||
RUNTIME_FUNCTION(Runtime_OptimizeFunctionOnNextCall) {
|
RUNTIME_FUNCTION(Runtime_OptimizeFunctionOnNextCall) {
|
||||||
HandleScope scope(isolate);
|
HandleScope scope(isolate);
|
||||||
return OptimizeFunctionOnNextCall(args, isolate, TierupKind::kTierupBytecode);
|
return OptimizeFunctionOnNextCall(args, isolate, TierupKind::kTierupBytecode);
|
||||||
|
@ -97,7 +97,7 @@ void PrintRegisters(UnoptimizedFrame* frame, std::ostream& os, bool is_input,
|
|||||||
} // namespace
|
} // namespace
|
||||||
|
|
||||||
RUNTIME_FUNCTION(Runtime_TraceUnoptimizedBytecodeEntry) {
|
RUNTIME_FUNCTION(Runtime_TraceUnoptimizedBytecodeEntry) {
|
||||||
if (!FLAG_trace_ignition && !FLAG_trace_baseline) {
|
if (!FLAG_trace_ignition && !FLAG_trace_baseline_exec) {
|
||||||
return ReadOnlyRoots(isolate).undefined_value();
|
return ReadOnlyRoots(isolate).undefined_value();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -108,7 +108,7 @@ RUNTIME_FUNCTION(Runtime_TraceUnoptimizedBytecodeEntry) {
|
|||||||
if (frame->is_interpreted() && !FLAG_trace_ignition) {
|
if (frame->is_interpreted() && !FLAG_trace_ignition) {
|
||||||
return ReadOnlyRoots(isolate).undefined_value();
|
return ReadOnlyRoots(isolate).undefined_value();
|
||||||
}
|
}
|
||||||
if (frame->is_baseline() && !FLAG_trace_baseline) {
|
if (frame->is_baseline() && !FLAG_trace_baseline_exec) {
|
||||||
return ReadOnlyRoots(isolate).undefined_value();
|
return ReadOnlyRoots(isolate).undefined_value();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -148,7 +148,7 @@ RUNTIME_FUNCTION(Runtime_TraceUnoptimizedBytecodeEntry) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
RUNTIME_FUNCTION(Runtime_TraceUnoptimizedBytecodeExit) {
|
RUNTIME_FUNCTION(Runtime_TraceUnoptimizedBytecodeExit) {
|
||||||
if (!FLAG_trace_ignition && !FLAG_trace_baseline) {
|
if (!FLAG_trace_ignition && !FLAG_trace_baseline_exec) {
|
||||||
return ReadOnlyRoots(isolate).undefined_value();
|
return ReadOnlyRoots(isolate).undefined_value();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -159,7 +159,7 @@ RUNTIME_FUNCTION(Runtime_TraceUnoptimizedBytecodeExit) {
|
|||||||
if (frame->is_interpreted() && !FLAG_trace_ignition) {
|
if (frame->is_interpreted() && !FLAG_trace_ignition) {
|
||||||
return ReadOnlyRoots(isolate).undefined_value();
|
return ReadOnlyRoots(isolate).undefined_value();
|
||||||
}
|
}
|
||||||
if (frame->is_baseline() && !FLAG_trace_baseline) {
|
if (frame->is_baseline() && !FLAG_trace_baseline_exec) {
|
||||||
return ReadOnlyRoots(isolate).undefined_value();
|
return ReadOnlyRoots(isolate).undefined_value();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
// Use of this source code is governed by a BSD-style license that can be
|
// Use of this source code is governed by a BSD-style license that can be
|
||||||
// found in the LICENSE file.
|
// found in the LICENSE file.
|
||||||
|
|
||||||
// Flags: --allow-natives-syntax
|
// Flags: --allow-natives-syntax --sparkplug
|
||||||
|
|
||||||
// Tier-up across Realms
|
// Tier-up across Realms
|
||||||
|
|
||||||
|
@ -2,6 +2,4 @@
|
|||||||
// Use of this source code is governed by a BSD-style license that can be
|
// Use of this source code is governed by a BSD-style license that can be
|
||||||
// found in the LICENSE file.
|
// found in the LICENSE file.
|
||||||
|
|
||||||
// Flags: --allow-natives-syntax --super-ic
|
|
||||||
|
|
||||||
export default 12;
|
export default 12;
|
@ -2,7 +2,7 @@
|
|||||||
// Use of this source code is governed by a BSD-style license that can be
|
// Use of this source code is governed by a BSD-style license that can be
|
||||||
// found in the LICENSE file.
|
// found in the LICENSE file.
|
||||||
|
|
||||||
// Flags: --allow-natives-syntax --super-ic
|
// Flags: --allow-natives-syntax --super-ic --sparkplug
|
||||||
|
|
||||||
export let exported = 17;
|
export let exported = 17;
|
||||||
import imported from 'test-baseline-module-helper.mjs';
|
import imported from 'test-baseline-module-helper.mjs';
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
// Use of this source code is governed by a BSD-style license that can be
|
// Use of this source code is governed by a BSD-style license that can be
|
||||||
// found in the LICENSE file.
|
// found in the LICENSE file.
|
||||||
|
|
||||||
// Flags: --allow-natives-syntax --super-ic
|
// Flags: --allow-natives-syntax --super-ic --sparkplug
|
||||||
|
|
||||||
function run(f, ...args) {
|
function run(f, ...args) {
|
||||||
try { f(...args); } catch (e) {}
|
try { f(...args); } catch (e) {}
|
||||||
|
Loading…
Reference in New Issue
Block a user