[nci] Replace CompilationTarget with a new Code::Kind value

With the new Turbofan variants (NCI and Turboprop), we need a way to
distinguish between them both during and after compilation. We
initially introduced CompilationTarget to track the variant during
compilation, but decided to reuse the code kind as the canonical spot to
store this information instead.

Why? Because it is an established mechanism, already available in most
of the necessary spots (inside the pipeline, on Code objects, in
profiling traces).

This CL removes CompilationTarget and adds a new
NATIVE_CONTEXT_INDEPENDENT kind, plus helper functions to determine
various things about a given code kind (e.g.: does this code kind
deopt?).

As a (very large) drive-by, refactor both Code::Kind and
AbstractCode::Kind into a new CodeKind enum class.

Bug: v8:8888
Change-Id: Ie858b9a53311b0731630be35cf5cd108dee95b39
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2336793
Commit-Queue: Jakob Gruber <jgruber@chromium.org>
Reviewed-by: Clemens Backes <clemensb@chromium.org>
Reviewed-by: Ross McIlroy <rmcilroy@chromium.org>
Reviewed-by: Dominik Inführ <dinfuehr@chromium.org>
Reviewed-by: Georg Neis <neis@chromium.org>
Cr-Commit-Position: refs/heads/master@{#69244}
This commit is contained in:
Jakob Gruber 2020-08-05 13:48:03 +02:00 committed by Commit Bot
parent c365959fc7
commit c51041f454
105 changed files with 1166 additions and 858 deletions

View File

@ -2768,6 +2768,8 @@ v8_source_set("v8_base_without_compiler") {
"src/objects/cell-inl.h", "src/objects/cell-inl.h",
"src/objects/cell.h", "src/objects/cell.h",
"src/objects/code-inl.h", "src/objects/code-inl.h",
"src/objects/code-kind.cc",
"src/objects/code-kind.h",
"src/objects/code.cc", "src/objects/code.cc",
"src/objects/code.h", "src/objects/code.h",
"src/objects/compilation-cache-inl.h", "src/objects/compilation-cache-inl.h",

View File

@ -360,7 +360,7 @@ Handle<Code> Builtins::GenerateOffHeapTrampolineFor(
? TrampolineType::kJump ? TrampolineType::kJump
: TrampolineType::kAbort); : TrampolineType::kAbort);
return Factory::CodeBuilder(isolate, desc, Code::BUILTIN) return Factory::CodeBuilder(isolate, desc, CodeKind::BUILTIN)
.set_read_only_data_container(kind_specfic_flags) .set_read_only_data_container(kind_specfic_flags)
.set_self_reference(generator.CodeObject()) .set_self_reference(generator.CodeObject())
.set_is_executable(generate_jump_to_instruction_stream) .set_is_executable(generate_jump_to_instruction_stream)

View File

@ -118,7 +118,7 @@ void BuiltinsConstantsTableBuilder::Finalize() {
for (auto it = it_scope.begin(); it != it_scope.end(); ++it) { for (auto it = it_scope.begin(); it != it_scope.end(); ++it) {
uint32_t index = *it.entry(); uint32_t index = *it.entry();
Object value = it.key(); Object value = it.key();
if (value.IsCode() && Code::cast(value).kind() == Code::BUILTIN) { if (value.IsCode() && Code::cast(value).kind() == CodeKind::BUILTIN) {
// Replace placeholder code objects with the real builtin. // Replace placeholder code objects with the real builtin.
// See also: SetupIsolateDelegate::PopulateWithPlaceholders. // See also: SetupIsolateDelegate::PopulateWithPlaceholders.
// TODO(jgruber): Deduplicate placeholders and their corresponding // TODO(jgruber): Deduplicate placeholders and their corresponding

View File

@ -75,7 +75,7 @@ Handle<Code> BuildPlaceholder(Isolate* isolate, int32_t builtin_index) {
} }
CodeDesc desc; CodeDesc desc;
masm.GetCode(isolate, &desc); masm.GetCode(isolate, &desc);
Handle<Code> code = Factory::CodeBuilder(isolate, desc, Code::BUILTIN) Handle<Code> code = Factory::CodeBuilder(isolate, desc, CodeKind::BUILTIN)
.set_self_reference(masm.CodeObject()) .set_self_reference(masm.CodeObject())
.set_builtin_index(builtin_index) .set_builtin_index(builtin_index)
.Build(); .Build();
@ -116,7 +116,7 @@ Code BuildWithMacroAssembler(Isolate* isolate, int32_t builtin_index,
masm.GetCode(isolate, &desc, MacroAssembler::kNoSafepointTable, masm.GetCode(isolate, &desc, MacroAssembler::kNoSafepointTable,
handler_table_offset); handler_table_offset);
Handle<Code> code = Factory::CodeBuilder(isolate, desc, Code::BUILTIN) Handle<Code> code = Factory::CodeBuilder(isolate, desc, CodeKind::BUILTIN)
.set_self_reference(masm.CodeObject()) .set_self_reference(masm.CodeObject())
.set_builtin_index(builtin_index) .set_builtin_index(builtin_index)
.Build(); .Build();
@ -142,7 +142,7 @@ Code BuildAdaptor(Isolate* isolate, int32_t builtin_index,
Builtins::Generate_Adaptor(&masm, builtin_address); Builtins::Generate_Adaptor(&masm, builtin_address);
CodeDesc desc; CodeDesc desc;
masm.GetCode(isolate, &desc); masm.GetCode(isolate, &desc);
Handle<Code> code = Factory::CodeBuilder(isolate, desc, Code::BUILTIN) Handle<Code> code = Factory::CodeBuilder(isolate, desc, CodeKind::BUILTIN)
.set_self_reference(masm.CodeObject()) .set_self_reference(masm.CodeObject())
.set_builtin_index(builtin_index) .set_builtin_index(builtin_index)
.Build(); .Build();
@ -162,7 +162,7 @@ Code BuildWithCodeStubAssemblerJS(Isolate* isolate, int32_t builtin_index,
const int argc_with_recv = const int argc_with_recv =
(argc == kDontAdaptArgumentsSentinel) ? 0 : argc + 1; (argc == kDontAdaptArgumentsSentinel) ? 0 : argc + 1;
compiler::CodeAssemblerState state( compiler::CodeAssemblerState state(
isolate, &zone, argc_with_recv, Code::BUILTIN, name, isolate, &zone, argc_with_recv, CodeKind::BUILTIN, name,
PoisoningMitigationLevel::kDontPoison, builtin_index); PoisoningMitigationLevel::kDontPoison, builtin_index);
generator(&state); generator(&state);
Handle<Code> code = compiler::CodeAssembler::GenerateCode( Handle<Code> code = compiler::CodeAssembler::GenerateCode(
@ -187,7 +187,7 @@ Code BuildWithCodeStubAssemblerCS(Isolate* isolate, int32_t builtin_index,
// Ensure descriptor is already initialized. // Ensure descriptor is already initialized.
DCHECK_LE(0, descriptor.GetRegisterParameterCount()); DCHECK_LE(0, descriptor.GetRegisterParameterCount());
compiler::CodeAssemblerState state( compiler::CodeAssemblerState state(
isolate, &zone, descriptor, Code::BUILTIN, name, isolate, &zone, descriptor, CodeKind::BUILTIN, name,
PoisoningMitigationLevel::kDontPoison, builtin_index); PoisoningMitigationLevel::kDontPoison, builtin_index);
generator(&state); generator(&state);
Handle<Code> code = compiler::CodeAssembler::GenerateCode( Handle<Code> code = compiler::CodeAssembler::GenerateCode(

View File

@ -58,32 +58,13 @@ namespace internal {
namespace { namespace {
const char* CompilationTargetName(CompilationTarget target) { bool IsForNativeContextIndependentCachingOnly(CodeKind kind) {
switch (target) { return CodeKindIsNativeContextIndependentJSFunction(kind) &&
case CompilationTarget::kTurbofan: !FLAG_turbo_nci_as_highest_tier;
return "Turbofan";
case CompilationTarget::kNativeContextIndependent:
return "NativeContextIndependent";
}
UNREACHABLE();
}
CompilationTarget CompilationTargetOf(OptimizedCompilationInfo* info) {
return info->native_context_independent()
? CompilationTarget::kNativeContextIndependent
: CompilationTarget::kTurbofan;
}
bool IsNativeContextIndependent(CompilationTarget target) {
return target == CompilationTarget::kNativeContextIndependent;
}
bool IsForNativeContextIndependentCachingOnly(CompilationTarget target) {
return IsNativeContextIndependent(target) && !FLAG_turbo_nci_as_highest_tier;
} }
bool IsForNativeContextIndependentCachingOnly(OptimizedCompilationInfo* info) { bool IsForNativeContextIndependentCachingOnly(OptimizedCompilationInfo* info) {
return IsForNativeContextIndependentCachingOnly(CompilationTargetOf(info)); return IsForNativeContextIndependentCachingOnly(info->code_kind());
} }
class CompilerTracer : public AllStatic { class CompilerTracer : public AllStatic {
@ -93,8 +74,7 @@ class CompilerTracer : public AllStatic {
OptimizedCompilationInfo* info) { OptimizedCompilationInfo* info) {
PrintF(scope.file(), "[%s ", header); PrintF(scope.file(), "[%s ", header);
info->closure()->ShortPrint(scope.file()); info->closure()->ShortPrint(scope.file());
PrintF(scope.file(), " (target %s)", PrintF(scope.file(), " (target %s)", CodeKindToString(info->code_kind()));
CompilationTargetName(CompilationTargetOf(info)));
} }
static void PrintTracePrefix(const CodeTracer::Scope& scope, static void PrintTracePrefix(const CodeTracer::Scope& scope,
@ -893,8 +873,7 @@ void InsertCodeIntoOptimizedCodeCache(
// Cached NCI code currently does not use the optimization marker field. // Cached NCI code currently does not use the optimization marker field.
if (IsForNativeContextIndependentCachingOnly(compilation_info)) return; if (IsForNativeContextIndependentCachingOnly(compilation_info)) return;
Handle<Code> code = compilation_info->code(); if (!CodeKindIsOptimizedJSFunction(compilation_info->code_kind())) return;
if (code->kind() != Code::OPTIMIZED_FUNCTION) return; // Nothing to do.
// Function context specialization folds-in the function context, // Function context specialization folds-in the function context,
// so no sharing can occur. // so no sharing can occur.
@ -906,6 +885,7 @@ void InsertCodeIntoOptimizedCodeCache(
} }
// Cache optimized context-specific code. // Cache optimized context-specific code.
Handle<Code> code = compilation_info->code();
Handle<JSFunction> function = compilation_info->closure(); Handle<JSFunction> function = compilation_info->closure();
Handle<SharedFunctionInfo> shared(function->shared(), function->GetIsolate()); Handle<SharedFunctionInfo> shared(function->shared(), function->GetIsolate());
Handle<NativeContext> native_context(function->context().native_context(), Handle<NativeContext> native_context(function->context().native_context(),
@ -922,7 +902,7 @@ void InsertCodeIntoOptimizedCodeCache(
void InsertCodeIntoCompilationCache(Isolate* isolate, void InsertCodeIntoCompilationCache(Isolate* isolate,
OptimizedCompilationInfo* info) { OptimizedCompilationInfo* info) {
if (!info->native_context_independent()) return; if (!CodeKindIsNativeContextIndependentJSFunction(info->code_kind())) return;
// TODO(jgruber,v8:8888): This should turn into a DCHECK once we // TODO(jgruber,v8:8888): This should turn into a DCHECK once we
// spawn dedicated NCI compile tasks. // spawn dedicated NCI compile tasks.
@ -930,7 +910,6 @@ void InsertCodeIntoCompilationCache(Isolate* isolate,
Handle<Code> code = info->code(); Handle<Code> code = info->code();
DCHECK(!info->function_context_specializing()); DCHECK(!info->function_context_specializing());
DCHECK_EQ(code->kind(), Code::OPTIMIZED_FUNCTION);
Handle<SharedFunctionInfo> sfi = info->shared_info(); Handle<SharedFunctionInfo> sfi = info->shared_info();
CompilationCache* cache = isolate->compilation_cache(); CompilationCache* cache = isolate->compilation_cache();
@ -1004,10 +983,11 @@ bool GetOptimizedCodeLater(OptimizedCompilationJob* job, Isolate* isolate) {
} }
MaybeHandle<Code> GetOptimizedCode(Handle<JSFunction> function, MaybeHandle<Code> GetOptimizedCode(Handle<JSFunction> function,
ConcurrencyMode mode, ConcurrencyMode mode, CodeKind code_kind,
CompilationTarget compilation_target,
BailoutId osr_offset = BailoutId::None(), BailoutId osr_offset = BailoutId::None(),
JavaScriptFrame* osr_frame = nullptr) { JavaScriptFrame* osr_frame = nullptr) {
DCHECK(CodeKindIsOptimizedJSFunction(code_kind));
Isolate* isolate = function->GetIsolate(); Isolate* isolate = function->GetIsolate();
Handle<SharedFunctionInfo> shared(function->shared(), isolate); Handle<SharedFunctionInfo> shared(function->shared(), isolate);
@ -1038,7 +1018,7 @@ MaybeHandle<Code> GetOptimizedCode(Handle<JSFunction> function,
PendingOptimizationTable::FunctionWasOptimized(isolate, function); PendingOptimizationTable::FunctionWasOptimized(isolate, function);
} }
if (!IsForNativeContextIndependentCachingOnly(compilation_target)) { if (!IsForNativeContextIndependentCachingOnly(code_kind)) {
Handle<Code> cached_code; Handle<Code> cached_code;
if (GetCodeFromOptimizedCodeCache(function, osr_offset) if (GetCodeFromOptimizedCodeCache(function, osr_offset)
.ToHandle(&cached_code)) { .ToHandle(&cached_code)) {
@ -1051,7 +1031,7 @@ MaybeHandle<Code> GetOptimizedCode(Handle<JSFunction> function,
DCHECK(shared->is_compiled()); DCHECK(shared->is_compiled());
function->feedback_vector().set_profiler_ticks(0); function->feedback_vector().set_profiler_ticks(0);
if (IsNativeContextIndependent(compilation_target)) { if (CodeKindIsNativeContextIndependentJSFunction(code_kind)) {
// We don't generate NCI code for OSR. // We don't generate NCI code for OSR.
DCHECK_EQ(osr_offset, BailoutId::None()); DCHECK_EQ(osr_offset, BailoutId::None());
// Don't generate NCI code when we've already done so in the past. // Don't generate NCI code when we've already done so in the past.
@ -1074,9 +1054,8 @@ MaybeHandle<Code> GetOptimizedCode(Handle<JSFunction> function,
// tolerate the lack of a script without bytecode. // tolerate the lack of a script without bytecode.
DCHECK_IMPLIES(!has_script, shared->HasBytecodeArray()); DCHECK_IMPLIES(!has_script, shared->HasBytecodeArray());
std::unique_ptr<OptimizedCompilationJob> job( std::unique_ptr<OptimizedCompilationJob> job(
compiler::Pipeline::NewCompilationJob( compiler::Pipeline::NewCompilationJob(isolate, function, code_kind,
isolate, function, has_script, osr_offset, osr_frame, has_script, osr_offset, osr_frame));
IsNativeContextIndependent(compilation_target)));
OptimizedCompilationInfo* compilation_info = job->compilation_info(); OptimizedCompilationInfo* compilation_info = job->compilation_info();
// In case of concurrent recompilation, all handles below this point will be // In case of concurrent recompilation, all handles below this point will be
@ -1098,7 +1077,7 @@ MaybeHandle<Code> GetOptimizedCode(Handle<JSFunction> function,
job.release(); // The background recompile job owns this now. job.release(); // The background recompile job owns this now.
// Set the optimization marker and return a code object which checks it. // Set the optimization marker and return a code object which checks it.
if (!IsForNativeContextIndependentCachingOnly(compilation_target)) { if (!IsForNativeContextIndependentCachingOnly(code_kind)) {
// Cached NCI code currently does not use the optimization marker field. // Cached NCI code currently does not use the optimization marker field.
function->SetOptimizationMarker( function->SetOptimizationMarker(
OptimizationMarker::kInOptimizationQueue); OptimizationMarker::kInOptimizationQueue);
@ -1778,7 +1757,7 @@ bool Compiler::Compile(Handle<JSFunction> function, ClearExceptionFlag flag,
Handle<Code> maybe_code; Handle<Code> maybe_code;
if (GetOptimizedCode(function, ConcurrencyMode::kNotConcurrent, if (GetOptimizedCode(function, ConcurrencyMode::kNotConcurrent,
DefaultCompilationTarget()) CodeKindForTopTier())
.ToHandle(&maybe_code)) { .ToHandle(&maybe_code)) {
code = maybe_code; code = maybe_code;
} }
@ -1839,15 +1818,16 @@ bool Compiler::FinalizeBackgroundCompileTask(
// static // static
bool Compiler::CompileOptimized(Handle<JSFunction> function, bool Compiler::CompileOptimized(Handle<JSFunction> function,
ConcurrencyMode mode, ConcurrencyMode mode, CodeKind code_kind) {
CompilationTarget target) { DCHECK(CodeKindIsOptimizedJSFunction(code_kind));
if (function->IsOptimized()) return true; if (function->IsOptimized()) return true;
Isolate* isolate = function->GetIsolate(); Isolate* isolate = function->GetIsolate();
DCHECK(AllowCompilation::IsAllowed(isolate)); DCHECK(AllowCompilation::IsAllowed(isolate));
Handle<Code> code; Handle<Code> code;
if (!GetOptimizedCode(function, mode, target).ToHandle(&code)) { if (!GetOptimizedCode(function, mode, code_kind).ToHandle(&code)) {
// Optimization failed, get unoptimized code. Unoptimized code must exist // Optimization failed, get unoptimized code. Unoptimized code must exist
// already if we are optimizing. // already if we are optimizing.
DCHECK(!isolate->has_pending_exception()); DCHECK(!isolate->has_pending_exception());
@ -1856,7 +1836,7 @@ bool Compiler::CompileOptimized(Handle<JSFunction> function,
code = BUILTIN_CODE(isolate, InterpreterEntryTrampoline); code = BUILTIN_CODE(isolate, InterpreterEntryTrampoline);
} }
if (!IsForNativeContextIndependentCachingOnly(target)) { if (!IsForNativeContextIndependentCachingOnly(code_kind)) {
function->set_code(*code); function->set_code(*code);
} }
@ -2913,7 +2893,7 @@ MaybeHandle<Code> Compiler::GetOptimizedCodeForOSR(Handle<JSFunction> function,
DCHECK(!osr_offset.IsNone()); DCHECK(!osr_offset.IsNone());
DCHECK_NOT_NULL(osr_frame); DCHECK_NOT_NULL(osr_frame);
return GetOptimizedCode(function, ConcurrencyMode::kNotConcurrent, return GetOptimizedCode(function, ConcurrencyMode::kNotConcurrent,
CompilationTarget::kTurbofan, osr_offset, osr_frame); CodeKindForOSR(), osr_offset, osr_frame);
} }
// static // static

View File

@ -43,17 +43,6 @@ class WorkerThreadRuntimeCallStats;
using UnoptimizedCompilationJobList = using UnoptimizedCompilationJobList =
std::forward_list<std::unique_ptr<UnoptimizedCompilationJob>>; std::forward_list<std::unique_ptr<UnoptimizedCompilationJob>>;
enum class CompilationTarget : uint8_t {
kTurbofan,
kNativeContextIndependent,
};
inline CompilationTarget DefaultCompilationTarget() {
return FLAG_turbo_nci_as_highest_tier
? CompilationTarget::kNativeContextIndependent
: CompilationTarget::kTurbofan;
}
inline bool ShouldSpawnExtraNativeContextIndependentCompilationJob() { inline bool ShouldSpawnExtraNativeContextIndependentCompilationJob() {
return FLAG_turbo_nci && !FLAG_turbo_nci_as_highest_tier; return FLAG_turbo_nci && !FLAG_turbo_nci_as_highest_tier;
} }
@ -84,7 +73,7 @@ class V8_EXPORT_PRIVATE Compiler : public AllStatic {
static bool Compile(Handle<JSFunction> function, ClearExceptionFlag flag, static bool Compile(Handle<JSFunction> function, ClearExceptionFlag flag,
IsCompiledScope* is_compiled_scope); IsCompiledScope* is_compiled_scope);
static bool CompileOptimized(Handle<JSFunction> function, static bool CompileOptimized(Handle<JSFunction> function,
ConcurrencyMode mode, CompilationTarget target); ConcurrencyMode mode, CodeKind code_kind);
// Collect source positions for a function that has already been compiled to // Collect source positions for a function that has already been compiled to
// bytecode, but for which source positions were not collected (e.g. because // bytecode, but for which source positions were not collected (e.g. because

View File

@ -19,8 +19,8 @@ namespace internal {
OptimizedCompilationInfo::OptimizedCompilationInfo( OptimizedCompilationInfo::OptimizedCompilationInfo(
Zone* zone, Isolate* isolate, Handle<SharedFunctionInfo> shared, Zone* zone, Isolate* isolate, Handle<SharedFunctionInfo> shared,
Handle<JSFunction> closure, bool native_context_independent) Handle<JSFunction> closure, CodeKind code_kind)
: code_kind_(Code::OPTIMIZED_FUNCTION), : code_kind_(code_kind),
zone_(zone), zone_(zone),
optimization_id_(isolate->NextOptimizationId()) { optimization_id_(isolate->NextOptimizationId()) {
DCHECK_EQ(*shared, closure->shared()); DCHECK_EQ(*shared, closure->shared());
@ -37,13 +37,12 @@ OptimizedCompilationInfo::OptimizedCompilationInfo(
set_source_positions(); set_source_positions();
} }
if (native_context_independent) set_native_context_independent();
SetTracingFlags(shared->PassesFilter(FLAG_trace_turbo_filter)); SetTracingFlags(shared->PassesFilter(FLAG_trace_turbo_filter));
ConfigureFlags(); ConfigureFlags();
} }
OptimizedCompilationInfo::OptimizedCompilationInfo( OptimizedCompilationInfo::OptimizedCompilationInfo(
Vector<const char> debug_name, Zone* zone, Code::Kind code_kind) Vector<const char> debug_name, Zone* zone, CodeKind code_kind)
: code_kind_(code_kind), : code_kind_(code_kind),
zone_(zone), zone_(zone),
optimization_id_(kNoOptimizationId), optimization_id_(kNoOptimizationId),
@ -59,7 +58,7 @@ bool OptimizedCompilationInfo::FlagSetIsValid(Flag flag) const {
case kPoisonRegisterArguments: case kPoisonRegisterArguments:
return untrusted_code_mitigations(); return untrusted_code_mitigations();
case kFunctionContextSpecializing: case kFunctionContextSpecializing:
return !native_context_independent(); return !IsNativeContextIndependent();
default: default:
return true; return true;
} }
@ -82,41 +81,32 @@ void OptimizedCompilationInfo::ConfigureFlags() {
if (FLAG_untrusted_code_mitigations) set_untrusted_code_mitigations(); if (FLAG_untrusted_code_mitigations) set_untrusted_code_mitigations();
switch (code_kind_) { switch (code_kind_) {
case Code::OPTIMIZED_FUNCTION: case CodeKind::OPTIMIZED_FUNCTION:
set_called_with_code_start_register(); if (FLAG_function_context_specialization) {
set_switch_jump_table();
if (FLAG_function_context_specialization &&
!native_context_independent()) {
set_function_context_specializing(); set_function_context_specializing();
} }
if (FLAG_turbo_splitting) { V8_FALLTHROUGH;
set_splitting(); case CodeKind::NATIVE_CONTEXT_INDEPENDENT:
}
if (FLAG_untrusted_code_mitigations) {
set_poison_register_arguments();
}
if (FLAG_analyze_environment_liveness) {
// TODO(yangguo): Disable this in case of debugging for crbug.com/826613
set_analyze_environment_liveness();
}
break;
case Code::BYTECODE_HANDLER:
set_called_with_code_start_register(); set_called_with_code_start_register();
if (FLAG_turbo_splitting) { set_switch_jump_table();
set_splitting(); if (FLAG_turbo_splitting) set_splitting();
} if (FLAG_untrusted_code_mitigations) set_poison_register_arguments();
// TODO(yangguo): Disable this in case of debugging for crbug.com/826613
if (FLAG_analyze_environment_liveness) set_analyze_environment_liveness();
break; break;
case Code::BUILTIN: case CodeKind::BYTECODE_HANDLER:
case Code::STUB: set_called_with_code_start_register();
if (FLAG_turbo_splitting) { if (FLAG_turbo_splitting) set_splitting();
set_splitting(); break;
} case CodeKind::BUILTIN:
case CodeKind::STUB:
if (FLAG_turbo_splitting) set_splitting();
#if ENABLE_GDB_JIT_INTERFACE && DEBUG #if ENABLE_GDB_JIT_INTERFACE && DEBUG
set_source_positions(); set_source_positions();
#endif // ENABLE_GDB_JIT_INTERFACE && DEBUG #endif // ENABLE_GDB_JIT_INTERFACE && DEBUG
break; break;
case Code::WASM_FUNCTION: case CodeKind::WASM_FUNCTION:
case Code::WASM_TO_CAPI_FUNCTION: case CodeKind::WASM_TO_CAPI_FUNCTION:
set_switch_jump_table(); set_switch_jump_table();
break; break;
default: default:
@ -183,19 +173,19 @@ std::unique_ptr<char[]> OptimizedCompilationInfo::GetDebugName() const {
StackFrame::Type OptimizedCompilationInfo::GetOutputStackFrameType() const { StackFrame::Type OptimizedCompilationInfo::GetOutputStackFrameType() const {
switch (code_kind()) { switch (code_kind()) {
case Code::STUB: case CodeKind::STUB:
case Code::BYTECODE_HANDLER: case CodeKind::BYTECODE_HANDLER:
case Code::BUILTIN: case CodeKind::BUILTIN:
return StackFrame::STUB; return StackFrame::STUB;
case Code::WASM_FUNCTION: case CodeKind::WASM_FUNCTION:
return StackFrame::WASM; return StackFrame::WASM;
case Code::WASM_TO_CAPI_FUNCTION: case CodeKind::WASM_TO_CAPI_FUNCTION:
return StackFrame::WASM_EXIT; return StackFrame::WASM_EXIT;
case Code::JS_TO_WASM_FUNCTION: case CodeKind::JS_TO_WASM_FUNCTION:
return StackFrame::JS_TO_WASM; return StackFrame::JS_TO_WASM;
case Code::WASM_TO_JS_FUNCTION: case CodeKind::WASM_TO_JS_FUNCTION:
return StackFrame::WASM_TO_JS; return StackFrame::WASM_TO_JS;
case Code::C_WASM_ENTRY: case CodeKind::C_WASM_ENTRY:
return StackFrame::C_WASM_ENTRY; return StackFrame::C_WASM_ENTRY;
default: default:
UNIMPLEMENTED(); UNIMPLEMENTED();
@ -203,6 +193,11 @@ StackFrame::Type OptimizedCompilationInfo::GetOutputStackFrameType() const {
} }
} }
void OptimizedCompilationInfo::SetCode(Handle<Code> code) {
DCHECK_EQ(code->kind(), code_kind());
code_ = code;
}
void OptimizedCompilationInfo::SetWasmCompilationResult( void OptimizedCompilationInfo::SetWasmCompilationResult(
std::unique_ptr<wasm::WasmCompilationResult> wasm_compilation_result) { std::unique_ptr<wasm::WasmCompilationResult> wasm_compilation_result) {
wasm_compilation_result_ = std::move(wasm_compilation_result); wasm_compilation_result_ = std::move(wasm_compilation_result);

View File

@ -68,8 +68,7 @@ class V8_EXPORT_PRIVATE OptimizedCompilationInfo final {
V(WasmRuntimeExceptionSupport, wasm_runtime_exception_support, 18) \ V(WasmRuntimeExceptionSupport, wasm_runtime_exception_support, 18) \
V(TurboControlFlowAwareAllocation, turbo_control_flow_aware_allocation, 19) \ V(TurboControlFlowAwareAllocation, turbo_control_flow_aware_allocation, 19) \
V(TurboPreprocessRanges, turbo_preprocess_ranges, 20) \ V(TurboPreprocessRanges, turbo_preprocess_ranges, 20) \
V(ConcurrentInlining, concurrent_inlining, 21) \ V(ConcurrentInlining, concurrent_inlining, 21)
V(NativeContextIndependent, native_context_independent, 22)
enum Flag { enum Flag {
#define DEF_ENUM(Camel, Lower, Bit) k##Camel = 1 << Bit, #define DEF_ENUM(Camel, Lower, Bit) k##Camel = 1 << Bit,
@ -101,11 +100,10 @@ class V8_EXPORT_PRIVATE OptimizedCompilationInfo final {
// Construct a compilation info for optimized compilation. // Construct a compilation info for optimized compilation.
OptimizedCompilationInfo(Zone* zone, Isolate* isolate, OptimizedCompilationInfo(Zone* zone, Isolate* isolate,
Handle<SharedFunctionInfo> shared, Handle<SharedFunctionInfo> shared,
Handle<JSFunction> closure, Handle<JSFunction> closure, CodeKind code_kind);
bool native_context_independent);
// Construct a compilation info for stub compilation, Wasm, and testing. // Construct a compilation info for stub compilation, Wasm, and testing.
OptimizedCompilationInfo(Vector<const char> debug_name, Zone* zone, OptimizedCompilationInfo(Vector<const char> debug_name, Zone* zone,
Code::Kind code_kind); CodeKind code_kind);
~OptimizedCompilationInfo(); ~OptimizedCompilationInfo();
@ -117,7 +115,7 @@ class V8_EXPORT_PRIVATE OptimizedCompilationInfo final {
bool has_bytecode_array() const { return !bytecode_array_.is_null(); } bool has_bytecode_array() const { return !bytecode_array_.is_null(); }
Handle<JSFunction> closure() const { return closure_; } Handle<JSFunction> closure() const { return closure_; }
Handle<Code> code() const { return code_; } Handle<Code> code() const { return code_; }
Code::Kind code_kind() const { return code_kind_; } CodeKind code_kind() const { return code_kind_; }
int32_t builtin_index() const { return builtin_index_; } int32_t builtin_index() const { return builtin_index_; }
void set_builtin_index(int32_t index) { builtin_index_ = index; } void set_builtin_index(int32_t index) { builtin_index_ = index; }
BailoutId osr_offset() const { return osr_offset_; } BailoutId osr_offset() const { return osr_offset_; }
@ -132,7 +130,7 @@ class V8_EXPORT_PRIVATE OptimizedCompilationInfo final {
// Code getters and setters. // Code getters and setters.
void SetCode(Handle<Code> code) { code_ = code; } void SetCode(Handle<Code> code);
void SetWasmCompilationResult(std::unique_ptr<wasm::WasmCompilationResult>); void SetWasmCompilationResult(std::unique_ptr<wasm::WasmCompilationResult>);
std::unique_ptr<wasm::WasmCompilationResult> ReleaseWasmCompilationResult(); std::unique_ptr<wasm::WasmCompilationResult> ReleaseWasmCompilationResult();
@ -147,12 +145,15 @@ class V8_EXPORT_PRIVATE OptimizedCompilationInfo final {
JSGlobalObject global_object() const; JSGlobalObject global_object() const;
// Accessors for the different compilation modes. // Accessors for the different compilation modes.
bool IsOptimizing() const { return code_kind() == Code::OPTIMIZED_FUNCTION; } bool IsOptimizing() const {
bool IsWasm() const { return code_kind() == Code::WASM_FUNCTION; } return CodeKindIsOptimizedJSFunction(code_kind());
bool IsNotOptimizedFunctionOrWasmFunction() const {
return code_kind() != Code::OPTIMIZED_FUNCTION &&
code_kind() != Code::WASM_FUNCTION;
} }
bool IsNativeContextIndependent() const {
return code_kind() == CodeKind::NATIVE_CONTEXT_INDEPENDENT;
}
bool IsStub() const { return code_kind() == CodeKind::STUB; }
bool IsWasm() const { return code_kind() == CodeKind::WASM_FUNCTION; }
void SetOptimizingForOsr(BailoutId osr_offset, JavaScriptFrame* osr_frame) { void SetOptimizingForOsr(BailoutId osr_offset, JavaScriptFrame* osr_frame) {
DCHECK(IsOptimizing()); DCHECK(IsOptimizing());
osr_offset_ = osr_offset; osr_offset_ = osr_offset;
@ -239,7 +240,7 @@ class V8_EXPORT_PRIVATE OptimizedCompilationInfo final {
PoisoningMitigationLevel poisoning_level_ = PoisoningMitigationLevel poisoning_level_ =
PoisoningMitigationLevel::kDontPoison; PoisoningMitigationLevel::kDontPoison;
const Code::Kind code_kind_; const CodeKind code_kind_;
int32_t builtin_index_ = -1; int32_t builtin_index_ = -1;
// We retain a reference the bytecode array specifically to ensure it doesn't // We retain a reference the bytecode array specifically to ensure it doesn't

View File

@ -471,7 +471,7 @@ void RelocInfo::Print(Isolate* isolate, std::ostream& os) { // NOLINT
const Address code_target = target_address(); const Address code_target = target_address();
Code code = Code::GetCodeFromTargetAddress(code_target); Code code = Code::GetCodeFromTargetAddress(code_target);
DCHECK(code.IsCode()); DCHECK(code.IsCode());
os << " (" << Code::Kind2String(code.kind()); os << " (" << CodeKindToString(code.kind());
if (Builtins::IsBuiltin(code)) { if (Builtins::IsBuiltin(code)) {
os << " " << Builtins::name(code.builtin_index()); os << " " << Builtins::name(code.builtin_index());
} }

View File

@ -92,11 +92,11 @@ CodeGenerator::CodeGenerator(
CreateFrameAccessState(frame); CreateFrameAccessState(frame);
CHECK_EQ(info->is_osr(), osr_helper_.has_value()); CHECK_EQ(info->is_osr(), osr_helper_.has_value());
tasm_.set_jump_optimization_info(jump_opt); tasm_.set_jump_optimization_info(jump_opt);
Code::Kind code_kind = info->code_kind(); CodeKind code_kind = info->code_kind();
if (code_kind == Code::WASM_FUNCTION || if (code_kind == CodeKind::WASM_FUNCTION ||
code_kind == Code::WASM_TO_CAPI_FUNCTION || code_kind == CodeKind::WASM_TO_CAPI_FUNCTION ||
code_kind == Code::WASM_TO_JS_FUNCTION || code_kind == CodeKind::WASM_TO_JS_FUNCTION ||
code_kind == Code::JS_TO_WASM_FUNCTION) { code_kind == CodeKind::JS_TO_WASM_FUNCTION) {
tasm_.set_abort_hard(true); tasm_.set_abort_hard(true);
} }
tasm_.set_builtin_index(builtin_index); tasm_.set_builtin_index(builtin_index);
@ -202,8 +202,7 @@ void CodeGenerator::AssembleCode() {
tasm()->CodeEntry(); tasm()->CodeEntry();
// Check that {kJavaScriptCallCodeStartRegister} has been set correctly. // Check that {kJavaScriptCallCodeStartRegister} has been set correctly.
if (FLAG_debug_code && (info->code_kind() == Code::OPTIMIZED_FUNCTION || if (FLAG_debug_code && info->called_with_code_start_register()) {
info->code_kind() == Code::BYTECODE_HANDLER)) {
tasm()->RecordComment("-- Prologue: check code start register --"); tasm()->RecordComment("-- Prologue: check code start register --");
AssembleCodeStartRegisterCheck(); AssembleCodeStartRegisterCheck();
} }
@ -515,7 +514,7 @@ MaybeHandle<Code> CodeGenerator::FinalizeCode() {
// TODO(jgruber,v8:8888): Turn this into a DCHECK once confidence is // TODO(jgruber,v8:8888): Turn this into a DCHECK once confidence is
// high that the implementation is complete. // high that the implementation is complete.
CHECK_IMPLIES(info()->native_context_independent(), CHECK_IMPLIES(info()->IsNativeContextIndependent(),
code->IsNativeContextIndependent(isolate())); code->IsNativeContextIndependent(isolate()));
isolate()->counters()->total_compiled_code_size()->Increment( isolate()->counters()->total_compiled_code_size()->Increment(
@ -834,7 +833,7 @@ void CodeGenerator::AssembleSourcePosition(SourcePosition source_position) {
source_position, false); source_position, false);
if (FLAG_code_comments) { if (FLAG_code_comments) {
OptimizedCompilationInfo* info = this->info(); OptimizedCompilationInfo* info = this->info();
if (info->IsNotOptimizedFunctionOrWasmFunction()) return; if (!info->IsOptimizing() && !info->IsWasm()) return;
std::ostringstream buffer; std::ostringstream buffer;
buffer << "-- "; buffer << "-- ";
// Turbolizer only needs the source position, as it can reconstruct // Turbolizer only needs the source position, as it can reconstruct
@ -865,10 +864,10 @@ bool CodeGenerator::GetSlotAboveSPBeforeTailCall(Instruction* instr,
} }
StubCallMode CodeGenerator::DetermineStubCallMode() const { StubCallMode CodeGenerator::DetermineStubCallMode() const {
Code::Kind code_kind = info()->code_kind(); CodeKind code_kind = info()->code_kind();
return (code_kind == Code::WASM_FUNCTION || return (code_kind == CodeKind::WASM_FUNCTION ||
code_kind == Code::WASM_TO_CAPI_FUNCTION || code_kind == CodeKind::WASM_TO_CAPI_FUNCTION ||
code_kind == Code::WASM_TO_JS_FUNCTION) code_kind == CodeKind::WASM_TO_JS_FUNCTION)
? StubCallMode::kCallWasmRuntimeStub ? StubCallMode::kCallWasmRuntimeStub
: StubCallMode::kCallCodeObject; : StubCallMode::kCallCodeObject;
} }

View File

@ -4680,7 +4680,7 @@ void CodeGenerator::PrepareForDeoptimizationExits(int deopt_count) {}
void CodeGenerator::IncrementStackAccessCounter( void CodeGenerator::IncrementStackAccessCounter(
InstructionOperand* source, InstructionOperand* destination) { InstructionOperand* source, InstructionOperand* destination) {
DCHECK(FLAG_trace_turbo_stack_accesses); DCHECK(FLAG_trace_turbo_stack_accesses);
if (info()->IsNotOptimizedFunctionOrWasmFunction()) return; if (!info()->IsOptimizing() && !info()->IsWasm()) return;
DCHECK_NOT_NULL(debug_name_); DCHECK_NOT_NULL(debug_name_);
auto IncrementCounter = [&](ExternalReference counter) { auto IncrementCounter = [&](ExternalReference counter) {
__ incl(__ ExternalReferenceAsOperand(counter)); __ incl(__ ExternalReferenceAsOperand(counter));

View File

@ -46,7 +46,7 @@ static_assert(
CodeAssemblerState::CodeAssemblerState( CodeAssemblerState::CodeAssemblerState(
Isolate* isolate, Zone* zone, const CallInterfaceDescriptor& descriptor, Isolate* isolate, Zone* zone, const CallInterfaceDescriptor& descriptor,
Code::Kind kind, const char* name, PoisoningMitigationLevel poisoning_level, CodeKind kind, const char* name, PoisoningMitigationLevel poisoning_level,
int32_t builtin_index) int32_t builtin_index)
// TODO(rmcilroy): Should we use Linkage::GetBytecodeDispatchDescriptor for // TODO(rmcilroy): Should we use Linkage::GetBytecodeDispatchDescriptor for
// bytecode handlers? // bytecode handlers?
@ -58,7 +58,7 @@ CodeAssemblerState::CodeAssemblerState(
kind, name, poisoning_level, builtin_index) {} kind, name, poisoning_level, builtin_index) {}
CodeAssemblerState::CodeAssemblerState(Isolate* isolate, Zone* zone, CodeAssemblerState::CodeAssemblerState(Isolate* isolate, Zone* zone,
int parameter_count, Code::Kind kind, int parameter_count, CodeKind kind,
const char* name, const char* name,
PoisoningMitigationLevel poisoning_level, PoisoningMitigationLevel poisoning_level,
int32_t builtin_index) int32_t builtin_index)
@ -66,14 +66,14 @@ CodeAssemblerState::CodeAssemblerState(Isolate* isolate, Zone* zone,
isolate, zone, isolate, zone,
Linkage::GetJSCallDescriptor( Linkage::GetJSCallDescriptor(
zone, false, parameter_count, zone, false, parameter_count,
(kind == Code::BUILTIN ? CallDescriptor::kPushArgumentCount (kind == CodeKind::BUILTIN ? CallDescriptor::kPushArgumentCount
: CallDescriptor::kNoFlags) | : CallDescriptor::kNoFlags) |
CallDescriptor::kCanUseRoots), CallDescriptor::kCanUseRoots),
kind, name, poisoning_level, builtin_index) {} kind, name, poisoning_level, builtin_index) {}
CodeAssemblerState::CodeAssemblerState(Isolate* isolate, Zone* zone, CodeAssemblerState::CodeAssemblerState(Isolate* isolate, Zone* zone,
CallDescriptor* call_descriptor, CallDescriptor* call_descriptor,
Code::Kind kind, const char* name, CodeKind kind, const char* name,
PoisoningMitigationLevel poisoning_level, PoisoningMitigationLevel poisoning_level,
int32_t builtin_index) int32_t builtin_index)
: raw_assembler_(new RawMachineAssembler( : raw_assembler_(new RawMachineAssembler(

View File

@ -1427,13 +1427,13 @@ class V8_EXPORT_PRIVATE CodeAssemblerState {
// |result_size| specifies the number of results returned by the stub. // |result_size| specifies the number of results returned by the stub.
// TODO(rmcilroy): move result_size to the CallInterfaceDescriptor. // TODO(rmcilroy): move result_size to the CallInterfaceDescriptor.
CodeAssemblerState(Isolate* isolate, Zone* zone, CodeAssemblerState(Isolate* isolate, Zone* zone,
const CallInterfaceDescriptor& descriptor, Code::Kind kind, const CallInterfaceDescriptor& descriptor, CodeKind kind,
const char* name, PoisoningMitigationLevel poisoning_level, const char* name, PoisoningMitigationLevel poisoning_level,
int32_t builtin_index = Builtins::kNoBuiltinId); int32_t builtin_index = Builtins::kNoBuiltinId);
// Create with JSCall linkage. // Create with JSCall linkage.
CodeAssemblerState(Isolate* isolate, Zone* zone, int parameter_count, CodeAssemblerState(Isolate* isolate, Zone* zone, int parameter_count,
Code::Kind kind, const char* name, CodeKind kind, const char* name,
PoisoningMitigationLevel poisoning_level, PoisoningMitigationLevel poisoning_level,
int32_t builtin_index = Builtins::kNoBuiltinId); int32_t builtin_index = Builtins::kNoBuiltinId);
@ -1457,7 +1457,7 @@ class V8_EXPORT_PRIVATE CodeAssemblerState {
friend class ScopedExceptionHandler; friend class ScopedExceptionHandler;
CodeAssemblerState(Isolate* isolate, Zone* zone, CodeAssemblerState(Isolate* isolate, Zone* zone,
CallDescriptor* call_descriptor, Code::Kind kind, CallDescriptor* call_descriptor, CodeKind kind,
const char* name, PoisoningMitigationLevel poisoning_level, const char* name, PoisoningMitigationLevel poisoning_level,
int32_t builtin_index); int32_t builtin_index);
@ -1465,7 +1465,7 @@ class V8_EXPORT_PRIVATE CodeAssemblerState {
void PopExceptionHandler(); void PopExceptionHandler();
std::unique_ptr<RawMachineAssembler> raw_assembler_; std::unique_ptr<RawMachineAssembler> raw_assembler_;
Code::Kind kind_; CodeKind kind_;
const char* name_; const char* name_;
int32_t builtin_index_; int32_t builtin_index_;
bool code_generated_; bool code_generated_;

View File

@ -144,14 +144,14 @@ bool CallDescriptor::CanTailCall(const CallDescriptor* callee) const {
// TODO(jkummerow, sigurds): Arguably frame size calculation should be // TODO(jkummerow, sigurds): Arguably frame size calculation should be
// keyed on code/frame type, not on CallDescriptor kind. Think about a // keyed on code/frame type, not on CallDescriptor kind. Think about a
// good way to organize this logic. // good way to organize this logic.
int CallDescriptor::CalculateFixedFrameSize(Code::Kind code_kind) const { int CallDescriptor::CalculateFixedFrameSize(CodeKind code_kind) const {
switch (kind_) { switch (kind_) {
case kCallJSFunction: case kCallJSFunction:
return PushArgumentCount() return PushArgumentCount()
? OptimizedBuiltinFrameConstants::kFixedSlotCount ? OptimizedBuiltinFrameConstants::kFixedSlotCount
: StandardFrameConstants::kFixedSlotCount; : StandardFrameConstants::kFixedSlotCount;
case kCallAddress: case kCallAddress:
if (code_kind == Code::C_WASM_ENTRY) { if (code_kind == CodeKind::C_WASM_ENTRY) {
return CWasmEntryFrameConstants::kFixedSlotCount; return CWasmEntryFrameConstants::kFixedSlotCount;
} }
return CommonFrameConstants::kFixedSlotCountAboveFp + return CommonFrameConstants::kFixedSlotCountAboveFp +
@ -170,7 +170,7 @@ int CallDescriptor::CalculateFixedFrameSize(Code::Kind code_kind) const {
CallDescriptor* Linkage::ComputeIncoming(Zone* zone, CallDescriptor* Linkage::ComputeIncoming(Zone* zone,
OptimizedCompilationInfo* info) { OptimizedCompilationInfo* info) {
DCHECK(!info->IsNotOptimizedFunctionOrWasmFunction()); DCHECK(info->IsOptimizing() || info->IsWasm());
if (!info->closure().is_null()) { if (!info->closure().is_null()) {
// If we are compiling a JS function, use a JS call descriptor, // If we are compiling a JS function, use a JS call descriptor,
// plus the receiver. // plus the receiver.

View File

@ -377,7 +377,7 @@ class V8_EXPORT_PRIVATE CallDescriptor final
bool CanTailCall(const CallDescriptor* callee) const; bool CanTailCall(const CallDescriptor* callee) const;
int CalculateFixedFrameSize(Code::Kind code_kind) const; int CalculateFixedFrameSize(CodeKind code_kind) const;
RegList AllocatableRegisters() const { return allocatable_registers_; } RegList AllocatableRegisters() const { return allocatable_registers_; }

View File

@ -154,7 +154,7 @@ class PipelineData {
codegen_zone_(codegen_zone_scope_.zone()), codegen_zone_(codegen_zone_scope_.zone()),
broker_(new JSHeapBroker( broker_(new JSHeapBroker(
isolate_, info_->zone(), info_->trace_heap_broker(), isolate_, info_->zone(), info_->trace_heap_broker(),
is_concurrent_inlining, info->native_context_independent(), is_concurrent_inlining, info->IsNativeContextIndependent(),
info->DetachPersistentHandles())), info->DetachPersistentHandles())),
register_allocation_zone_scope_(zone_stats_, register_allocation_zone_scope_(zone_stats_,
kRegisterAllocationZoneName), kRegisterAllocationZoneName),
@ -879,7 +879,7 @@ void PrintCode(Isolate* isolate, Handle<Code> code,
} }
#ifdef ENABLE_DISASSEMBLER #ifdef ENABLE_DISASSEMBLER
bool print_code = const bool print_code =
FLAG_print_code || FLAG_print_code ||
(info->IsOptimizing() && FLAG_print_opt_code && (info->IsOptimizing() && FLAG_print_opt_code &&
info->shared_info()->PassesFilter(FLAG_print_opt_code_filter)); info->shared_info()->PassesFilter(FLAG_print_opt_code_filter));
@ -889,7 +889,7 @@ void PrintCode(Isolate* isolate, Handle<Code> code,
auto& os = tracing_scope.stream(); auto& os = tracing_scope.stream();
// Print the source code if available. // Print the source code if available.
bool print_source = code->kind() == Code::OPTIMIZED_FUNCTION; const bool print_source = info->IsOptimizing();
if (print_source) { if (print_source) {
Handle<SharedFunctionInfo> shared = info->shared_info(); Handle<SharedFunctionInfo> shared = info->shared_info();
if (shared->script().IsScript() && if (shared->script().IsScript() &&
@ -1046,8 +1046,7 @@ class PipelineCompilationJob final : public OptimizedCompilationJob {
PipelineCompilationJob(Isolate* isolate, PipelineCompilationJob(Isolate* isolate,
Handle<SharedFunctionInfo> shared_info, Handle<SharedFunctionInfo> shared_info,
Handle<JSFunction> function, BailoutId osr_offset, Handle<JSFunction> function, BailoutId osr_offset,
JavaScriptFrame* osr_frame, JavaScriptFrame* osr_frame, CodeKind code_kind);
bool native_context_independent);
~PipelineCompilationJob() final; ~PipelineCompilationJob() final;
protected: protected:
@ -1075,7 +1074,7 @@ class PipelineCompilationJob final : public OptimizedCompilationJob {
PipelineCompilationJob::PipelineCompilationJob( PipelineCompilationJob::PipelineCompilationJob(
Isolate* isolate, Handle<SharedFunctionInfo> shared_info, Isolate* isolate, Handle<SharedFunctionInfo> shared_info,
Handle<JSFunction> function, BailoutId osr_offset, Handle<JSFunction> function, BailoutId osr_offset,
JavaScriptFrame* osr_frame, bool native_context_independent) JavaScriptFrame* osr_frame, CodeKind code_kind)
// Note that the OptimizedCompilationInfo is not initialized at the time // Note that the OptimizedCompilationInfo is not initialized at the time
// we pass it to the CompilationJob constructor, but it is not // we pass it to the CompilationJob constructor, but it is not
// dereferenced there. // dereferenced there.
@ -1084,7 +1083,7 @@ PipelineCompilationJob::PipelineCompilationJob(
kPipelineCompilationJobZoneName), kPipelineCompilationJobZoneName),
zone_stats_(function->GetIsolate()->allocator()), zone_stats_(function->GetIsolate()->allocator()),
compilation_info_(&zone_, function->GetIsolate(), shared_info, function, compilation_info_(&zone_, function->GetIsolate(), shared_info, function,
native_context_independent), code_kind),
pipeline_statistics_(CreatePipelineStatistics( pipeline_statistics_(CreatePipelineStatistics(
handle(Script::cast(shared_info->script()), isolate), handle(Script::cast(shared_info->script()), isolate),
compilation_info(), function->GetIsolate(), &zone_stats_)), compilation_info(), function->GetIsolate(), &zone_stats_)),
@ -1127,14 +1126,14 @@ PipelineCompilationJob::Status PipelineCompilationJob::PrepareJobImpl(
return AbortOptimization(BailoutReason::kFunctionTooBig); return AbortOptimization(BailoutReason::kFunctionTooBig);
} }
if (!FLAG_always_opt && !compilation_info()->native_context_independent()) { if (!FLAG_always_opt && !compilation_info()->IsNativeContextIndependent()) {
compilation_info()->set_bailout_on_uninitialized(); compilation_info()->set_bailout_on_uninitialized();
} }
if (FLAG_turbo_loop_peeling) { if (FLAG_turbo_loop_peeling) {
compilation_info()->set_loop_peeling(); compilation_info()->set_loop_peeling();
} }
if (FLAG_turbo_inlining && if (FLAG_turbo_inlining &&
!compilation_info()->native_context_independent()) { !compilation_info()->IsNativeContextIndependent()) {
compilation_info()->set_inlining(); compilation_info()->set_inlining();
} }
@ -1162,7 +1161,7 @@ PipelineCompilationJob::Status PipelineCompilationJob::PrepareJobImpl(
if (compilation_info()->closure()->raw_feedback_cell().map() == if (compilation_info()->closure()->raw_feedback_cell().map() ==
ReadOnlyRoots(isolate).one_closure_cell_map() && ReadOnlyRoots(isolate).one_closure_cell_map() &&
!compilation_info()->is_osr() && !compilation_info()->is_osr() &&
!compilation_info()->native_context_independent()) { !compilation_info()->IsNativeContextIndependent()) {
compilation_info()->set_function_context_specializing(); compilation_info()->set_function_context_specializing();
data_.ChooseSpecializationContext(); data_.ChooseSpecializationContext();
} }
@ -1248,7 +1247,7 @@ PipelineCompilationJob::Status PipelineCompilationJob::FinalizeJobImpl(
compilation_info()->SetCode(code); compilation_info()->SetCode(code);
Handle<NativeContext> context(compilation_info()->native_context(), isolate); Handle<NativeContext> context(compilation_info()->native_context(), isolate);
context->AddOptimizedCode(*code); if (CodeKindCanDeoptimize(code->kind())) context->AddOptimizedCode(*code);
RegisterWeakObjectsInOptimizedCode(isolate, context, code); RegisterWeakObjectsInOptimizedCode(isolate, context, code);
return SUCCEEDED; return SUCCEEDED;
} }
@ -1282,8 +1281,7 @@ class WasmHeapStubCompilationJob final : public OptimizedCompilationJob {
WasmHeapStubCompilationJob(Isolate* isolate, wasm::WasmEngine* wasm_engine, WasmHeapStubCompilationJob(Isolate* isolate, wasm::WasmEngine* wasm_engine,
CallDescriptor* call_descriptor, CallDescriptor* call_descriptor,
std::unique_ptr<Zone> zone, Graph* graph, std::unique_ptr<Zone> zone, Graph* graph,
Code::Kind kind, CodeKind kind, std::unique_ptr<char[]> debug_name,
std::unique_ptr<char[]> debug_name,
const AssemblerOptions& options, const AssemblerOptions& options,
SourcePositionTable* source_positions) SourcePositionTable* source_positions)
// Note that the OptimizedCompilationInfo is not initialized at the time // Note that the OptimizedCompilationInfo is not initialized at the time
@ -1327,7 +1325,7 @@ std::unique_ptr<OptimizedCompilationJob>
Pipeline::NewWasmHeapStubCompilationJob( Pipeline::NewWasmHeapStubCompilationJob(
Isolate* isolate, wasm::WasmEngine* wasm_engine, Isolate* isolate, wasm::WasmEngine* wasm_engine,
CallDescriptor* call_descriptor, std::unique_ptr<Zone> zone, Graph* graph, CallDescriptor* call_descriptor, std::unique_ptr<Zone> zone, Graph* graph,
Code::Kind kind, std::unique_ptr<char[]> debug_name, CodeKind kind, std::unique_ptr<char[]> debug_name,
const AssemblerOptions& options, SourcePositionTable* source_positions) { const AssemblerOptions& options, SourcePositionTable* source_positions) {
return std::make_unique<WasmHeapStubCompilationJob>( return std::make_unique<WasmHeapStubCompilationJob>(
isolate, wasm_engine, call_descriptor, std::move(zone), graph, kind, isolate, wasm_engine, call_descriptor, std::move(zone), graph, kind,
@ -1355,7 +1353,7 @@ CompilationJob::Status WasmHeapStubCompilationJob::ExecuteJobImpl(
<< " using TurboFan" << std::endl; << " using TurboFan" << std::endl;
} }
if (info_.trace_turbo_graph()) { // Simple textual RPO. if (info_.trace_turbo_graph()) { // Simple textual RPO.
StdoutStream{} << "-- wasm stub " << Code::Kind2String(info_.code_kind()) StdoutStream{} << "-- wasm stub " << CodeKindToString(info_.code_kind())
<< " graph -- " << std::endl << " graph -- " << std::endl
<< AsRPO(*data_.graph()); << AsRPO(*data_.graph());
} }
@ -1425,7 +1423,7 @@ struct GraphBuilderPhase {
if (data->info()->bailout_on_uninitialized()) { if (data->info()->bailout_on_uninitialized()) {
flags |= BytecodeGraphBuilderFlag::kBailoutOnUninitialized; flags |= BytecodeGraphBuilderFlag::kBailoutOnUninitialized;
} }
if (data->info()->native_context_independent()) { if (data->info()->IsNativeContextIndependent()) {
flags |= BytecodeGraphBuilderFlag::kNativeContextIndependent; flags |= BytecodeGraphBuilderFlag::kNativeContextIndependent;
} }
@ -1485,7 +1483,7 @@ struct InliningPhase {
AddReducer(data, &graph_reducer, &dead_code_elimination); AddReducer(data, &graph_reducer, &dead_code_elimination);
AddReducer(data, &graph_reducer, &checkpoint_elimination); AddReducer(data, &graph_reducer, &checkpoint_elimination);
AddReducer(data, &graph_reducer, &common_reducer); AddReducer(data, &graph_reducer, &common_reducer);
if (!data->info()->native_context_independent()) { if (!data->info()->IsNativeContextIndependent()) {
AddReducer(data, &graph_reducer, &native_context_specialization); AddReducer(data, &graph_reducer, &native_context_specialization);
AddReducer(data, &graph_reducer, &context_specialization); AddReducer(data, &graph_reducer, &context_specialization);
} }
@ -1628,7 +1626,7 @@ struct TypedLoweringPhase {
data->broker(), data->common(), data->broker(), data->common(),
data->machine(), temp_zone); data->machine(), temp_zone);
AddReducer(data, &graph_reducer, &dead_code_elimination); AddReducer(data, &graph_reducer, &dead_code_elimination);
if (!data->info()->native_context_independent()) { if (!data->info()->IsNativeContextIndependent()) {
AddReducer(data, &graph_reducer, &create_lowering); AddReducer(data, &graph_reducer, &create_lowering);
} }
AddReducer(data, &graph_reducer, &constant_folding_reducer); AddReducer(data, &graph_reducer, &constant_folding_reducer);
@ -2445,11 +2443,11 @@ struct VerifyGraphPhase {
bool values_only = false) { bool values_only = false) {
Verifier::CodeType code_type; Verifier::CodeType code_type;
switch (data->info()->code_kind()) { switch (data->info()->code_kind()) {
case Code::WASM_FUNCTION: case CodeKind::WASM_FUNCTION:
case Code::WASM_TO_CAPI_FUNCTION: case CodeKind::WASM_TO_CAPI_FUNCTION:
case Code::WASM_TO_JS_FUNCTION: case CodeKind::WASM_TO_JS_FUNCTION:
case Code::JS_TO_WASM_FUNCTION: case CodeKind::JS_TO_WASM_FUNCTION:
case Code::C_WASM_ENTRY: case CodeKind::C_WASM_ENTRY:
code_type = Verifier::kWasm; code_type = Verifier::kWasm;
break; break;
default: default:
@ -2801,7 +2799,7 @@ int HashGraphForPGO(Graph* graph) {
MaybeHandle<Code> Pipeline::GenerateCodeForCodeStub( MaybeHandle<Code> Pipeline::GenerateCodeForCodeStub(
Isolate* isolate, CallDescriptor* call_descriptor, Graph* graph, Isolate* isolate, CallDescriptor* call_descriptor, Graph* graph,
JSGraph* jsgraph, SourcePositionTable* source_positions, Code::Kind kind, JSGraph* jsgraph, SourcePositionTable* source_positions, CodeKind kind,
const char* debug_name, int32_t builtin_index, const char* debug_name, int32_t builtin_index,
PoisoningMitigationLevel poisoning_level, const AssemblerOptions& options, PoisoningMitigationLevel poisoning_level, const AssemblerOptions& options,
const ProfileDataFromFile* profile_data) { const ProfileDataFromFile* profile_data) {
@ -2932,9 +2930,8 @@ std::ostream& operator<<(std::ostream& out, const BlockStartsAsJSON& s) {
// static // static
wasm::WasmCompilationResult Pipeline::GenerateCodeForWasmNativeStub( wasm::WasmCompilationResult Pipeline::GenerateCodeForWasmNativeStub(
wasm::WasmEngine* wasm_engine, CallDescriptor* call_descriptor, wasm::WasmEngine* wasm_engine, CallDescriptor* call_descriptor,
MachineGraph* mcgraph, Code::Kind kind, int wasm_kind, MachineGraph* mcgraph, CodeKind kind, int wasm_kind, const char* debug_name,
const char* debug_name, const AssemblerOptions& options, const AssemblerOptions& options, SourcePositionTable* source_positions) {
SourcePositionTable* source_positions) {
Graph* graph = mcgraph->graph(); Graph* graph = mcgraph->graph();
OptimizedCompilationInfo info(CStrVector(debug_name), graph->zone(), kind); OptimizedCompilationInfo info(CStrVector(debug_name), graph->zone(), kind);
// Construct a pipeline for scheduling and code generation. // Construct a pipeline for scheduling and code generation.
@ -2965,7 +2962,7 @@ wasm::WasmCompilationResult Pipeline::GenerateCodeForWasmNativeStub(
} }
if (info.trace_turbo_graph()) { // Simple textual RPO. if (info.trace_turbo_graph()) { // Simple textual RPO.
StdoutStream{} << "-- wasm stub " << Code::Kind2String(kind) << " graph -- " StdoutStream{} << "-- wasm stub " << CodeKindToString(kind) << " graph -- "
<< std::endl << std::endl
<< AsRPO(*graph); << AsRPO(*graph);
} }
@ -3105,14 +3102,12 @@ MaybeHandle<Code> Pipeline::GenerateCodeForTesting(
// static // static
std::unique_ptr<OptimizedCompilationJob> Pipeline::NewCompilationJob( std::unique_ptr<OptimizedCompilationJob> Pipeline::NewCompilationJob(
Isolate* isolate, Handle<JSFunction> function, bool has_script, Isolate* isolate, Handle<JSFunction> function, CodeKind code_kind,
BailoutId osr_offset, JavaScriptFrame* osr_frame, bool has_script, BailoutId osr_offset, JavaScriptFrame* osr_frame) {
bool native_context_independent) {
Handle<SharedFunctionInfo> shared = Handle<SharedFunctionInfo> shared =
handle(function->shared(), function->GetIsolate()); handle(function->shared(), function->GetIsolate());
return std::make_unique<PipelineCompilationJob>(isolate, shared, function, return std::make_unique<PipelineCompilationJob>(
osr_offset, osr_frame, isolate, shared, function, osr_offset, osr_frame, code_kind);
native_context_independent);
} }
// static // static
@ -3244,7 +3239,7 @@ bool Pipeline::AllocateRegistersForTesting(const RegisterConfiguration* config,
bool use_mid_tier_register_allocator, bool use_mid_tier_register_allocator,
bool run_verifier) { bool run_verifier) {
OptimizedCompilationInfo info(ArrayVector("testing"), sequence->zone(), OptimizedCompilationInfo info(ArrayVector("testing"), sequence->zone(),
Code::STUB); CodeKind::STUB);
ZoneStats zone_stats(sequence->isolate()->allocator()); ZoneStats zone_stats(sequence->isolate()->allocator());
PipelineData data(&zone_stats, &info, sequence->isolate(), sequence); PipelineData data(&zone_stats, &info, sequence->isolate(), sequence);
data.InitializeFrameData(nullptr); data.InitializeFrameData(nullptr);
@ -3320,10 +3315,9 @@ bool PipelineImpl::SelectInstructions(Linkage* linkage) {
<< "--------------------------------------------------\n"; << "--------------------------------------------------\n";
} }
Zone temp_zone(data->allocator(), kMachineGraphVerifierZoneName); Zone temp_zone(data->allocator(), kMachineGraphVerifierZoneName);
MachineGraphVerifier::Run( MachineGraphVerifier::Run(data->graph(), data->schedule(), linkage,
data->graph(), data->schedule(), linkage, data->info()->IsStub(), data->debug_name(),
data->info()->IsNotOptimizedFunctionOrWasmFunction(), &temp_zone);
data->debug_name(), &temp_zone);
} }
data->InitializeInstructionSequence(call_descriptor); data->InitializeInstructionSequence(call_descriptor);

View File

@ -46,10 +46,9 @@ class Pipeline : public AllStatic {
public: public:
// Returns a new compilation job for the given JavaScript function. // Returns a new compilation job for the given JavaScript function.
static std::unique_ptr<OptimizedCompilationJob> NewCompilationJob( static std::unique_ptr<OptimizedCompilationJob> NewCompilationJob(
Isolate* isolate, Handle<JSFunction> function, bool has_script, Isolate* isolate, Handle<JSFunction> function, CodeKind code_kind,
BailoutId osr_offset = BailoutId::None(), bool has_script, BailoutId osr_offset = BailoutId::None(),
JavaScriptFrame* osr_frame = nullptr, JavaScriptFrame* osr_frame = nullptr);
bool native_context_independent = false);
// Run the pipeline for the WebAssembly compilation info. // Run the pipeline for the WebAssembly compilation info.
static void GenerateCodeForWasmFunction( static void GenerateCodeForWasmFunction(
@ -62,7 +61,7 @@ class Pipeline : public AllStatic {
// Run the pipeline on a machine graph and generate code. // Run the pipeline on a machine graph and generate code.
static wasm::WasmCompilationResult GenerateCodeForWasmNativeStub( static wasm::WasmCompilationResult GenerateCodeForWasmNativeStub(
wasm::WasmEngine* wasm_engine, CallDescriptor* call_descriptor, wasm::WasmEngine* wasm_engine, CallDescriptor* call_descriptor,
MachineGraph* mcgraph, Code::Kind kind, int wasm_kind, MachineGraph* mcgraph, CodeKind kind, int wasm_kind,
const char* debug_name, const AssemblerOptions& assembler_options, const char* debug_name, const AssemblerOptions& assembler_options,
SourcePositionTable* source_positions = nullptr); SourcePositionTable* source_positions = nullptr);
@ -70,14 +69,14 @@ class Pipeline : public AllStatic {
static std::unique_ptr<OptimizedCompilationJob> NewWasmHeapStubCompilationJob( static std::unique_ptr<OptimizedCompilationJob> NewWasmHeapStubCompilationJob(
Isolate* isolate, wasm::WasmEngine* wasm_engine, Isolate* isolate, wasm::WasmEngine* wasm_engine,
CallDescriptor* call_descriptor, std::unique_ptr<Zone> zone, Graph* graph, CallDescriptor* call_descriptor, std::unique_ptr<Zone> zone, Graph* graph,
Code::Kind kind, std::unique_ptr<char[]> debug_name, CodeKind kind, std::unique_ptr<char[]> debug_name,
const AssemblerOptions& options, const AssemblerOptions& options,
SourcePositionTable* source_positions = nullptr); SourcePositionTable* source_positions = nullptr);
// Run the pipeline on a machine graph and generate code. // Run the pipeline on a machine graph and generate code.
static MaybeHandle<Code> GenerateCodeForCodeStub( static MaybeHandle<Code> GenerateCodeForCodeStub(
Isolate* isolate, CallDescriptor* call_descriptor, Graph* graph, Isolate* isolate, CallDescriptor* call_descriptor, Graph* graph,
JSGraph* jsgraph, SourcePositionTable* source_positions, Code::Kind kind, JSGraph* jsgraph, SourcePositionTable* source_positions, CodeKind kind,
const char* debug_name, int32_t builtin_index, const char* debug_name, int32_t builtin_index,
PoisoningMitigationLevel poisoning_level, const AssemblerOptions& options, PoisoningMitigationLevel poisoning_level, const AssemblerOptions& options,
const ProfileDataFromFile* profile_data); const ProfileDataFromFile* profile_data);

View File

@ -6792,7 +6792,7 @@ std::unique_ptr<OptimizedCompilationJob> NewJSToWasmCompilationJob(
return Pipeline::NewWasmHeapStubCompilationJob( return Pipeline::NewWasmHeapStubCompilationJob(
isolate, wasm_engine, incoming, std::move(zone), graph, isolate, wasm_engine, incoming, std::move(zone), graph,
Code::JS_TO_WASM_FUNCTION, std::move(name_buffer), CodeKind::JS_TO_WASM_FUNCTION, std::move(name_buffer),
WasmAssemblerOptions()); WasmAssemblerOptions());
} }
@ -7019,7 +7019,7 @@ wasm::WasmCompilationResult CompileWasmMathIntrinsic(
} }
wasm::WasmCompilationResult result = Pipeline::GenerateCodeForWasmNativeStub( wasm::WasmCompilationResult result = Pipeline::GenerateCodeForWasmNativeStub(
wasm_engine, call_descriptor, mcgraph, Code::WASM_FUNCTION, wasm_engine, call_descriptor, mcgraph, CodeKind::WASM_FUNCTION,
wasm::WasmCode::kFunction, debug_name, WasmStubAssemblerOptions(), wasm::WasmCode::kFunction, debug_name, WasmStubAssemblerOptions(),
source_positions); source_positions);
return result; return result;
@ -7078,7 +7078,7 @@ wasm::WasmCompilationResult CompileWasmImportCallWrapper(
incoming = GetI32WasmCallDescriptor(&zone, incoming); incoming = GetI32WasmCallDescriptor(&zone, incoming);
} }
wasm::WasmCompilationResult result = Pipeline::GenerateCodeForWasmNativeStub( wasm::WasmCompilationResult result = Pipeline::GenerateCodeForWasmNativeStub(
wasm_engine, incoming, mcgraph, Code::WASM_TO_JS_FUNCTION, wasm_engine, incoming, mcgraph, CodeKind::WASM_TO_JS_FUNCTION,
wasm::WasmCode::kWasmToJsWrapper, func_name, WasmStubAssemblerOptions(), wasm::WasmCode::kWasmToJsWrapper, func_name, WasmStubAssemblerOptions(),
source_position_table); source_position_table);
result.kind = wasm::WasmCompilationResult::kWasmToJsWrapper; result.kind = wasm::WasmCompilationResult::kWasmToJsWrapper;
@ -7126,7 +7126,7 @@ wasm::WasmCode* CompileWasmCapiCallWrapper(wasm::WasmEngine* wasm_engine,
const char* debug_name = "WasmCapiCall"; const char* debug_name = "WasmCapiCall";
wasm::WasmCompilationResult result = Pipeline::GenerateCodeForWasmNativeStub( wasm::WasmCompilationResult result = Pipeline::GenerateCodeForWasmNativeStub(
wasm_engine, call_descriptor, mcgraph, Code::WASM_TO_CAPI_FUNCTION, wasm_engine, call_descriptor, mcgraph, CodeKind::WASM_TO_CAPI_FUNCTION,
wasm::WasmCode::kWasmToCapiWrapper, debug_name, wasm::WasmCode::kWasmToCapiWrapper, debug_name,
WasmStubAssemblerOptions(), source_positions); WasmStubAssemblerOptions(), source_positions);
std::unique_ptr<wasm::WasmCode> wasm_code = native_module->AddCode( std::unique_ptr<wasm::WasmCode> wasm_code = native_module->AddCode(
@ -7171,7 +7171,7 @@ MaybeHandle<Code> CompileJSToJSWrapper(Isolate* isolate,
std::unique_ptr<OptimizedCompilationJob> job( std::unique_ptr<OptimizedCompilationJob> job(
Pipeline::NewWasmHeapStubCompilationJob( Pipeline::NewWasmHeapStubCompilationJob(
isolate, isolate->wasm_engine(), incoming, std::move(zone), graph, isolate, isolate->wasm_engine(), incoming, std::move(zone), graph,
Code::JS_TO_JS_FUNCTION, std::move(name_buffer), CodeKind::JS_TO_JS_FUNCTION, std::move(name_buffer),
AssemblerOptions::Default(isolate))); AssemblerOptions::Default(isolate)));
if (job->ExecuteJob(isolate->counters()->runtime_call_stats()) == if (job->ExecuteJob(isolate->counters()->runtime_call_stats()) ==
@ -7225,7 +7225,7 @@ Handle<Code> CompileCWasmEntry(Isolate* isolate, const wasm::FunctionSig* sig) {
std::unique_ptr<OptimizedCompilationJob> job( std::unique_ptr<OptimizedCompilationJob> job(
Pipeline::NewWasmHeapStubCompilationJob( Pipeline::NewWasmHeapStubCompilationJob(
isolate, isolate->wasm_engine(), incoming, std::move(zone), graph, isolate, isolate->wasm_engine(), incoming, std::move(zone), graph,
Code::C_WASM_ENTRY, std::move(name_buffer), CodeKind::C_WASM_ENTRY, std::move(name_buffer),
AssemblerOptions::Default(isolate))); AssemblerOptions::Default(isolate)));
CHECK_NE(job->ExecuteJob(isolate->counters()->runtime_call_stats()), CHECK_NE(job->ExecuteJob(isolate->counters()->runtime_call_stats()),
@ -7307,7 +7307,7 @@ wasm::WasmCompilationResult ExecuteTurbofanWasmCompilation(
InstructionSelector::AlignmentRequirements())); InstructionSelector::AlignmentRequirements()));
OptimizedCompilationInfo info(GetDebugName(&zone, func_index), &zone, OptimizedCompilationInfo info(GetDebugName(&zone, func_index), &zone,
Code::WASM_FUNCTION); CodeKind::WASM_FUNCTION);
if (env->runtime_exception_support) { if (env->runtime_exception_support) {
info.set_wasm_runtime_exception_support(); info.set_wasm_runtime_exception_support();
} }

View File

@ -980,7 +980,7 @@ void Debug::PrepareStepOnThrow() {
// If it only contains one function, we already found the handler. // If it only contains one function, we already found the handler.
if (summaries.size() > 1) { if (summaries.size() > 1) {
Handle<AbstractCode> code = summary.AsJavaScript().abstract_code(); Handle<AbstractCode> code = summary.AsJavaScript().abstract_code();
CHECK_EQ(AbstractCode::INTERPRETED_FUNCTION, code->kind()); CHECK_EQ(CodeKind::INTERPRETED_FUNCTION, code->kind());
HandlerTable table(code->GetBytecodeArray()); HandlerTable table(code->GetBytecodeArray());
int code_offset = summary.code_offset(); int code_offset = summary.code_offset();
HandlerTable::CatchPrediction prediction; HandlerTable::CatchPrediction prediction;

View File

@ -194,7 +194,7 @@ Code Deoptimizer::FindDeoptimizingCode(Address addr) {
Object element = native_context.DeoptimizedCodeListHead(); Object element = native_context.DeoptimizedCodeListHead();
while (!element.IsUndefined(isolate)) { while (!element.IsUndefined(isolate)) {
Code code = Code::cast(element); Code code = Code::cast(element);
CHECK_EQ(code.kind(), Code::OPTIMIZED_FUNCTION); CHECK(CodeKindCanDeoptimize(code.kind()));
if (code.contains(addr)) return code; if (code.contains(addr)) return code;
element = code.next_code_link(); element = code.next_code_link();
} }
@ -275,7 +275,7 @@ class ActivationsFinder : public ThreadVisitor {
for (StackFrameIterator it(isolate, top); !it.done(); it.Advance()) { for (StackFrameIterator it(isolate, top); !it.done(); it.Advance()) {
if (it.frame()->type() == StackFrame::OPTIMIZED) { if (it.frame()->type() == StackFrame::OPTIMIZED) {
Code code = it.frame()->LookupCode(); Code code = it.frame()->LookupCode();
if (code.kind() == Code::OPTIMIZED_FUNCTION && if (CodeKindCanDeoptimize(code.kind()) &&
code.marked_for_deoptimization()) { code.marked_for_deoptimization()) {
codes_->erase(code); codes_->erase(code);
// Obtain the trampoline to the deoptimizer call. // Obtain the trampoline to the deoptimizer call.
@ -331,7 +331,7 @@ void Deoptimizer::DeoptimizeMarkedCodeForContext(NativeContext native_context) {
// Turbofan deopt is checked when we are patching addresses on stack. // Turbofan deopt is checked when we are patching addresses on stack.
bool safe_if_deopt_triggered = safepoint.has_deoptimization_index(); bool safe_if_deopt_triggered = safepoint.has_deoptimization_index();
bool is_builtin_code = code.kind() == Code::BUILTIN; bool is_builtin_code = code.kind() == CodeKind::BUILTIN;
DCHECK(topmost_optimized_code.is_null() || safe_if_deopt_triggered || DCHECK(topmost_optimized_code.is_null() || safe_if_deopt_triggered ||
is_builtin_code); is_builtin_code);
if (topmost_optimized_code.is_null()) { if (topmost_optimized_code.is_null()) {
@ -352,7 +352,7 @@ void Deoptimizer::DeoptimizeMarkedCodeForContext(NativeContext native_context) {
Object element = native_context.OptimizedCodeListHead(); Object element = native_context.OptimizedCodeListHead();
while (!element.IsUndefined(isolate)) { while (!element.IsUndefined(isolate)) {
Code code = Code::cast(element); Code code = Code::cast(element);
CHECK_EQ(code.kind(), Code::OPTIMIZED_FUNCTION); CHECK(CodeKindCanDeoptimize(code.kind()));
Object next = code.next_code_link(); Object next = code.next_code_link();
if (code.marked_for_deoptimization()) { if (code.marked_for_deoptimization()) {
@ -442,7 +442,7 @@ void Deoptimizer::MarkAllCodeForContext(NativeContext native_context) {
Isolate* isolate = native_context.GetIsolate(); Isolate* isolate = native_context.GetIsolate();
while (!element.IsUndefined(isolate)) { while (!element.IsUndefined(isolate)) {
Code code = Code::cast(element); Code code = Code::cast(element);
CHECK_EQ(code.kind(), Code::OPTIMIZED_FUNCTION); CHECK(CodeKindCanDeoptimize(code.kind()));
code.set_marked_for_deoptimization(true); code.set_marked_for_deoptimization(true);
element = code.next_code_link(); element = code.next_code_link();
} }
@ -457,7 +457,7 @@ void Deoptimizer::DeoptimizeFunction(JSFunction function, Code code) {
function.ResetIfBytecodeFlushed(); function.ResetIfBytecodeFlushed();
if (code.is_null()) code = function.code(); if (code.is_null()) code = function.code();
if (code.kind() == Code::OPTIMIZED_FUNCTION) { if (CodeKindCanDeoptimize(code.kind())) {
// Mark the code for deoptimization and unlink any functions that also // Mark the code for deoptimization and unlink any functions that also
// refer to that code. The code cannot be shared across native contexts, // refer to that code. The code cannot be shared across native contexts,
// so we only need to search one. // so we only need to search one.
@ -549,7 +549,7 @@ Deoptimizer::Deoptimizer(Isolate* isolate, JSFunction function,
DCHECK(AllowHeapAllocation::IsAllowed()); DCHECK(AllowHeapAllocation::IsAllowed());
disallow_heap_allocation_ = new DisallowHeapAllocation(); disallow_heap_allocation_ = new DisallowHeapAllocation();
#endif // DEBUG #endif // DEBUG
CHECK_EQ(compiled_code_.kind(), Code::OPTIMIZED_FUNCTION); CHECK(CodeKindCanDeoptimize(compiled_code_.kind()));
if (!compiled_code_.deopt_already_counted() && if (!compiled_code_.deopt_already_counted() &&
deopt_kind_ == DeoptimizeKind::kSoft) { deopt_kind_ == DeoptimizeKind::kSoft) {
isolate->counters()->soft_deopts_executed()->Increment(); isolate->counters()->soft_deopts_executed()->Increment();
@ -608,8 +608,7 @@ void Deoptimizer::PrintFunctionName() {
if (function_.IsHeapObject() && function_.IsJSFunction()) { if (function_.IsHeapObject() && function_.IsJSFunction()) {
function_.ShortPrint(trace_scope_->file()); function_.ShortPrint(trace_scope_->file());
} else { } else {
PrintF(trace_scope_->file(), "%s", PrintF(trace_scope_->file(), "%s", CodeKindToString(compiled_code_.kind()));
Code::Kind2String(compiled_code_.kind()));
} }
} }
@ -695,7 +694,7 @@ int Deoptimizer::GetDeoptimizedCodeCount(Isolate* isolate) {
Object element = native_context.DeoptimizedCodeListHead(); Object element = native_context.DeoptimizedCodeListHead();
while (!element.IsUndefined(isolate)) { while (!element.IsUndefined(isolate)) {
Code code = Code::cast(element); Code code = Code::cast(element);
DCHECK_EQ(code.kind(), Code::OPTIMIZED_FUNCTION); DCHECK(CodeKindCanDeoptimize(code.kind()));
if (!code.marked_for_deoptimization()) { if (!code.marked_for_deoptimization()) {
length++; length++;
} }
@ -1874,7 +1873,7 @@ unsigned Deoptimizer::ComputeInputFrameSize() const {
// function into account so we have to avoid double counting them. // function into account so we have to avoid double counting them.
unsigned fixed_size_above_fp = ComputeInputFrameAboveFpFixedSize(); unsigned fixed_size_above_fp = ComputeInputFrameAboveFpFixedSize();
unsigned result = fixed_size_above_fp + fp_to_sp_delta_; unsigned result = fixed_size_above_fp + fp_to_sp_delta_;
DCHECK_EQ(compiled_code_.kind(), Code::OPTIMIZED_FUNCTION); DCHECK(CodeKindCanDeoptimize(compiled_code_.kind()));
unsigned stack_slots = compiled_code_.stack_slots(); unsigned stack_slots = compiled_code_.stack_slots();
unsigned outgoing_size = 0; unsigned outgoing_size = 0;
// ComputeOutgoingArgumentSize(compiled_code_, bailout_id_); // ComputeOutgoingArgumentSize(compiled_code_, bailout_id_);
@ -1908,8 +1907,9 @@ void Deoptimizer::EnsureCodeForDeoptimizationEntry(Isolate* isolate,
// Allocate the code as immovable since the entry addresses will be used // Allocate the code as immovable since the entry addresses will be used
// directly and there is no support for relocating them. // directly and there is no support for relocating them.
Handle<Code> code = Handle<Code> code = Factory::CodeBuilder(isolate, desc, CodeKind::STUB)
Factory::CodeBuilder(isolate, desc, Code::STUB).set_immovable().Build(); .set_immovable()
.Build();
CHECK(isolate->heap()->IsImmovable(*code)); CHECK(isolate->heap()->IsImmovable(*code));
CHECK(data->deopt_entry_code(kind).is_null()); CHECK(data->deopt_entry_code(kind).is_null());

View File

@ -241,11 +241,11 @@ static void PrintRelocInfo(StringBuilder* out, Isolate* isolate,
out->AddFormatted(" ;; code:"); out->AddFormatted(" ;; code:");
Code code = isolate->heap()->GcSafeFindCodeForInnerPointer( Code code = isolate->heap()->GcSafeFindCodeForInnerPointer(
relocinfo->target_address()); relocinfo->target_address());
Code::Kind kind = code.kind(); CodeKind kind = code.kind();
if (code.is_builtin()) { if (code.is_builtin()) {
out->AddFormatted(" Builtin::%s", Builtins::name(code.builtin_index())); out->AddFormatted(" Builtin::%s", Builtins::name(code.builtin_index()));
} else { } else {
out->AddFormatted(" %s", Code::Kind2String(kind)); out->AddFormatted(" %s", CodeKindToString(kind));
} }
} else if (RelocInfo::IsWasmStubCall(rmode) && host.is_wasm_code()) { } else if (RelocInfo::IsWasmStubCall(rmode) && host.is_wasm_code()) {
// Host is isolate-independent, try wasm native module instead. // Host is isolate-independent, try wasm native module instead.

View File

@ -902,8 +902,7 @@ class CodeDescription {
LineInfo* lineinfo() const { return lineinfo_; } LineInfo* lineinfo() const { return lineinfo_; }
bool is_function() const { bool is_function() const {
Code::Kind kind = code_.kind(); return CodeKindIsOptimizedJSFunction(code_.kind());
return kind == Code::OPTIMIZED_FUNCTION;
} }
bool has_scope_info() const { return !shared_info_.is_null(); } bool has_scope_info() const { return !shared_info_.is_null(); }

View File

@ -1445,8 +1445,8 @@ void WasmInstanceObject::WasmInstanceObjectVerify(Isolate* isolate) {
void WasmExportedFunctionData::WasmExportedFunctionDataVerify( void WasmExportedFunctionData::WasmExportedFunctionDataVerify(
Isolate* isolate) { Isolate* isolate) {
TorqueGeneratedClassVerifiers::WasmExportedFunctionDataVerify(*this, isolate); TorqueGeneratedClassVerifiers::WasmExportedFunctionDataVerify(*this, isolate);
CHECK(wrapper_code().kind() == Code::JS_TO_WASM_FUNCTION || CHECK(wrapper_code().kind() == CodeKind::JS_TO_WASM_FUNCTION ||
wrapper_code().kind() == Code::C_WASM_ENTRY || wrapper_code().kind() == CodeKind::C_WASM_ENTRY ||
(wrapper_code().is_builtin() && (wrapper_code().is_builtin() &&
wrapper_code().builtin_index() == Builtins::kGenericJSToWasmWrapper)); wrapper_code().builtin_index() == Builtins::kGenericJSToWasmWrapper));
} }

View File

@ -204,8 +204,8 @@ void PerfJitLogger::LogRecordedBuffer(
MaybeHandle<SharedFunctionInfo> maybe_shared, const char* name, MaybeHandle<SharedFunctionInfo> maybe_shared, const char* name,
int length) { int length) {
if (FLAG_perf_basic_prof_only_functions && if (FLAG_perf_basic_prof_only_functions &&
(abstract_code->kind() != AbstractCode::INTERPRETED_FUNCTION && (abstract_code->kind() != CodeKind::INTERPRETED_FUNCTION &&
abstract_code->kind() != AbstractCode::OPTIMIZED_FUNCTION)) { abstract_code->kind() != CodeKind::OPTIMIZED_FUNCTION)) {
return; return;
} }
@ -222,8 +222,8 @@ void PerfJitLogger::LogRecordedBuffer(
Handle<SharedFunctionInfo> shared; Handle<SharedFunctionInfo> shared;
if (FLAG_perf_prof && !maybe_shared.ToHandle(&shared)) { if (FLAG_perf_prof && !maybe_shared.ToHandle(&shared)) {
// TODO(herhut): This currently breaks for js2wasm/wasm2js functions. // TODO(herhut): This currently breaks for js2wasm/wasm2js functions.
if (code->kind() != Code::JS_TO_WASM_FUNCTION && if (code->kind() != CodeKind::JS_TO_WASM_FUNCTION &&
code->kind() != Code::WASM_TO_JS_FUNCTION) { code->kind() != CodeKind::WASM_TO_JS_FUNCTION) {
LogWriteDebugInfo(code, shared); LogWriteDebugInfo(code, shared);
} }
} }

View File

@ -568,7 +568,7 @@ StackFrame::Type StackFrame::ComputeType(const StackFrameIteratorBase* iterator,
Code code_obj = GetContainingCode(iterator->isolate(), pc); Code code_obj = GetContainingCode(iterator->isolate(), pc);
if (!code_obj.is_null()) { if (!code_obj.is_null()) {
switch (code_obj.kind()) { switch (code_obj.kind()) {
case Code::BUILTIN: case CodeKind::BUILTIN:
if (StackFrame::IsTypeMarker(marker)) break; if (StackFrame::IsTypeMarker(marker)) break;
if (code_obj.is_interpreter_trampoline_builtin()) { if (code_obj.is_interpreter_trampoline_builtin()) {
return INTERPRETED; return INTERPRETED;
@ -581,17 +581,18 @@ StackFrame::Type StackFrame::ComputeType(const StackFrameIteratorBase* iterator,
return OPTIMIZED; return OPTIMIZED;
} }
return BUILTIN; return BUILTIN;
case Code::OPTIMIZED_FUNCTION: case CodeKind::OPTIMIZED_FUNCTION:
case CodeKind::NATIVE_CONTEXT_INDEPENDENT:
return OPTIMIZED; return OPTIMIZED;
case Code::JS_TO_WASM_FUNCTION: case CodeKind::JS_TO_WASM_FUNCTION:
return JS_TO_WASM; return JS_TO_WASM;
case Code::JS_TO_JS_FUNCTION: case CodeKind::JS_TO_JS_FUNCTION:
return STUB; return STUB;
case Code::C_WASM_ENTRY: case CodeKind::C_WASM_ENTRY:
return C_WASM_ENTRY; return C_WASM_ENTRY;
case Code::WASM_FUNCTION: case CodeKind::WASM_FUNCTION:
case Code::WASM_TO_CAPI_FUNCTION: case CodeKind::WASM_TO_CAPI_FUNCTION:
case Code::WASM_TO_JS_FUNCTION: case CodeKind::WASM_TO_JS_FUNCTION:
// Never appear as on-heap {Code} objects. // Never appear as on-heap {Code} objects.
UNREACHABLE(); UNREACHABLE();
default: default:
@ -1078,7 +1079,7 @@ Address StubFrame::GetCallerStackPointer() const {
int StubFrame::LookupExceptionHandlerInTable() { int StubFrame::LookupExceptionHandlerInTable() {
Code code = LookupCode(); Code code = LookupCode();
DCHECK(code.is_turbofanned()); DCHECK(code.is_turbofanned());
DCHECK_EQ(code.kind(), Code::BUILTIN); DCHECK_EQ(code.kind(), CodeKind::BUILTIN);
HandlerTable table(code); HandlerTable table(code);
int pc_offset = static_cast<int>(pc() - code.InstructionStart()); int pc_offset = static_cast<int>(pc() - code.InstructionStart());
return table.LookupReturn(pc_offset); return table.LookupReturn(pc_offset);
@ -1109,7 +1110,7 @@ Code JavaScriptFrame::unchecked_code() const { return function().code(); }
int OptimizedFrame::ComputeParametersCount() const { int OptimizedFrame::ComputeParametersCount() const {
Code code = LookupCode(); Code code = LookupCode();
if (code.kind() == Code::BUILTIN) { if (code.kind() == CodeKind::BUILTIN) {
return static_cast<int>( return static_cast<int>(
Memory<intptr_t>(fp() + OptimizedBuiltinFrameConstants::kArgCOffset)); Memory<intptr_t>(fp() + OptimizedBuiltinFrameConstants::kArgCOffset));
} else { } else {
@ -1348,7 +1349,7 @@ FrameSummary::JavaScriptFrameSummary::JavaScriptFrameSummary(
is_constructor_(is_constructor), is_constructor_(is_constructor),
parameters_(parameters, isolate) { parameters_(parameters, isolate) {
DCHECK(abstract_code.IsBytecodeArray() || DCHECK(abstract_code.IsBytecodeArray() ||
Code::cast(abstract_code).kind() != Code::OPTIMIZED_FUNCTION); !CodeKindIsOptimizedJSFunction(Code::cast(abstract_code).kind()));
} }
void FrameSummary::EnsureSourcePositionsAvailable() { void FrameSummary::EnsureSourcePositionsAvailable() {
@ -1511,7 +1512,7 @@ void OptimizedFrame::Summarize(std::vector<FrameSummary>* frames) const {
// Delegate to JS frame in absence of turbofan deoptimization. // Delegate to JS frame in absence of turbofan deoptimization.
// TODO(turbofan): Revisit once we support deoptimization across the board. // TODO(turbofan): Revisit once we support deoptimization across the board.
Code code = LookupCode(); Code code = LookupCode();
if (code.kind() == Code::BUILTIN) { if (code.kind() == CodeKind::BUILTIN) {
return JavaScriptFrame::Summarize(frames); return JavaScriptFrame::Summarize(frames);
} }
@ -1598,8 +1599,7 @@ int OptimizedFrame::LookupExceptionHandlerInTable(
// When the return pc has been replaced by a trampoline there won't be // When the return pc has been replaced by a trampoline there won't be
// a handler for this trampoline. Thus we need to use the return pc that // a handler for this trampoline. Thus we need to use the return pc that
// _used to be_ on the stack to get the right ExceptionHandler. // _used to be_ on the stack to get the right ExceptionHandler.
if (code.kind() == Code::OPTIMIZED_FUNCTION && if (CodeKindCanDeoptimize(code.kind()) && code.marked_for_deoptimization()) {
code.marked_for_deoptimization()) {
SafepointTable safepoints(code); SafepointTable safepoints(code);
pc_offset = safepoints.find_return_pc(pc_offset); pc_offset = safepoints.find_return_pc(pc_offset);
} }
@ -1620,7 +1620,7 @@ DeoptimizationData OptimizedFrame::GetDeoptimizationData(
code = isolate()->heap()->GcSafeFindCodeForInnerPointer(pc()); code = isolate()->heap()->GcSafeFindCodeForInnerPointer(pc());
} }
DCHECK(!code.is_null()); DCHECK(!code.is_null());
DCHECK(code.kind() == Code::OPTIMIZED_FUNCTION); DCHECK(CodeKindCanDeoptimize(code.kind()));
SafepointEntry safepoint_entry = code.GetSafepointEntry(pc()); SafepointEntry safepoint_entry = code.GetSafepointEntry(pc());
if (safepoint_entry.has_deoptimization_index()) { if (safepoint_entry.has_deoptimization_index()) {
@ -1634,7 +1634,7 @@ DeoptimizationData OptimizedFrame::GetDeoptimizationData(
#ifndef V8_REVERSE_JSARGS #ifndef V8_REVERSE_JSARGS
Object OptimizedFrame::receiver() const { Object OptimizedFrame::receiver() const {
Code code = LookupCode(); Code code = LookupCode();
if (code.kind() == Code::BUILTIN) { if (code.kind() == CodeKind::BUILTIN) {
intptr_t argc = static_cast<int>( intptr_t argc = static_cast<int>(
Memory<intptr_t>(fp() + OptimizedBuiltinFrameConstants::kArgCOffset)); Memory<intptr_t>(fp() + OptimizedBuiltinFrameConstants::kArgCOffset));
intptr_t args_size = intptr_t args_size =
@ -1656,7 +1656,7 @@ void OptimizedFrame::GetFunctions(
// Delegate to JS frame in absence of turbofan deoptimization. // Delegate to JS frame in absence of turbofan deoptimization.
// TODO(turbofan): Revisit once we support deoptimization across the board. // TODO(turbofan): Revisit once we support deoptimization across the board.
Code code = LookupCode(); Code code = LookupCode();
if (code.kind() == Code::BUILTIN) { if (code.kind() == CodeKind::BUILTIN) {
return JavaScriptFrame::GetFunctions(functions); return JavaScriptFrame::GetFunctions(functions);
} }

View File

@ -1827,7 +1827,7 @@ Object Isolate::UnwindAndFindHandler() {
// TODO(bmeurer): Turbofanned BUILTIN frames appear as OPTIMIZED, // TODO(bmeurer): Turbofanned BUILTIN frames appear as OPTIMIZED,
// but do not have a code kind of OPTIMIZED_FUNCTION. // but do not have a code kind of OPTIMIZED_FUNCTION.
if (code.kind() == Code::OPTIMIZED_FUNCTION && if (CodeKindCanDeoptimize(code.kind()) &&
code.marked_for_deoptimization()) { code.marked_for_deoptimization()) {
// If the target code is lazy deoptimized, we jump to the original // If the target code is lazy deoptimized, we jump to the original
// return address, but we make a note that we are throwing, so // return address, but we make a note that we are throwing, so
@ -1849,7 +1849,7 @@ Object Isolate::UnwindAndFindHandler() {
DCHECK_NULL(wasm_engine()->code_manager()->LookupCode(frame->pc())); DCHECK_NULL(wasm_engine()->code_manager()->LookupCode(frame->pc()));
#endif // DEBUG #endif // DEBUG
Code code = stub_frame->LookupCode(); Code code = stub_frame->LookupCode();
if (!code.IsCode() || code.kind() != Code::BUILTIN || if (!code.IsCode() || code.kind() != CodeKind::BUILTIN ||
!code.has_handler_table() || !code.is_turbofanned()) { !code.has_handler_table() || !code.is_turbofanned()) {
break; break;
} }
@ -1954,14 +1954,14 @@ HandlerTable::CatchPrediction PredictException(JavaScriptFrame* frame) {
for (size_t i = summaries.size(); i != 0; i--) { for (size_t i = summaries.size(); i != 0; i--) {
const FrameSummary& summary = summaries[i - 1]; const FrameSummary& summary = summaries[i - 1];
Handle<AbstractCode> code = summary.AsJavaScript().abstract_code(); Handle<AbstractCode> code = summary.AsJavaScript().abstract_code();
if (code->IsCode() && code->kind() == AbstractCode::BUILTIN) { if (code->IsCode() && code->kind() == CodeKind::BUILTIN) {
prediction = code->GetCode().GetBuiltinCatchPrediction(); prediction = code->GetCode().GetBuiltinCatchPrediction();
if (prediction == HandlerTable::UNCAUGHT) continue; if (prediction == HandlerTable::UNCAUGHT) continue;
return prediction; return prediction;
} }
// Must have been constructed from a bytecode array. // Must have been constructed from a bytecode array.
CHECK_EQ(AbstractCode::INTERPRETED_FUNCTION, code->kind()); CHECK_EQ(CodeKind::INTERPRETED_FUNCTION, code->kind());
int code_offset = summary.code_offset(); int code_offset = summary.code_offset();
HandlerTable table(code->GetBytecodeArray()); HandlerTable table(code->GetBytecodeArray());
int index = table.LookupRange(code_offset, nullptr, &prediction); int index = table.LookupRange(code_offset, nullptr, &prediction);
@ -2030,7 +2030,7 @@ Isolate::CatchType Isolate::PredictExceptionCatcher() {
case StackFrame::STUB: { case StackFrame::STUB: {
Handle<Code> code(frame->LookupCode(), this); Handle<Code> code(frame->LookupCode(), this);
if (!code->IsCode() || code->kind() != Code::BUILTIN || if (!code->IsCode() || code->kind() != CodeKind::BUILTIN ||
!code->has_handler_table() || !code->is_turbofanned()) { !code->has_handler_table() || !code->is_turbofanned()) {
break; break;
} }
@ -2536,7 +2536,7 @@ Handle<Object> Isolate::GetPromiseOnStackOnThrow() {
catch_prediction = PredictException(JavaScriptFrame::cast(frame)); catch_prediction = PredictException(JavaScriptFrame::cast(frame));
} else if (frame->type() == StackFrame::STUB) { } else if (frame->type() == StackFrame::STUB) {
Code code = frame->LookupCode(); Code code = frame->LookupCode();
if (!code.IsCode() || code.kind() != Code::BUILTIN || if (!code.IsCode() || code.kind() != CodeKind::BUILTIN ||
!code.has_handler_table() || !code.is_turbofanned()) { !code.has_handler_table() || !code.is_turbofanned()) {
continue; continue;
} }

View File

@ -383,7 +383,7 @@ V8_EXPORT_PRIVATE void FreeCurrentEmbeddedBlob();
#define ISOLATE_INIT_DEBUG_ARRAY_LIST(V) \ #define ISOLATE_INIT_DEBUG_ARRAY_LIST(V) \
V(CommentStatistic, paged_space_comments_statistics, \ V(CommentStatistic, paged_space_comments_statistics, \
CommentStatistic::kMaxComments + 1) \ CommentStatistic::kMaxComments + 1) \
V(int, code_kind_statistics, AbstractCode::NUMBER_OF_KINDS) V(int, code_kind_statistics, kCodeKindCount)
#else #else
#define ISOLATE_INIT_DEBUG_ARRAY_LIST(V) #define ISOLATE_INIT_DEBUG_ARRAY_LIST(V)

View File

@ -41,7 +41,7 @@ void CodeStatistics::RecordCodeAndMetadataStatistics(HeapObject object,
#ifdef DEBUG #ifdef DEBUG
// Record code kind and code comment statistics. // Record code kind and code comment statistics.
isolate->code_kind_statistics()[abstract_code.kind()] += isolate->code_kind_statistics()[static_cast<int>(abstract_code.kind())] +=
abstract_code.Size(); abstract_code.Size();
CodeStatistics::CollectCodeCommentStatistics(object, isolate); CodeStatistics::CollectCodeCommentStatistics(object, isolate);
#endif #endif
@ -86,10 +86,10 @@ void CodeStatistics::ReportCodeStatistics(Isolate* isolate) {
// Report code kind statistics // Report code kind statistics
int* code_kind_statistics = isolate->code_kind_statistics(); int* code_kind_statistics = isolate->code_kind_statistics();
PrintF("\n Code kind histograms: \n"); PrintF("\n Code kind histograms: \n");
for (int i = 0; i < AbstractCode::NUMBER_OF_KINDS; i++) { for (int i = 0; i < kCodeKindCount; i++) {
if (code_kind_statistics[i] > 0) { if (code_kind_statistics[i] > 0) {
PrintF(" %-20s: %10d bytes\n", PrintF(" %-20s: %10d bytes\n",
AbstractCode::Kind2String(static_cast<AbstractCode::Kind>(i)), CodeKindToString(static_cast<CodeKind>(i)),
code_kind_statistics[i]); code_kind_statistics[i]);
} }
} }
@ -124,7 +124,7 @@ void CodeStatistics::ReportCodeStatistics(Isolate* isolate) {
void CodeStatistics::ResetCodeStatistics(Isolate* isolate) { void CodeStatistics::ResetCodeStatistics(Isolate* isolate) {
// Clear code kind statistics // Clear code kind statistics
int* code_kind_statistics = isolate->code_kind_statistics(); int* code_kind_statistics = isolate->code_kind_statistics();
for (int i = 0; i < AbstractCode::NUMBER_OF_KINDS; i++) { for (int i = 0; i < kCodeKindCount; i++) {
code_kind_statistics[i] = 0; code_kind_statistics[i] = 0;
} }

View File

@ -86,7 +86,7 @@ int ComputeCodeObjectSize(const CodeDesc& desc) {
} // namespace } // namespace
Factory::CodeBuilder::CodeBuilder(Isolate* isolate, const CodeDesc& desc, Factory::CodeBuilder::CodeBuilder(Isolate* isolate, const CodeDesc& desc,
Code::Kind kind) CodeKind kind)
: isolate_(isolate), : isolate_(isolate),
code_desc_(desc), code_desc_(desc),
kind_(kind), kind_(kind),

View File

@ -795,7 +795,7 @@ class V8_EXPORT_PRIVATE Factory : public FactoryBase<Factory> {
// which tries to gracefully handle allocation failure. // which tries to gracefully handle allocation failure.
class V8_EXPORT_PRIVATE CodeBuilder final { class V8_EXPORT_PRIVATE CodeBuilder final {
public: public:
CodeBuilder(Isolate* isolate, const CodeDesc& desc, Code::Kind kind); CodeBuilder(Isolate* isolate, const CodeDesc& desc, CodeKind kind);
// Builds a new code object (fully initialized). All header fields of the // Builds a new code object (fully initialized). All header fields of the
// returned object are immutable and the code object is write protected. // returned object are immutable and the code object is write protected.
@ -875,7 +875,7 @@ class V8_EXPORT_PRIVATE Factory : public FactoryBase<Factory> {
Isolate* const isolate_; Isolate* const isolate_;
const CodeDesc& code_desc_; const CodeDesc& code_desc_;
const Code::Kind kind_; const CodeKind kind_;
MaybeHandle<Object> self_reference_; MaybeHandle<Object> self_reference_;
int32_t builtin_index_ = Builtins::kNoBuiltinId; int32_t builtin_index_ = Builtins::kNoBuiltinId;

View File

@ -1020,16 +1020,13 @@ void ObjectStatsCollectorImpl::RecordVirtualBytecodeArrayDetails(
namespace { namespace {
ObjectStats::VirtualInstanceType CodeKindToVirtualInstanceType( ObjectStats::VirtualInstanceType CodeKindToVirtualInstanceType(CodeKind kind) {
Code::Kind kind) {
switch (kind) { switch (kind) {
#define CODE_KIND_CASE(type) \ #define CODE_KIND_CASE(type) \
case Code::type: \ case CodeKind::type: \
return ObjectStats::type; return ObjectStats::type;
CODE_KIND_LIST(CODE_KIND_CASE) CODE_KIND_LIST(CODE_KIND_CASE)
#undef CODE_KIND_CASE #undef CODE_KIND_CASE
default:
UNREACHABLE();
} }
UNREACHABLE(); UNREACHABLE();
} }
@ -1049,7 +1046,7 @@ void ObjectStatsCollectorImpl::RecordVirtualCodeDetails(Code code) {
HeapObject::cast(source_position_table), HeapObject::cast(source_position_table),
ObjectStats::SOURCE_POSITION_TABLE_TYPE); ObjectStats::SOURCE_POSITION_TABLE_TYPE);
} }
if (code.kind() == Code::Kind::OPTIMIZED_FUNCTION) { if (CodeKindIsOptimizedJSFunction(code.kind())) {
DeoptimizationData input_data = DeoptimizationData input_data =
DeoptimizationData::cast(code.deoptimization_data()); DeoptimizationData::cast(code.deoptimization_data());
if (input_data.length() > 0) { if (input_data.length() > 0) {

View File

@ -3112,8 +3112,8 @@ Handle<Code> GenerateBytecodeHandler(Isolate* isolate, const char* debug_name,
const AssemblerOptions& options) { const AssemblerOptions& options) {
Zone zone(isolate->allocator(), ZONE_NAME, kCompressGraphZone); Zone zone(isolate->allocator(), ZONE_NAME, kCompressGraphZone);
compiler::CodeAssemblerState state( compiler::CodeAssemblerState state(
isolate, &zone, InterpreterDispatchDescriptor{}, Code::BYTECODE_HANDLER, isolate, &zone, InterpreterDispatchDescriptor{},
debug_name, CodeKind::BYTECODE_HANDLER, debug_name,
FLAG_untrusted_code_mitigations FLAG_untrusted_code_mitigations
? PoisoningMitigationLevel::kPoisonCriticalOnly ? PoisoningMitigationLevel::kPoisonCriticalOnly
: PoisoningMitigationLevel::kDontPoison, : PoisoningMitigationLevel::kDontPoison,

View File

@ -99,7 +99,7 @@ Code Interpreter::GetBytecodeHandler(Bytecode bytecode,
void Interpreter::SetBytecodeHandler(Bytecode bytecode, void Interpreter::SetBytecodeHandler(Bytecode bytecode,
OperandScale operand_scale, Code handler) { OperandScale operand_scale, Code handler) {
DCHECK(handler.is_off_heap_trampoline()); DCHECK(handler.is_off_heap_trampoline());
DCHECK(handler.kind() == Code::BYTECODE_HANDLER); DCHECK(handler.kind() == CodeKind::BYTECODE_HANDLER);
size_t index = GetDispatchTableIndex(bytecode, operand_scale); size_t index = GetDispatchTableIndex(bytecode, operand_scale);
dispatch_table_[index] = handler.InstructionStart(); dispatch_table_[index] = handler.InstructionStart();
} }
@ -342,7 +342,7 @@ bool Interpreter::IsDispatchTableInitialized() const {
} }
const char* Interpreter::LookupNameOfBytecodeHandler(const Code code) { const char* Interpreter::LookupNameOfBytecodeHandler(const Code code) {
if (code.kind() == Code::BYTECODE_HANDLER) { if (code.kind() == CodeKind::BYTECODE_HANDLER) {
return Builtins::name(code.builtin_index()); return Builtins::name(code.builtin_index());
} }
return nullptr; return nullptr;

View File

@ -75,9 +75,10 @@ static v8::CodeEventType GetCodeEventTypeForTag(
static const char* ComputeMarker(SharedFunctionInfo shared, AbstractCode code) { static const char* ComputeMarker(SharedFunctionInfo shared, AbstractCode code) {
switch (code.kind()) { switch (code.kind()) {
case AbstractCode::INTERPRETED_FUNCTION: case CodeKind::INTERPRETED_FUNCTION:
return shared.optimization_disabled() ? "" : "~"; return shared.optimization_disabled() ? "" : "~";
case AbstractCode::OPTIMIZED_FUNCTION: case CodeKind::OPTIMIZED_FUNCTION:
case CodeKind::NATIVE_CONTEXT_INDEPENDENT:
return "*"; return "*";
default: default:
return ""; return "";
@ -325,9 +326,7 @@ void PerfBasicLogger::LogRecordedBuffer(Handle<AbstractCode> code,
MaybeHandle<SharedFunctionInfo>, MaybeHandle<SharedFunctionInfo>,
const char* name, int length) { const char* name, int length) {
if (FLAG_perf_basic_prof_only_functions && if (FLAG_perf_basic_prof_only_functions &&
(code->kind() != AbstractCode::INTERPRETED_FUNCTION && CodeKindIsBuiltinOrJSFunction(code->kind())) {
code->kind() != AbstractCode::BUILTIN &&
code->kind() != AbstractCode::OPTIMIZED_FUNCTION)) {
return; return;
} }
@ -1154,11 +1153,12 @@ namespace {
void AppendCodeCreateHeader( void AppendCodeCreateHeader(
Log::MessageBuilder& msg, // NOLINT(runtime/references) Log::MessageBuilder& msg, // NOLINT(runtime/references)
CodeEventListener::LogEventsAndTags tag, AbstractCode::Kind kind, CodeEventListener::LogEventsAndTags tag, CodeKind kind, uint8_t* address,
uint8_t* address, int size, base::ElapsedTimer* timer) { int size, base::ElapsedTimer* timer) {
msg << kLogEventsNames[CodeEventListener::CODE_CREATION_EVENT] msg << kLogEventsNames[CodeEventListener::CODE_CREATION_EVENT]
<< Logger::kNext << kLogEventsNames[tag] << Logger::kNext << kind << Logger::kNext << kLogEventsNames[tag] << Logger::kNext
<< Logger::kNext << timer->Elapsed().InMicroseconds() << Logger::kNext << static_cast<int>(kind) << Logger::kNext
<< timer->Elapsed().InMicroseconds() << Logger::kNext
<< reinterpret_cast<void*>(address) << Logger::kNext << size << reinterpret_cast<void*>(address) << Logger::kNext << size
<< Logger::kNext; << Logger::kNext;
} }
@ -1315,7 +1315,7 @@ void Logger::CodeCreateEvent(LogEventsAndTags tag, const wasm::WasmCode* code,
if (!is_listening_to_code_events()) return; if (!is_listening_to_code_events()) return;
if (!FLAG_log_code || !log_->IsEnabled()) return; if (!FLAG_log_code || !log_->IsEnabled()) return;
Log::MessageBuilder msg(log_.get()); Log::MessageBuilder msg(log_.get());
AppendCodeCreateHeader(msg, tag, AbstractCode::Kind::WASM_FUNCTION, AppendCodeCreateHeader(msg, tag, CodeKind::WASM_FUNCTION,
code->instructions().begin(), code->instructions().begin(),
code->instructions().length(), &timer_); code->instructions().length(), &timer_);
DCHECK(!name.empty()); DCHECK(!name.empty());
@ -2056,20 +2056,21 @@ void ExistingCodeLogger::LogCodeObject(Object object) {
CodeEventListener::LogEventsAndTags tag = CodeEventListener::STUB_TAG; CodeEventListener::LogEventsAndTags tag = CodeEventListener::STUB_TAG;
const char* description = "Unknown code from before profiling"; const char* description = "Unknown code from before profiling";
switch (abstract_code->kind()) { switch (abstract_code->kind()) {
case AbstractCode::INTERPRETED_FUNCTION: case CodeKind::INTERPRETED_FUNCTION:
case AbstractCode::OPTIMIZED_FUNCTION: case CodeKind::OPTIMIZED_FUNCTION:
case CodeKind::NATIVE_CONTEXT_INDEPENDENT:
return; // We log this later using LogCompiledFunctions. return; // We log this later using LogCompiledFunctions.
case AbstractCode::BYTECODE_HANDLER: case CodeKind::BYTECODE_HANDLER:
return; // We log it later by walking the dispatch table. return; // We log it later by walking the dispatch table.
case AbstractCode::STUB: case CodeKind::STUB:
description = "STUB code"; description = "STUB code";
tag = CodeEventListener::STUB_TAG; tag = CodeEventListener::STUB_TAG;
break; break;
case AbstractCode::REGEXP: case CodeKind::REGEXP:
description = "Regular expression code"; description = "Regular expression code";
tag = CodeEventListener::REG_EXP_TAG; tag = CodeEventListener::REG_EXP_TAG;
break; break;
case AbstractCode::BUILTIN: case CodeKind::BUILTIN:
if (Code::cast(object).is_interpreter_trampoline_builtin() && if (Code::cast(object).is_interpreter_trampoline_builtin() &&
Code::cast(object) != Code::cast(object) !=
*BUILTIN_CODE(isolate_, InterpreterEntryTrampoline)) { *BUILTIN_CODE(isolate_, InterpreterEntryTrampoline)) {
@ -2079,32 +2080,30 @@ void ExistingCodeLogger::LogCodeObject(Object object) {
isolate_->builtins()->name(abstract_code->GetCode().builtin_index()); isolate_->builtins()->name(abstract_code->GetCode().builtin_index());
tag = CodeEventListener::BUILTIN_TAG; tag = CodeEventListener::BUILTIN_TAG;
break; break;
case AbstractCode::WASM_FUNCTION: case CodeKind::WASM_FUNCTION:
description = "A Wasm function"; description = "A Wasm function";
tag = CodeEventListener::FUNCTION_TAG; tag = CodeEventListener::FUNCTION_TAG;
break; break;
case AbstractCode::JS_TO_WASM_FUNCTION: case CodeKind::JS_TO_WASM_FUNCTION:
description = "A JavaScript to Wasm adapter"; description = "A JavaScript to Wasm adapter";
tag = CodeEventListener::STUB_TAG; tag = CodeEventListener::STUB_TAG;
break; break;
case AbstractCode::JS_TO_JS_FUNCTION: case CodeKind::JS_TO_JS_FUNCTION:
description = "A WebAssembly.Function adapter"; description = "A WebAssembly.Function adapter";
tag = CodeEventListener::STUB_TAG; tag = CodeEventListener::STUB_TAG;
break; break;
case AbstractCode::WASM_TO_CAPI_FUNCTION: case CodeKind::WASM_TO_CAPI_FUNCTION:
description = "A Wasm to C-API adapter"; description = "A Wasm to C-API adapter";
tag = CodeEventListener::STUB_TAG; tag = CodeEventListener::STUB_TAG;
break; break;
case AbstractCode::WASM_TO_JS_FUNCTION: case CodeKind::WASM_TO_JS_FUNCTION:
description = "A Wasm to JavaScript adapter"; description = "A Wasm to JavaScript adapter";
tag = CodeEventListener::STUB_TAG; tag = CodeEventListener::STUB_TAG;
break; break;
case AbstractCode::C_WASM_ENTRY: case CodeKind::C_WASM_ENTRY:
description = "A C to Wasm entry stub"; description = "A C to Wasm entry stub";
tag = CodeEventListener::STUB_TAG; tag = CodeEventListener::STUB_TAG;
break; break;
case AbstractCode::NUMBER_OF_KINDS:
UNIMPLEMENTED();
} }
CALL_CODE_EVENT_HANDLER(CodeCreateEvent(tag, abstract_code, description)) CALL_CODE_EVENT_HANDLER(CodeCreateEvent(tag, abstract_code, description))
} }

View File

@ -116,12 +116,8 @@ bool AbstractCode::contains(Address inner_pointer) {
return (address() <= inner_pointer) && (inner_pointer <= address() + Size()); return (address() <= inner_pointer) && (inner_pointer <= address() + Size());
} }
AbstractCode::Kind AbstractCode::kind() { CodeKind AbstractCode::kind() {
if (IsCode()) { return IsCode() ? GetCode().kind() : CodeKind::INTERPRETED_FUNCTION;
return static_cast<AbstractCode::Kind>(GetCode().kind());
} else {
return INTERPRETED_FUNCTION;
}
} }
Code AbstractCode::GetCode() { return Code::cast(*this); } Code AbstractCode::GetCode() { return Code::cast(*this); }
@ -345,16 +341,16 @@ void Code::CopyRelocInfoToByteArray(ByteArray dest, const CodeDesc& desc) {
int Code::CodeSize() const { return SizeFor(body_size()); } int Code::CodeSize() const { return SizeFor(body_size()); }
Code::Kind Code::kind() const { CodeKind Code::kind() const {
STATIC_ASSERT(FIELD_SIZE(kFlagsOffset) == kInt32Size); STATIC_ASSERT(FIELD_SIZE(kFlagsOffset) == kInt32Size);
return KindField::decode(ReadField<uint32_t>(kFlagsOffset)); return KindField::decode(ReadField<uint32_t>(kFlagsOffset));
} }
void Code::initialize_flags(Kind kind, bool has_unwinding_info, void Code::initialize_flags(CodeKind kind, bool has_unwinding_info,
bool is_turbofanned, int stack_slots, bool is_turbofanned, int stack_slots,
bool is_off_heap_trampoline) { bool is_off_heap_trampoline) {
CHECK(0 <= stack_slots && stack_slots < StackSlotsField::kMax); CHECK(0 <= stack_slots && stack_slots < StackSlotsField::kMax);
DCHECK_NE(kind, NUMBER_OF_KINDS); DCHECK(!CodeKindIsInterpretedJSFunction(kind));
uint32_t flags = HasUnwindingInfoField::encode(has_unwinding_info) | uint32_t flags = HasUnwindingInfoField::encode(has_unwinding_info) |
KindField::encode(kind) | KindField::encode(kind) |
IsTurbofannedField::encode(is_turbofanned) | IsTurbofannedField::encode(is_turbofanned) |
@ -378,12 +374,12 @@ inline bool Code::checks_optimization_marker() const {
(builtin_index() == Builtins::kCompileLazy || (builtin_index() == Builtins::kCompileLazy ||
builtin_index() == Builtins::kInterpreterEntryTrampoline); builtin_index() == Builtins::kInterpreterEntryTrampoline);
return checks_marker || return checks_marker ||
(kind() == OPTIMIZED_FUNCTION && marked_for_deoptimization()); (CodeKindCanDeoptimize(kind()) && marked_for_deoptimization());
} }
inline bool Code::has_tagged_params() const { inline bool Code::has_tagged_params() const {
return kind() != JS_TO_WASM_FUNCTION && kind() != C_WASM_ENTRY && return kind() != CodeKind::JS_TO_WASM_FUNCTION &&
kind() != WASM_FUNCTION; kind() != CodeKind::C_WASM_ENTRY && kind() != CodeKind::WASM_FUNCTION;
} }
inline bool Code::has_unwinding_info() const { inline bool Code::has_unwinding_info() const {
@ -395,39 +391,39 @@ inline bool Code::is_turbofanned() const {
} }
inline bool Code::can_have_weak_objects() const { inline bool Code::can_have_weak_objects() const {
DCHECK(kind() == OPTIMIZED_FUNCTION); DCHECK(CodeKindIsOptimizedJSFunction(kind()));
int32_t flags = code_data_container().kind_specific_flags(); int32_t flags = code_data_container().kind_specific_flags();
return CanHaveWeakObjectsField::decode(flags); return CanHaveWeakObjectsField::decode(flags);
} }
inline void Code::set_can_have_weak_objects(bool value) { inline void Code::set_can_have_weak_objects(bool value) {
DCHECK(kind() == OPTIMIZED_FUNCTION); DCHECK(CodeKindIsOptimizedJSFunction(kind()));
int32_t previous = code_data_container().kind_specific_flags(); int32_t previous = code_data_container().kind_specific_flags();
int32_t updated = CanHaveWeakObjectsField::update(previous, value); int32_t updated = CanHaveWeakObjectsField::update(previous, value);
code_data_container().set_kind_specific_flags(updated); code_data_container().set_kind_specific_flags(updated);
} }
inline bool Code::is_promise_rejection() const { inline bool Code::is_promise_rejection() const {
DCHECK(kind() == BUILTIN); DCHECK(kind() == CodeKind::BUILTIN);
int32_t flags = code_data_container().kind_specific_flags(); int32_t flags = code_data_container().kind_specific_flags();
return IsPromiseRejectionField::decode(flags); return IsPromiseRejectionField::decode(flags);
} }
inline void Code::set_is_promise_rejection(bool value) { inline void Code::set_is_promise_rejection(bool value) {
DCHECK(kind() == BUILTIN); DCHECK(kind() == CodeKind::BUILTIN);
int32_t previous = code_data_container().kind_specific_flags(); int32_t previous = code_data_container().kind_specific_flags();
int32_t updated = IsPromiseRejectionField::update(previous, value); int32_t updated = IsPromiseRejectionField::update(previous, value);
code_data_container().set_kind_specific_flags(updated); code_data_container().set_kind_specific_flags(updated);
} }
inline bool Code::is_exception_caught() const { inline bool Code::is_exception_caught() const {
DCHECK(kind() == BUILTIN); DCHECK(kind() == CodeKind::BUILTIN);
int32_t flags = code_data_container().kind_specific_flags(); int32_t flags = code_data_container().kind_specific_flags();
return IsExceptionCaughtField::decode(flags); return IsExceptionCaughtField::decode(flags);
} }
inline void Code::set_is_exception_caught(bool value) { inline void Code::set_is_exception_caught(bool value) {
DCHECK(kind() == BUILTIN); DCHECK(kind() == CodeKind::BUILTIN);
int32_t previous = code_data_container().kind_specific_flags(); int32_t previous = code_data_container().kind_specific_flags();
int32_t updated = IsExceptionCaughtField::update(previous, value); int32_t updated = IsExceptionCaughtField::update(previous, value);
code_data_container().set_kind_specific_flags(updated); code_data_container().set_kind_specific_flags(updated);
@ -457,13 +453,13 @@ void Code::set_builtin_index(int index) {
bool Code::is_builtin() const { return builtin_index() != -1; } bool Code::is_builtin() const { return builtin_index() != -1; }
unsigned Code::inlined_bytecode_size() const { unsigned Code::inlined_bytecode_size() const {
DCHECK(kind() == OPTIMIZED_FUNCTION || DCHECK(CodeKindIsOptimizedJSFunction(kind()) ||
ReadField<unsigned>(kInlinedBytecodeSizeOffset) == 0); ReadField<unsigned>(kInlinedBytecodeSizeOffset) == 0);
return ReadField<unsigned>(kInlinedBytecodeSizeOffset); return ReadField<unsigned>(kInlinedBytecodeSizeOffset);
} }
void Code::set_inlined_bytecode_size(unsigned size) { void Code::set_inlined_bytecode_size(unsigned size) {
DCHECK(kind() == OPTIMIZED_FUNCTION || size == 0); DCHECK(CodeKindIsOptimizedJSFunction(kind()) || size == 0);
WriteField<unsigned>(kInlinedBytecodeSizeOffset, size); WriteField<unsigned>(kInlinedBytecodeSizeOffset, size);
} }
@ -477,13 +473,13 @@ int Code::stack_slots() const {
} }
bool Code::marked_for_deoptimization() const { bool Code::marked_for_deoptimization() const {
DCHECK(kind() == OPTIMIZED_FUNCTION); DCHECK(CodeKindCanDeoptimize(kind()));
int32_t flags = code_data_container().kind_specific_flags(); int32_t flags = code_data_container().kind_specific_flags();
return MarkedForDeoptimizationField::decode(flags); return MarkedForDeoptimizationField::decode(flags);
} }
void Code::set_marked_for_deoptimization(bool flag) { void Code::set_marked_for_deoptimization(bool flag) {
DCHECK(kind() == OPTIMIZED_FUNCTION); DCHECK(CodeKindCanDeoptimize(kind()));
DCHECK_IMPLIES(flag, AllowDeoptimization::IsAllowed(GetIsolate())); DCHECK_IMPLIES(flag, AllowDeoptimization::IsAllowed(GetIsolate()));
int32_t previous = code_data_container().kind_specific_flags(); int32_t previous = code_data_container().kind_specific_flags();
int32_t updated = MarkedForDeoptimizationField::update(previous, flag); int32_t updated = MarkedForDeoptimizationField::update(previous, flag);
@ -491,7 +487,7 @@ void Code::set_marked_for_deoptimization(bool flag) {
} }
int Code::deoptimization_count() const { int Code::deoptimization_count() const {
DCHECK(kind() == OPTIMIZED_FUNCTION); DCHECK(CodeKindCanDeoptimize(kind()));
int32_t flags = code_data_container().kind_specific_flags(); int32_t flags = code_data_container().kind_specific_flags();
int count = DeoptCountField::decode(flags); int count = DeoptCountField::decode(flags);
DCHECK_GE(count, 0); DCHECK_GE(count, 0);
@ -499,7 +495,7 @@ int Code::deoptimization_count() const {
} }
void Code::increment_deoptimization_count() { void Code::increment_deoptimization_count() {
DCHECK(kind() == OPTIMIZED_FUNCTION); DCHECK(CodeKindCanDeoptimize(kind()));
int32_t flags = code_data_container().kind_specific_flags(); int32_t flags = code_data_container().kind_specific_flags();
int32_t count = DeoptCountField::decode(flags); int32_t count = DeoptCountField::decode(flags);
DCHECK_GE(count, 0); DCHECK_GE(count, 0);
@ -509,13 +505,13 @@ void Code::increment_deoptimization_count() {
} }
bool Code::embedded_objects_cleared() const { bool Code::embedded_objects_cleared() const {
DCHECK(kind() == OPTIMIZED_FUNCTION); DCHECK(CodeKindIsOptimizedJSFunction(kind()));
int32_t flags = code_data_container().kind_specific_flags(); int32_t flags = code_data_container().kind_specific_flags();
return EmbeddedObjectsClearedField::decode(flags); return EmbeddedObjectsClearedField::decode(flags);
} }
void Code::set_embedded_objects_cleared(bool flag) { void Code::set_embedded_objects_cleared(bool flag) {
DCHECK(kind() == OPTIMIZED_FUNCTION); DCHECK(CodeKindIsOptimizedJSFunction(kind()));
DCHECK_IMPLIES(flag, marked_for_deoptimization()); DCHECK_IMPLIES(flag, marked_for_deoptimization());
int32_t previous = code_data_container().kind_specific_flags(); int32_t previous = code_data_container().kind_specific_flags();
int32_t updated = EmbeddedObjectsClearedField::update(previous, flag); int32_t updated = EmbeddedObjectsClearedField::update(previous, flag);
@ -523,21 +519,23 @@ void Code::set_embedded_objects_cleared(bool flag) {
} }
bool Code::deopt_already_counted() const { bool Code::deopt_already_counted() const {
DCHECK(kind() == OPTIMIZED_FUNCTION); DCHECK(CodeKindCanDeoptimize(kind()));
int32_t flags = code_data_container().kind_specific_flags(); int32_t flags = code_data_container().kind_specific_flags();
return DeoptAlreadyCountedField::decode(flags); return DeoptAlreadyCountedField::decode(flags);
} }
void Code::set_deopt_already_counted(bool flag) { void Code::set_deopt_already_counted(bool flag) {
DCHECK(kind() == OPTIMIZED_FUNCTION); DCHECK(CodeKindCanDeoptimize(kind()));
DCHECK_IMPLIES(flag, AllowDeoptimization::IsAllowed(GetIsolate())); DCHECK_IMPLIES(flag, AllowDeoptimization::IsAllowed(GetIsolate()));
int32_t previous = code_data_container().kind_specific_flags(); int32_t previous = code_data_container().kind_specific_flags();
int32_t updated = DeoptAlreadyCountedField::update(previous, flag); int32_t updated = DeoptAlreadyCountedField::update(previous, flag);
code_data_container().set_kind_specific_flags(updated); code_data_container().set_kind_specific_flags(updated);
} }
bool Code::is_optimized_code() const { return kind() == OPTIMIZED_FUNCTION; } bool Code::is_optimized_code() const {
bool Code::is_wasm_code() const { return kind() == WASM_FUNCTION; } return CodeKindIsOptimizedJSFunction(kind());
}
bool Code::is_wasm_code() const { return kind() == CodeKind::WASM_FUNCTION; }
int Code::constant_pool_offset() const { int Code::constant_pool_offset() const {
if (!FLAG_enable_embedded_constant_pool) return code_comments_offset(); if (!FLAG_enable_embedded_constant_pool) return code_comments_offset();

22
src/objects/code-kind.cc Normal file
View File

@ -0,0 +1,22 @@
// Copyright 2020 the V8 project authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "src/objects/code-kind.h"
namespace v8 {
namespace internal {
const char* CodeKindToString(CodeKind kind) {
switch (kind) {
#define CASE(name) \
case CodeKind::name: \
return #name;
CODE_KIND_LIST(CASE)
#undef CASE
}
UNREACHABLE();
}
} // namespace internal
} // namespace v8

80
src/objects/code-kind.h Normal file
View File

@ -0,0 +1,80 @@
// Copyright 2020 the V8 project authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef V8_OBJECTS_CODE_KIND_H_
#define V8_OBJECTS_CODE_KIND_H_
#include "src/flags/flags.h"
namespace v8 {
namespace internal {
// TODO(jgruber,rmcilroy): Rename OPTIMIZED_FUNCTION once we've fully
// disambiguated Turboprop, Turbofan, and NCI code kinds.
// TODO(jgruber): Rename STUB to DEOPT_ENTRIES_OR_FOR_TESTING, or split it into
// DEOPT_ENTRIES and FOR_TESTING, or convert DEOPT_ENTRIES into a builtin.
#define CODE_KIND_LIST(V) \
V(OPTIMIZED_FUNCTION) \
V(BYTECODE_HANDLER) \
V(STUB) \
V(BUILTIN) \
V(REGEXP) \
V(WASM_FUNCTION) \
V(WASM_TO_CAPI_FUNCTION) \
V(WASM_TO_JS_FUNCTION) \
V(JS_TO_WASM_FUNCTION) \
V(JS_TO_JS_FUNCTION) \
V(C_WASM_ENTRY) \
V(INTERPRETED_FUNCTION) \
V(NATIVE_CONTEXT_INDEPENDENT)
enum class CodeKind {
#define DEFINE_CODE_KIND_ENUM(name) name,
CODE_KIND_LIST(DEFINE_CODE_KIND_ENUM)
#undef DEFINE_CODE_KIND_ENUM
};
#define V(name) +1
static constexpr int kCodeKindCount = CODE_KIND_LIST(V);
#undef V
const char* CodeKindToString(CodeKind kind);
inline bool CodeKindIsInterpretedJSFunction(CodeKind kind) {
return kind == CodeKind::INTERPRETED_FUNCTION;
}
inline bool CodeKindIsNativeContextIndependentJSFunction(CodeKind kind) {
return kind == CodeKind::NATIVE_CONTEXT_INDEPENDENT;
}
inline bool CodeKindIsBuiltinOrJSFunction(CodeKind kind) {
return kind == CodeKind::BUILTIN || kind == CodeKind::INTERPRETED_FUNCTION ||
kind == CodeKind::OPTIMIZED_FUNCTION ||
kind == CodeKind::NATIVE_CONTEXT_INDEPENDENT;
}
inline bool CodeKindIsOptimizedJSFunction(CodeKind kind) {
return kind == CodeKind::OPTIMIZED_FUNCTION ||
kind == CodeKind::NATIVE_CONTEXT_INDEPENDENT;
}
inline bool CodeKindCanDeoptimize(CodeKind kind) {
// Even though NCI code does not deopt by itself at the time of writing,
// tests may trigger deopts manually and thus we cannot make a narrower
// distinction here.
return CodeKindIsOptimizedJSFunction(kind);
}
inline CodeKind CodeKindForTopTier() {
return FLAG_turbo_nci_as_highest_tier ? CodeKind::NATIVE_CONTEXT_INDEPENDENT
: CodeKind::OPTIMIZED_FUNCTION;
}
inline CodeKind CodeKindForOSR() { return CodeKind::OPTIMIZED_FUNCTION; }
} // namespace internal
} // namespace v8
#endif // V8_OBJECTS_CODE_KIND_H_

View File

@ -226,27 +226,6 @@ bool Code::CanDeoptAt(Address pc) {
return false; return false;
} }
// Identify kind of code.
const char* Code::Kind2String(Kind kind) {
switch (kind) {
#define CASE(name) \
case name: \
return #name;
CODE_KIND_LIST(CASE)
#undef CASE
case NUMBER_OF_KINDS:
break;
}
UNREACHABLE();
}
// Identify kind of code.
const char* AbstractCode::Kind2String(Kind kind) {
DCHECK_NE(kind, AbstractCode::NUMBER_OF_KINDS);
if (kind == AbstractCode::INTERPRETED_FUNCTION) return "INTERPRETED_FUNCTION";
return Code::Kind2String(static_cast<Code::Kind>(kind));
}
bool Code::IsIsolateIndependent(Isolate* isolate) { bool Code::IsIsolateIndependent(Isolate* isolate) {
static constexpr int kModeMask = static constexpr int kModeMask =
RelocInfo::AllRealModesMask() & RelocInfo::AllRealModesMask() &
@ -394,7 +373,7 @@ Code Code::OptimizedCodeIterator::Next() {
} }
current_code_ = next.IsUndefined(isolate_) ? Code() : Code::cast(next); current_code_ = next.IsUndefined(isolate_) ? Code() : Code::cast(next);
} while (current_code_.is_null()); } while (current_code_.is_null());
DCHECK_EQ(Code::OPTIMIZED_FUNCTION, current_code_.kind()); DCHECK(CodeKindCanDeoptimize(current_code_.kind()));
return current_code_; return current_code_;
} }
@ -421,7 +400,7 @@ SharedFunctionInfo DeoptimizationData::GetInlinedFunction(int index) {
#ifdef ENABLE_DISASSEMBLER #ifdef ENABLE_DISASSEMBLER
const char* Code::GetName(Isolate* isolate) const { const char* Code::GetName(Isolate* isolate) const {
if (kind() == BYTECODE_HANDLER) { if (kind() == CodeKind::BYTECODE_HANDLER) {
return isolate->interpreter()->LookupNameOfBytecodeHandler(*this); return isolate->interpreter()->LookupNameOfBytecodeHandler(*this);
} else { } else {
// There are some handlers and ICs that we can also find names for with // There are some handlers and ICs that we can also find names for with
@ -689,14 +668,14 @@ inline void DisassembleCodeRange(Isolate* isolate, std::ostream& os, Code code,
void Code::Disassemble(const char* name, std::ostream& os, Isolate* isolate, void Code::Disassemble(const char* name, std::ostream& os, Isolate* isolate,
Address current_pc) { Address current_pc) {
os << "kind = " << Kind2String(kind()) << "\n"; os << "kind = " << CodeKindToString(kind()) << "\n";
if (name == nullptr) { if (name == nullptr) {
name = GetName(isolate); name = GetName(isolate);
} }
if ((name != nullptr) && (name[0] != '\0')) { if ((name != nullptr) && (name[0] != '\0')) {
os << "name = " << name << "\n"; os << "name = " << name << "\n";
} }
if (kind() == OPTIMIZED_FUNCTION) { if (CodeKindIsOptimizedJSFunction(kind())) {
os << "stack_slots = " << stack_slots() << "\n"; os << "stack_slots = " << stack_slots() << "\n";
} }
os << "compiler = " << (is_turbofanned() ? "turbofan" : "unknown") << "\n"; os << "compiler = " << (is_turbofanned() ? "turbofan" : "unknown") << "\n";
@ -761,7 +740,7 @@ void Code::Disassemble(const char* name, std::ostream& os, Isolate* isolate,
} }
} }
if (kind() == OPTIMIZED_FUNCTION) { if (CodeKindCanDeoptimize(kind())) {
DeoptimizationData data = DeoptimizationData data =
DeoptimizationData::cast(this->deoptimization_data()); DeoptimizationData::cast(this->deoptimization_data());
data.DeoptimizationDataPrint(os); data.DeoptimizationDataPrint(os);
@ -795,9 +774,8 @@ void Code::Disassemble(const char* name, std::ostream& os, Isolate* isolate,
if (has_handler_table()) { if (has_handler_table()) {
HandlerTable table(*this); HandlerTable table(*this);
os << "Handler Table (size = " << table.NumberOfReturnEntries() << ")\n"; os << "Handler Table (size = " << table.NumberOfReturnEntries() << ")\n";
if (kind() == OPTIMIZED_FUNCTION) { if (CodeKindIsOptimizedJSFunction(kind()))
table.HandlerTableReturnPrint(os); table.HandlerTableReturnPrint(os);
}
os << "\n"; os << "\n";
} }

View File

@ -7,6 +7,7 @@
#include "src/base/bit-field.h" #include "src/base/bit-field.h"
#include "src/codegen/handler-table.h" #include "src/codegen/handler-table.h"
#include "src/objects/code-kind.h"
#include "src/objects/contexts.h" #include "src/objects/contexts.h"
#include "src/objects/fixed-array.h" #include "src/objects/fixed-array.h"
#include "src/objects/heap-object.h" #include "src/objects/heap-object.h"
@ -77,32 +78,6 @@ class Code : public HeapObject {
// cache state, and arguments count. // cache state, and arguments count.
using Flags = uint32_t; using Flags = uint32_t;
// TODO(jgruber,rmcilroy): Rename OPTIMIZED_FUNCTION once we've fully
// disambiguated Turboprop, Turbofan, and NCI code kinds.
// TODO(jgruber): Rename STUB to DEOPT_ENTRIES_OR_FOR_TESTING, or split it into
// DEOPT_ENTRIES and FOR_TESTING, or convert DEOPT_ENTRIES into a builtin.
#define CODE_KIND_LIST(V) \
V(OPTIMIZED_FUNCTION) \
V(BYTECODE_HANDLER) \
V(STUB) \
V(BUILTIN) \
V(REGEXP) \
V(WASM_FUNCTION) \
V(WASM_TO_CAPI_FUNCTION) \
V(WASM_TO_JS_FUNCTION) \
V(JS_TO_WASM_FUNCTION) \
V(JS_TO_JS_FUNCTION) \
V(C_WASM_ENTRY)
enum Kind {
#define DEFINE_CODE_KIND_ENUM(name) name,
CODE_KIND_LIST(DEFINE_CODE_KIND_ENUM)
#undef DEFINE_CODE_KIND_ENUM
NUMBER_OF_KINDS
};
static const char* Kind2String(Kind kind);
#ifdef ENABLE_DISASSEMBLER #ifdef ENABLE_DISASSEMBLER
const char* GetName(Isolate* isolate) const; const char* GetName(Isolate* isolate) const;
V8_EXPORT_PRIVATE void Disassemble(const char* name, std::ostream& os, V8_EXPORT_PRIVATE void Disassemble(const char* name, std::ostream& os,
@ -151,7 +126,7 @@ class Code : public HeapObject {
inline int relocation_size() const; inline int relocation_size() const;
// [kind]: Access to specific code kind. // [kind]: Access to specific code kind.
inline Kind kind() const; inline CodeKind kind() const;
inline bool is_optimized_code() const; inline bool is_optimized_code() const;
inline bool is_wasm_code() const; inline bool is_wasm_code() const;
@ -166,12 +141,12 @@ class Code : public HeapObject {
// Tells whether the outgoing parameters of this code are tagged pointers. // Tells whether the outgoing parameters of this code are tagged pointers.
inline bool has_tagged_params() const; inline bool has_tagged_params() const;
// [is_turbofanned]: For kind STUB or OPTIMIZED_FUNCTION, tells whether the // [is_turbofanned]: Tells whether the code object was generated by the
// code object was generated by the TurboFan optimizing compiler. // TurboFan optimizing compiler.
inline bool is_turbofanned() const; inline bool is_turbofanned() const;
// [can_have_weak_objects]: For kind OPTIMIZED_FUNCTION, tells whether the // [can_have_weak_objects]: If CodeKindIsOptimizedJSFunction(kind), tells
// embedded objects in code should be treated weakly. // whether the embedded objects in code should be treated weakly.
inline bool can_have_weak_objects() const; inline bool can_have_weak_objects() const;
inline void set_can_have_weak_objects(bool value); inline void set_can_have_weak_objects(bool value);
@ -224,24 +199,26 @@ class Code : public HeapObject {
// The size of the executable instruction area, without embedded metadata. // The size of the executable instruction area, without embedded metadata.
int ExecutableInstructionSize() const; int ExecutableInstructionSize() const;
// [marked_for_deoptimization]: For kind OPTIMIZED_FUNCTION tells whether // [marked_for_deoptimization]: If CodeKindCanDeoptimize(kind), tells whether
// the code is going to be deoptimized. // the code is going to be deoptimized.
inline bool marked_for_deoptimization() const; inline bool marked_for_deoptimization() const;
inline void set_marked_for_deoptimization(bool flag); inline void set_marked_for_deoptimization(bool flag);
// [deoptimzation_count]: In turboprop we retain the deoptimized code on soft // [deoptimization_count]: If CodeKindCanDeoptimize(kind). In turboprop we
// deopts for a certain number of soft deopts. This field keeps track of // retain the deoptimized code on soft deopts for a certain number of soft
// number of deoptimizations we have seen so far. // deopts. This field keeps track of the number of deoptimizations we have
// seen so far.
inline int deoptimization_count() const; inline int deoptimization_count() const;
inline void increment_deoptimization_count(); inline void increment_deoptimization_count();
// [embedded_objects_cleared]: For kind OPTIMIZED_FUNCTION tells whether // [embedded_objects_cleared]: If CodeKindIsOptimizedJSFunction(kind), tells
// the embedded objects in the code marked for deoptimization were cleared. // whether the embedded objects in the code marked for deoptimization were
// Note that embedded_objects_cleared() implies marked_for_deoptimization(). // cleared. Note that embedded_objects_cleared() implies
// marked_for_deoptimization().
inline bool embedded_objects_cleared() const; inline bool embedded_objects_cleared() const;
inline void set_embedded_objects_cleared(bool flag); inline void set_embedded_objects_cleared(bool flag);
// [deopt_already_counted]: For kind OPTIMIZED_FUNCTION tells whether // [deopt_already_counted]: If CodeKindCanDeoptimize(kind), tells whether
// the code was already deoptimized. // the code was already deoptimized.
inline bool deopt_already_counted() const; inline bool deopt_already_counted() const;
inline void set_deopt_already_counted(bool flag); inline void set_deopt_already_counted(bool flag);
@ -282,7 +259,7 @@ class Code : public HeapObject {
inline void clear_padding(); inline void clear_padding();
// Initialize the flags field. Similar to clear_padding above this ensure that // Initialize the flags field. Similar to clear_padding above this ensure that
// the snapshot content is deterministic. // the snapshot content is deterministic.
inline void initialize_flags(Kind kind, bool has_unwinding_info, inline void initialize_flags(CodeKind kind, bool has_unwinding_info,
bool is_turbofanned, int stack_slots, bool is_turbofanned, int stack_slots,
bool is_off_heap_trampoline); bool is_off_heap_trampoline);
@ -495,18 +472,18 @@ class Code : public HeapObject {
// Flags layout. base::BitField<type, shift, size>. // Flags layout. base::BitField<type, shift, size>.
#define CODE_FLAGS_BIT_FIELDS(V, _) \ #define CODE_FLAGS_BIT_FIELDS(V, _) \
V(HasUnwindingInfoField, bool, 1, _) \ V(HasUnwindingInfoField, bool, 1, _) \
V(KindField, Kind, 4, _) \ V(KindField, CodeKind, 4, _) \
V(IsTurbofannedField, bool, 1, _) \ V(IsTurbofannedField, bool, 1, _) \
V(StackSlotsField, int, 24, _) \ V(StackSlotsField, int, 24, _) \
V(IsOffHeapTrampoline, bool, 1, _) V(IsOffHeapTrampoline, bool, 1, _)
DEFINE_BIT_FIELDS(CODE_FLAGS_BIT_FIELDS) DEFINE_BIT_FIELDS(CODE_FLAGS_BIT_FIELDS)
#undef CODE_FLAGS_BIT_FIELDS #undef CODE_FLAGS_BIT_FIELDS
STATIC_ASSERT(NUMBER_OF_KINDS <= KindField::kMax); STATIC_ASSERT(kCodeKindCount <= KindField::kNumValues);
STATIC_ASSERT(CODE_FLAGS_BIT_FIELDS_Ranges::kBitsCount == 31); STATIC_ASSERT(CODE_FLAGS_BIT_FIELDS_Ranges::kBitsCount == 31);
STATIC_ASSERT(CODE_FLAGS_BIT_FIELDS_Ranges::kBitsCount <= STATIC_ASSERT(CODE_FLAGS_BIT_FIELDS_Ranges::kBitsCount <=
FIELD_SIZE(kFlagsOffset) * kBitsPerByte); FIELD_SIZE(kFlagsOffset) * kBitsPerByte);
// KindSpecificFlags layout (STUB, BUILTIN, and OPTIMIZED_FUNCTION). // KindSpecificFlags layout.
#define CODE_KIND_SPECIFIC_FLAGS_BIT_FIELDS(V, _) \ #define CODE_KIND_SPECIFIC_FLAGS_BIT_FIELDS(V, _) \
V(MarkedForDeoptimizationField, bool, 1, _) \ V(MarkedForDeoptimizationField, bool, 1, _) \
V(EmbeddedObjectsClearedField, bool, 1, _) \ V(EmbeddedObjectsClearedField, bool, 1, _) \
@ -556,16 +533,6 @@ class Code::OptimizedCodeIterator {
class AbstractCode : public HeapObject { class AbstractCode : public HeapObject {
public: public:
NEVER_READ_ONLY_SPACE NEVER_READ_ONLY_SPACE
// All code kinds and INTERPRETED_FUNCTION.
enum Kind {
#define DEFINE_CODE_KIND_ENUM(name) name,
CODE_KIND_LIST(DEFINE_CODE_KIND_ENUM)
#undef DEFINE_CODE_KIND_ENUM
INTERPRETED_FUNCTION,
NUMBER_OF_KINDS
};
static const char* Kind2String(Kind kind);
int SourcePosition(int offset); int SourcePosition(int offset);
int SourceStatementPosition(int offset); int SourceStatementPosition(int offset);
@ -607,8 +574,8 @@ class AbstractCode : public HeapObject {
// Returns true if pc is inside this object's instructions. // Returns true if pc is inside this object's instructions.
inline bool contains(Address pc); inline bool contains(Address pc);
// Returns the AbstractCode::Kind of the code. // Returns the kind of the code.
inline Kind kind(); inline CodeKind kind();
// Calculate the size of the code object to report for log events. This takes // Calculate the size of the code object to report for log events. This takes
// the layout of the code object into account. // the layout of the code object into account.

View File

@ -411,7 +411,7 @@ Handle<Object> Context::Lookup(Handle<Context> context, Handle<String> name,
} }
void NativeContext::AddOptimizedCode(Code code) { void NativeContext::AddOptimizedCode(Code code) {
DCHECK(code.kind() == Code::OPTIMIZED_FUNCTION); DCHECK(CodeKindCanDeoptimize(code.kind()));
DCHECK(code.next_code_link().IsUndefined()); DCHECK(code.next_code_link().IsUndefined());
code.set_next_code_link(get(OPTIMIZED_CODE_LIST)); code.set_next_code_link(get(OPTIMIZED_CODE_LIST));
set(OPTIMIZED_CODE_LIST, code, UPDATE_WEAK_WRITE_BARRIER); set(OPTIMIZED_CODE_LIST, code, UPDATE_WEAK_WRITE_BARRIER);

View File

@ -376,7 +376,7 @@ void FeedbackVector::AddToVectorsForProfilingTools(
// static // static
void FeedbackVector::SetOptimizedCode(Handle<FeedbackVector> vector, void FeedbackVector::SetOptimizedCode(Handle<FeedbackVector> vector,
Handle<Code> code) { Handle<Code> code) {
DCHECK_EQ(code->kind(), Code::OPTIMIZED_FUNCTION); DCHECK(CodeKindIsOptimizedJSFunction(code->kind()));
vector->set_optimized_code_weak_or_smi(HeapObjectReference::Weak(*code)); vector->set_optimized_code_weak_or_smi(HeapObjectReference::Weak(*code));
} }

View File

@ -43,7 +43,7 @@ ClosureFeedbackCellArray JSFunction::closure_feedback_cell_array() const {
// TODO(jupvfranco): rename this function. Maybe RunOptimizedCode, // TODO(jupvfranco): rename this function. Maybe RunOptimizedCode,
// or IsValidOptimizedCode. // or IsValidOptimizedCode.
bool JSFunction::IsOptimized() { bool JSFunction::IsOptimized() {
return is_compiled() && code().kind() == Code::OPTIMIZED_FUNCTION && return is_compiled() && CodeKindIsOptimizedJSFunction(code().kind()) &&
!code().marked_for_deoptimization(); !code().marked_for_deoptimization();
} }
@ -66,7 +66,7 @@ void JSFunction::ClearOptimizationMarker() {
// interpreted on its next activation, and already doesn't count as IsOptimized. // interpreted on its next activation, and already doesn't count as IsOptimized.
bool JSFunction::IsInterpreted() { bool JSFunction::IsInterpreted() {
return is_compiled() && (code().is_interpreter_trampoline_builtin() || return is_compiled() && (code().is_interpreter_trampoline_builtin() ||
(code().kind() == Code::OPTIMIZED_FUNCTION && (CodeKindIsOptimizedJSFunction(code().kind()) &&
code().marked_for_deoptimization())); code().marked_for_deoptimization()));
} }

View File

@ -2059,7 +2059,7 @@ void HeapObject::HeapObjectShortPrint(std::ostream& os) { // NOLINT
} }
case CODE_TYPE: { case CODE_TYPE: {
Code code = Code::cast(*this); Code code = Code::cast(*this);
os << "<Code " << Code::Kind2String(code.kind()); os << "<Code " << CodeKindToString(code.kind());
if (code.is_builtin()) { if (code.is_builtin()) {
os << " " << Builtins::name(code.builtin_index()); os << " " << Builtins::name(code.builtin_index());
} }

View File

@ -19,7 +19,7 @@ void OSROptimizedCodeCache::AddOptimizedCode(
Handle<NativeContext> native_context, Handle<SharedFunctionInfo> shared, Handle<NativeContext> native_context, Handle<SharedFunctionInfo> shared,
Handle<Code> code, BailoutId osr_offset) { Handle<Code> code, BailoutId osr_offset) {
DCHECK(!osr_offset.IsNone()); DCHECK(!osr_offset.IsNone());
DCHECK_EQ(code->kind(), Code::OPTIMIZED_FUNCTION); DCHECK(CodeKindIsOptimizedJSFunction(code->kind()));
STATIC_ASSERT(kEntryLength == 3); STATIC_ASSERT(kEntryLength == 3);
Isolate* isolate = native_context->GetIsolate(); Isolate* isolate = native_context->GetIsolate();
DCHECK(!isolate->serializer_enabled()); DCHECK(!isolate->serializer_enabled());

View File

@ -432,8 +432,8 @@ void SharedFunctionInfo::DisableOptimization(BailoutReason reason) {
set_flags(DisabledOptimizationReasonBits::update(flags(), reason)); set_flags(DisabledOptimizationReasonBits::update(flags(), reason));
// Code should be the lazy compilation stub or else interpreted. // Code should be the lazy compilation stub or else interpreted.
DCHECK(abstract_code().kind() == AbstractCode::INTERPRETED_FUNCTION || DCHECK(abstract_code().kind() == CodeKind::INTERPRETED_FUNCTION ||
abstract_code().kind() == AbstractCode::BUILTIN); abstract_code().kind() == CodeKind::BUILTIN);
PROFILE(GetIsolate(), PROFILE(GetIsolate(),
CodeDisableOptEvent(handle(abstract_code(), GetIsolate()), CodeDisableOptEvent(handle(abstract_code(), GetIsolate()),
handle(*this, GetIsolate()))); handle(*this, GetIsolate())));

View File

@ -1107,7 +1107,7 @@ void V8HeapExplorer::ExtractSharedFunctionInfoReferences(
} else { } else {
TagObject(shared.GetCode(), TagObject(shared.GetCode(),
names_->GetFormatted("(%s code)", names_->GetFormatted("(%s code)",
Code::Kind2String(shared.GetCode().kind()))); CodeKindToString(shared.GetCode().kind())));
} }
if (shared.name_or_scope_info().IsScopeInfo()) { if (shared.name_or_scope_info().IsScopeInfo()) {

View File

@ -903,9 +903,10 @@ Handle<HeapObject> RegExpMacroAssemblerARM::GetCode(Handle<String> source) {
CodeDesc code_desc; CodeDesc code_desc;
masm_->GetCode(isolate(), &code_desc); masm_->GetCode(isolate(), &code_desc);
Handle<Code> code = Factory::CodeBuilder(isolate(), code_desc, Code::REGEXP) Handle<Code> code =
.set_self_reference(masm_->CodeObject()) Factory::CodeBuilder(isolate(), code_desc, CodeKind::REGEXP)
.Build(); .set_self_reference(masm_->CodeObject())
.Build();
PROFILE(masm_->isolate(), PROFILE(masm_->isolate(),
RegExpCodeCreateEvent(Handle<AbstractCode>::cast(code), source)); RegExpCodeCreateEvent(Handle<AbstractCode>::cast(code), source));
return Handle<HeapObject>::cast(code); return Handle<HeapObject>::cast(code);

View File

@ -1096,9 +1096,10 @@ Handle<HeapObject> RegExpMacroAssemblerARM64::GetCode(Handle<String> source) {
CodeDesc code_desc; CodeDesc code_desc;
masm_->GetCode(isolate(), &code_desc); masm_->GetCode(isolate(), &code_desc);
Handle<Code> code = Factory::CodeBuilder(isolate(), code_desc, Code::REGEXP) Handle<Code> code =
.set_self_reference(masm_->CodeObject()) Factory::CodeBuilder(isolate(), code_desc, CodeKind::REGEXP)
.Build(); .set_self_reference(masm_->CodeObject())
.Build();
PROFILE(masm_->isolate(), PROFILE(masm_->isolate(),
RegExpCodeCreateEvent(Handle<AbstractCode>::cast(code), source)); RegExpCodeCreateEvent(Handle<AbstractCode>::cast(code), source));
return Handle<HeapObject>::cast(code); return Handle<HeapObject>::cast(code);

View File

@ -942,9 +942,10 @@ Handle<HeapObject> RegExpMacroAssemblerIA32::GetCode(Handle<String> source) {
CodeDesc code_desc; CodeDesc code_desc;
masm_->GetCode(masm_->isolate(), &code_desc); masm_->GetCode(masm_->isolate(), &code_desc);
Handle<Code> code = Factory::CodeBuilder(isolate(), code_desc, Code::REGEXP) Handle<Code> code =
.set_self_reference(masm_->CodeObject()) Factory::CodeBuilder(isolate(), code_desc, CodeKind::REGEXP)
.Build(); .set_self_reference(masm_->CodeObject())
.Build();
PROFILE(masm_->isolate(), PROFILE(masm_->isolate(),
RegExpCodeCreateEvent(Handle<AbstractCode>::cast(code), source)); RegExpCodeCreateEvent(Handle<AbstractCode>::cast(code), source));
return Handle<HeapObject>::cast(code); return Handle<HeapObject>::cast(code);

View File

@ -914,9 +914,10 @@ Handle<HeapObject> RegExpMacroAssemblerMIPS::GetCode(Handle<String> source) {
CodeDesc code_desc; CodeDesc code_desc;
masm_->GetCode(isolate(), &code_desc); masm_->GetCode(isolate(), &code_desc);
Handle<Code> code = Factory::CodeBuilder(isolate(), code_desc, Code::REGEXP) Handle<Code> code =
.set_self_reference(masm_->CodeObject()) Factory::CodeBuilder(isolate(), code_desc, CodeKind::REGEXP)
.Build(); .set_self_reference(masm_->CodeObject())
.Build();
LOG(masm_->isolate(), LOG(masm_->isolate(),
RegExpCodeCreateEvent(Handle<AbstractCode>::cast(code), source)); RegExpCodeCreateEvent(Handle<AbstractCode>::cast(code), source));
return Handle<HeapObject>::cast(code); return Handle<HeapObject>::cast(code);

View File

@ -950,9 +950,10 @@ Handle<HeapObject> RegExpMacroAssemblerMIPS::GetCode(Handle<String> source) {
CodeDesc code_desc; CodeDesc code_desc;
masm_->GetCode(isolate(), &code_desc); masm_->GetCode(isolate(), &code_desc);
Handle<Code> code = Factory::CodeBuilder(isolate(), code_desc, Code::REGEXP) Handle<Code> code =
.set_self_reference(masm_->CodeObject()) Factory::CodeBuilder(isolate(), code_desc, CodeKind::REGEXP)
.Build(); .set_self_reference(masm_->CodeObject())
.Build();
LOG(masm_->isolate(), LOG(masm_->isolate(),
RegExpCodeCreateEvent(Handle<AbstractCode>::cast(code), source)); RegExpCodeCreateEvent(Handle<AbstractCode>::cast(code), source));
return Handle<HeapObject>::cast(code); return Handle<HeapObject>::cast(code);

View File

@ -956,9 +956,10 @@ Handle<HeapObject> RegExpMacroAssemblerPPC::GetCode(Handle<String> source) {
CodeDesc code_desc; CodeDesc code_desc;
masm_->GetCode(isolate(), &code_desc); masm_->GetCode(isolate(), &code_desc);
Handle<Code> code = Factory::CodeBuilder(isolate(), code_desc, Code::REGEXP) Handle<Code> code =
.set_self_reference(masm_->CodeObject()) Factory::CodeBuilder(isolate(), code_desc, CodeKind::REGEXP)
.Build(); .set_self_reference(masm_->CodeObject())
.Build();
PROFILE(masm_->isolate(), PROFILE(masm_->isolate(),
RegExpCodeCreateEvent(Handle<AbstractCode>::cast(code), source)); RegExpCodeCreateEvent(Handle<AbstractCode>::cast(code), source));
return Handle<HeapObject>::cast(code); return Handle<HeapObject>::cast(code);

View File

@ -951,9 +951,10 @@ Handle<HeapObject> RegExpMacroAssemblerS390::GetCode(Handle<String> source) {
CodeDesc code_desc; CodeDesc code_desc;
masm_->GetCode(isolate(), &code_desc); masm_->GetCode(isolate(), &code_desc);
Handle<Code> code = Factory::CodeBuilder(isolate(), code_desc, Code::REGEXP) Handle<Code> code =
.set_self_reference(masm_->CodeObject()) Factory::CodeBuilder(isolate(), code_desc, CodeKind::REGEXP)
.Build(); .set_self_reference(masm_->CodeObject())
.Build();
PROFILE(masm_->isolate(), PROFILE(masm_->isolate(),
RegExpCodeCreateEvent(Handle<AbstractCode>::cast(code), source)); RegExpCodeCreateEvent(Handle<AbstractCode>::cast(code), source));
return Handle<HeapObject>::cast(code); return Handle<HeapObject>::cast(code);

View File

@ -1005,7 +1005,7 @@ Handle<HeapObject> RegExpMacroAssemblerX64::GetCode(Handle<String> source) {
CodeDesc code_desc; CodeDesc code_desc;
Isolate* isolate = this->isolate(); Isolate* isolate = this->isolate();
masm_.GetCode(isolate, &code_desc); masm_.GetCode(isolate, &code_desc);
Handle<Code> code = Factory::CodeBuilder(isolate, code_desc, Code::REGEXP) Handle<Code> code = Factory::CodeBuilder(isolate, code_desc, CodeKind::REGEXP)
.set_self_reference(masm_.CodeObject()) .set_self_reference(masm_.CodeObject())
.Build(); .Build();
PROFILE(isolate, PROFILE(isolate,

View File

@ -65,12 +65,12 @@ Object CompileOptimized(Isolate* isolate, Handle<JSFunction> function,
if (check.JsHasOverflowed(kStackSpaceRequiredForCompilation * KB)) { if (check.JsHasOverflowed(kStackSpaceRequiredForCompilation * KB)) {
return isolate->StackOverflow(); return isolate->StackOverflow();
} }
if (!Compiler::CompileOptimized(function, mode, DefaultCompilationTarget())) { if (!Compiler::CompileOptimized(function, mode, CodeKindForTopTier())) {
return ReadOnlyRoots(isolate).exception(); return ReadOnlyRoots(isolate).exception();
} }
if (ShouldSpawnExtraNativeContextIndependentCompilationJob()) { if (ShouldSpawnExtraNativeContextIndependentCompilationJob()) {
if (!Compiler::CompileOptimized( if (!Compiler::CompileOptimized(function, mode,
function, mode, CompilationTarget::kNativeContextIndependent)) { CodeKind::NATIVE_CONTEXT_INDEPENDENT)) {
return ReadOnlyRoots(isolate).exception(); return ReadOnlyRoots(isolate).exception();
} }
} }
@ -164,7 +164,7 @@ RUNTIME_FUNCTION(Runtime_NotifyDeoptimized) {
HandleScope scope(isolate); HandleScope scope(isolate);
DCHECK_EQ(0, args.length()); DCHECK_EQ(0, args.length());
Deoptimizer* deoptimizer = Deoptimizer::Grab(isolate); Deoptimizer* deoptimizer = Deoptimizer::Grab(isolate);
DCHECK(deoptimizer->compiled_code()->kind() == Code::OPTIMIZED_FUNCTION); DCHECK(CodeKindCanDeoptimize(deoptimizer->compiled_code()->kind()));
DCHECK(deoptimizer->compiled_code()->is_turbofanned()); DCHECK(deoptimizer->compiled_code()->is_turbofanned());
DCHECK(AllowHeapAllocation::IsAllowed()); DCHECK(AllowHeapAllocation::IsAllowed());
DCHECK(isolate->context().is_null()); DCHECK(isolate->context().is_null());
@ -284,7 +284,7 @@ RUNTIME_FUNCTION(Runtime_CompileForOnStackReplacement) {
// Check whether we ended up with usable optimized code. // Check whether we ended up with usable optimized code.
Handle<Code> result; Handle<Code> result;
if (maybe_result.ToHandle(&result) && if (maybe_result.ToHandle(&result) &&
result->kind() == Code::OPTIMIZED_FUNCTION) { CodeKindIsOptimizedJSFunction(result->kind())) {
DeoptimizationData data = DeoptimizationData data =
DeoptimizationData::cast(result->deoptimization_data()); DeoptimizationData::cast(result->deoptimization_data());

View File

@ -489,8 +489,8 @@ RUNTIME_FUNCTION(Runtime_NeverOptimizeFunction) {
if (!function_object->IsJSFunction()) return CrashUnlessFuzzing(isolate); if (!function_object->IsJSFunction()) return CrashUnlessFuzzing(isolate);
Handle<JSFunction> function = Handle<JSFunction>::cast(function_object); Handle<JSFunction> function = Handle<JSFunction>::cast(function_object);
SharedFunctionInfo sfi = function->shared(); SharedFunctionInfo sfi = function->shared();
if (sfi.abstract_code().kind() != AbstractCode::INTERPRETED_FUNCTION && if (sfi.abstract_code().kind() != CodeKind::INTERPRETED_FUNCTION &&
sfi.abstract_code().kind() != AbstractCode::BUILTIN) { sfi.abstract_code().kind() != CodeKind::BUILTIN) {
return CrashUnlessFuzzing(isolate); return CrashUnlessFuzzing(isolate);
} }
sfi.DisableOptimization(BailoutReason::kNeverOptimize); sfi.DisableOptimization(BailoutReason::kNeverOptimize);
@ -1157,7 +1157,7 @@ RUNTIME_FUNCTION(Runtime_IsWasmCode) {
SealHandleScope shs(isolate); SealHandleScope shs(isolate);
DCHECK_EQ(1, args.length()); DCHECK_EQ(1, args.length());
CONVERT_ARG_CHECKED(JSFunction, function, 0); CONVERT_ARG_CHECKED(JSFunction, function, 0);
bool is_js_to_wasm = function.code().kind() == Code::JS_TO_WASM_FUNCTION; bool is_js_to_wasm = function.code().kind() == CodeKind::JS_TO_WASM_FUNCTION;
return isolate->heap()->ToBoolean(is_js_to_wasm); return isolate->heap()->ToBoolean(is_js_to_wasm);
} }

View File

@ -165,7 +165,7 @@ bool Serializer::SerializeBackReference(HeapObject obj) {
bool Serializer::ObjectIsBytecodeHandler(HeapObject obj) const { bool Serializer::ObjectIsBytecodeHandler(HeapObject obj) const {
if (!obj.IsCode()) return false; if (!obj.IsCode()) return false;
return (Code::cast(obj).kind() == Code::BYTECODE_HANDLER); return (Code::cast(obj).kind() == CodeKind::BYTECODE_HANDLER);
} }
void Serializer::PutRoot(RootIndex root, HeapObject object) { void Serializer::PutRoot(RootIndex root, HeapObject object) {

View File

@ -86,11 +86,11 @@ bool IsUnexpectedCodeObject(Isolate* isolate, HeapObject obj) {
Code code = Code::cast(obj); Code code = Code::cast(obj);
// TODO(v8:8768): Deopt entry code should not be serialized. // TODO(v8:8768): Deopt entry code should not be serialized.
if (code.kind() == Code::STUB && isolate->deoptimizer_data() != nullptr) { if (code.kind() == CodeKind::STUB && isolate->deoptimizer_data() != nullptr) {
if (isolate->deoptimizer_data()->IsDeoptEntryCode(code)) return false; if (isolate->deoptimizer_data()->IsDeoptEntryCode(code)) return false;
} }
if (code.kind() == Code::REGEXP) return false; if (code.kind() == CodeKind::REGEXP) return false;
if (!code.is_builtin()) return true; if (!code.is_builtin()) return true;
if (code.is_off_heap_trampoline()) return false; if (code.is_off_heap_trampoline()) return false;

View File

@ -1748,7 +1748,7 @@ uint32_t WasmExceptionPackage::GetEncodedSize(
bool WasmExportedFunction::IsWasmExportedFunction(Object object) { bool WasmExportedFunction::IsWasmExportedFunction(Object object) {
if (!object.IsJSFunction()) return false; if (!object.IsJSFunction()) return false;
JSFunction js_function = JSFunction::cast(object); JSFunction js_function = JSFunction::cast(object);
if (Code::JS_TO_WASM_FUNCTION != js_function.code().kind() && if (CodeKind::JS_TO_WASM_FUNCTION != js_function.code().kind() &&
js_function.code().builtin_index() != Builtins::kGenericJSToWasmWrapper) { js_function.code().builtin_index() != Builtins::kGenericJSToWasmWrapper) {
return false; return false;
} }
@ -1761,7 +1761,7 @@ bool WasmCapiFunction::IsWasmCapiFunction(Object object) {
JSFunction js_function = JSFunction::cast(object); JSFunction js_function = JSFunction::cast(object);
// TODO(jkummerow): Enable this when there is a JavaScript wrapper // TODO(jkummerow): Enable this when there is a JavaScript wrapper
// able to call this function. // able to call this function.
// if (js_function->code()->kind() != Code::WASM_TO_CAPI_FUNCTION) { // if (js_function->code()->kind() != CodeKind::WASM_TO_CAPI_FUNCTION) {
// return false; // return false;
// } // }
// DCHECK(js_function->shared()->HasWasmCapiFunctionData()); // DCHECK(js_function->shared()->HasWasmCapiFunctionData());
@ -1801,7 +1801,7 @@ Handle<WasmExportedFunction> WasmExportedFunction::New(
Isolate* isolate, Handle<WasmInstanceObject> instance, int func_index, Isolate* isolate, Handle<WasmInstanceObject> instance, int func_index,
int arity, Handle<Code> export_wrapper) { int arity, Handle<Code> export_wrapper) {
DCHECK( DCHECK(
Code::JS_TO_WASM_FUNCTION == export_wrapper->kind() || CodeKind::JS_TO_WASM_FUNCTION == export_wrapper->kind() ||
(export_wrapper->is_builtin() && (export_wrapper->is_builtin() &&
export_wrapper->builtin_index() == Builtins::kGenericJSToWasmWrapper)); export_wrapper->builtin_index() == Builtins::kGenericJSToWasmWrapper));
int num_imported_functions = instance->module()->num_imported_functions; int num_imported_functions = instance->module()->num_imported_functions;

View File

@ -21,7 +21,8 @@ Handle<Code> AssembleCodeImpl(std::function<void(MacroAssembler&)> assemble) {
CodeDesc desc; CodeDesc desc;
assm.GetCode(isolate, &desc); assm.GetCode(isolate, &desc);
Handle<Code> code = Factory::CodeBuilder(isolate, desc, Code::STUB).Build(); Handle<Code> code =
Factory::CodeBuilder(isolate, desc, CodeKind::STUB).Build();
if (FLAG_print_code) { if (FLAG_print_code) {
code->Print(); code->Print();
} }

View File

@ -245,8 +245,6 @@ HandleAndZoneScope::HandleAndZoneScope(bool support_zone_compression)
HandleAndZoneScope::~HandleAndZoneScope() = default; HandleAndZoneScope::~HandleAndZoneScope() = default;
static constexpr bool kNativeContextDependent = false;
i::Handle<i::JSFunction> Optimize( i::Handle<i::JSFunction> Optimize(
i::Handle<i::JSFunction> function, i::Zone* zone, i::Isolate* isolate, i::Handle<i::JSFunction> function, i::Zone* zone, i::Isolate* isolate,
uint32_t flags, std::unique_ptr<i::compiler::JSHeapBroker>* out_broker) { uint32_t flags, std::unique_ptr<i::compiler::JSHeapBroker>* out_broker) {
@ -259,7 +257,7 @@ i::Handle<i::JSFunction> Optimize(
CHECK_NOT_NULL(zone); CHECK_NOT_NULL(zone);
i::OptimizedCompilationInfo info(zone, isolate, shared, function, i::OptimizedCompilationInfo info(zone, isolate, shared, function,
kNativeContextDependent); i::CodeKind::OPTIMIZED_FUNCTION);
if (flags & i::OptimizedCompilationInfo::kInlining) { if (flags & i::OptimizedCompilationInfo::kInlining) {
info.set_inlining(); info.set_inlining();

View File

@ -22,19 +22,19 @@ class CodeAssemblerTester {
explicit CodeAssemblerTester(Isolate* isolate, const char* name = "test") explicit CodeAssemblerTester(Isolate* isolate, const char* name = "test")
: zone_(isolate->allocator(), ZONE_NAME, kCompressGraphZone), : zone_(isolate->allocator(), ZONE_NAME, kCompressGraphZone),
scope_(isolate), scope_(isolate),
state_(isolate, &zone_, VoidDescriptor{}, Code::STUB, name, state_(isolate, &zone_, VoidDescriptor{}, CodeKind::STUB, name,
PoisoningMitigationLevel::kDontPoison) {} PoisoningMitigationLevel::kDontPoison) {}
// Test generating code for a JS function (e.g. builtins). // Test generating code for a JS function (e.g. builtins).
CodeAssemblerTester(Isolate* isolate, int parameter_count, CodeAssemblerTester(Isolate* isolate, int parameter_count,
Code::Kind kind = Code::BUILTIN, CodeKind kind = CodeKind::BUILTIN,
const char* name = "test") const char* name = "test")
: zone_(isolate->allocator(), ZONE_NAME, kCompressGraphZone), : zone_(isolate->allocator(), ZONE_NAME, kCompressGraphZone),
scope_(isolate), scope_(isolate),
state_(isolate, &zone_, parameter_count, kind, name, state_(isolate, &zone_, parameter_count, kind, name,
PoisoningMitigationLevel::kDontPoison) {} PoisoningMitigationLevel::kDontPoison) {}
CodeAssemblerTester(Isolate* isolate, Code::Kind kind, CodeAssemblerTester(Isolate* isolate, CodeKind kind,
const char* name = "test") const char* name = "test")
: zone_(isolate->allocator(), ZONE_NAME, kCompressGraphZone), : zone_(isolate->allocator(), ZONE_NAME, kCompressGraphZone),
scope_(isolate), scope_(isolate),
@ -45,7 +45,7 @@ class CodeAssemblerTester {
const char* name = "test") const char* name = "test")
: zone_(isolate->allocator(), ZONE_NAME, kCompressGraphZone), : zone_(isolate->allocator(), ZONE_NAME, kCompressGraphZone),
scope_(isolate), scope_(isolate),
state_(isolate, &zone_, call_descriptor, Code::STUB, name, state_(isolate, &zone_, call_descriptor, CodeKind::STUB, name,
PoisoningMitigationLevel::kDontPoison, Builtins::kNoBuiltinId) {} PoisoningMitigationLevel::kDontPoison, Builtins::kNoBuiltinId) {}
CodeAssemblerState* state() { return &state_; } CodeAssemblerState* state() { return &state_; }

View File

@ -40,7 +40,7 @@ class RawMachineAssemblerTester : public HandleAndZoneScope,
InstructionSelector::AlignmentRequirements()) {} InstructionSelector::AlignmentRequirements()) {}
template <typename... ParamMachTypes> template <typename... ParamMachTypes>
RawMachineAssemblerTester(Code::Kind kind, ParamMachTypes... p) RawMachineAssemblerTester(CodeKind kind, ParamMachTypes... p)
: HandleAndZoneScope(kCompressGraphZone), : HandleAndZoneScope(kCompressGraphZone),
CallHelper<ReturnType>( CallHelper<ReturnType>(
main_isolate(), main_isolate(),
@ -91,7 +91,7 @@ class RawMachineAssemblerTester : public HandleAndZoneScope,
} }
private: private:
Code::Kind kind_ = Code::Kind::STUB; CodeKind kind_ = CodeKind::STUB;
MaybeHandle<Code> code_; MaybeHandle<Code> code_;
}; };

View File

@ -145,15 +145,13 @@ Handle<JSFunction> FunctionTester::Compile(Handle<JSFunction> function) {
return Optimize(function, &zone, isolate, flags_); return Optimize(function, &zone, isolate, flags_);
} }
static constexpr bool kNativeContextDependent = false;
// Compile the given machine graph instead of the source of the function // Compile the given machine graph instead of the source of the function
// and replace the JSFunction's code with the result. // and replace the JSFunction's code with the result.
Handle<JSFunction> FunctionTester::CompileGraph(Graph* graph) { Handle<JSFunction> FunctionTester::CompileGraph(Graph* graph) {
Handle<SharedFunctionInfo> shared(function->shared(), isolate); Handle<SharedFunctionInfo> shared(function->shared(), isolate);
Zone zone(isolate->allocator(), ZONE_NAME); Zone zone(isolate->allocator(), ZONE_NAME);
OptimizedCompilationInfo info(&zone, isolate, shared, function, OptimizedCompilationInfo info(&zone, isolate, shared, function,
kNativeContextDependent); CodeKind::OPTIMIZED_FUNCTION);
auto call_descriptor = Linkage::ComputeIncoming(&zone, &info); auto call_descriptor = Linkage::ComputeIncoming(&zone, &info);
Handle<Code> code = Handle<Code> code =

View File

@ -77,7 +77,7 @@ Handle<Code> BuildTeardownFunction(Isolate* isolate,
Handle<Code> BuildSetupFunction(Isolate* isolate, Handle<Code> BuildSetupFunction(Isolate* isolate,
CallDescriptor* call_descriptor, CallDescriptor* call_descriptor,
std::vector<AllocatedOperand> parameters) { std::vector<AllocatedOperand> parameters) {
CodeAssemblerTester tester(isolate, 3, Code::BUILTIN, CodeAssemblerTester tester(isolate, 3, CodeKind::BUILTIN,
"setup"); // Include receiver. "setup"); // Include receiver.
CodeStubAssembler assembler(tester.state()); CodeStubAssembler assembler(tester.state());
std::vector<Node*> params; std::vector<Node*> params;
@ -964,10 +964,10 @@ class CodeGeneratorTester {
explicit CodeGeneratorTester(TestEnvironment* environment, explicit CodeGeneratorTester(TestEnvironment* environment,
int extra_stack_space = 0) int extra_stack_space = 0)
: zone_(environment->main_zone()), : zone_(environment->main_zone()),
info_(ArrayVector("test"), environment->main_zone(), Code::STUB), info_(ArrayVector("test"), environment->main_zone(), CodeKind::STUB),
linkage_(environment->test_descriptor()), linkage_(environment->test_descriptor()),
frame_(environment->test_descriptor()->CalculateFixedFrameSize( frame_(environment->test_descriptor()->CalculateFixedFrameSize(
Code::STUB)) { CodeKind::STUB)) {
// Pick half of the stack parameters at random and move them into spill // Pick half of the stack parameters at random and move them into spill
// slots, separated by `extra_stack_space` bytes. // slots, separated by `extra_stack_space` bytes.
// When testing a move with stack slots using CheckAssembleMove or // When testing a move with stack slots using CheckAssembleMove or

View File

@ -26,8 +26,6 @@ namespace compiler {
static Operator dummy_operator(IrOpcode::kParameter, Operator::kNoWrite, static Operator dummy_operator(IrOpcode::kParameter, Operator::kNoWrite,
"dummy", 0, 0, 0, 0, 0, 0); "dummy", 0, 0, 0, 0, 0, 0);
static constexpr bool kNativeContextDependent = false;
// So we can get a real JS function. // So we can get a real JS function.
static Handle<JSFunction> Compile(const char* source) { static Handle<JSFunction> Compile(const char* source) {
Isolate* isolate = CcTest::i_isolate(); Isolate* isolate = CcTest::i_isolate();
@ -51,7 +49,7 @@ TEST(TestLinkageCreate) {
Handle<JSFunction> function = Compile("a + b"); Handle<JSFunction> function = Compile("a + b");
Handle<SharedFunctionInfo> shared(function->shared(), handles.main_isolate()); Handle<SharedFunctionInfo> shared(function->shared(), handles.main_isolate());
OptimizedCompilationInfo info(handles.main_zone(), function->GetIsolate(), OptimizedCompilationInfo info(handles.main_zone(), function->GetIsolate(),
shared, function, kNativeContextDependent); shared, function, CodeKind::OPTIMIZED_FUNCTION);
auto call_descriptor = Linkage::ComputeIncoming(info.zone(), &info); auto call_descriptor = Linkage::ComputeIncoming(info.zone(), &info);
CHECK(call_descriptor); CHECK(call_descriptor);
} }
@ -69,7 +67,8 @@ TEST(TestLinkageJSFunctionIncoming) {
Handle<SharedFunctionInfo> shared(function->shared(), Handle<SharedFunctionInfo> shared(function->shared(),
handles.main_isolate()); handles.main_isolate());
OptimizedCompilationInfo info(handles.main_zone(), function->GetIsolate(), OptimizedCompilationInfo info(handles.main_zone(), function->GetIsolate(),
shared, function, kNativeContextDependent); shared, function,
CodeKind::OPTIMIZED_FUNCTION);
auto call_descriptor = Linkage::ComputeIncoming(info.zone(), &info); auto call_descriptor = Linkage::ComputeIncoming(info.zone(), &info);
CHECK(call_descriptor); CHECK(call_descriptor);
@ -86,7 +85,7 @@ TEST(TestLinkageJSCall) {
Handle<JSFunction> function = Compile("a + c"); Handle<JSFunction> function = Compile("a + c");
Handle<SharedFunctionInfo> shared(function->shared(), handles.main_isolate()); Handle<SharedFunctionInfo> shared(function->shared(), handles.main_isolate());
OptimizedCompilationInfo info(handles.main_zone(), function->GetIsolate(), OptimizedCompilationInfo info(handles.main_zone(), function->GetIsolate(),
shared, function, kNativeContextDependent); shared, function, CodeKind::OPTIMIZED_FUNCTION);
for (int i = 0; i < 32; i++) { for (int i = 0; i < 32; i++) {
auto call_descriptor = Linkage::GetJSCallDescriptor( auto call_descriptor = Linkage::GetJSCallDescriptor(
@ -110,7 +109,7 @@ TEST(TestLinkageStubCall) {
Isolate* isolate = CcTest::InitIsolateOnce(); Isolate* isolate = CcTest::InitIsolateOnce();
Zone zone(isolate->allocator(), ZONE_NAME); Zone zone(isolate->allocator(), ZONE_NAME);
Callable callable = Builtins::CallableFor(isolate, Builtins::kToNumber); Callable callable = Builtins::CallableFor(isolate, Builtins::kToNumber);
OptimizedCompilationInfo info(ArrayVector("test"), &zone, Code::STUB); OptimizedCompilationInfo info(ArrayVector("test"), &zone, CodeKind::STUB);
auto call_descriptor = Linkage::GetStubCallDescriptor( auto call_descriptor = Linkage::GetStubCallDescriptor(
&zone, callable.descriptor(), 0, CallDescriptor::kNoFlags, &zone, callable.descriptor(), 0, CallDescriptor::kNoFlags,
Operator::kNoProperties); Operator::kNoProperties);
@ -130,7 +129,7 @@ TEST(TestFPLinkageStubCall) {
Zone zone(isolate->allocator(), ZONE_NAME); Zone zone(isolate->allocator(), ZONE_NAME);
Callable callable = Callable callable =
Builtins::CallableFor(isolate, Builtins::kWasmFloat64ToNumber); Builtins::CallableFor(isolate, Builtins::kWasmFloat64ToNumber);
OptimizedCompilationInfo info(ArrayVector("test"), &zone, Code::STUB); OptimizedCompilationInfo info(ArrayVector("test"), &zone, CodeKind::STUB);
auto call_descriptor = Linkage::GetStubCallDescriptor( auto call_descriptor = Linkage::GetStubCallDescriptor(
&zone, callable.descriptor(), 0, CallDescriptor::kNoFlags, &zone, callable.descriptor(), 0, CallDescriptor::kNoFlags,
Operator::kNoProperties); Operator::kNoProperties);

View File

@ -163,7 +163,7 @@ void TestReturnMultipleValues(MachineType type) {
m.Return(count, returns.get()); m.Return(count, returns.get());
OptimizedCompilationInfo info(ArrayVector("testing"), handles.main_zone(), OptimizedCompilationInfo info(ArrayVector("testing"), handles.main_zone(),
Code::WASM_FUNCTION); CodeKind::WASM_FUNCTION);
Handle<Code> code = Pipeline::GenerateCodeForTesting( Handle<Code> code = Pipeline::GenerateCodeForTesting(
&info, handles.main_isolate(), desc, m.graph(), &info, handles.main_isolate(), desc, m.graph(),
AssemblerOptions::Default(handles.main_isolate()), AssemblerOptions::Default(handles.main_isolate()),
@ -191,7 +191,7 @@ void TestReturnMultipleValues(MachineType type) {
byte* code_start = byte* code_start =
module->AddCodeForTesting(code)->instructions().begin(); module->AddCodeForTesting(code)->instructions().begin();
RawMachineAssemblerTester<int32_t> mt(Code::Kind::JS_TO_WASM_FUNCTION); RawMachineAssemblerTester<int32_t> mt(CodeKind::JS_TO_WASM_FUNCTION);
const int input_count = 2 + param_count; const int input_count = 2 + param_count;
Node* call_inputs[2 + kMaxParamCount]; Node* call_inputs[2 + kMaxParamCount];
call_inputs[0] = mt.PointerConstant(code_start); call_inputs[0] = mt.PointerConstant(code_start);
@ -268,7 +268,7 @@ void ReturnLastValue(MachineType type) {
m.Return(return_count, returns.get()); m.Return(return_count, returns.get());
OptimizedCompilationInfo info(ArrayVector("testing"), handles.main_zone(), OptimizedCompilationInfo info(ArrayVector("testing"), handles.main_zone(),
Code::WASM_FUNCTION); CodeKind::WASM_FUNCTION);
Handle<Code> code = Pipeline::GenerateCodeForTesting( Handle<Code> code = Pipeline::GenerateCodeForTesting(
&info, handles.main_isolate(), desc, m.graph(), &info, handles.main_isolate(), desc, m.graph(),
AssemblerOptions::Default(handles.main_isolate()), AssemblerOptions::Default(handles.main_isolate()),
@ -331,7 +331,7 @@ void ReturnSumOfReturns(MachineType type) {
m.Return(return_count, returns.get()); m.Return(return_count, returns.get());
OptimizedCompilationInfo info(ArrayVector("testing"), handles.main_zone(), OptimizedCompilationInfo info(ArrayVector("testing"), handles.main_zone(),
Code::WASM_FUNCTION); CodeKind::WASM_FUNCTION);
Handle<Code> code = Pipeline::GenerateCodeForTesting( Handle<Code> code = Pipeline::GenerateCodeForTesting(
&info, handles.main_isolate(), desc, m.graph(), &info, handles.main_isolate(), desc, m.graph(),
AssemblerOptions::Default(handles.main_isolate()), AssemblerOptions::Default(handles.main_isolate()),

View File

@ -71,8 +71,6 @@ class BytecodeGraphCallable {
Handle<JSFunction> function_; Handle<JSFunction> function_;
}; };
static constexpr bool kNativeContextDependent = false;
class BytecodeGraphTester { class BytecodeGraphTester {
public: public:
BytecodeGraphTester(Isolate* isolate, const char* script, BytecodeGraphTester(Isolate* isolate, const char* script,
@ -125,7 +123,7 @@ class BytecodeGraphTester {
Zone zone(isolate_->allocator(), ZONE_NAME); Zone zone(isolate_->allocator(), ZONE_NAME);
Handle<SharedFunctionInfo> shared(function->shared(), isolate_); Handle<SharedFunctionInfo> shared(function->shared(), isolate_);
OptimizedCompilationInfo compilation_info(&zone, isolate_, shared, function, OptimizedCompilationInfo compilation_info(&zone, isolate_, shared, function,
kNativeContextDependent); CodeKind::OPTIMIZED_FUNCTION);
// Compiler relies on canonicalized handles, let's create // Compiler relies on canonicalized handles, let's create
// a canonicalized scope and migrate existing handles there. // a canonicalized scope and migrate existing handles there.

View File

@ -246,7 +246,7 @@ Handle<Code> CompileGraph(const char* name, CallDescriptor* call_descriptor,
Graph* graph, Schedule* schedule = nullptr) { Graph* graph, Schedule* schedule = nullptr) {
Isolate* isolate = CcTest::InitIsolateOnce(); Isolate* isolate = CcTest::InitIsolateOnce();
OptimizedCompilationInfo info(ArrayVector("testing"), graph->zone(), OptimizedCompilationInfo info(ArrayVector("testing"), graph->zone(),
Code::STUB); CodeKind::STUB);
Handle<Code> code = Pipeline::GenerateCodeForTesting( Handle<Code> code = Pipeline::GenerateCodeForTesting(
&info, isolate, call_descriptor, graph, &info, isolate, call_descriptor, graph,
AssemblerOptions::Default(isolate), schedule) AssemblerOptions::Default(isolate), schedule)

View File

@ -206,7 +206,8 @@ HEAP_TEST(TestNewSpaceRefsInCopiedCode) {
CodeDesc desc; CodeDesc desc;
masm.GetCode(isolate, &desc); masm.GetCode(isolate, &desc);
Handle<Code> code = Factory::CodeBuilder(isolate, desc, Code::STUB).Build(); Handle<Code> code =
Factory::CodeBuilder(isolate, desc, CodeKind::STUB).Build();
Handle<Code> copy; Handle<Code> copy;
{ {
@ -229,7 +230,8 @@ static void CheckFindCodeObject(Isolate* isolate) {
CodeDesc desc; CodeDesc desc;
assm.GetCode(isolate, &desc); assm.GetCode(isolate, &desc);
Handle<Code> code = Factory::CodeBuilder(isolate, desc, Code::STUB).Build(); Handle<Code> code =
Factory::CodeBuilder(isolate, desc, CodeKind::STUB).Build();
CHECK(code->IsCode()); CHECK(code->IsCode());
HeapObject obj = HeapObject::cast(*code); HeapObject obj = HeapObject::cast(*code);
@ -240,7 +242,8 @@ static void CheckFindCodeObject(Isolate* isolate) {
CHECK_EQ(*code, found); CHECK_EQ(*code, found);
} }
Handle<Code> copy = Factory::CodeBuilder(isolate, desc, Code::STUB).Build(); Handle<Code> copy =
Factory::CodeBuilder(isolate, desc, CodeKind::STUB).Build();
HeapObject obj_copy = HeapObject::cast(*copy); HeapObject obj_copy = HeapObject::cast(*copy);
Object not_right = Object not_right =
isolate->FindCodeObject(obj_copy.address() + obj_copy.Size() / 2); isolate->FindCodeObject(obj_copy.address() + obj_copy.Size() / 2);
@ -4442,7 +4445,7 @@ static Handle<Code> DummyOptimizedCode(Isolate* isolate) {
masm.Drop(2); masm.Drop(2);
masm.GetCode(isolate, &desc); masm.GetCode(isolate, &desc);
Handle<Code> code = Handle<Code> code =
Factory::CodeBuilder(isolate, desc, Code::OPTIMIZED_FUNCTION) Factory::CodeBuilder(isolate, desc, CodeKind::OPTIMIZED_FUNCTION)
.set_self_reference(masm.CodeObject()) .set_self_reference(masm.CodeObject())
.Build(); .Build();
CHECK(code->IsCode()); CHECK(code->IsCode());
@ -6464,8 +6467,9 @@ Handle<Code> GenerateDummyImmovableCode(Isolate* isolate) {
CodeDesc desc; CodeDesc desc;
assm.GetCode(isolate, &desc); assm.GetCode(isolate, &desc);
Handle<Code> code = Handle<Code> code = Factory::CodeBuilder(isolate, desc, CodeKind::STUB)
Factory::CodeBuilder(isolate, desc, Code::STUB).set_immovable().Build(); .set_immovable()
.Build();
CHECK(code->IsCode()); CHECK(code->IsCode());
return code; return code;

View File

@ -50,7 +50,8 @@ TEST(WeakReferencesBasic) {
assm.nop(); // supported on all architectures assm.nop(); // supported on all architectures
CodeDesc desc; CodeDesc desc;
assm.GetCode(isolate, &desc); assm.GetCode(isolate, &desc);
Handle<Code> code = Factory::CodeBuilder(isolate, desc, Code::STUB).Build(); Handle<Code> code =
Factory::CodeBuilder(isolate, desc, CodeKind::STUB).Build();
CHECK(code->IsCode()); CHECK(code->IsCode());
lh->set_data1(HeapObjectReference::Weak(*code)); lh->set_data1(HeapObjectReference::Weak(*code));

View File

@ -107,7 +107,7 @@ TEST(StubCacheSecondaryOffset) {
namespace { namespace {
Handle<Code> CreateCodeOfKind(Code::Kind kind) { Handle<Code> CreateCodeOfKind(CodeKind kind) {
Isolate* isolate(CcTest::InitIsolateOnce()); Isolate* isolate(CcTest::InitIsolateOnce());
CodeAssemblerTester data(isolate, kind); CodeAssemblerTester data(isolate, kind);
CodeStubAssembler m(data.state()); CodeStubAssembler m(data.state());
@ -204,7 +204,7 @@ TEST(TryProbeStubCache) {
// Generate some number of handlers. // Generate some number of handlers.
for (int i = 0; i < 30; i++) { for (int i = 0; i < 30; i++) {
handlers.push_back(CreateCodeOfKind(Code::STUB)); handlers.push_back(CreateCodeOfKind(CodeKind::STUB));
} }
// Ensure that GC does happen because from now on we are going to fill our // Ensure that GC does happen because from now on we are going to fill our

View File

@ -60,7 +60,8 @@ TEST(0) {
CodeDesc desc; CodeDesc desc;
assm.GetCode(isolate, &desc); assm.GetCode(isolate, &desc);
Handle<Code> code = Factory::CodeBuilder(isolate, desc, Code::STUB).Build(); Handle<Code> code =
Factory::CodeBuilder(isolate, desc, CodeKind::STUB).Build();
#ifdef DEBUG #ifdef DEBUG
StdoutStream os; StdoutStream os;
code->Print(os); code->Print(os);
@ -95,7 +96,8 @@ TEST(1) {
CodeDesc desc; CodeDesc desc;
assm.GetCode(isolate, &desc); assm.GetCode(isolate, &desc);
Handle<Code> code = Factory::CodeBuilder(isolate, desc, Code::STUB).Build(); Handle<Code> code =
Factory::CodeBuilder(isolate, desc, CodeKind::STUB).Build();
#ifdef DEBUG #ifdef DEBUG
StdoutStream os; StdoutStream os;
code->Print(os); code->Print(os);
@ -139,7 +141,8 @@ TEST(2) {
CodeDesc desc; CodeDesc desc;
assm.GetCode(isolate, &desc); assm.GetCode(isolate, &desc);
Handle<Code> code = Factory::CodeBuilder(isolate, desc, Code::STUB).Build(); Handle<Code> code =
Factory::CodeBuilder(isolate, desc, CodeKind::STUB).Build();
#ifdef DEBUG #ifdef DEBUG
StdoutStream os; StdoutStream os;
code->Print(os); code->Print(os);
@ -184,7 +187,8 @@ TEST(3) {
CodeDesc desc; CodeDesc desc;
assm.GetCode(isolate, &desc); assm.GetCode(isolate, &desc);
Handle<Code> code = Factory::CodeBuilder(isolate, desc, Code::STUB).Build(); Handle<Code> code =
Factory::CodeBuilder(isolate, desc, CodeKind::STUB).Build();
#ifdef DEBUG #ifdef DEBUG
StdoutStream os; StdoutStream os;
code->Print(os); code->Print(os);
@ -313,7 +317,8 @@ TEST(4) {
CodeDesc desc; CodeDesc desc;
assm.GetCode(isolate, &desc); assm.GetCode(isolate, &desc);
Handle<Code> code = Factory::CodeBuilder(isolate, desc, Code::STUB).Build(); Handle<Code> code =
Factory::CodeBuilder(isolate, desc, CodeKind::STUB).Build();
#ifdef DEBUG #ifdef DEBUG
StdoutStream os; StdoutStream os;
code->Print(os); code->Print(os);
@ -374,7 +379,8 @@ TEST(5) {
CodeDesc desc; CodeDesc desc;
assm.GetCode(isolate, &desc); assm.GetCode(isolate, &desc);
Handle<Code> code = Factory::CodeBuilder(isolate, desc, Code::STUB).Build(); Handle<Code> code =
Factory::CodeBuilder(isolate, desc, CodeKind::STUB).Build();
#ifdef DEBUG #ifdef DEBUG
StdoutStream os; StdoutStream os;
code->Print(os); code->Print(os);
@ -404,7 +410,8 @@ TEST(6) {
CodeDesc desc; CodeDesc desc;
assm.GetCode(isolate, &desc); assm.GetCode(isolate, &desc);
Handle<Code> code = Factory::CodeBuilder(isolate, desc, Code::STUB).Build(); Handle<Code> code =
Factory::CodeBuilder(isolate, desc, CodeKind::STUB).Build();
#ifdef DEBUG #ifdef DEBUG
StdoutStream os; StdoutStream os;
code->Print(os); code->Print(os);
@ -470,7 +477,8 @@ static void TestRoundingMode(VCVTTypes types,
CodeDesc desc; CodeDesc desc;
assm.GetCode(isolate, &desc); assm.GetCode(isolate, &desc);
Handle<Code> code = Factory::CodeBuilder(isolate, desc, Code::STUB).Build(); Handle<Code> code =
Factory::CodeBuilder(isolate, desc, CodeKind::STUB).Build();
#ifdef DEBUG #ifdef DEBUG
StdoutStream os; StdoutStream os;
code->Print(os); code->Print(os);
@ -651,7 +659,8 @@ TEST(8) {
CodeDesc desc; CodeDesc desc;
assm.GetCode(isolate, &desc); assm.GetCode(isolate, &desc);
Handle<Code> code = Factory::CodeBuilder(isolate, desc, Code::STUB).Build(); Handle<Code> code =
Factory::CodeBuilder(isolate, desc, CodeKind::STUB).Build();
#ifdef DEBUG #ifdef DEBUG
StdoutStream os; StdoutStream os;
code->Print(os); code->Print(os);
@ -759,7 +768,8 @@ TEST(9) {
CodeDesc desc; CodeDesc desc;
assm.GetCode(isolate, &desc); assm.GetCode(isolate, &desc);
Handle<Code> code = Factory::CodeBuilder(isolate, desc, Code::STUB).Build(); Handle<Code> code =
Factory::CodeBuilder(isolate, desc, CodeKind::STUB).Build();
#ifdef DEBUG #ifdef DEBUG
StdoutStream os; StdoutStream os;
code->Print(os); code->Print(os);
@ -863,7 +873,8 @@ TEST(10) {
CodeDesc desc; CodeDesc desc;
assm.GetCode(isolate, &desc); assm.GetCode(isolate, &desc);
Handle<Code> code = Factory::CodeBuilder(isolate, desc, Code::STUB).Build(); Handle<Code> code =
Factory::CodeBuilder(isolate, desc, CodeKind::STUB).Build();
#ifdef DEBUG #ifdef DEBUG
StdoutStream os; StdoutStream os;
code->Print(os); code->Print(os);
@ -956,7 +967,8 @@ TEST(11) {
CodeDesc desc; CodeDesc desc;
assm.GetCode(isolate, &desc); assm.GetCode(isolate, &desc);
Handle<Code> code = Factory::CodeBuilder(isolate, desc, Code::STUB).Build(); Handle<Code> code =
Factory::CodeBuilder(isolate, desc, CodeKind::STUB).Build();
#ifdef DEBUG #ifdef DEBUG
StdoutStream os; StdoutStream os;
code->Print(os); code->Print(os);
@ -1080,7 +1092,8 @@ TEST(13) {
CodeDesc desc; CodeDesc desc;
assm.GetCode(isolate, &desc); assm.GetCode(isolate, &desc);
Handle<Code> code = Factory::CodeBuilder(isolate, desc, Code::STUB).Build(); Handle<Code> code =
Factory::CodeBuilder(isolate, desc, CodeKind::STUB).Build();
#ifdef DEBUG #ifdef DEBUG
StdoutStream os; StdoutStream os;
code->Print(os); code->Print(os);
@ -1151,7 +1164,8 @@ TEST(14) {
CodeDesc desc; CodeDesc desc;
assm.GetCode(isolate, &desc); assm.GetCode(isolate, &desc);
Handle<Code> code = Factory::CodeBuilder(isolate, desc, Code::STUB).Build(); Handle<Code> code =
Factory::CodeBuilder(isolate, desc, CodeKind::STUB).Build();
#ifdef DEBUG #ifdef DEBUG
StdoutStream os; StdoutStream os;
code->Print(os); code->Print(os);
@ -2030,7 +2044,8 @@ TEST(15) {
CodeDesc desc; CodeDesc desc;
assm.GetCode(isolate, &desc); assm.GetCode(isolate, &desc);
Handle<Code> code = Factory::CodeBuilder(isolate, desc, Code::STUB).Build(); Handle<Code> code =
Factory::CodeBuilder(isolate, desc, CodeKind::STUB).Build();
#ifdef DEBUG #ifdef DEBUG
StdoutStream os; StdoutStream os;
code->Print(os); code->Print(os);
@ -2305,7 +2320,8 @@ TEST(16) {
CodeDesc desc; CodeDesc desc;
assm.GetCode(isolate, &desc); assm.GetCode(isolate, &desc);
Handle<Code> code = Factory::CodeBuilder(isolate, desc, Code::STUB).Build(); Handle<Code> code =
Factory::CodeBuilder(isolate, desc, CodeKind::STUB).Build();
#ifdef DEBUG #ifdef DEBUG
StdoutStream os; StdoutStream os;
code->Print(os); code->Print(os);
@ -2382,7 +2398,8 @@ TEST(sdiv) {
CodeDesc desc; CodeDesc desc;
assm.GetCode(isolate, &desc); assm.GetCode(isolate, &desc);
Handle<Code> code = Factory::CodeBuilder(isolate, desc, Code::STUB).Build(); Handle<Code> code =
Factory::CodeBuilder(isolate, desc, CodeKind::STUB).Build();
#ifdef DEBUG #ifdef DEBUG
StdoutStream os; StdoutStream os;
code->Print(os); code->Print(os);
@ -2441,7 +2458,8 @@ TEST(udiv) {
CodeDesc desc; CodeDesc desc;
assm.GetCode(isolate, &desc); assm.GetCode(isolate, &desc);
Handle<Code> code = Factory::CodeBuilder(isolate, desc, Code::STUB).Build(); Handle<Code> code =
Factory::CodeBuilder(isolate, desc, CodeKind::STUB).Build();
#ifdef DEBUG #ifdef DEBUG
StdoutStream os; StdoutStream os;
code->Print(os); code->Print(os);
@ -2469,7 +2487,8 @@ TEST(smmla) {
__ bx(lr); __ bx(lr);
CodeDesc desc; CodeDesc desc;
assm.GetCode(isolate, &desc); assm.GetCode(isolate, &desc);
Handle<Code> code = Factory::CodeBuilder(isolate, desc, Code::STUB).Build(); Handle<Code> code =
Factory::CodeBuilder(isolate, desc, CodeKind::STUB).Build();
#ifdef OBJECT_PRINT #ifdef OBJECT_PRINT
code->Print(std::cout); code->Print(std::cout);
#endif #endif
@ -2493,7 +2512,8 @@ TEST(smmul) {
__ bx(lr); __ bx(lr);
CodeDesc desc; CodeDesc desc;
assm.GetCode(isolate, &desc); assm.GetCode(isolate, &desc);
Handle<Code> code = Factory::CodeBuilder(isolate, desc, Code::STUB).Build(); Handle<Code> code =
Factory::CodeBuilder(isolate, desc, CodeKind::STUB).Build();
#ifdef OBJECT_PRINT #ifdef OBJECT_PRINT
code->Print(std::cout); code->Print(std::cout);
#endif #endif
@ -2517,7 +2537,8 @@ TEST(sxtb) {
__ bx(lr); __ bx(lr);
CodeDesc desc; CodeDesc desc;
assm.GetCode(isolate, &desc); assm.GetCode(isolate, &desc);
Handle<Code> code = Factory::CodeBuilder(isolate, desc, Code::STUB).Build(); Handle<Code> code =
Factory::CodeBuilder(isolate, desc, CodeKind::STUB).Build();
#ifdef OBJECT_PRINT #ifdef OBJECT_PRINT
code->Print(std::cout); code->Print(std::cout);
#endif #endif
@ -2541,7 +2562,8 @@ TEST(sxtab) {
__ bx(lr); __ bx(lr);
CodeDesc desc; CodeDesc desc;
assm.GetCode(isolate, &desc); assm.GetCode(isolate, &desc);
Handle<Code> code = Factory::CodeBuilder(isolate, desc, Code::STUB).Build(); Handle<Code> code =
Factory::CodeBuilder(isolate, desc, CodeKind::STUB).Build();
#ifdef OBJECT_PRINT #ifdef OBJECT_PRINT
code->Print(std::cout); code->Print(std::cout);
#endif #endif
@ -2565,7 +2587,8 @@ TEST(sxth) {
__ bx(lr); __ bx(lr);
CodeDesc desc; CodeDesc desc;
assm.GetCode(isolate, &desc); assm.GetCode(isolate, &desc);
Handle<Code> code = Factory::CodeBuilder(isolate, desc, Code::STUB).Build(); Handle<Code> code =
Factory::CodeBuilder(isolate, desc, CodeKind::STUB).Build();
#ifdef OBJECT_PRINT #ifdef OBJECT_PRINT
code->Print(std::cout); code->Print(std::cout);
#endif #endif
@ -2589,7 +2612,8 @@ TEST(sxtah) {
__ bx(lr); __ bx(lr);
CodeDesc desc; CodeDesc desc;
assm.GetCode(isolate, &desc); assm.GetCode(isolate, &desc);
Handle<Code> code = Factory::CodeBuilder(isolate, desc, Code::STUB).Build(); Handle<Code> code =
Factory::CodeBuilder(isolate, desc, CodeKind::STUB).Build();
#ifdef OBJECT_PRINT #ifdef OBJECT_PRINT
code->Print(std::cout); code->Print(std::cout);
#endif #endif
@ -2613,7 +2637,8 @@ TEST(uxtb) {
__ bx(lr); __ bx(lr);
CodeDesc desc; CodeDesc desc;
assm.GetCode(isolate, &desc); assm.GetCode(isolate, &desc);
Handle<Code> code = Factory::CodeBuilder(isolate, desc, Code::STUB).Build(); Handle<Code> code =
Factory::CodeBuilder(isolate, desc, CodeKind::STUB).Build();
#ifdef OBJECT_PRINT #ifdef OBJECT_PRINT
code->Print(std::cout); code->Print(std::cout);
#endif #endif
@ -2637,7 +2662,8 @@ TEST(uxtab) {
__ bx(lr); __ bx(lr);
CodeDesc desc; CodeDesc desc;
assm.GetCode(isolate, &desc); assm.GetCode(isolate, &desc);
Handle<Code> code = Factory::CodeBuilder(isolate, desc, Code::STUB).Build(); Handle<Code> code =
Factory::CodeBuilder(isolate, desc, CodeKind::STUB).Build();
#ifdef OBJECT_PRINT #ifdef OBJECT_PRINT
code->Print(std::cout); code->Print(std::cout);
#endif #endif
@ -2661,7 +2687,8 @@ TEST(uxth) {
__ bx(lr); __ bx(lr);
CodeDesc desc; CodeDesc desc;
assm.GetCode(isolate, &desc); assm.GetCode(isolate, &desc);
Handle<Code> code = Factory::CodeBuilder(isolate, desc, Code::STUB).Build(); Handle<Code> code =
Factory::CodeBuilder(isolate, desc, CodeKind::STUB).Build();
#ifdef OBJECT_PRINT #ifdef OBJECT_PRINT
code->Print(std::cout); code->Print(std::cout);
#endif #endif
@ -2685,7 +2712,8 @@ TEST(uxtah) {
__ bx(lr); __ bx(lr);
CodeDesc desc; CodeDesc desc;
assm.GetCode(isolate, &desc); assm.GetCode(isolate, &desc);
Handle<Code> code = Factory::CodeBuilder(isolate, desc, Code::STUB).Build(); Handle<Code> code =
Factory::CodeBuilder(isolate, desc, CodeKind::STUB).Build();
#ifdef OBJECT_PRINT #ifdef OBJECT_PRINT
code->Print(std::cout); code->Print(std::cout);
#endif #endif
@ -2725,7 +2753,8 @@ TEST(rbit) {
CodeDesc desc; CodeDesc desc;
assm.GetCode(isolate, &desc); assm.GetCode(isolate, &desc);
Handle<Code> code = Factory::CodeBuilder(isolate, desc, Code::STUB).Build(); Handle<Code> code =
Factory::CodeBuilder(isolate, desc, CodeKind::STUB).Build();
#ifdef OBJECT_PRINT #ifdef OBJECT_PRINT
code->Print(std::cout); code->Print(std::cout);
@ -2805,7 +2834,7 @@ TEST(code_relative_offset) {
CodeDesc desc; CodeDesc desc;
assm.GetCode(isolate, &desc); assm.GetCode(isolate, &desc);
Handle<Code> code = Factory::CodeBuilder(isolate, desc, Code::STUB) Handle<Code> code = Factory::CodeBuilder(isolate, desc, CodeKind::STUB)
.set_self_reference(code_object) .set_self_reference(code_object)
.Build(); .Build();
auto f = GeneratedCode<F_iiiii>::FromCode(*code); auto f = GeneratedCode<F_iiiii>::FromCode(*code);
@ -2845,7 +2874,8 @@ TEST(msr_mrs) {
CodeDesc desc; CodeDesc desc;
assm.GetCode(isolate, &desc); assm.GetCode(isolate, &desc);
Handle<Code> code = Factory::CodeBuilder(isolate, desc, Code::STUB).Build(); Handle<Code> code =
Factory::CodeBuilder(isolate, desc, CodeKind::STUB).Build();
#ifdef DEBUG #ifdef DEBUG
StdoutStream os; StdoutStream os;
code->Print(os); code->Print(os);
@ -2941,7 +2971,8 @@ TEST(ARMv8_float32_vrintX) {
CodeDesc desc; CodeDesc desc;
assm.GetCode(isolate, &desc); assm.GetCode(isolate, &desc);
Handle<Code> code = Factory::CodeBuilder(isolate, desc, Code::STUB).Build(); Handle<Code> code =
Factory::CodeBuilder(isolate, desc, CodeKind::STUB).Build();
#ifdef DEBUG #ifdef DEBUG
StdoutStream os; StdoutStream os;
code->Print(os); code->Print(os);
@ -3041,7 +3072,8 @@ TEST(ARMv8_vrintX) {
CodeDesc desc; CodeDesc desc;
assm.GetCode(isolate, &desc); assm.GetCode(isolate, &desc);
Handle<Code> code = Factory::CodeBuilder(isolate, desc, Code::STUB).Build(); Handle<Code> code =
Factory::CodeBuilder(isolate, desc, CodeKind::STUB).Build();
#ifdef DEBUG #ifdef DEBUG
StdoutStream os; StdoutStream os;
code->Print(os); code->Print(os);
@ -3177,7 +3209,8 @@ TEST(ARMv8_vsel) {
CodeDesc desc; CodeDesc desc;
assm.GetCode(isolate, &desc); assm.GetCode(isolate, &desc);
Handle<Code> code = Factory::CodeBuilder(isolate, desc, Code::STUB).Build(); Handle<Code> code =
Factory::CodeBuilder(isolate, desc, CodeKind::STUB).Build();
#ifdef DEBUG #ifdef DEBUG
StdoutStream os; StdoutStream os;
code->Print(os); code->Print(os);
@ -3267,7 +3300,8 @@ TEST(ARMv8_vminmax_f64) {
CodeDesc desc; CodeDesc desc;
assm.GetCode(isolate, &desc); assm.GetCode(isolate, &desc);
Handle<Code> code = Factory::CodeBuilder(isolate, desc, Code::STUB).Build(); Handle<Code> code =
Factory::CodeBuilder(isolate, desc, CodeKind::STUB).Build();
#ifdef DEBUG #ifdef DEBUG
StdoutStream os; StdoutStream os;
code->Print(os); code->Print(os);
@ -3346,7 +3380,8 @@ TEST(ARMv8_vminmax_f32) {
CodeDesc desc; CodeDesc desc;
assm.GetCode(isolate, &desc); assm.GetCode(isolate, &desc);
Handle<Code> code = Factory::CodeBuilder(isolate, desc, Code::STUB).Build(); Handle<Code> code =
Factory::CodeBuilder(isolate, desc, CodeKind::STUB).Build();
#ifdef DEBUG #ifdef DEBUG
StdoutStream os; StdoutStream os;
code->Print(os); code->Print(os);
@ -3479,7 +3514,7 @@ static GeneratedCode<F_ppiii> GenerateMacroFloatMinMax(
CodeDesc desc; CodeDesc desc;
assm.GetCode(assm.isolate(), &desc); assm.GetCode(assm.isolate(), &desc);
Handle<Code> code = Handle<Code> code =
Factory::CodeBuilder(assm.isolate(), desc, Code::STUB).Build(); Factory::CodeBuilder(assm.isolate(), desc, CodeKind::STUB).Build();
#ifdef DEBUG #ifdef DEBUG
StdoutStream os; StdoutStream os;
code->Print(os); code->Print(os);
@ -3641,7 +3676,8 @@ TEST(unaligned_loads) {
CodeDesc desc; CodeDesc desc;
assm.GetCode(isolate, &desc); assm.GetCode(isolate, &desc);
Handle<Code> code = Factory::CodeBuilder(isolate, desc, Code::STUB).Build(); Handle<Code> code =
Factory::CodeBuilder(isolate, desc, CodeKind::STUB).Build();
#ifdef DEBUG #ifdef DEBUG
StdoutStream os; StdoutStream os;
code->Print(os); code->Print(os);
@ -3683,7 +3719,8 @@ TEST(unaligned_stores) {
CodeDesc desc; CodeDesc desc;
assm.GetCode(isolate, &desc); assm.GetCode(isolate, &desc);
Handle<Code> code = Factory::CodeBuilder(isolate, desc, Code::STUB).Build(); Handle<Code> code =
Factory::CodeBuilder(isolate, desc, CodeKind::STUB).Build();
#ifdef DEBUG #ifdef DEBUG
StdoutStream os; StdoutStream os;
code->Print(os); code->Print(os);
@ -3782,7 +3819,8 @@ TEST(vswp) {
CodeDesc desc; CodeDesc desc;
assm.GetCode(isolate, &desc); assm.GetCode(isolate, &desc);
Handle<Code> code = Factory::CodeBuilder(isolate, desc, Code::STUB).Build(); Handle<Code> code =
Factory::CodeBuilder(isolate, desc, CodeKind::STUB).Build();
#ifdef DEBUG #ifdef DEBUG
StdoutStream os; StdoutStream os;
code->Print(os); code->Print(os);
@ -3993,7 +4031,8 @@ TEST(split_add_immediate) {
CodeDesc desc; CodeDesc desc;
assm.GetCode(isolate, &desc); assm.GetCode(isolate, &desc);
Handle<Code> code = Factory::CodeBuilder(isolate, desc, Code::STUB).Build(); Handle<Code> code =
Factory::CodeBuilder(isolate, desc, CodeKind::STUB).Build();
#ifdef DEBUG #ifdef DEBUG
StdoutStream os; StdoutStream os;
code->Print(os); code->Print(os);
@ -4012,7 +4051,8 @@ TEST(split_add_immediate) {
CodeDesc desc; CodeDesc desc;
assm.GetCode(isolate, &desc); assm.GetCode(isolate, &desc);
Handle<Code> code = Factory::CodeBuilder(isolate, desc, Code::STUB).Build(); Handle<Code> code =
Factory::CodeBuilder(isolate, desc, CodeKind::STUB).Build();
#ifdef DEBUG #ifdef DEBUG
StdoutStream os; StdoutStream os;
code->Print(os); code->Print(os);
@ -4034,7 +4074,8 @@ TEST(split_add_immediate) {
CodeDesc desc; CodeDesc desc;
assm.GetCode(isolate, &desc); assm.GetCode(isolate, &desc);
Handle<Code> code = Factory::CodeBuilder(isolate, desc, Code::STUB).Build(); Handle<Code> code =
Factory::CodeBuilder(isolate, desc, CodeKind::STUB).Build();
#ifdef DEBUG #ifdef DEBUG
StdoutStream os; StdoutStream os;
code->Print(os); code->Print(os);

View File

@ -158,16 +158,16 @@ static void InitializeVM() {
#define RUN() simulator.RunFrom(reinterpret_cast<Instruction*>(code->entry())) #define RUN() simulator.RunFrom(reinterpret_cast<Instruction*>(code->entry()))
#define END() \ #define END() \
__ Debug("End test.", __LINE__, TRACE_DISABLE | LOG_ALL); \ __ Debug("End test.", __LINE__, TRACE_DISABLE | LOG_ALL); \
core.Dump(&masm); \ core.Dump(&masm); \
__ PopCalleeSavedRegisters(); \ __ PopCalleeSavedRegisters(); \
__ Ret(); \ __ Ret(); \
{ \ { \
CodeDesc desc; \ CodeDesc desc; \
__ GetCode(masm.isolate(), &desc); \ __ GetCode(masm.isolate(), &desc); \
code = Factory::CodeBuilder(isolate, desc, Code::STUB).Build(); \ code = Factory::CodeBuilder(isolate, desc, CodeKind::STUB).Build(); \
if (FLAG_print_code) code->Print(); \ if (FLAG_print_code) code->Print(); \
} }
#else // ifdef USE_SIMULATOR. #else // ifdef USE_SIMULATOR.
@ -204,15 +204,15 @@ static void InitializeVM() {
f.Call(); \ f.Call(); \
} }
#define END() \ #define END() \
core.Dump(&masm); \ core.Dump(&masm); \
__ PopCalleeSavedRegisters(); \ __ PopCalleeSavedRegisters(); \
__ Ret(); \ __ Ret(); \
{ \ { \
CodeDesc desc; \ CodeDesc desc; \
__ GetCode(masm.isolate(), &desc); \ __ GetCode(masm.isolate(), &desc); \
code = Factory::CodeBuilder(isolate, desc, Code::STUB).Build(); \ code = Factory::CodeBuilder(isolate, desc, CodeKind::STUB).Build(); \
if (FLAG_print_code) code->Print(); \ if (FLAG_print_code) code->Print(); \
} }
#endif // ifdef USE_SIMULATOR. #endif // ifdef USE_SIMULATOR.
@ -14880,7 +14880,7 @@ TEST(pool_size) {
CodeDesc desc; CodeDesc desc;
masm.GetCode(isolate, &desc); masm.GetCode(isolate, &desc);
code = Factory::CodeBuilder(isolate, desc, Code::STUB) code = Factory::CodeBuilder(isolate, desc, CodeKind::STUB)
.set_self_reference(masm.CodeObject()) .set_self_reference(masm.CodeObject())
.Build(); .Build();

View File

@ -62,7 +62,8 @@ TEST(AssemblerIa320) {
CodeDesc desc; CodeDesc desc;
assm.GetCode(isolate, &desc); assm.GetCode(isolate, &desc);
Handle<Code> code = Factory::CodeBuilder(isolate, desc, Code::STUB).Build(); Handle<Code> code =
Factory::CodeBuilder(isolate, desc, CodeKind::STUB).Build();
#ifdef OBJECT_PRINT #ifdef OBJECT_PRINT
StdoutStream os; StdoutStream os;
code->Print(os); code->Print(os);
@ -99,7 +100,8 @@ TEST(AssemblerIa321) {
CodeDesc desc; CodeDesc desc;
assm.GetCode(isolate, &desc); assm.GetCode(isolate, &desc);
Handle<Code> code = Factory::CodeBuilder(isolate, desc, Code::STUB).Build(); Handle<Code> code =
Factory::CodeBuilder(isolate, desc, CodeKind::STUB).Build();
#ifdef OBJECT_PRINT #ifdef OBJECT_PRINT
StdoutStream os; StdoutStream os;
code->Print(os); code->Print(os);
@ -140,7 +142,8 @@ TEST(AssemblerIa322) {
CodeDesc desc; CodeDesc desc;
assm.GetCode(isolate, &desc); assm.GetCode(isolate, &desc);
Handle<Code> code = Factory::CodeBuilder(isolate, desc, Code::STUB).Build(); Handle<Code> code =
Factory::CodeBuilder(isolate, desc, CodeKind::STUB).Build();
#ifdef OBJECT_PRINT #ifdef OBJECT_PRINT
StdoutStream os; StdoutStream os;
code->Print(os); code->Print(os);
@ -168,7 +171,8 @@ TEST(AssemblerIa323) {
CodeDesc desc; CodeDesc desc;
assm.GetCode(isolate, &desc); assm.GetCode(isolate, &desc);
Handle<Code> code = Factory::CodeBuilder(isolate, desc, Code::STUB).Build(); Handle<Code> code =
Factory::CodeBuilder(isolate, desc, CodeKind::STUB).Build();
#ifdef OBJECT_PRINT #ifdef OBJECT_PRINT
StdoutStream os; StdoutStream os;
code->Print(os); code->Print(os);
@ -196,7 +200,8 @@ TEST(AssemblerIa324) {
CodeDesc desc; CodeDesc desc;
assm.GetCode(isolate, &desc); assm.GetCode(isolate, &desc);
Handle<Code> code = Factory::CodeBuilder(isolate, desc, Code::STUB).Build(); Handle<Code> code =
Factory::CodeBuilder(isolate, desc, CodeKind::STUB).Build();
#ifdef OBJECT_PRINT #ifdef OBJECT_PRINT
StdoutStream os; StdoutStream os;
code->Print(os); code->Print(os);
@ -223,7 +228,8 @@ TEST(AssemblerIa325) {
CodeDesc desc; CodeDesc desc;
assm.GetCode(isolate, &desc); assm.GetCode(isolate, &desc);
Handle<Code> code = Factory::CodeBuilder(isolate, desc, Code::STUB).Build(); Handle<Code> code =
Factory::CodeBuilder(isolate, desc, CodeKind::STUB).Build();
F0 f = FUNCTION_CAST<F0>(code->entry()); F0 f = FUNCTION_CAST<F0>(code->entry());
int res = f(); int res = f();
CHECK_EQ(42, res); CHECK_EQ(42, res);
@ -255,7 +261,8 @@ TEST(AssemblerIa326) {
CodeDesc desc; CodeDesc desc;
assm.GetCode(isolate, &desc); assm.GetCode(isolate, &desc);
Handle<Code> code = Factory::CodeBuilder(isolate, desc, Code::STUB).Build(); Handle<Code> code =
Factory::CodeBuilder(isolate, desc, CodeKind::STUB).Build();
#ifdef OBJECT_PRINT #ifdef OBJECT_PRINT
StdoutStream os; StdoutStream os;
code->Print(os); code->Print(os);
@ -286,7 +293,8 @@ TEST(AssemblerIa328) {
__ ret(0); __ ret(0);
CodeDesc desc; CodeDesc desc;
assm.GetCode(isolate, &desc); assm.GetCode(isolate, &desc);
Handle<Code> code = Factory::CodeBuilder(isolate, desc, Code::STUB).Build(); Handle<Code> code =
Factory::CodeBuilder(isolate, desc, CodeKind::STUB).Build();
#ifdef OBJECT_PRINT #ifdef OBJECT_PRINT
StdoutStream os; StdoutStream os;
code->Print(os); code->Print(os);
@ -368,7 +376,8 @@ TEST(AssemblerMultiByteNop) {
CodeDesc desc; CodeDesc desc;
assm.GetCode(isolate, &desc); assm.GetCode(isolate, &desc);
Handle<Code> code = Factory::CodeBuilder(isolate, desc, Code::STUB).Build(); Handle<Code> code =
Factory::CodeBuilder(isolate, desc, CodeKind::STUB).Build();
CHECK(code->IsCode()); CHECK(code->IsCode());
F0 f = FUNCTION_CAST<F0>(code->entry()); F0 f = FUNCTION_CAST<F0>(code->entry());
@ -418,7 +427,8 @@ void DoSSE2(const v8::FunctionCallbackInfo<v8::Value>& args) {
CodeDesc desc; CodeDesc desc;
assm.GetCode(isolate, &desc); assm.GetCode(isolate, &desc);
Handle<Code> code = Factory::CodeBuilder(isolate, desc, Code::STUB).Build(); Handle<Code> code =
Factory::CodeBuilder(isolate, desc, CodeKind::STUB).Build();
F0 f = FUNCTION_CAST<F0>(code->entry()); F0 f = FUNCTION_CAST<F0>(code->entry());
int res = f(); int res = f();
@ -482,7 +492,8 @@ TEST(AssemblerIa32Extractps) {
CodeDesc desc; CodeDesc desc;
assm.GetCode(isolate, &desc); assm.GetCode(isolate, &desc);
Handle<Code> code = Factory::CodeBuilder(isolate, desc, Code::STUB).Build(); Handle<Code> code =
Factory::CodeBuilder(isolate, desc, CodeKind::STUB).Build();
#ifdef OBJECT_PRINT #ifdef OBJECT_PRINT
StdoutStream os; StdoutStream os;
code->Print(os); code->Print(os);
@ -520,7 +531,8 @@ TEST(AssemblerIa32SSE) {
CodeDesc desc; CodeDesc desc;
assm.GetCode(isolate, &desc); assm.GetCode(isolate, &desc);
Handle<Code> code = Factory::CodeBuilder(isolate, desc, Code::STUB).Build(); Handle<Code> code =
Factory::CodeBuilder(isolate, desc, CodeKind::STUB).Build();
#ifdef OBJECT_PRINT #ifdef OBJECT_PRINT
StdoutStream os; StdoutStream os;
code->Print(os); code->Print(os);
@ -552,7 +564,8 @@ TEST(AssemblerIa32SSE3) {
CodeDesc desc; CodeDesc desc;
assm.GetCode(isolate, &desc); assm.GetCode(isolate, &desc);
Handle<Code> code = Factory::CodeBuilder(isolate, desc, Code::STUB).Build(); Handle<Code> code =
Factory::CodeBuilder(isolate, desc, CodeKind::STUB).Build();
#ifdef OBJECT_PRINT #ifdef OBJECT_PRINT
StdoutStream os; StdoutStream os;
code->Print(os); code->Print(os);
@ -779,7 +792,8 @@ TEST(AssemblerX64FMA_sd) {
CodeDesc desc; CodeDesc desc;
assm.GetCode(isolate, &desc); assm.GetCode(isolate, &desc);
Handle<Code> code = Factory::CodeBuilder(isolate, desc, Code::STUB).Build(); Handle<Code> code =
Factory::CodeBuilder(isolate, desc, CodeKind::STUB).Build();
#ifdef OBJECT_PRINT #ifdef OBJECT_PRINT
StdoutStream os; StdoutStream os;
code->Print(os); code->Print(os);
@ -1006,7 +1020,8 @@ TEST(AssemblerX64FMA_ss) {
CodeDesc desc; CodeDesc desc;
assm.GetCode(isolate, &desc); assm.GetCode(isolate, &desc);
Handle<Code> code = Factory::CodeBuilder(isolate, desc, Code::STUB).Build(); Handle<Code> code =
Factory::CodeBuilder(isolate, desc, CodeKind::STUB).Build();
#ifdef OBJECT_PRINT #ifdef OBJECT_PRINT
StdoutStream os; StdoutStream os;
code->Print(os); code->Print(os);
@ -1113,7 +1128,8 @@ TEST(AssemblerIa32BMI1) {
CodeDesc desc; CodeDesc desc;
assm.GetCode(isolate, &desc); assm.GetCode(isolate, &desc);
Handle<Code> code = Factory::CodeBuilder(isolate, desc, Code::STUB).Build(); Handle<Code> code =
Factory::CodeBuilder(isolate, desc, CodeKind::STUB).Build();
#ifdef OBJECT_PRINT #ifdef OBJECT_PRINT
StdoutStream os; StdoutStream os;
code->Print(os); code->Print(os);
@ -1160,7 +1176,8 @@ TEST(AssemblerIa32LZCNT) {
CodeDesc desc; CodeDesc desc;
assm.GetCode(isolate, &desc); assm.GetCode(isolate, &desc);
Handle<Code> code = Factory::CodeBuilder(isolate, desc, Code::STUB).Build(); Handle<Code> code =
Factory::CodeBuilder(isolate, desc, CodeKind::STUB).Build();
#ifdef OBJECT_PRINT #ifdef OBJECT_PRINT
StdoutStream os; StdoutStream os;
code->Print(os); code->Print(os);
@ -1207,7 +1224,8 @@ TEST(AssemblerIa32POPCNT) {
CodeDesc desc; CodeDesc desc;
assm.GetCode(isolate, &desc); assm.GetCode(isolate, &desc);
Handle<Code> code = Factory::CodeBuilder(isolate, desc, Code::STUB).Build(); Handle<Code> code =
Factory::CodeBuilder(isolate, desc, CodeKind::STUB).Build();
#ifdef OBJECT_PRINT #ifdef OBJECT_PRINT
StdoutStream os; StdoutStream os;
code->Print(os); code->Print(os);
@ -1352,7 +1370,8 @@ TEST(AssemblerIa32BMI2) {
CodeDesc desc; CodeDesc desc;
assm.GetCode(isolate, &desc); assm.GetCode(isolate, &desc);
Handle<Code> code = Factory::CodeBuilder(isolate, desc, Code::STUB).Build(); Handle<Code> code =
Factory::CodeBuilder(isolate, desc, CodeKind::STUB).Build();
#ifdef OBJECT_PRINT #ifdef OBJECT_PRINT
StdoutStream os; StdoutStream os;
code->Print(os); code->Print(os);
@ -1395,7 +1414,8 @@ TEST(AssemblerIa32JumpTables1) {
CodeDesc desc; CodeDesc desc;
assm.GetCode(isolate, &desc); assm.GetCode(isolate, &desc);
Handle<Code> code = Factory::CodeBuilder(isolate, desc, Code::STUB).Build(); Handle<Code> code =
Factory::CodeBuilder(isolate, desc, CodeKind::STUB).Build();
#ifdef OBJECT_PRINT #ifdef OBJECT_PRINT
StdoutStream os; StdoutStream os;
code->Print(os); code->Print(os);
@ -1442,7 +1462,8 @@ TEST(AssemblerIa32JumpTables2) {
CodeDesc desc; CodeDesc desc;
assm.GetCode(isolate, &desc); assm.GetCode(isolate, &desc);
Handle<Code> code = Factory::CodeBuilder(isolate, desc, Code::STUB).Build(); Handle<Code> code =
Factory::CodeBuilder(isolate, desc, CodeKind::STUB).Build();
#ifdef OBJECT_PRINT #ifdef OBJECT_PRINT
StdoutStream os; StdoutStream os;
code->Print(os); code->Print(os);
@ -1484,7 +1505,8 @@ TEST(Regress621926) {
CodeDesc desc; CodeDesc desc;
assm.GetCode(isolate, &desc); assm.GetCode(isolate, &desc);
Handle<Code> code = Factory::CodeBuilder(isolate, desc, Code::STUB).Build(); Handle<Code> code =
Factory::CodeBuilder(isolate, desc, CodeKind::STUB).Build();
#ifdef OBJECT_PRINT #ifdef OBJECT_PRINT
StdoutStream os; StdoutStream os;

View File

@ -64,7 +64,8 @@ TEST(MIPS0) {
CodeDesc desc; CodeDesc desc;
assm.GetCode(isolate, &desc); assm.GetCode(isolate, &desc);
Handle<Code> code = Factory::CodeBuilder(isolate, desc, Code::STUB).Build(); Handle<Code> code =
Factory::CodeBuilder(isolate, desc, CodeKind::STUB).Build();
auto f = GeneratedCode<F2>::FromCode(*code); auto f = GeneratedCode<F2>::FromCode(*code);
int res = reinterpret_cast<int>(f.Call(0xAB0, 0xC, 0, 0, 0)); int res = reinterpret_cast<int>(f.Call(0xAB0, 0xC, 0, 0, 0));
CHECK_EQ(static_cast<int32_t>(0xABC), res); CHECK_EQ(static_cast<int32_t>(0xABC), res);
@ -98,7 +99,8 @@ TEST(MIPS1) {
CodeDesc desc; CodeDesc desc;
assm.GetCode(isolate, &desc); assm.GetCode(isolate, &desc);
Handle<Code> code = Factory::CodeBuilder(isolate, desc, Code::STUB).Build(); Handle<Code> code =
Factory::CodeBuilder(isolate, desc, CodeKind::STUB).Build();
auto f = GeneratedCode<F1>::FromCode(*code); auto f = GeneratedCode<F1>::FromCode(*code);
int res = reinterpret_cast<int>(f.Call(50, 0, 0, 0, 0)); int res = reinterpret_cast<int>(f.Call(50, 0, 0, 0, 0));
CHECK_EQ(1275, res); CHECK_EQ(1275, res);
@ -234,7 +236,8 @@ TEST(MIPS2) {
CodeDesc desc; CodeDesc desc;
assm.GetCode(isolate, &desc); assm.GetCode(isolate, &desc);
Handle<Code> code = Factory::CodeBuilder(isolate, desc, Code::STUB).Build(); Handle<Code> code =
Factory::CodeBuilder(isolate, desc, CodeKind::STUB).Build();
auto f = GeneratedCode<F2>::FromCode(*code); auto f = GeneratedCode<F2>::FromCode(*code);
int res = reinterpret_cast<int>(f.Call(0xAB0, 0xC, 0, 0, 0)); int res = reinterpret_cast<int>(f.Call(0xAB0, 0xC, 0, 0, 0));
CHECK_EQ(static_cast<int32_t>(0x31415926), res); CHECK_EQ(static_cast<int32_t>(0x31415926), res);
@ -333,7 +336,8 @@ TEST(MIPS3) {
CodeDesc desc; CodeDesc desc;
assm.GetCode(isolate, &desc); assm.GetCode(isolate, &desc);
Handle<Code> code = Factory::CodeBuilder(isolate, desc, Code::STUB).Build(); Handle<Code> code =
Factory::CodeBuilder(isolate, desc, CodeKind::STUB).Build();
auto f = GeneratedCode<F3>::FromCode(*code); auto f = GeneratedCode<F3>::FromCode(*code);
// Double test values. // Double test values.
t.a = 1.5e14; t.a = 1.5e14;
@ -434,7 +438,8 @@ TEST(MIPS4) {
CodeDesc desc; CodeDesc desc;
assm.GetCode(isolate, &desc); assm.GetCode(isolate, &desc);
Handle<Code> code = Factory::CodeBuilder(isolate, desc, Code::STUB).Build(); Handle<Code> code =
Factory::CodeBuilder(isolate, desc, CodeKind::STUB).Build();
auto f = GeneratedCode<F3>::FromCode(*code); auto f = GeneratedCode<F3>::FromCode(*code);
t.a = 1.5e22; t.a = 1.5e22;
t.b = 2.75e11; t.b = 2.75e11;
@ -494,7 +499,8 @@ TEST(MIPS5) {
CodeDesc desc; CodeDesc desc;
assm.GetCode(isolate, &desc); assm.GetCode(isolate, &desc);
Handle<Code> code = Factory::CodeBuilder(isolate, desc, Code::STUB).Build(); Handle<Code> code =
Factory::CodeBuilder(isolate, desc, CodeKind::STUB).Build();
auto f = GeneratedCode<F3>::FromCode(*code); auto f = GeneratedCode<F3>::FromCode(*code);
t.a = 1.5e4; t.a = 1.5e4;
t.b = 2.75e8; t.b = 2.75e8;
@ -561,7 +567,8 @@ TEST(MIPS6) {
CodeDesc desc; CodeDesc desc;
assm.GetCode(isolate, &desc); assm.GetCode(isolate, &desc);
Handle<Code> code = Factory::CodeBuilder(isolate, desc, Code::STUB).Build(); Handle<Code> code =
Factory::CodeBuilder(isolate, desc, CodeKind::STUB).Build();
auto f = GeneratedCode<F3>::FromCode(*code); auto f = GeneratedCode<F3>::FromCode(*code);
t.ui = 0x11223344; t.ui = 0x11223344;
t.si = 0x99AABBCC; t.si = 0x99AABBCC;
@ -652,7 +659,8 @@ TEST(MIPS7) {
CodeDesc desc; CodeDesc desc;
assm.GetCode(isolate, &desc); assm.GetCode(isolate, &desc);
Handle<Code> code = Factory::CodeBuilder(isolate, desc, Code::STUB).Build(); Handle<Code> code =
Factory::CodeBuilder(isolate, desc, CodeKind::STUB).Build();
auto f = GeneratedCode<F3>::FromCode(*code); auto f = GeneratedCode<F3>::FromCode(*code);
t.a = 1.5e14; t.a = 1.5e14;
t.b = 2.75e11; t.b = 2.75e11;
@ -747,7 +755,8 @@ TEST(MIPS8) {
CodeDesc desc; CodeDesc desc;
assm.GetCode(isolate, &desc); assm.GetCode(isolate, &desc);
Handle<Code> code = Factory::CodeBuilder(isolate, desc, Code::STUB).Build(); Handle<Code> code =
Factory::CodeBuilder(isolate, desc, CodeKind::STUB).Build();
auto f = GeneratedCode<F3>::FromCode(*code); auto f = GeneratedCode<F3>::FromCode(*code);
t.input = 0x12345678; t.input = 0x12345678;
f.Call(&t, 0x0, 0, 0, 0); f.Call(&t, 0x0, 0, 0, 0);
@ -791,7 +800,8 @@ TEST(MIPS9) {
CodeDesc desc; CodeDesc desc;
assm.GetCode(isolate, &desc); assm.GetCode(isolate, &desc);
Handle<Code> code = Factory::CodeBuilder(isolate, desc, Code::STUB).Build(); Handle<Code> code =
Factory::CodeBuilder(isolate, desc, CodeKind::STUB).Build();
USE(code); USE(code);
} }
@ -841,7 +851,8 @@ TEST(MIPS10) {
CodeDesc desc; CodeDesc desc;
assm.GetCode(isolate, &desc); assm.GetCode(isolate, &desc);
Handle<Code> code = Factory::CodeBuilder(isolate, desc, Code::STUB).Build(); Handle<Code> code =
Factory::CodeBuilder(isolate, desc, CodeKind::STUB).Build();
auto f = GeneratedCode<F3>::FromCode(*code); auto f = GeneratedCode<F3>::FromCode(*code);
t.a = 2.147483646e+09; // 0x7FFFFFFE -> 0xFF80000041DFFFFF as double. t.a = 2.147483646e+09; // 0x7FFFFFFE -> 0xFF80000041DFFFFF as double.
t.b_word = 0x0FF00FF0; // 0x0FF00FF0 -> 0x as double. t.b_word = 0x0FF00FF0; // 0x0FF00FF0 -> 0x as double.
@ -967,7 +978,8 @@ TEST(MIPS11) {
CodeDesc desc; CodeDesc desc;
assm.GetCode(isolate, &desc); assm.GetCode(isolate, &desc);
Handle<Code> code = Factory::CodeBuilder(isolate, desc, Code::STUB).Build(); Handle<Code> code =
Factory::CodeBuilder(isolate, desc, CodeKind::STUB).Build();
auto f = GeneratedCode<F3>::FromCode(*code); auto f = GeneratedCode<F3>::FromCode(*code);
t.reg_init = 0xAABBCCDD; t.reg_init = 0xAABBCCDD;
t.mem_init = 0x11223344; t.mem_init = 0x11223344;
@ -1091,7 +1103,8 @@ TEST(MIPS12) {
CodeDesc desc; CodeDesc desc;
assm.GetCode(isolate, &desc); assm.GetCode(isolate, &desc);
Handle<Code> code = Factory::CodeBuilder(isolate, desc, Code::STUB).Build(); Handle<Code> code =
Factory::CodeBuilder(isolate, desc, CodeKind::STUB).Build();
auto f = GeneratedCode<F3>::FromCode(*code); auto f = GeneratedCode<F3>::FromCode(*code);
t.x = 1; t.x = 1;
t.y = 2; t.y = 2;
@ -1143,7 +1156,8 @@ TEST(MIPS13) {
CodeDesc desc; CodeDesc desc;
assm.GetCode(isolate, &desc); assm.GetCode(isolate, &desc);
Handle<Code> code = Factory::CodeBuilder(isolate, desc, Code::STUB).Build(); Handle<Code> code =
Factory::CodeBuilder(isolate, desc, CodeKind::STUB).Build();
auto f = GeneratedCode<F3>::FromCode(*code); auto f = GeneratedCode<F3>::FromCode(*code);
t.cvt_big_in = 0xFFFFFFFF; t.cvt_big_in = 0xFFFFFFFF;
@ -1262,7 +1276,8 @@ TEST(MIPS14) {
CodeDesc desc; CodeDesc desc;
assm.GetCode(isolate, &desc); assm.GetCode(isolate, &desc);
Handle<Code> code = Factory::CodeBuilder(isolate, desc, Code::STUB).Build(); Handle<Code> code =
Factory::CodeBuilder(isolate, desc, CodeKind::STUB).Build();
auto f = GeneratedCode<F3>::FromCode(*code); auto f = GeneratedCode<F3>::FromCode(*code);
t.round_up_in = 123.51; t.round_up_in = 123.51;
@ -1365,7 +1380,8 @@ TEST(seleqz_selnez) {
__ nop(); __ nop();
CodeDesc desc; CodeDesc desc;
assm.GetCode(isolate, &desc); assm.GetCode(isolate, &desc);
Handle<Code> code = Factory::CodeBuilder(isolate, desc, Code::STUB).Build(); Handle<Code> code =
Factory::CodeBuilder(isolate, desc, CodeKind::STUB).Build();
auto f = GeneratedCode<F3>::FromCode(*code); auto f = GeneratedCode<F3>::FromCode(*code);
(f.Call(&test, 0, 0, 0, 0)); (f.Call(&test, 0, 0, 0, 0));
@ -1478,7 +1494,8 @@ TEST(min_max) {
CodeDesc desc; CodeDesc desc;
assm.GetCode(isolate, &desc); assm.GetCode(isolate, &desc);
Handle<Code> code = Factory::CodeBuilder(isolate, desc, Code::STUB).Build(); Handle<Code> code =
Factory::CodeBuilder(isolate, desc, CodeKind::STUB).Build();
auto f = GeneratedCode<F3>::FromCode(*code); auto f = GeneratedCode<F3>::FromCode(*code);
for (int i = 0; i < kTableLength; i++) { for (int i = 0; i < kTableLength; i++) {
test.a = inputsa[i]; test.a = inputsa[i];
@ -1587,7 +1604,8 @@ TEST(rint_d) {
CodeDesc desc; CodeDesc desc;
assm.GetCode(isolate, &desc); assm.GetCode(isolate, &desc);
Handle<Code> code = Factory::CodeBuilder(isolate, desc, Code::STUB).Build(); Handle<Code> code =
Factory::CodeBuilder(isolate, desc, CodeKind::STUB).Build();
auto f = GeneratedCode<F3>::FromCode(*code); auto f = GeneratedCode<F3>::FromCode(*code);
for (int j = 0; j < 4; j++) { for (int j = 0; j < 4; j++) {
@ -1633,7 +1651,8 @@ TEST(sel) {
__ nop(); __ nop();
CodeDesc desc; CodeDesc desc;
assm.GetCode(isolate, &desc); assm.GetCode(isolate, &desc);
Handle<Code> code = Factory::CodeBuilder(isolate, desc, Code::STUB).Build(); Handle<Code> code =
Factory::CodeBuilder(isolate, desc, CodeKind::STUB).Build();
auto f = GeneratedCode<F3>::FromCode(*code); auto f = GeneratedCode<F3>::FromCode(*code);
const int test_size = 3; const int test_size = 3;
@ -1764,7 +1783,8 @@ TEST(rint_s) {
CodeDesc desc; CodeDesc desc;
assm.GetCode(isolate, &desc); assm.GetCode(isolate, &desc);
Handle<Code> code = Factory::CodeBuilder(isolate, desc, Code::STUB).Build(); Handle<Code> code =
Factory::CodeBuilder(isolate, desc, CodeKind::STUB).Build();
auto f = GeneratedCode<F3>::FromCode(*code); auto f = GeneratedCode<F3>::FromCode(*code);
for (int j = 0; j < 4; j++) { for (int j = 0; j < 4; j++) {
@ -1807,7 +1827,8 @@ TEST(Cvt_d_uw) {
CodeDesc desc; CodeDesc desc;
assm.GetCode(isolate, &desc); assm.GetCode(isolate, &desc);
Handle<Code> code = Factory::CodeBuilder(isolate, desc, Code::STUB).Build(); Handle<Code> code =
Factory::CodeBuilder(isolate, desc, CodeKind::STUB).Build();
auto f = GeneratedCode<F3>::FromCode(*code); auto f = GeneratedCode<F3>::FromCode(*code);
for (int i = 0; i < kTableLength; i++) { for (int i = 0; i < kTableLength; i++) {
test.input = inputs[i]; test.input = inputs[i];
@ -1887,7 +1908,8 @@ TEST(mina_maxa) {
CodeDesc desc; CodeDesc desc;
assm.GetCode(isolate, &desc); assm.GetCode(isolate, &desc);
Handle<Code> code = Factory::CodeBuilder(isolate, desc, Code::STUB).Build(); Handle<Code> code =
Factory::CodeBuilder(isolate, desc, CodeKind::STUB).Build();
auto f = GeneratedCode<F3>::FromCode(*code); auto f = GeneratedCode<F3>::FromCode(*code);
for (int i = 0; i < kTableLength; i++) { for (int i = 0; i < kTableLength; i++) {
test.a = inputsa[i]; test.a = inputsa[i];
@ -1966,7 +1988,8 @@ TEST(trunc_l) {
Test test; Test test;
CodeDesc desc; CodeDesc desc;
assm.GetCode(isolate, &desc); assm.GetCode(isolate, &desc);
Handle<Code> code = Factory::CodeBuilder(isolate, desc, Code::STUB).Build(); Handle<Code> code =
Factory::CodeBuilder(isolate, desc, CodeKind::STUB).Build();
auto f = GeneratedCode<F3>::FromCode(*code); auto f = GeneratedCode<F3>::FromCode(*code);
for (int i = 0; i < kTableLength; i++) { for (int i = 0; i < kTableLength; i++) {
test.a = inputs_D[i]; test.a = inputs_D[i];
@ -2045,7 +2068,8 @@ TEST(movz_movn) {
CodeDesc desc; CodeDesc desc;
assm.GetCode(isolate, &desc); assm.GetCode(isolate, &desc);
Handle<Code> code = Factory::CodeBuilder(isolate, desc, Code::STUB).Build(); Handle<Code> code =
Factory::CodeBuilder(isolate, desc, CodeKind::STUB).Build();
auto f = GeneratedCode<F3>::FromCode(*code); auto f = GeneratedCode<F3>::FromCode(*code);
for (int i = 0; i < kTableLength; i++) { for (int i = 0; i < kTableLength; i++) {
test.a = inputs_D[i]; test.a = inputs_D[i];
@ -2146,7 +2170,7 @@ TEST(movt_movd) {
CodeDesc desc; CodeDesc desc;
assm.GetCode(isolate, &desc); assm.GetCode(isolate, &desc);
Handle<Code> code = Handle<Code> code =
Factory::CodeBuilder(isolate, desc, Code::STUB).Build(); Factory::CodeBuilder(isolate, desc, CodeKind::STUB).Build();
auto f = GeneratedCode<F3>::FromCode(*code); auto f = GeneratedCode<F3>::FromCode(*code);
(f.Call(&test, 0, 0, 0, 0)); (f.Call(&test, 0, 0, 0, 0));
@ -2230,7 +2254,8 @@ TEST(cvt_w_d) {
Test test; Test test;
CodeDesc desc; CodeDesc desc;
assm.GetCode(isolate, &desc); assm.GetCode(isolate, &desc);
Handle<Code> code = Factory::CodeBuilder(isolate, desc, Code::STUB).Build(); Handle<Code> code =
Factory::CodeBuilder(isolate, desc, CodeKind::STUB).Build();
auto f = GeneratedCode<F3>::FromCode(*code); auto f = GeneratedCode<F3>::FromCode(*code);
for (int j = 0; j < 4; j++) { for (int j = 0; j < 4; j++) {
test.fcsr = fcsr_inputs[j]; test.fcsr = fcsr_inputs[j];
@ -2296,7 +2321,8 @@ TEST(trunc_w) {
Test test; Test test;
CodeDesc desc; CodeDesc desc;
assm.GetCode(isolate, &desc); assm.GetCode(isolate, &desc);
Handle<Code> code = Factory::CodeBuilder(isolate, desc, Code::STUB).Build(); Handle<Code> code =
Factory::CodeBuilder(isolate, desc, CodeKind::STUB).Build();
auto f = GeneratedCode<F3>::FromCode(*code); auto f = GeneratedCode<F3>::FromCode(*code);
for (int i = 0; i < kTableLength; i++) { for (int i = 0; i < kTableLength; i++) {
test.a = inputs_D[i]; test.a = inputs_D[i];
@ -2364,7 +2390,8 @@ TEST(round_w) {
Test test; Test test;
CodeDesc desc; CodeDesc desc;
assm.GetCode(isolate, &desc); assm.GetCode(isolate, &desc);
Handle<Code> code = Factory::CodeBuilder(isolate, desc, Code::STUB).Build(); Handle<Code> code =
Factory::CodeBuilder(isolate, desc, CodeKind::STUB).Build();
auto f = GeneratedCode<F3>::FromCode(*code); auto f = GeneratedCode<F3>::FromCode(*code);
for (int i = 0; i < kTableLength; i++) { for (int i = 0; i < kTableLength; i++) {
test.a = inputs_D[i]; test.a = inputs_D[i];
@ -2434,7 +2461,8 @@ TEST(round_l) {
Test test; Test test;
CodeDesc desc; CodeDesc desc;
assm.GetCode(isolate, &desc); assm.GetCode(isolate, &desc);
Handle<Code> code = Factory::CodeBuilder(isolate, desc, Code::STUB).Build(); Handle<Code> code =
Factory::CodeBuilder(isolate, desc, CodeKind::STUB).Build();
auto f = GeneratedCode<F3>::FromCode(*code); auto f = GeneratedCode<F3>::FromCode(*code);
for (int i = 0; i < kTableLength; i++) { for (int i = 0; i < kTableLength; i++) {
test.a = inputs_D[i]; test.a = inputs_D[i];
@ -2506,7 +2534,8 @@ TEST(sub) {
CodeDesc desc; CodeDesc desc;
assm.GetCode(isolate, &desc); assm.GetCode(isolate, &desc);
Handle<Code> code = Factory::CodeBuilder(isolate, desc, Code::STUB).Build(); Handle<Code> code =
Factory::CodeBuilder(isolate, desc, CodeKind::STUB).Build();
auto f = GeneratedCode<F3>::FromCode(*code); auto f = GeneratedCode<F3>::FromCode(*code);
for (int i = 0; i < kTableLength; i++) { for (int i = 0; i < kTableLength; i++) {
test.a = inputfs_S[i]; test.a = inputfs_S[i];
@ -2584,7 +2613,8 @@ TEST(sqrt_rsqrt_recip) {
CodeDesc desc; CodeDesc desc;
assm.GetCode(isolate, &desc); assm.GetCode(isolate, &desc);
Handle<Code> code = Factory::CodeBuilder(isolate, desc, Code::STUB).Build(); Handle<Code> code =
Factory::CodeBuilder(isolate, desc, CodeKind::STUB).Build();
auto f = GeneratedCode<F3>::FromCode(*code); auto f = GeneratedCode<F3>::FromCode(*code);
for (int i = 0; i < kTableLength; i++) { for (int i = 0; i < kTableLength; i++) {
@ -2663,7 +2693,8 @@ TEST(neg) {
CodeDesc desc; CodeDesc desc;
assm.GetCode(isolate, &desc); assm.GetCode(isolate, &desc);
Handle<Code> code = Factory::CodeBuilder(isolate, desc, Code::STUB).Build(); Handle<Code> code =
Factory::CodeBuilder(isolate, desc, CodeKind::STUB).Build();
auto f = GeneratedCode<F3>::FromCode(*code); auto f = GeneratedCode<F3>::FromCode(*code);
for (int i = 0; i < kTableLength; i++) { for (int i = 0; i < kTableLength; i++) {
test.a = inputs_S[i]; test.a = inputs_S[i];
@ -2719,7 +2750,8 @@ TEST(mul) {
CodeDesc desc; CodeDesc desc;
assm.GetCode(isolate, &desc); assm.GetCode(isolate, &desc);
Handle<Code> code = Factory::CodeBuilder(isolate, desc, Code::STUB).Build(); Handle<Code> code =
Factory::CodeBuilder(isolate, desc, CodeKind::STUB).Build();
auto f = GeneratedCode<F3>::FromCode(*code); auto f = GeneratedCode<F3>::FromCode(*code);
for (int i = 0; i < kTableLength; i++) { for (int i = 0; i < kTableLength; i++) {
test.a = inputfs_S[i]; test.a = inputfs_S[i];
@ -2774,7 +2806,8 @@ TEST(mov) {
CodeDesc desc; CodeDesc desc;
assm.GetCode(isolate, &desc); assm.GetCode(isolate, &desc);
Handle<Code> code = Factory::CodeBuilder(isolate, desc, Code::STUB).Build(); Handle<Code> code =
Factory::CodeBuilder(isolate, desc, CodeKind::STUB).Build();
auto f = GeneratedCode<F3>::FromCode(*code); auto f = GeneratedCode<F3>::FromCode(*code);
for (int i = 0; i < kTableLength; i++) { for (int i = 0; i < kTableLength; i++) {
test.a = inputs_D[i]; test.a = inputs_D[i];
@ -2840,7 +2873,8 @@ TEST(floor_w) {
Test test; Test test;
CodeDesc desc; CodeDesc desc;
assm.GetCode(isolate, &desc); assm.GetCode(isolate, &desc);
Handle<Code> code = Factory::CodeBuilder(isolate, desc, Code::STUB).Build(); Handle<Code> code =
Factory::CodeBuilder(isolate, desc, CodeKind::STUB).Build();
auto f = GeneratedCode<F3>::FromCode(*code); auto f = GeneratedCode<F3>::FromCode(*code);
for (int i = 0; i < kTableLength; i++) { for (int i = 0; i < kTableLength; i++) {
test.a = inputs_D[i]; test.a = inputs_D[i];
@ -2910,7 +2944,8 @@ TEST(floor_l) {
Test test; Test test;
CodeDesc desc; CodeDesc desc;
assm.GetCode(isolate, &desc); assm.GetCode(isolate, &desc);
Handle<Code> code = Factory::CodeBuilder(isolate, desc, Code::STUB).Build(); Handle<Code> code =
Factory::CodeBuilder(isolate, desc, CodeKind::STUB).Build();
auto f = GeneratedCode<F3>::FromCode(*code); auto f = GeneratedCode<F3>::FromCode(*code);
for (int i = 0; i < kTableLength; i++) { for (int i = 0; i < kTableLength; i++) {
test.a = inputs_D[i]; test.a = inputs_D[i];
@ -2981,7 +3016,8 @@ TEST(ceil_w) {
Test test; Test test;
CodeDesc desc; CodeDesc desc;
assm.GetCode(isolate, &desc); assm.GetCode(isolate, &desc);
Handle<Code> code = Factory::CodeBuilder(isolate, desc, Code::STUB).Build(); Handle<Code> code =
Factory::CodeBuilder(isolate, desc, CodeKind::STUB).Build();
auto f = GeneratedCode<F3>::FromCode(*code); auto f = GeneratedCode<F3>::FromCode(*code);
for (int i = 0; i < kTableLength; i++) { for (int i = 0; i < kTableLength; i++) {
test.a = inputs_D[i]; test.a = inputs_D[i];
@ -3051,7 +3087,8 @@ TEST(ceil_l) {
Test test; Test test;
CodeDesc desc; CodeDesc desc;
assm.GetCode(isolate, &desc); assm.GetCode(isolate, &desc);
Handle<Code> code = Factory::CodeBuilder(isolate, desc, Code::STUB).Build(); Handle<Code> code =
Factory::CodeBuilder(isolate, desc, CodeKind::STUB).Build();
auto f = GeneratedCode<F3>::FromCode(*code); auto f = GeneratedCode<F3>::FromCode(*code);
for (int i = 0; i < kTableLength; i++) { for (int i = 0; i < kTableLength; i++) {
test.a = inputs_D[i]; test.a = inputs_D[i];
@ -3118,7 +3155,8 @@ TEST(jump_tables1) {
CodeDesc desc; CodeDesc desc;
assm.GetCode(isolate, &desc); assm.GetCode(isolate, &desc);
Handle<Code> code = Factory::CodeBuilder(isolate, desc, Code::STUB).Build(); Handle<Code> code =
Factory::CodeBuilder(isolate, desc, CodeKind::STUB).Build();
#ifdef OBJECT_PRINT #ifdef OBJECT_PRINT
code->Print(std::cout); code->Print(std::cout);
#endif #endif
@ -3182,7 +3220,8 @@ TEST(jump_tables2) {
CodeDesc desc; CodeDesc desc;
assm.GetCode(isolate, &desc); assm.GetCode(isolate, &desc);
Handle<Code> code = Factory::CodeBuilder(isolate, desc, Code::STUB).Build(); Handle<Code> code =
Factory::CodeBuilder(isolate, desc, CodeKind::STUB).Build();
#ifdef OBJECT_PRINT #ifdef OBJECT_PRINT
code->Print(std::cout); code->Print(std::cout);
#endif #endif
@ -3253,7 +3292,8 @@ TEST(jump_tables3) {
CodeDesc desc; CodeDesc desc;
assm.GetCode(isolate, &desc); assm.GetCode(isolate, &desc);
Handle<Code> code = Factory::CodeBuilder(isolate, desc, Code::STUB).Build(); Handle<Code> code =
Factory::CodeBuilder(isolate, desc, CodeKind::STUB).Build();
#ifdef OBJECT_PRINT #ifdef OBJECT_PRINT
code->Print(std::cout); code->Print(std::cout);
#endif #endif
@ -3303,7 +3343,8 @@ TEST(BITSWAP) {
CodeDesc desc; CodeDesc desc;
assm.GetCode(isolate, &desc); assm.GetCode(isolate, &desc);
Handle<Code> code = Factory::CodeBuilder(isolate, desc, Code::STUB).Build(); Handle<Code> code =
Factory::CodeBuilder(isolate, desc, CodeKind::STUB).Build();
auto f = GeneratedCode<F3>::FromCode(*code); auto f = GeneratedCode<F3>::FromCode(*code);
t.r1 = 0x781A15C3; t.r1 = 0x781A15C3;
t.r2 = 0x8B71FCDE; t.r2 = 0x8B71FCDE;
@ -3436,7 +3477,8 @@ TEST(class_fmt) {
CodeDesc desc; CodeDesc desc;
assm.GetCode(isolate, &desc); assm.GetCode(isolate, &desc);
Handle<Code> code = Factory::CodeBuilder(isolate, desc, Code::STUB).Build(); Handle<Code> code =
Factory::CodeBuilder(isolate, desc, CodeKind::STUB).Build();
auto f = GeneratedCode<F3>::FromCode(*code); auto f = GeneratedCode<F3>::FromCode(*code);
t.dSignalingNan = std::numeric_limits<double>::signaling_NaN(); t.dSignalingNan = std::numeric_limits<double>::signaling_NaN();
@ -3526,7 +3568,8 @@ TEST(ABS) {
CodeDesc desc; CodeDesc desc;
assm.GetCode(isolate, &desc); assm.GetCode(isolate, &desc);
Handle<Code> code = Factory::CodeBuilder(isolate, desc, Code::STUB).Build(); Handle<Code> code =
Factory::CodeBuilder(isolate, desc, CodeKind::STUB).Build();
auto f = GeneratedCode<F3>::FromCode(*code); auto f = GeneratedCode<F3>::FromCode(*code);
test.a = -2.0; test.a = -2.0;
test.b = -2.0; test.b = -2.0;
@ -3618,7 +3661,8 @@ TEST(ADD_FMT) {
CodeDesc desc; CodeDesc desc;
assm.GetCode(isolate, &desc); assm.GetCode(isolate, &desc);
Handle<Code> code = Factory::CodeBuilder(isolate, desc, Code::STUB).Build(); Handle<Code> code =
Factory::CodeBuilder(isolate, desc, CodeKind::STUB).Build();
auto f = GeneratedCode<F3>::FromCode(*code); auto f = GeneratedCode<F3>::FromCode(*code);
test.a = 2.0; test.a = 2.0;
test.b = 3.0; test.b = 3.0;
@ -3771,7 +3815,8 @@ TEST(C_COND_FMT) {
CodeDesc desc; CodeDesc desc;
assm.GetCode(isolate, &desc); assm.GetCode(isolate, &desc);
Handle<Code> code = Factory::CodeBuilder(isolate, desc, Code::STUB).Build(); Handle<Code> code =
Factory::CodeBuilder(isolate, desc, CodeKind::STUB).Build();
auto f = GeneratedCode<F3>::FromCode(*code); auto f = GeneratedCode<F3>::FromCode(*code);
test.dOp1 = 2.0; test.dOp1 = 2.0;
test.dOp2 = 3.0; test.dOp2 = 3.0;
@ -3970,7 +4015,8 @@ TEST(CMP_COND_FMT) {
CodeDesc desc; CodeDesc desc;
assm.GetCode(isolate, &desc); assm.GetCode(isolate, &desc);
Handle<Code> code = Factory::CodeBuilder(isolate, desc, Code::STUB).Build(); Handle<Code> code =
Factory::CodeBuilder(isolate, desc, CodeKind::STUB).Build();
auto f = GeneratedCode<F3>::FromCode(*code); auto f = GeneratedCode<F3>::FromCode(*code);
uint64_t dTrue = 0xFFFFFFFFFFFFFFFF; uint64_t dTrue = 0xFFFFFFFFFFFFFFFF;
uint64_t dFalse = 0x0000000000000000; uint64_t dFalse = 0x0000000000000000;
@ -4155,7 +4201,8 @@ TEST(CVT) {
CodeDesc desc; CodeDesc desc;
assm.GetCode(isolate, &desc); assm.GetCode(isolate, &desc);
Handle<Code> code = Factory::CodeBuilder(isolate, desc, Code::STUB).Build(); Handle<Code> code =
Factory::CodeBuilder(isolate, desc, CodeKind::STUB).Build();
auto f = GeneratedCode<F3>::FromCode(*code); auto f = GeneratedCode<F3>::FromCode(*code);
test.cvt_d_s_in = -0.51; test.cvt_d_s_in = -0.51;
@ -4366,7 +4413,8 @@ TEST(DIV_FMT) {
CodeDesc desc; CodeDesc desc;
assm.GetCode(isolate, &desc); assm.GetCode(isolate, &desc);
Handle<Code> code = Factory::CodeBuilder(isolate, desc, Code::STUB).Build(); Handle<Code> code =
Factory::CodeBuilder(isolate, desc, CodeKind::STUB).Build();
auto f = GeneratedCode<F3>::FromCode(*code); auto f = GeneratedCode<F3>::FromCode(*code);
@ -4457,7 +4505,8 @@ uint32_t run_align(uint32_t rs_value, uint32_t rt_value, uint8_t bp) {
CodeDesc desc; CodeDesc desc;
assm.GetCode(isolate, &desc); assm.GetCode(isolate, &desc);
Handle<Code> code = Factory::CodeBuilder(isolate, desc, Code::STUB).Build(); Handle<Code> code =
Factory::CodeBuilder(isolate, desc, CodeKind::STUB).Build();
auto f = GeneratedCode<F2>::FromCode(*code); auto f = GeneratedCode<F2>::FromCode(*code);
@ -4511,7 +4560,8 @@ uint32_t run_aluipc(int16_t offset) {
CodeDesc desc; CodeDesc desc;
assm.GetCode(isolate, &desc); assm.GetCode(isolate, &desc);
Handle<Code> code = Factory::CodeBuilder(isolate, desc, Code::STUB).Build(); Handle<Code> code =
Factory::CodeBuilder(isolate, desc, CodeKind::STUB).Build();
auto f = GeneratedCode<F2>::FromCode(*code); auto f = GeneratedCode<F2>::FromCode(*code);
PC = (uint32_t)code->entry(); // Set the program counter. PC = (uint32_t)code->entry(); // Set the program counter.
@ -4563,7 +4613,8 @@ uint32_t run_auipc(int16_t offset) {
CodeDesc desc; CodeDesc desc;
assm.GetCode(isolate, &desc); assm.GetCode(isolate, &desc);
Handle<Code> code = Factory::CodeBuilder(isolate, desc, Code::STUB).Build(); Handle<Code> code =
Factory::CodeBuilder(isolate, desc, CodeKind::STUB).Build();
auto f = GeneratedCode<F2>::FromCode(*code); auto f = GeneratedCode<F2>::FromCode(*code);
PC = (uint32_t)code->entry(); // Set the program counter. PC = (uint32_t)code->entry(); // Set the program counter.
@ -4637,7 +4688,8 @@ uint32_t run_lwpc(int offset) {
CodeDesc desc; CodeDesc desc;
assm.GetCode(isolate, &desc); assm.GetCode(isolate, &desc);
Handle<Code> code = Factory::CodeBuilder(isolate, desc, Code::STUB).Build(); Handle<Code> code =
Factory::CodeBuilder(isolate, desc, CodeKind::STUB).Build();
auto f = GeneratedCode<F2>::FromCode(*code); auto f = GeneratedCode<F2>::FromCode(*code);
@ -4716,7 +4768,8 @@ uint32_t run_jic(int16_t offset) {
CodeDesc desc; CodeDesc desc;
assm.GetCode(isolate, &desc); assm.GetCode(isolate, &desc);
Handle<Code> code = Factory::CodeBuilder(isolate, desc, Code::STUB).Build(); Handle<Code> code =
Factory::CodeBuilder(isolate, desc, CodeKind::STUB).Build();
auto f = GeneratedCode<F2>::FromCode(*code); auto f = GeneratedCode<F2>::FromCode(*code);
@ -4786,7 +4839,8 @@ uint64_t run_beqzc(int32_t value, int32_t offset) {
CodeDesc desc; CodeDesc desc;
assm.GetCode(isolate, &desc); assm.GetCode(isolate, &desc);
Handle<Code> code = Factory::CodeBuilder(isolate, desc, Code::STUB).Build(); Handle<Code> code =
Factory::CodeBuilder(isolate, desc, CodeKind::STUB).Build();
auto f = GeneratedCode<F2>::FromCode(*code); auto f = GeneratedCode<F2>::FromCode(*code);
@ -4891,7 +4945,8 @@ void run_bz_bnz(TestCaseMsaBranch* input, Branch GenerateBranch,
CodeDesc desc; CodeDesc desc;
assm.GetCode(isolate, &desc); assm.GetCode(isolate, &desc);
Handle<Code> code = Factory::CodeBuilder(isolate, desc, Code::STUB).Build(); Handle<Code> code =
Factory::CodeBuilder(isolate, desc, CodeKind::STUB).Build();
#ifdef OBJECT_PRINT #ifdef OBJECT_PRINT
code->Print(std::cout); code->Print(std::cout);
#endif #endif
@ -5060,7 +5115,8 @@ uint32_t run_jialc(int16_t offset) {
CodeDesc desc; CodeDesc desc;
assm.GetCode(isolate, &desc); assm.GetCode(isolate, &desc);
Handle<Code> code = Factory::CodeBuilder(isolate, desc, Code::STUB).Build(); Handle<Code> code =
Factory::CodeBuilder(isolate, desc, CodeKind::STUB).Build();
auto f = GeneratedCode<F2>::FromCode(*code); auto f = GeneratedCode<F2>::FromCode(*code);
@ -5107,7 +5163,8 @@ static uint32_t run_addiupc(int32_t imm19) {
CodeDesc desc; CodeDesc desc;
assm.GetCode(isolate, &desc); assm.GetCode(isolate, &desc);
Handle<Code> code = Factory::CodeBuilder(isolate, desc, Code::STUB).Build(); Handle<Code> code =
Factory::CodeBuilder(isolate, desc, CodeKind::STUB).Build();
auto f = GeneratedCode<F2>::FromCode(*code); auto f = GeneratedCode<F2>::FromCode(*code);
PC = (uint32_t)code->entry(); // Set the program counter. PC = (uint32_t)code->entry(); // Set the program counter.
@ -5188,7 +5245,8 @@ int32_t run_bc(int32_t offset) {
CodeDesc desc; CodeDesc desc;
assm.GetCode(isolate, &desc); assm.GetCode(isolate, &desc);
Handle<Code> code = Factory::CodeBuilder(isolate, desc, Code::STUB).Build(); Handle<Code> code =
Factory::CodeBuilder(isolate, desc, CodeKind::STUB).Build();
auto f = GeneratedCode<F2>::FromCode(*code); auto f = GeneratedCode<F2>::FromCode(*code);
@ -5268,7 +5326,8 @@ int32_t run_balc(int32_t offset) {
CodeDesc desc; CodeDesc desc;
assm.GetCode(isolate, &desc); assm.GetCode(isolate, &desc);
Handle<Code> code = Factory::CodeBuilder(isolate, desc, Code::STUB).Build(); Handle<Code> code =
Factory::CodeBuilder(isolate, desc, CodeKind::STUB).Build();
auto f = GeneratedCode<F2>::FromCode(*code); auto f = GeneratedCode<F2>::FromCode(*code);
@ -5291,7 +5350,8 @@ uint32_t run_aui(uint32_t rs, uint16_t offset) {
CodeDesc desc; CodeDesc desc;
assm.GetCode(isolate, &desc); assm.GetCode(isolate, &desc);
Handle<Code> code = Factory::CodeBuilder(isolate, desc, Code::STUB).Build(); Handle<Code> code =
Factory::CodeBuilder(isolate, desc, CodeKind::STUB).Build();
auto f = GeneratedCode<F2>::FromCode(*code); auto f = GeneratedCode<F2>::FromCode(*code);
@ -5379,7 +5439,8 @@ uint32_t run_bal(int16_t offset) {
CodeDesc desc; CodeDesc desc;
assm.GetCode(isolate, &desc); assm.GetCode(isolate, &desc);
Handle<Code> code = Factory::CodeBuilder(isolate, desc, Code::STUB).Build(); Handle<Code> code =
Factory::CodeBuilder(isolate, desc, CodeKind::STUB).Build();
auto f = GeneratedCode<F2>::FromCode(*code); auto f = GeneratedCode<F2>::FromCode(*code);
@ -5430,7 +5491,8 @@ TEST(Trampoline) {
CodeDesc desc; CodeDesc desc;
assm.GetCode(isolate, &desc); assm.GetCode(isolate, &desc);
Handle<Code> code = Factory::CodeBuilder(isolate, desc, Code::STUB).Build(); Handle<Code> code =
Factory::CodeBuilder(isolate, desc, CodeKind::STUB).Build();
auto f = GeneratedCode<F2>::FromCode(*code); auto f = GeneratedCode<F2>::FromCode(*code);
int32_t res = reinterpret_cast<int32_t>(f.Call(42, 42, 0, 0, 0)); int32_t res = reinterpret_cast<int32_t>(f.Call(42, 42, 0, 0, 0));
@ -5556,7 +5618,8 @@ void helper_madd_msub_maddf_msubf(F func) {
CodeDesc desc; CodeDesc desc;
assm.GetCode(isolate, &desc); assm.GetCode(isolate, &desc);
Handle<Code> code = Factory::CodeBuilder(isolate, desc, Code::STUB).Build(); Handle<Code> code =
Factory::CodeBuilder(isolate, desc, CodeKind::STUB).Build();
auto f = GeneratedCode<F3>::FromCode(*code); auto f = GeneratedCode<F3>::FromCode(*code);
const size_t kTableLength = sizeof(test_cases) / sizeof(TestCaseMaddMsub<T>); const size_t kTableLength = sizeof(test_cases) / sizeof(TestCaseMaddMsub<T>);
@ -5640,7 +5703,8 @@ uint32_t run_Subu(uint32_t imm, int32_t num_instr) {
CodeDesc desc; CodeDesc desc;
assm.GetCode(isolate, &desc); assm.GetCode(isolate, &desc);
Handle<Code> code = Factory::CodeBuilder(isolate, desc, Code::STUB).Build(); Handle<Code> code =
Factory::CodeBuilder(isolate, desc, CodeKind::STUB).Build();
auto f = GeneratedCode<F2>::FromCode(*code); auto f = GeneratedCode<F2>::FromCode(*code);
uint32_t res = reinterpret_cast<uint32_t>(f.Call(0, 0, 0, 0, 0)); uint32_t res = reinterpret_cast<uint32_t>(f.Call(0, 0, 0, 0, 0));
@ -5743,7 +5807,8 @@ TEST(MSA_fill_copy) {
CodeDesc desc; CodeDesc desc;
assm.GetCode(isolate, &desc); assm.GetCode(isolate, &desc);
Handle<Code> code = Factory::CodeBuilder(isolate, desc, Code::STUB).Build(); Handle<Code> code =
Factory::CodeBuilder(isolate, desc, CodeKind::STUB).Build();
#ifdef OBJECT_PRINT #ifdef OBJECT_PRINT
code->Print(std::cout); code->Print(std::cout);
#endif #endif
@ -5810,7 +5875,8 @@ TEST(MSA_fill_copy_2) {
CodeDesc desc; CodeDesc desc;
assm.GetCode(isolate, &desc); assm.GetCode(isolate, &desc);
Handle<Code> code = Factory::CodeBuilder(isolate, desc, Code::STUB).Build(); Handle<Code> code =
Factory::CodeBuilder(isolate, desc, CodeKind::STUB).Build();
#ifdef OBJECT_PRINT #ifdef OBJECT_PRINT
code->Print(std::cout); code->Print(std::cout);
#endif #endif
@ -5866,7 +5932,8 @@ TEST(MSA_fill_copy_3) {
CodeDesc desc; CodeDesc desc;
assm.GetCode(isolate, &desc); assm.GetCode(isolate, &desc);
Handle<Code> code = Factory::CodeBuilder(isolate, desc, Code::STUB).Build(); Handle<Code> code =
Factory::CodeBuilder(isolate, desc, CodeKind::STUB).Build();
#ifdef OBJECT_PRINT #ifdef OBJECT_PRINT
code->Print(std::cout); code->Print(std::cout);
#endif #endif
@ -5910,7 +5977,8 @@ void run_msa_insert(int32_t rs_value, int n, msa_reg_t* w) {
CodeDesc desc; CodeDesc desc;
assm.GetCode(isolate, &desc); assm.GetCode(isolate, &desc);
Handle<Code> code = Factory::CodeBuilder(isolate, desc, Code::STUB).Build(); Handle<Code> code =
Factory::CodeBuilder(isolate, desc, CodeKind::STUB).Build();
#ifdef OBJECT_PRINT #ifdef OBJECT_PRINT
code->Print(std::cout); code->Print(std::cout);
#endif #endif
@ -6009,7 +6077,8 @@ TEST(MSA_move_v) {
CodeDesc desc; CodeDesc desc;
assm.GetCode(isolate, &desc); assm.GetCode(isolate, &desc);
Handle<Code> code = Factory::CodeBuilder(isolate, desc, Code::STUB).Build(); Handle<Code> code =
Factory::CodeBuilder(isolate, desc, CodeKind::STUB).Build();
#ifdef OBJECT_PRINT #ifdef OBJECT_PRINT
code->Print(std::cout); code->Print(std::cout);
#endif #endif
@ -6053,7 +6122,8 @@ void run_msa_sldi(OperFunc GenerateOperation,
CodeDesc desc; CodeDesc desc;
assm.GetCode(isolate, &desc); assm.GetCode(isolate, &desc);
Handle<Code> code = Factory::CodeBuilder(isolate, desc, Code::STUB).Build(); Handle<Code> code =
Factory::CodeBuilder(isolate, desc, CodeKind::STUB).Build();
#ifdef OBJECT_PRINT #ifdef OBJECT_PRINT
code->Print(std::cout); code->Print(std::cout);
#endif #endif
@ -6137,7 +6207,8 @@ void run_msa_ctc_cfc(uint32_t value) {
CodeDesc desc; CodeDesc desc;
assm.GetCode(isolate, &desc); assm.GetCode(isolate, &desc);
Handle<Code> code = Factory::CodeBuilder(isolate, desc, Code::STUB).Build(); Handle<Code> code =
Factory::CodeBuilder(isolate, desc, CodeKind::STUB).Build();
#ifdef OBJECT_PRINT #ifdef OBJECT_PRINT
code->Print(std::cout); code->Print(std::cout);
#endif #endif
@ -6246,7 +6317,8 @@ void run_msa_i8(SecondaryField opcode, uint64_t ws_lo, uint64_t ws_hi,
CodeDesc desc; CodeDesc desc;
assm.GetCode(isolate, &desc); assm.GetCode(isolate, &desc);
Handle<Code> code = Factory::CodeBuilder(isolate, desc, Code::STUB).Build(); Handle<Code> code =
Factory::CodeBuilder(isolate, desc, CodeKind::STUB).Build();
#ifdef OBJECT_PRINT #ifdef OBJECT_PRINT
code->Print(std::cout); code->Print(std::cout);
#endif #endif
@ -6423,7 +6495,8 @@ uint32_t run_Ins(uint32_t imm, uint32_t source, uint16_t pos, uint16_t size) {
CodeDesc desc; CodeDesc desc;
assm.GetCode(isolate, &desc); assm.GetCode(isolate, &desc);
Handle<Code> code = Factory::CodeBuilder(isolate, desc, Code::STUB).Build(); Handle<Code> code =
Factory::CodeBuilder(isolate, desc, CodeKind::STUB).Build();
auto f = GeneratedCode<F2>::FromCode(*code); auto f = GeneratedCode<F2>::FromCode(*code);
uint32_t res = reinterpret_cast<uint32_t>(f.Call(0, 0, 0, 0, 0)); uint32_t res = reinterpret_cast<uint32_t>(f.Call(0, 0, 0, 0, 0));
@ -6472,7 +6545,8 @@ uint32_t run_Ext(uint32_t source, uint16_t pos, uint16_t size) {
CodeDesc desc; CodeDesc desc;
assm.GetCode(isolate, &desc); assm.GetCode(isolate, &desc);
Handle<Code> code = Factory::CodeBuilder(isolate, desc, Code::STUB).Build(); Handle<Code> code =
Factory::CodeBuilder(isolate, desc, CodeKind::STUB).Build();
auto f = GeneratedCode<F2>::FromCode(*code); auto f = GeneratedCode<F2>::FromCode(*code);
uint32_t res = reinterpret_cast<uint32_t>(f.Call(0, 0, 0, 0, 0)); uint32_t res = reinterpret_cast<uint32_t>(f.Call(0, 0, 0, 0, 0));
@ -6533,7 +6607,8 @@ void run_msa_i5(struct TestCaseMsaI5* input, bool i5_sign_ext,
CodeDesc desc; CodeDesc desc;
assm.GetCode(isolate, &desc); assm.GetCode(isolate, &desc);
Handle<Code> code = Factory::CodeBuilder(isolate, desc, Code::STUB).Build(); Handle<Code> code =
Factory::CodeBuilder(isolate, desc, CodeKind::STUB).Build();
#ifdef OBJECT_PRINT #ifdef OBJECT_PRINT
code->Print(std::cout); code->Print(std::cout);
#endif #endif
@ -6952,7 +7027,8 @@ void run_msa_2r(const struct TestCaseMsa2R* input,
CodeDesc desc; CodeDesc desc;
assm.GetCode(isolate, &desc); assm.GetCode(isolate, &desc);
Handle<Code> code = Factory::CodeBuilder(isolate, desc, Code::STUB).Build(); Handle<Code> code =
Factory::CodeBuilder(isolate, desc, CodeKind::STUB).Build();
#ifdef OBJECT_PRINT #ifdef OBJECT_PRINT
code->Print(std::cout); code->Print(std::cout);
#endif #endif
@ -8001,7 +8077,8 @@ void run_msa_vector(struct TestCaseMsaVector* input,
CodeDesc desc; CodeDesc desc;
assm.GetCode(isolate, &desc); assm.GetCode(isolate, &desc);
Handle<Code> code = Factory::CodeBuilder(isolate, desc, Code::STUB).Build(); Handle<Code> code =
Factory::CodeBuilder(isolate, desc, CodeKind::STUB).Build();
#ifdef OBJECT_PRINT #ifdef OBJECT_PRINT
code->Print(std::cout); code->Print(std::cout);
#endif #endif
@ -8088,7 +8165,8 @@ void run_msa_bit(struct TestCaseMsaBit* input, InstFunc GenerateInstructionFunc,
CodeDesc desc; CodeDesc desc;
assm.GetCode(isolate, &desc); assm.GetCode(isolate, &desc);
Handle<Code> code = Factory::CodeBuilder(isolate, desc, Code::STUB).Build(); Handle<Code> code =
Factory::CodeBuilder(isolate, desc, CodeKind::STUB).Build();
#ifdef OBJECT_PRINT #ifdef OBJECT_PRINT
code->Print(std::cout); code->Print(std::cout);
#endif #endif
@ -8560,7 +8638,8 @@ void run_msa_i10(int32_t input, InstFunc GenerateVectorInstructionFunc,
CodeDesc desc; CodeDesc desc;
assm.GetCode(isolate, &desc); assm.GetCode(isolate, &desc);
Handle<Code> code = Factory::CodeBuilder(isolate, desc, Code::STUB).Build(); Handle<Code> code =
Factory::CodeBuilder(isolate, desc, CodeKind::STUB).Build();
#ifdef OBJECT_PRINT #ifdef OBJECT_PRINT
code->Print(std::cout); code->Print(std::cout);
#endif #endif
@ -8637,7 +8716,8 @@ void run_msa_mi10(InstFunc GenerateVectorInstructionFunc) {
CodeDesc desc; CodeDesc desc;
assm.GetCode(isolate, &desc); assm.GetCode(isolate, &desc);
Handle<Code> code = Factory::CodeBuilder(isolate, desc, Code::STUB).Build(); Handle<Code> code =
Factory::CodeBuilder(isolate, desc, CodeKind::STUB).Build();
#ifdef OBJECT_PRINT #ifdef OBJECT_PRINT
code->Print(std::cout); code->Print(std::cout);
#endif #endif
@ -8715,7 +8795,8 @@ void run_msa_3r(struct TestCaseMsa3R* input, InstFunc GenerateI5InstructionFunc,
CodeDesc desc; CodeDesc desc;
assm.GetCode(isolate, &desc); assm.GetCode(isolate, &desc);
Handle<Code> code = Factory::CodeBuilder(isolate, desc, Code::STUB).Build(); Handle<Code> code =
Factory::CodeBuilder(isolate, desc, CodeKind::STUB).Build();
#ifdef OBJECT_PRINT #ifdef OBJECT_PRINT
code->Print(std::cout); code->Print(std::cout);
#endif #endif
@ -9720,7 +9801,8 @@ void run_msa_3rf(const struct TestCaseMsa3RF* input,
CodeDesc desc; CodeDesc desc;
assm.GetCode(isolate, &desc); assm.GetCode(isolate, &desc);
Handle<Code> code = Factory::CodeBuilder(isolate, desc, Code::STUB).Build(); Handle<Code> code =
Factory::CodeBuilder(isolate, desc, CodeKind::STUB).Build();
#ifdef OBJECT_PRINT #ifdef OBJECT_PRINT
code->Print(std::cout); code->Print(std::cout);
#endif #endif

View File

@ -65,7 +65,8 @@ TEST(MIPS0) {
CodeDesc desc; CodeDesc desc;
assm.GetCode(isolate, &desc); assm.GetCode(isolate, &desc);
Handle<Code> code = Factory::CodeBuilder(isolate, desc, Code::STUB).Build(); Handle<Code> code =
Factory::CodeBuilder(isolate, desc, CodeKind::STUB).Build();
auto f = GeneratedCode<F2>::FromCode(*code); auto f = GeneratedCode<F2>::FromCode(*code);
int64_t res = reinterpret_cast<int64_t>(f.Call(0xAB0, 0xC, 0, 0, 0)); int64_t res = reinterpret_cast<int64_t>(f.Call(0xAB0, 0xC, 0, 0, 0));
CHECK_EQ(0xABCL, res); CHECK_EQ(0xABCL, res);
@ -99,7 +100,8 @@ TEST(MIPS1) {
CodeDesc desc; CodeDesc desc;
assm.GetCode(isolate, &desc); assm.GetCode(isolate, &desc);
Handle<Code> code = Factory::CodeBuilder(isolate, desc, Code::STUB).Build(); Handle<Code> code =
Factory::CodeBuilder(isolate, desc, CodeKind::STUB).Build();
auto f = GeneratedCode<F1>::FromCode(*code); auto f = GeneratedCode<F1>::FromCode(*code);
int64_t res = reinterpret_cast<int64_t>(f.Call(50, 0, 0, 0, 0)); int64_t res = reinterpret_cast<int64_t>(f.Call(50, 0, 0, 0, 0));
CHECK_EQ(1275L, res); CHECK_EQ(1275L, res);
@ -243,7 +245,8 @@ TEST(MIPS2) {
CodeDesc desc; CodeDesc desc;
assm.GetCode(isolate, &desc); assm.GetCode(isolate, &desc);
Handle<Code> code = Factory::CodeBuilder(isolate, desc, Code::STUB).Build(); Handle<Code> code =
Factory::CodeBuilder(isolate, desc, CodeKind::STUB).Build();
auto f = GeneratedCode<F2>::FromCode(*code); auto f = GeneratedCode<F2>::FromCode(*code);
int64_t res = reinterpret_cast<int64_t>(f.Call(0xAB0, 0xC, 0, 0, 0)); int64_t res = reinterpret_cast<int64_t>(f.Call(0xAB0, 0xC, 0, 0, 0));
@ -343,7 +346,8 @@ TEST(MIPS3) {
CodeDesc desc; CodeDesc desc;
assm.GetCode(isolate, &desc); assm.GetCode(isolate, &desc);
Handle<Code> code = Factory::CodeBuilder(isolate, desc, Code::STUB).Build(); Handle<Code> code =
Factory::CodeBuilder(isolate, desc, CodeKind::STUB).Build();
auto f = GeneratedCode<F3>::FromCode(*code); auto f = GeneratedCode<F3>::FromCode(*code);
// Double test values. // Double test values.
t.a = 1.5e14; t.a = 1.5e14;
@ -434,7 +438,8 @@ TEST(MIPS4) {
CodeDesc desc; CodeDesc desc;
assm.GetCode(isolate, &desc); assm.GetCode(isolate, &desc);
Handle<Code> code = Factory::CodeBuilder(isolate, desc, Code::STUB).Build(); Handle<Code> code =
Factory::CodeBuilder(isolate, desc, CodeKind::STUB).Build();
auto f = GeneratedCode<F3>::FromCode(*code); auto f = GeneratedCode<F3>::FromCode(*code);
t.a = 1.5e22; t.a = 1.5e22;
t.b = 2.75e11; t.b = 2.75e11;
@ -497,7 +502,8 @@ TEST(MIPS5) {
CodeDesc desc; CodeDesc desc;
assm.GetCode(isolate, &desc); assm.GetCode(isolate, &desc);
Handle<Code> code = Factory::CodeBuilder(isolate, desc, Code::STUB).Build(); Handle<Code> code =
Factory::CodeBuilder(isolate, desc, CodeKind::STUB).Build();
auto f = GeneratedCode<F3>::FromCode(*code); auto f = GeneratedCode<F3>::FromCode(*code);
t.a = 1.5e4; t.a = 1.5e4;
t.b = 2.75e8; t.b = 2.75e8;
@ -564,7 +570,8 @@ TEST(MIPS6) {
CodeDesc desc; CodeDesc desc;
assm.GetCode(isolate, &desc); assm.GetCode(isolate, &desc);
Handle<Code> code = Factory::CodeBuilder(isolate, desc, Code::STUB).Build(); Handle<Code> code =
Factory::CodeBuilder(isolate, desc, CodeKind::STUB).Build();
auto f = GeneratedCode<F3>::FromCode(*code); auto f = GeneratedCode<F3>::FromCode(*code);
t.ui = 0x11223344; t.ui = 0x11223344;
t.si = 0x99AABBCC; t.si = 0x99AABBCC;
@ -649,7 +656,8 @@ TEST(MIPS7) {
CodeDesc desc; CodeDesc desc;
assm.GetCode(isolate, &desc); assm.GetCode(isolate, &desc);
Handle<Code> code = Factory::CodeBuilder(isolate, desc, Code::STUB).Build(); Handle<Code> code =
Factory::CodeBuilder(isolate, desc, CodeKind::STUB).Build();
auto f = GeneratedCode<F3>::FromCode(*code); auto f = GeneratedCode<F3>::FromCode(*code);
t.a = 1.5e14; t.a = 1.5e14;
t.b = 2.75e11; t.b = 2.75e11;
@ -744,7 +752,8 @@ TEST(MIPS8) {
CodeDesc desc; CodeDesc desc;
assm.GetCode(isolate, &desc); assm.GetCode(isolate, &desc);
Handle<Code> code = Factory::CodeBuilder(isolate, desc, Code::STUB).Build(); Handle<Code> code =
Factory::CodeBuilder(isolate, desc, CodeKind::STUB).Build();
auto f = GeneratedCode<F3>::FromCode(*code); auto f = GeneratedCode<F3>::FromCode(*code);
t.input = 0x12345678; t.input = 0x12345678;
f.Call(&t, 0x0, 0, 0, 0); f.Call(&t, 0x0, 0, 0, 0);
@ -788,7 +797,8 @@ TEST(MIPS9) {
CodeDesc desc; CodeDesc desc;
assm.GetCode(isolate, &desc); assm.GetCode(isolate, &desc);
Handle<Code> code = Factory::CodeBuilder(isolate, desc, Code::STUB).Build(); Handle<Code> code =
Factory::CodeBuilder(isolate, desc, CodeKind::STUB).Build();
USE(code); USE(code);
} }
@ -863,7 +873,8 @@ TEST(MIPS10) {
CodeDesc desc; CodeDesc desc;
assm.GetCode(isolate, &desc); assm.GetCode(isolate, &desc);
Handle<Code> code = Factory::CodeBuilder(isolate, desc, Code::STUB).Build(); Handle<Code> code =
Factory::CodeBuilder(isolate, desc, CodeKind::STUB).Build();
auto f = GeneratedCode<F3>::FromCode(*code); auto f = GeneratedCode<F3>::FromCode(*code);
t.a = 2.147483647e9; // 0x7FFFFFFF -> 0x41DFFFFFFFC00000 as double. t.a = 2.147483647e9; // 0x7FFFFFFF -> 0x41DFFFFFFFC00000 as double.
t.b_long_hi = 0x000000FF; // 0xFF00FF00FF -> 0x426FE01FE01FE000 as double. t.b_long_hi = 0x000000FF; // 0xFF00FF00FF -> 0x426FE01FE01FE000 as double.
@ -996,7 +1007,8 @@ TEST(MIPS11) {
CodeDesc desc; CodeDesc desc;
assm.GetCode(isolate, &desc); assm.GetCode(isolate, &desc);
Handle<Code> code = Factory::CodeBuilder(isolate, desc, Code::STUB).Build(); Handle<Code> code =
Factory::CodeBuilder(isolate, desc, CodeKind::STUB).Build();
auto f = GeneratedCode<F3>::FromCode(*code); auto f = GeneratedCode<F3>::FromCode(*code);
t.reg_init = 0xAABBCCDD; t.reg_init = 0xAABBCCDD;
t.mem_init = 0x11223344; t.mem_init = 0x11223344;
@ -1119,7 +1131,8 @@ TEST(MIPS12) {
CodeDesc desc; CodeDesc desc;
assm.GetCode(isolate, &desc); assm.GetCode(isolate, &desc);
Handle<Code> code = Factory::CodeBuilder(isolate, desc, Code::STUB).Build(); Handle<Code> code =
Factory::CodeBuilder(isolate, desc, CodeKind::STUB).Build();
auto f = GeneratedCode<F3>::FromCode(*code); auto f = GeneratedCode<F3>::FromCode(*code);
t.x = 1; t.x = 1;
t.y = 2; t.y = 2;
@ -1171,7 +1184,8 @@ TEST(MIPS13) {
CodeDesc desc; CodeDesc desc;
assm.GetCode(isolate, &desc); assm.GetCode(isolate, &desc);
Handle<Code> code = Factory::CodeBuilder(isolate, desc, Code::STUB).Build(); Handle<Code> code =
Factory::CodeBuilder(isolate, desc, CodeKind::STUB).Build();
auto f = GeneratedCode<F3>::FromCode(*code); auto f = GeneratedCode<F3>::FromCode(*code);
t.cvt_big_in = 0xFFFFFFFF; t.cvt_big_in = 0xFFFFFFFF;
@ -1290,7 +1304,8 @@ TEST(MIPS14) {
CodeDesc desc; CodeDesc desc;
assm.GetCode(isolate, &desc); assm.GetCode(isolate, &desc);
Handle<Code> code = Factory::CodeBuilder(isolate, desc, Code::STUB).Build(); Handle<Code> code =
Factory::CodeBuilder(isolate, desc, CodeKind::STUB).Build();
auto f = GeneratedCode<F3>::FromCode(*code); auto f = GeneratedCode<F3>::FromCode(*code);
t.round_up_in = 123.51; t.round_up_in = 123.51;
@ -1417,7 +1432,8 @@ TEST(MIPS16) {
CodeDesc desc; CodeDesc desc;
assm.GetCode(isolate, &desc); assm.GetCode(isolate, &desc);
Handle<Code> code = Factory::CodeBuilder(isolate, desc, Code::STUB).Build(); Handle<Code> code =
Factory::CodeBuilder(isolate, desc, CodeKind::STUB).Build();
auto f = GeneratedCode<F3>::FromCode(*code); auto f = GeneratedCode<F3>::FromCode(*code);
t.ui = 0x44332211; t.ui = 0x44332211;
t.si = 0x99AABBCC; t.si = 0x99AABBCC;
@ -1543,7 +1559,8 @@ TEST(seleqz_selnez) {
__ nop(); __ nop();
CodeDesc desc; CodeDesc desc;
assm.GetCode(isolate, &desc); assm.GetCode(isolate, &desc);
Handle<Code> code = Factory::CodeBuilder(isolate, desc, Code::STUB).Build(); Handle<Code> code =
Factory::CodeBuilder(isolate, desc, CodeKind::STUB).Build();
auto f = GeneratedCode<F3>::FromCode(*code); auto f = GeneratedCode<F3>::FromCode(*code);
f.Call(&test, 0, 0, 0, 0); f.Call(&test, 0, 0, 0, 0);
@ -1657,7 +1674,8 @@ TEST(min_max) {
CodeDesc desc; CodeDesc desc;
assm.GetCode(isolate, &desc); assm.GetCode(isolate, &desc);
Handle<Code> code = Factory::CodeBuilder(isolate, desc, Code::STUB).Build(); Handle<Code> code =
Factory::CodeBuilder(isolate, desc, CodeKind::STUB).Build();
auto f = GeneratedCode<F3>::FromCode(*code); auto f = GeneratedCode<F3>::FromCode(*code);
for (int i = 4; i < kTableLength; i++) { for (int i = 4; i < kTableLength; i++) {
test.a = inputsa[i]; test.a = inputsa[i];
@ -1764,7 +1782,8 @@ TEST(rint_d) {
CodeDesc desc; CodeDesc desc;
assm.GetCode(isolate, &desc); assm.GetCode(isolate, &desc);
Handle<Code> code = Factory::CodeBuilder(isolate, desc, Code::STUB).Build(); Handle<Code> code =
Factory::CodeBuilder(isolate, desc, CodeKind::STUB).Build();
auto f = GeneratedCode<F3>::FromCode(*code); auto f = GeneratedCode<F3>::FromCode(*code);
for (int j = 0; j < 4; j++) { for (int j = 0; j < 4; j++) {
@ -1810,7 +1829,8 @@ TEST(sel) {
__ nop(); __ nop();
CodeDesc desc; CodeDesc desc;
assm.GetCode(isolate, &desc); assm.GetCode(isolate, &desc);
Handle<Code> code = Factory::CodeBuilder(isolate, desc, Code::STUB).Build(); Handle<Code> code =
Factory::CodeBuilder(isolate, desc, CodeKind::STUB).Build();
auto f = GeneratedCode<F3>::FromCode(*code); auto f = GeneratedCode<F3>::FromCode(*code);
const int test_size = 3; const int test_size = 3;
@ -1941,7 +1961,8 @@ TEST(rint_s) {
CodeDesc desc; CodeDesc desc;
assm.GetCode(isolate, &desc); assm.GetCode(isolate, &desc);
Handle<Code> code = Factory::CodeBuilder(isolate, desc, Code::STUB).Build(); Handle<Code> code =
Factory::CodeBuilder(isolate, desc, CodeKind::STUB).Build();
auto f = GeneratedCode<F3>::FromCode(*code); auto f = GeneratedCode<F3>::FromCode(*code);
for (int j = 0; j < 4; j++) { for (int j = 0; j < 4; j++) {
@ -2025,7 +2046,8 @@ TEST(mina_maxa) {
CodeDesc desc; CodeDesc desc;
assm.GetCode(isolate, &desc); assm.GetCode(isolate, &desc);
Handle<Code> code = Factory::CodeBuilder(isolate, desc, Code::STUB).Build(); Handle<Code> code =
Factory::CodeBuilder(isolate, desc, CodeKind::STUB).Build();
auto f = GeneratedCode<F3>::FromCode(*code); auto f = GeneratedCode<F3>::FromCode(*code);
for (int i = 0; i < kTableLength; i++) { for (int i = 0; i < kTableLength; i++) {
test.a = inputsa[i]; test.a = inputsa[i];
@ -2105,7 +2127,8 @@ TEST(trunc_l) {
Test test; Test test;
CodeDesc desc; CodeDesc desc;
assm.GetCode(isolate, &desc); assm.GetCode(isolate, &desc);
Handle<Code> code = Factory::CodeBuilder(isolate, desc, Code::STUB).Build(); Handle<Code> code =
Factory::CodeBuilder(isolate, desc, CodeKind::STUB).Build();
auto f = GeneratedCode<F3>::FromCode(*code); auto f = GeneratedCode<F3>::FromCode(*code);
for (int i = 0; i < kTableLength; i++) { for (int i = 0; i < kTableLength; i++) {
test.a = inputs_D[i]; test.a = inputs_D[i];
@ -2184,7 +2207,8 @@ TEST(movz_movn) {
CodeDesc desc; CodeDesc desc;
assm.GetCode(isolate, &desc); assm.GetCode(isolate, &desc);
Handle<Code> code = Factory::CodeBuilder(isolate, desc, Code::STUB).Build(); Handle<Code> code =
Factory::CodeBuilder(isolate, desc, CodeKind::STUB).Build();
auto f = GeneratedCode<F3>::FromCode(*code); auto f = GeneratedCode<F3>::FromCode(*code);
for (int i = 0; i < kTableLength; i++) { for (int i = 0; i < kTableLength; i++) {
test.a = inputs_D[i]; test.a = inputs_D[i];
@ -2284,7 +2308,7 @@ TEST(movt_movd) {
CodeDesc desc; CodeDesc desc;
assm.GetCode(isolate, &desc); assm.GetCode(isolate, &desc);
Handle<Code> code = Handle<Code> code =
Factory::CodeBuilder(isolate, desc, Code::STUB).Build(); Factory::CodeBuilder(isolate, desc, CodeKind::STUB).Build();
auto f = GeneratedCode<F3>::FromCode(*code); auto f = GeneratedCode<F3>::FromCode(*code);
f.Call(&test, 0, 0, 0, 0); f.Call(&test, 0, 0, 0, 0);
@ -2369,7 +2393,8 @@ TEST(cvt_w_d) {
Test test; Test test;
CodeDesc desc; CodeDesc desc;
assm.GetCode(isolate, &desc); assm.GetCode(isolate, &desc);
Handle<Code> code = Factory::CodeBuilder(isolate, desc, Code::STUB).Build(); Handle<Code> code =
Factory::CodeBuilder(isolate, desc, CodeKind::STUB).Build();
auto f = GeneratedCode<F3>::FromCode(*code); auto f = GeneratedCode<F3>::FromCode(*code);
for (int j = 0; j < 4; j++) { for (int j = 0; j < 4; j++) {
test.fcsr = fcsr_inputs[j]; test.fcsr = fcsr_inputs[j];
@ -2435,7 +2460,8 @@ TEST(trunc_w) {
Test test; Test test;
CodeDesc desc; CodeDesc desc;
assm.GetCode(isolate, &desc); assm.GetCode(isolate, &desc);
Handle<Code> code = Factory::CodeBuilder(isolate, desc, Code::STUB).Build(); Handle<Code> code =
Factory::CodeBuilder(isolate, desc, CodeKind::STUB).Build();
auto f = GeneratedCode<F3>::FromCode(*code); auto f = GeneratedCode<F3>::FromCode(*code);
for (int i = 0; i < kTableLength; i++) { for (int i = 0; i < kTableLength; i++) {
test.a = inputs_D[i]; test.a = inputs_D[i];
@ -2503,7 +2529,8 @@ TEST(round_w) {
Test test; Test test;
CodeDesc desc; CodeDesc desc;
assm.GetCode(isolate, &desc); assm.GetCode(isolate, &desc);
Handle<Code> code = Factory::CodeBuilder(isolate, desc, Code::STUB).Build(); Handle<Code> code =
Factory::CodeBuilder(isolate, desc, CodeKind::STUB).Build();
auto f = GeneratedCode<F3>::FromCode(*code); auto f = GeneratedCode<F3>::FromCode(*code);
for (int i = 0; i < kTableLength; i++) { for (int i = 0; i < kTableLength; i++) {
test.a = inputs_D[i]; test.a = inputs_D[i];
@ -2572,7 +2599,8 @@ TEST(round_l) {
Test test; Test test;
CodeDesc desc; CodeDesc desc;
assm.GetCode(isolate, &desc); assm.GetCode(isolate, &desc);
Handle<Code> code = Factory::CodeBuilder(isolate, desc, Code::STUB).Build(); Handle<Code> code =
Factory::CodeBuilder(isolate, desc, CodeKind::STUB).Build();
auto f = GeneratedCode<F3>::FromCode(*code); auto f = GeneratedCode<F3>::FromCode(*code);
for (int i = 0; i < kTableLength; i++) { for (int i = 0; i < kTableLength; i++) {
test.a = inputs_D[i]; test.a = inputs_D[i];
@ -2643,7 +2671,8 @@ TEST(sub) {
CodeDesc desc; CodeDesc desc;
assm.GetCode(isolate, &desc); assm.GetCode(isolate, &desc);
Handle<Code> code = Factory::CodeBuilder(isolate, desc, Code::STUB).Build(); Handle<Code> code =
Factory::CodeBuilder(isolate, desc, CodeKind::STUB).Build();
auto f = GeneratedCode<F3>::FromCode(*code); auto f = GeneratedCode<F3>::FromCode(*code);
for (int i = 0; i < kTableLength; i++) { for (int i = 0; i < kTableLength; i++) {
test.a = inputfs_S[i]; test.a = inputfs_S[i];
@ -2714,7 +2743,8 @@ TEST(sqrt_rsqrt_recip) {
CodeDesc desc; CodeDesc desc;
assm.GetCode(isolate, &desc); assm.GetCode(isolate, &desc);
Handle<Code> code = Factory::CodeBuilder(isolate, desc, Code::STUB).Build(); Handle<Code> code =
Factory::CodeBuilder(isolate, desc, CodeKind::STUB).Build();
auto f = GeneratedCode<F3>::FromCode(*code); auto f = GeneratedCode<F3>::FromCode(*code);
for (int i = 0; i < kTableLength; i++) { for (int i = 0; i < kTableLength; i++) {
@ -2791,7 +2821,8 @@ TEST(neg) {
CodeDesc desc; CodeDesc desc;
assm.GetCode(isolate, &desc); assm.GetCode(isolate, &desc);
Handle<Code> code = Factory::CodeBuilder(isolate, desc, Code::STUB).Build(); Handle<Code> code =
Factory::CodeBuilder(isolate, desc, CodeKind::STUB).Build();
auto f = GeneratedCode<F3>::FromCode(*code); auto f = GeneratedCode<F3>::FromCode(*code);
for (int i = 0; i < kTableLength; i++) { for (int i = 0; i < kTableLength; i++) {
test.a = inputs_S[i]; test.a = inputs_S[i];
@ -2848,7 +2879,8 @@ TEST(mul) {
CodeDesc desc; CodeDesc desc;
assm.GetCode(isolate, &desc); assm.GetCode(isolate, &desc);
Handle<Code> code = Factory::CodeBuilder(isolate, desc, Code::STUB).Build(); Handle<Code> code =
Factory::CodeBuilder(isolate, desc, CodeKind::STUB).Build();
auto f = GeneratedCode<F3>::FromCode(*code); auto f = GeneratedCode<F3>::FromCode(*code);
for (int i = 0; i < kTableLength; i++) { for (int i = 0; i < kTableLength; i++) {
test.a = inputfs_S[i]; test.a = inputfs_S[i];
@ -2902,7 +2934,8 @@ TEST(mov) {
CodeDesc desc; CodeDesc desc;
assm.GetCode(isolate, &desc); assm.GetCode(isolate, &desc);
Handle<Code> code = Factory::CodeBuilder(isolate, desc, Code::STUB).Build(); Handle<Code> code =
Factory::CodeBuilder(isolate, desc, CodeKind::STUB).Build();
auto f = GeneratedCode<F3>::FromCode(*code); auto f = GeneratedCode<F3>::FromCode(*code);
for (int i = 0; i < kTableLength; i++) { for (int i = 0; i < kTableLength; i++) {
test.a = inputs_D[i]; test.a = inputs_D[i];
@ -2968,7 +3001,8 @@ TEST(floor_w) {
Test test; Test test;
CodeDesc desc; CodeDesc desc;
assm.GetCode(isolate, &desc); assm.GetCode(isolate, &desc);
Handle<Code> code = Factory::CodeBuilder(isolate, desc, Code::STUB).Build(); Handle<Code> code =
Factory::CodeBuilder(isolate, desc, CodeKind::STUB).Build();
auto f = GeneratedCode<F3>::FromCode(*code); auto f = GeneratedCode<F3>::FromCode(*code);
for (int i = 0; i < kTableLength; i++) { for (int i = 0; i < kTableLength; i++) {
test.a = inputs_D[i]; test.a = inputs_D[i];
@ -3037,7 +3071,8 @@ TEST(floor_l) {
Test test; Test test;
CodeDesc desc; CodeDesc desc;
assm.GetCode(isolate, &desc); assm.GetCode(isolate, &desc);
Handle<Code> code = Factory::CodeBuilder(isolate, desc, Code::STUB).Build(); Handle<Code> code =
Factory::CodeBuilder(isolate, desc, CodeKind::STUB).Build();
auto f = GeneratedCode<F3>::FromCode(*code); auto f = GeneratedCode<F3>::FromCode(*code);
for (int i = 0; i < kTableLength; i++) { for (int i = 0; i < kTableLength; i++) {
test.a = inputs_D[i]; test.a = inputs_D[i];
@ -3107,7 +3142,8 @@ TEST(ceil_w) {
Test test; Test test;
CodeDesc desc; CodeDesc desc;
assm.GetCode(isolate, &desc); assm.GetCode(isolate, &desc);
Handle<Code> code = Factory::CodeBuilder(isolate, desc, Code::STUB).Build(); Handle<Code> code =
Factory::CodeBuilder(isolate, desc, CodeKind::STUB).Build();
auto f = GeneratedCode<F3>::FromCode(*code); auto f = GeneratedCode<F3>::FromCode(*code);
for (int i = 0; i < kTableLength; i++) { for (int i = 0; i < kTableLength; i++) {
test.a = inputs_D[i]; test.a = inputs_D[i];
@ -3176,7 +3212,8 @@ TEST(ceil_l) {
Test test; Test test;
CodeDesc desc; CodeDesc desc;
assm.GetCode(isolate, &desc); assm.GetCode(isolate, &desc);
Handle<Code> code = Factory::CodeBuilder(isolate, desc, Code::STUB).Build(); Handle<Code> code =
Factory::CodeBuilder(isolate, desc, CodeKind::STUB).Build();
auto f = GeneratedCode<F3>::FromCode(*code); auto f = GeneratedCode<F3>::FromCode(*code);
for (int i = 0; i < kTableLength; i++) { for (int i = 0; i < kTableLength; i++) {
test.a = inputs_D[i]; test.a = inputs_D[i];
@ -3242,7 +3279,8 @@ TEST(jump_tables1) {
CodeDesc desc; CodeDesc desc;
assm.GetCode(isolate, &desc); assm.GetCode(isolate, &desc);
Handle<Code> code = Factory::CodeBuilder(isolate, desc, Code::STUB).Build(); Handle<Code> code =
Factory::CodeBuilder(isolate, desc, CodeKind::STUB).Build();
#ifdef OBJECT_PRINT #ifdef OBJECT_PRINT
code->Print(std::cout); code->Print(std::cout);
#endif #endif
@ -3306,7 +3344,8 @@ TEST(jump_tables2) {
CodeDesc desc; CodeDesc desc;
assm.GetCode(isolate, &desc); assm.GetCode(isolate, &desc);
Handle<Code> code = Factory::CodeBuilder(isolate, desc, Code::STUB).Build(); Handle<Code> code =
Factory::CodeBuilder(isolate, desc, CodeKind::STUB).Build();
#ifdef OBJECT_PRINT #ifdef OBJECT_PRINT
code->Print(std::cout); code->Print(std::cout);
#endif #endif
@ -3380,7 +3419,8 @@ TEST(jump_tables3) {
CodeDesc desc; CodeDesc desc;
assm.GetCode(isolate, &desc); assm.GetCode(isolate, &desc);
Handle<Code> code = Factory::CodeBuilder(isolate, desc, Code::STUB).Build(); Handle<Code> code =
Factory::CodeBuilder(isolate, desc, CodeKind::STUB).Build();
#ifdef OBJECT_PRINT #ifdef OBJECT_PRINT
code->Print(std::cout); code->Print(std::cout);
#endif #endif
@ -3452,7 +3492,8 @@ TEST(BITSWAP) {
CodeDesc desc; CodeDesc desc;
assm.GetCode(isolate, &desc); assm.GetCode(isolate, &desc);
Handle<Code> code = Factory::CodeBuilder(isolate, desc, Code::STUB).Build(); Handle<Code> code =
Factory::CodeBuilder(isolate, desc, CodeKind::STUB).Build();
auto f = GeneratedCode<F3>::FromCode(*code); auto f = GeneratedCode<F3>::FromCode(*code);
t.r1 = 0x00102100781A15C3; t.r1 = 0x00102100781A15C3;
t.r2 = 0x001021008B71FCDE; t.r2 = 0x001021008B71FCDE;
@ -3593,7 +3634,8 @@ TEST(class_fmt) {
CodeDesc desc; CodeDesc desc;
assm.GetCode(isolate, &desc); assm.GetCode(isolate, &desc);
Handle<Code> code = Factory::CodeBuilder(isolate, desc, Code::STUB).Build(); Handle<Code> code =
Factory::CodeBuilder(isolate, desc, CodeKind::STUB).Build();
auto f = GeneratedCode<F3>::FromCode(*code); auto f = GeneratedCode<F3>::FromCode(*code);
// Double test values. // Double test values.
@ -3685,7 +3727,8 @@ TEST(ABS) {
CodeDesc desc; CodeDesc desc;
assm.GetCode(isolate, &desc); assm.GetCode(isolate, &desc);
Handle<Code> code = Factory::CodeBuilder(isolate, desc, Code::STUB).Build(); Handle<Code> code =
Factory::CodeBuilder(isolate, desc, CodeKind::STUB).Build();
auto f = GeneratedCode<F3>::FromCode(*code); auto f = GeneratedCode<F3>::FromCode(*code);
test.a = -2.0; test.a = -2.0;
test.b = -2.0; test.b = -2.0;
@ -3777,7 +3820,8 @@ TEST(ADD_FMT) {
CodeDesc desc; CodeDesc desc;
assm.GetCode(isolate, &desc); assm.GetCode(isolate, &desc);
Handle<Code> code = Factory::CodeBuilder(isolate, desc, Code::STUB).Build(); Handle<Code> code =
Factory::CodeBuilder(isolate, desc, CodeKind::STUB).Build();
auto f = GeneratedCode<F3>::FromCode(*code); auto f = GeneratedCode<F3>::FromCode(*code);
test.a = 2.0; test.a = 2.0;
test.b = 3.0; test.b = 3.0;
@ -3930,7 +3974,8 @@ TEST(C_COND_FMT) {
CodeDesc desc; CodeDesc desc;
assm.GetCode(isolate, &desc); assm.GetCode(isolate, &desc);
Handle<Code> code = Factory::CodeBuilder(isolate, desc, Code::STUB).Build(); Handle<Code> code =
Factory::CodeBuilder(isolate, desc, CodeKind::STUB).Build();
auto f = GeneratedCode<F3>::FromCode(*code); auto f = GeneratedCode<F3>::FromCode(*code);
test.dOp1 = 2.0; test.dOp1 = 2.0;
test.dOp2 = 3.0; test.dOp2 = 3.0;
@ -4129,7 +4174,8 @@ TEST(CMP_COND_FMT) {
CodeDesc desc; CodeDesc desc;
assm.GetCode(isolate, &desc); assm.GetCode(isolate, &desc);
Handle<Code> code = Factory::CodeBuilder(isolate, desc, Code::STUB).Build(); Handle<Code> code =
Factory::CodeBuilder(isolate, desc, CodeKind::STUB).Build();
auto f = GeneratedCode<F3>::FromCode(*code); auto f = GeneratedCode<F3>::FromCode(*code);
uint64_t dTrue = 0xFFFFFFFFFFFFFFFF; uint64_t dTrue = 0xFFFFFFFFFFFFFFFF;
uint64_t dFalse = 0x0000000000000000; uint64_t dFalse = 0x0000000000000000;
@ -4306,7 +4352,8 @@ TEST(CVT) {
CodeDesc desc; CodeDesc desc;
assm.GetCode(isolate, &desc); assm.GetCode(isolate, &desc);
Handle<Code> code = Factory::CodeBuilder(isolate, desc, Code::STUB).Build(); Handle<Code> code =
Factory::CodeBuilder(isolate, desc, CodeKind::STUB).Build();
auto f = GeneratedCode<F3>::FromCode(*code); auto f = GeneratedCode<F3>::FromCode(*code);
test.cvt_d_s_in = -0.51; test.cvt_d_s_in = -0.51;
@ -4476,7 +4523,8 @@ TEST(DIV_FMT) {
__ nop(); __ nop();
CodeDesc desc; CodeDesc desc;
assm.GetCode(isolate, &desc); assm.GetCode(isolate, &desc);
Handle<Code> code = Factory::CodeBuilder(isolate, desc, Code::STUB).Build(); Handle<Code> code =
Factory::CodeBuilder(isolate, desc, CodeKind::STUB).Build();
auto f = GeneratedCode<F3>::FromCode(*code); auto f = GeneratedCode<F3>::FromCode(*code);
f.Call(&test, 0, 0, 0, 0); f.Call(&test, 0, 0, 0, 0);
@ -4566,7 +4614,8 @@ uint64_t run_align(uint64_t rs_value, uint64_t rt_value, uint8_t bp) {
CodeDesc desc; CodeDesc desc;
assm.GetCode(isolate, &desc); assm.GetCode(isolate, &desc);
Handle<Code> code = Factory::CodeBuilder(isolate, desc, Code::STUB).Build(); Handle<Code> code =
Factory::CodeBuilder(isolate, desc, CodeKind::STUB).Build();
auto f = GeneratedCode<F4>::FromCode(*code); auto f = GeneratedCode<F4>::FromCode(*code);
@ -4620,7 +4669,8 @@ uint64_t run_dalign(uint64_t rs_value, uint64_t rt_value, uint8_t bp) {
CodeDesc desc; CodeDesc desc;
assm.GetCode(isolate, &desc); assm.GetCode(isolate, &desc);
Handle<Code> code = Factory::CodeBuilder(isolate, desc, Code::STUB).Build(); Handle<Code> code =
Factory::CodeBuilder(isolate, desc, CodeKind::STUB).Build();
auto f = GeneratedCode<F4>::FromCode(*code); auto f = GeneratedCode<F4>::FromCode(*code);
uint64_t res = uint64_t res =
@ -4679,7 +4729,8 @@ uint64_t run_aluipc(int16_t offset) {
CodeDesc desc; CodeDesc desc;
assm.GetCode(isolate, &desc); assm.GetCode(isolate, &desc);
Handle<Code> code = Factory::CodeBuilder(isolate, desc, Code::STUB).Build(); Handle<Code> code =
Factory::CodeBuilder(isolate, desc, CodeKind::STUB).Build();
auto f = GeneratedCode<F2>::FromCode(*code); auto f = GeneratedCode<F2>::FromCode(*code);
PC = (uint64_t)code->entry(); // Set the program counter. PC = (uint64_t)code->entry(); // Set the program counter.
@ -4731,7 +4782,8 @@ uint64_t run_auipc(int16_t offset) {
CodeDesc desc; CodeDesc desc;
assm.GetCode(isolate, &desc); assm.GetCode(isolate, &desc);
Handle<Code> code = Factory::CodeBuilder(isolate, desc, Code::STUB).Build(); Handle<Code> code =
Factory::CodeBuilder(isolate, desc, CodeKind::STUB).Build();
auto f = GeneratedCode<F2>::FromCode(*code); auto f = GeneratedCode<F2>::FromCode(*code);
PC = (uint64_t)code->entry(); // Set the program counter. PC = (uint64_t)code->entry(); // Set the program counter.
@ -4784,7 +4836,8 @@ uint64_t run_aui(uint64_t rs, uint16_t offset) {
CodeDesc desc; CodeDesc desc;
assm.GetCode(isolate, &desc); assm.GetCode(isolate, &desc);
Handle<Code> code = Factory::CodeBuilder(isolate, desc, Code::STUB).Build(); Handle<Code> code =
Factory::CodeBuilder(isolate, desc, CodeKind::STUB).Build();
auto f = GeneratedCode<F2>::FromCode(*code); auto f = GeneratedCode<F2>::FromCode(*code);
@ -4807,7 +4860,8 @@ uint64_t run_daui(uint64_t rs, uint16_t offset) {
CodeDesc desc; CodeDesc desc;
assm.GetCode(isolate, &desc); assm.GetCode(isolate, &desc);
Handle<Code> code = Factory::CodeBuilder(isolate, desc, Code::STUB).Build(); Handle<Code> code =
Factory::CodeBuilder(isolate, desc, CodeKind::STUB).Build();
auto f = GeneratedCode<F2>::FromCode(*code); auto f = GeneratedCode<F2>::FromCode(*code);
@ -4830,7 +4884,8 @@ uint64_t run_dahi(uint64_t rs, uint16_t offset) {
CodeDesc desc; CodeDesc desc;
assm.GetCode(isolate, &desc); assm.GetCode(isolate, &desc);
Handle<Code> code = Factory::CodeBuilder(isolate, desc, Code::STUB).Build(); Handle<Code> code =
Factory::CodeBuilder(isolate, desc, CodeKind::STUB).Build();
auto f = GeneratedCode<F2>::FromCode(*code); auto f = GeneratedCode<F2>::FromCode(*code);
@ -4853,7 +4908,8 @@ uint64_t run_dati(uint64_t rs, uint16_t offset) {
CodeDesc desc; CodeDesc desc;
assm.GetCode(isolate, &desc); assm.GetCode(isolate, &desc);
Handle<Code> code = Factory::CodeBuilder(isolate, desc, Code::STUB).Build(); Handle<Code> code =
Factory::CodeBuilder(isolate, desc, CodeKind::STUB).Build();
auto f = GeneratedCode<F2>::FromCode(*code); auto f = GeneratedCode<F2>::FromCode(*code);
@ -4955,7 +5011,8 @@ uint64_t run_li_macro(uint64_t imm, LiFlags mode, int32_t num_instr = 0) {
CodeDesc desc; CodeDesc desc;
assm.GetCode(isolate, &desc); assm.GetCode(isolate, &desc);
Handle<Code> code = Factory::CodeBuilder(isolate, desc, Code::STUB).Build(); Handle<Code> code =
Factory::CodeBuilder(isolate, desc, CodeKind::STUB).Build();
#ifdef OBJECT_PRINT #ifdef OBJECT_PRINT
code->Print(std::cout); code->Print(std::cout);
#endif #endif
@ -5166,7 +5223,8 @@ uint64_t run_lwpc(int offset) {
CodeDesc desc; CodeDesc desc;
assm.GetCode(isolate, &desc); assm.GetCode(isolate, &desc);
Handle<Code> code = Factory::CodeBuilder(isolate, desc, Code::STUB).Build(); Handle<Code> code =
Factory::CodeBuilder(isolate, desc, CodeKind::STUB).Build();
auto f = GeneratedCode<F2>::FromCode(*code); auto f = GeneratedCode<F2>::FromCode(*code);
@ -5242,7 +5300,8 @@ uint64_t run_lwupc(int offset) {
CodeDesc desc; CodeDesc desc;
assm.GetCode(isolate, &desc); assm.GetCode(isolate, &desc);
Handle<Code> code = Factory::CodeBuilder(isolate, desc, Code::STUB).Build(); Handle<Code> code =
Factory::CodeBuilder(isolate, desc, CodeKind::STUB).Build();
auto f = GeneratedCode<F2>::FromCode(*code); auto f = GeneratedCode<F2>::FromCode(*code);
@ -5321,7 +5380,8 @@ uint64_t run_jic(int16_t offset) {
CodeDesc desc; CodeDesc desc;
assm.GetCode(isolate, &desc); assm.GetCode(isolate, &desc);
Handle<Code> code = Factory::CodeBuilder(isolate, desc, Code::STUB).Build(); Handle<Code> code =
Factory::CodeBuilder(isolate, desc, CodeKind::STUB).Build();
auto f = GeneratedCode<F2>::FromCode(*code); auto f = GeneratedCode<F2>::FromCode(*code);
@ -5391,7 +5451,8 @@ uint64_t run_beqzc(int32_t value, int32_t offset) {
CodeDesc desc; CodeDesc desc;
assm.GetCode(isolate, &desc); assm.GetCode(isolate, &desc);
Handle<Code> code = Factory::CodeBuilder(isolate, desc, Code::STUB).Build(); Handle<Code> code =
Factory::CodeBuilder(isolate, desc, CodeKind::STUB).Build();
auto f = GeneratedCode<F2>::FromCode(*code); auto f = GeneratedCode<F2>::FromCode(*code);
@ -5496,7 +5557,8 @@ void run_bz_bnz(TestCaseMsaBranch* input, Branch GenerateBranch,
CodeDesc desc; CodeDesc desc;
assm.GetCode(isolate, &desc); assm.GetCode(isolate, &desc);
Handle<Code> code = Factory::CodeBuilder(isolate, desc, Code::STUB).Build(); Handle<Code> code =
Factory::CodeBuilder(isolate, desc, CodeKind::STUB).Build();
#ifdef OBJECT_PRINT #ifdef OBJECT_PRINT
code->Print(std::cout); code->Print(std::cout);
#endif #endif
@ -5665,7 +5727,8 @@ uint64_t run_jialc(int16_t offset) {
CodeDesc desc; CodeDesc desc;
assm.GetCode(isolate, &desc); assm.GetCode(isolate, &desc);
Handle<Code> code = Factory::CodeBuilder(isolate, desc, Code::STUB).Build(); Handle<Code> code =
Factory::CodeBuilder(isolate, desc, CodeKind::STUB).Build();
auto f = GeneratedCode<F2>::FromCode(*code); auto f = GeneratedCode<F2>::FromCode(*code);
@ -5715,7 +5778,8 @@ uint64_t run_addiupc(int32_t imm19) {
CodeDesc desc; CodeDesc desc;
assm.GetCode(isolate, &desc); assm.GetCode(isolate, &desc);
Handle<Code> code = Factory::CodeBuilder(isolate, desc, Code::STUB).Build(); Handle<Code> code =
Factory::CodeBuilder(isolate, desc, CodeKind::STUB).Build();
auto f = GeneratedCode<F2>::FromCode(*code); auto f = GeneratedCode<F2>::FromCode(*code);
PC = (uint64_t)code->entry(); // Set the program counter. PC = (uint64_t)code->entry(); // Set the program counter.
@ -5789,7 +5853,8 @@ uint64_t run_ldpc(int offset) {
CodeDesc desc; CodeDesc desc;
assm.GetCode(isolate, &desc); assm.GetCode(isolate, &desc);
Handle<Code> code = Factory::CodeBuilder(isolate, desc, Code::STUB).Build(); Handle<Code> code =
Factory::CodeBuilder(isolate, desc, CodeKind::STUB).Build();
auto f = GeneratedCode<F2>::FromCode(*code); auto f = GeneratedCode<F2>::FromCode(*code);
@ -5876,7 +5941,8 @@ int64_t run_bc(int32_t offset) {
CodeDesc desc; CodeDesc desc;
assm.GetCode(isolate, &desc); assm.GetCode(isolate, &desc);
Handle<Code> code = Factory::CodeBuilder(isolate, desc, Code::STUB).Build(); Handle<Code> code =
Factory::CodeBuilder(isolate, desc, CodeKind::STUB).Build();
auto f = GeneratedCode<F2>::FromCode(*code); auto f = GeneratedCode<F2>::FromCode(*code);
@ -5956,7 +6022,8 @@ int64_t run_balc(int32_t offset) {
CodeDesc desc; CodeDesc desc;
assm.GetCode(isolate, &desc); assm.GetCode(isolate, &desc);
Handle<Code> code = Factory::CodeBuilder(isolate, desc, Code::STUB).Build(); Handle<Code> code =
Factory::CodeBuilder(isolate, desc, CodeKind::STUB).Build();
auto f = GeneratedCode<F2>::FromCode(*code); auto f = GeneratedCode<F2>::FromCode(*code);
@ -6004,7 +6071,8 @@ uint64_t run_dsll(uint64_t rt_value, uint16_t sa_value) {
CodeDesc desc; CodeDesc desc;
assm.GetCode(isolate, &desc); assm.GetCode(isolate, &desc);
Handle<Code> code = Factory::CodeBuilder(isolate, desc, Code::STUB).Build(); Handle<Code> code =
Factory::CodeBuilder(isolate, desc, CodeKind::STUB).Build();
auto f = GeneratedCode<F4>::FromCode(*code); auto f = GeneratedCode<F4>::FromCode(*code);
@ -6060,7 +6128,8 @@ uint64_t run_bal(int16_t offset) {
CodeDesc desc; CodeDesc desc;
assm.GetCode(isolate, &desc); assm.GetCode(isolate, &desc);
Handle<Code> code = Factory::CodeBuilder(isolate, desc, Code::STUB).Build(); Handle<Code> code =
Factory::CodeBuilder(isolate, desc, CodeKind::STUB).Build();
auto f = GeneratedCode<F2>::FromCode(*code); auto f = GeneratedCode<F2>::FromCode(*code);
@ -6113,7 +6182,8 @@ TEST(Trampoline) {
CodeDesc desc; CodeDesc desc;
assm.GetCode(isolate, &desc); assm.GetCode(isolate, &desc);
Handle<Code> code = Factory::CodeBuilder(isolate, desc, Code::STUB).Build(); Handle<Code> code =
Factory::CodeBuilder(isolate, desc, CodeKind::STUB).Build();
auto f = GeneratedCode<F2>::FromCode(*code); auto f = GeneratedCode<F2>::FromCode(*code);
int64_t res = reinterpret_cast<int64_t>(f.Call(42, 42, 0, 0, 0)); int64_t res = reinterpret_cast<int64_t>(f.Call(42, 42, 0, 0, 0));
@ -6239,7 +6309,8 @@ void helper_madd_msub_maddf_msubf(F func) {
CodeDesc desc; CodeDesc desc;
assm.GetCode(isolate, &desc); assm.GetCode(isolate, &desc);
Handle<Code> code = Factory::CodeBuilder(isolate, desc, Code::STUB).Build(); Handle<Code> code =
Factory::CodeBuilder(isolate, desc, CodeKind::STUB).Build();
auto f = GeneratedCode<F3>::FromCode(*code); auto f = GeneratedCode<F3>::FromCode(*code);
const size_t kTableLength = sizeof(test_cases) / sizeof(TestCaseMaddMsub<T>); const size_t kTableLength = sizeof(test_cases) / sizeof(TestCaseMaddMsub<T>);
@ -6321,7 +6392,8 @@ uint64_t run_Subu(uint64_t imm, int32_t num_instr) {
CodeDesc desc; CodeDesc desc;
assm.GetCode(isolate, &desc); assm.GetCode(isolate, &desc);
Handle<Code> code = Factory::CodeBuilder(isolate, desc, Code::STUB).Build(); Handle<Code> code =
Factory::CodeBuilder(isolate, desc, CodeKind::STUB).Build();
#ifdef OBJECT_PRINT #ifdef OBJECT_PRINT
code->Print(std::cout); code->Print(std::cout);
#endif #endif
@ -6403,7 +6475,8 @@ uint64_t run_Dsubu(uint64_t imm, int32_t num_instr) {
CodeDesc desc; CodeDesc desc;
assm.GetCode(isolate, &desc); assm.GetCode(isolate, &desc);
Handle<Code> code = Factory::CodeBuilder(isolate, desc, Code::STUB).Build(); Handle<Code> code =
Factory::CodeBuilder(isolate, desc, CodeKind::STUB).Build();
#ifdef OBJECT_PRINT #ifdef OBJECT_PRINT
code->Print(std::cout); code->Print(std::cout);
#endif #endif
@ -6498,7 +6571,8 @@ uint64_t run_Dins(uint64_t imm, uint64_t source, uint16_t pos, uint16_t size) {
CodeDesc desc; CodeDesc desc;
assm.GetCode(isolate, &desc); assm.GetCode(isolate, &desc);
Handle<Code> code = Factory::CodeBuilder(isolate, desc, Code::STUB).Build(); Handle<Code> code =
Factory::CodeBuilder(isolate, desc, CodeKind::STUB).Build();
auto f = GeneratedCode<F2>::FromCode(*code); auto f = GeneratedCode<F2>::FromCode(*code);
uint64_t res = reinterpret_cast<uint64_t>(f.Call(0, 0, 0, 0, 0)); uint64_t res = reinterpret_cast<uint64_t>(f.Call(0, 0, 0, 0, 0));
@ -6557,7 +6631,8 @@ uint64_t run_Ins(uint64_t imm, uint64_t source, uint16_t pos, uint16_t size) {
CodeDesc desc; CodeDesc desc;
assm.GetCode(isolate, &desc); assm.GetCode(isolate, &desc);
Handle<Code> code = Factory::CodeBuilder(isolate, desc, Code::STUB).Build(); Handle<Code> code =
Factory::CodeBuilder(isolate, desc, CodeKind::STUB).Build();
auto f = GeneratedCode<F2>::FromCode(*code); auto f = GeneratedCode<F2>::FromCode(*code);
uint64_t res = reinterpret_cast<uint64_t>(f.Call(0, 0, 0, 0, 0)); uint64_t res = reinterpret_cast<uint64_t>(f.Call(0, 0, 0, 0, 0));
@ -6624,7 +6699,8 @@ uint64_t run_Ext(uint64_t source, uint16_t pos, uint16_t size) {
CodeDesc desc; CodeDesc desc;
assm.GetCode(isolate, &desc); assm.GetCode(isolate, &desc);
Handle<Code> code = Factory::CodeBuilder(isolate, desc, Code::STUB).Build(); Handle<Code> code =
Factory::CodeBuilder(isolate, desc, CodeKind::STUB).Build();
auto f = GeneratedCode<F2>::FromCode(*code); auto f = GeneratedCode<F2>::FromCode(*code);
uint64_t res = reinterpret_cast<uint64_t>(f.Call(0, 0, 0, 0, 0)); uint64_t res = reinterpret_cast<uint64_t>(f.Call(0, 0, 0, 0, 0));
@ -6706,7 +6782,8 @@ TEST(MSA_fill_copy) {
CodeDesc desc; CodeDesc desc;
assm.GetCode(isolate, &desc); assm.GetCode(isolate, &desc);
Handle<Code> code = Factory::CodeBuilder(isolate, desc, Code::STUB).Build(); Handle<Code> code =
Factory::CodeBuilder(isolate, desc, CodeKind::STUB).Build();
#ifdef OBJECT_PRINT #ifdef OBJECT_PRINT
code->Print(std::cout); code->Print(std::cout);
#endif #endif
@ -6768,7 +6845,8 @@ TEST(MSA_fill_copy_2) {
CodeDesc desc; CodeDesc desc;
assm.GetCode(isolate, &desc); assm.GetCode(isolate, &desc);
Handle<Code> code = Factory::CodeBuilder(isolate, desc, Code::STUB).Build(); Handle<Code> code =
Factory::CodeBuilder(isolate, desc, CodeKind::STUB).Build();
#ifdef OBJECT_PRINT #ifdef OBJECT_PRINT
code->Print(std::cout); code->Print(std::cout);
#endif #endif
@ -6820,7 +6898,8 @@ TEST(MSA_fill_copy_3) {
CodeDesc desc; CodeDesc desc;
assm.GetCode(isolate, &desc); assm.GetCode(isolate, &desc);
Handle<Code> code = Factory::CodeBuilder(isolate, desc, Code::STUB).Build(); Handle<Code> code =
Factory::CodeBuilder(isolate, desc, CodeKind::STUB).Build();
#ifdef OBJECT_PRINT #ifdef OBJECT_PRINT
code->Print(std::cout); code->Print(std::cout);
#endif #endif
@ -6868,7 +6947,8 @@ void run_msa_insert(int64_t rs_value, int n, msa_reg_t* w) {
CodeDesc desc; CodeDesc desc;
assm.GetCode(isolate, &desc); assm.GetCode(isolate, &desc);
Handle<Code> code = Factory::CodeBuilder(isolate, desc, Code::STUB).Build(); Handle<Code> code =
Factory::CodeBuilder(isolate, desc, CodeKind::STUB).Build();
#ifdef OBJECT_PRINT #ifdef OBJECT_PRINT
code->Print(std::cout); code->Print(std::cout);
#endif #endif
@ -6977,7 +7057,8 @@ void run_msa_ctc_cfc(uint64_t value) {
CodeDesc desc; CodeDesc desc;
assm.GetCode(isolate, &desc); assm.GetCode(isolate, &desc);
Handle<Code> code = Factory::CodeBuilder(isolate, desc, Code::STUB).Build(); Handle<Code> code =
Factory::CodeBuilder(isolate, desc, CodeKind::STUB).Build();
#ifdef OBJECT_PRINT #ifdef OBJECT_PRINT
code->Print(std::cout); code->Print(std::cout);
#endif #endif
@ -7025,7 +7106,8 @@ TEST(MSA_move_v) {
CodeDesc desc; CodeDesc desc;
assm.GetCode(isolate, &desc); assm.GetCode(isolate, &desc);
Handle<Code> code = Factory::CodeBuilder(isolate, desc, Code::STUB).Build(); Handle<Code> code =
Factory::CodeBuilder(isolate, desc, CodeKind::STUB).Build();
#ifdef OBJECT_PRINT #ifdef OBJECT_PRINT
code->Print(std::cout); code->Print(std::cout);
#endif #endif
@ -7069,7 +7151,8 @@ void run_msa_sldi(OperFunc GenerateOperation,
CodeDesc desc; CodeDesc desc;
assm.GetCode(isolate, &desc); assm.GetCode(isolate, &desc);
Handle<Code> code = Factory::CodeBuilder(isolate, desc, Code::STUB).Build(); Handle<Code> code =
Factory::CodeBuilder(isolate, desc, CodeKind::STUB).Build();
#ifdef OBJECT_PRINT #ifdef OBJECT_PRINT
code->Print(std::cout); code->Print(std::cout);
#endif #endif
@ -7228,7 +7311,8 @@ void run_msa_i8(SecondaryField opcode, uint64_t ws_lo, uint64_t ws_hi,
CodeDesc desc; CodeDesc desc;
assm.GetCode(isolate, &desc); assm.GetCode(isolate, &desc);
Handle<Code> code = Factory::CodeBuilder(isolate, desc, Code::STUB).Build(); Handle<Code> code =
Factory::CodeBuilder(isolate, desc, CodeKind::STUB).Build();
#ifdef OBJECT_PRINT #ifdef OBJECT_PRINT
code->Print(std::cout); code->Print(std::cout);
#endif #endif
@ -7431,7 +7515,8 @@ void run_msa_i5(struct TestCaseMsaI5* input, bool i5_sign_ext,
CodeDesc desc; CodeDesc desc;
assm.GetCode(isolate, &desc); assm.GetCode(isolate, &desc);
Handle<Code> code = Factory::CodeBuilder(isolate, desc, Code::STUB).Build(); Handle<Code> code =
Factory::CodeBuilder(isolate, desc, CodeKind::STUB).Build();
#ifdef OBJECT_PRINT #ifdef OBJECT_PRINT
code->Print(std::cout); code->Print(std::cout);
#endif #endif
@ -7856,7 +7941,8 @@ void run_msa_2r(const struct TestCaseMsa2R* input,
CodeDesc desc; CodeDesc desc;
assm.GetCode(isolate, &desc); assm.GetCode(isolate, &desc);
Handle<Code> code = Factory::CodeBuilder(isolate, desc, Code::STUB).Build(); Handle<Code> code =
Factory::CodeBuilder(isolate, desc, CodeKind::STUB).Build();
#ifdef OBJECT_PRINT #ifdef OBJECT_PRINT
code->Print(std::cout); code->Print(std::cout);
#endif #endif
@ -8905,7 +8991,8 @@ void run_msa_vector(struct TestCaseMsaVector* input,
CodeDesc desc; CodeDesc desc;
assm.GetCode(isolate, &desc); assm.GetCode(isolate, &desc);
Handle<Code> code = Factory::CodeBuilder(isolate, desc, Code::STUB).Build(); Handle<Code> code =
Factory::CodeBuilder(isolate, desc, CodeKind::STUB).Build();
#ifdef OBJECT_PRINT #ifdef OBJECT_PRINT
code->Print(std::cout); code->Print(std::cout);
#endif #endif
@ -8992,7 +9079,8 @@ void run_msa_bit(struct TestCaseMsaBit* input, InstFunc GenerateInstructionFunc,
CodeDesc desc; CodeDesc desc;
assm.GetCode(isolate, &desc); assm.GetCode(isolate, &desc);
Handle<Code> code = Factory::CodeBuilder(isolate, desc, Code::STUB).Build(); Handle<Code> code =
Factory::CodeBuilder(isolate, desc, CodeKind::STUB).Build();
#ifdef OBJECT_PRINT #ifdef OBJECT_PRINT
code->Print(std::cout); code->Print(std::cout);
#endif #endif
@ -9464,7 +9552,8 @@ void run_msa_i10(int32_t input, InstFunc GenerateVectorInstructionFunc,
CodeDesc desc; CodeDesc desc;
assm.GetCode(isolate, &desc); assm.GetCode(isolate, &desc);
Handle<Code> code = Factory::CodeBuilder(isolate, desc, Code::STUB).Build(); Handle<Code> code =
Factory::CodeBuilder(isolate, desc, CodeKind::STUB).Build();
#ifdef OBJECT_PRINT #ifdef OBJECT_PRINT
code->Print(std::cout); code->Print(std::cout);
#endif #endif
@ -9541,7 +9630,8 @@ void run_msa_mi10(InstFunc GenerateVectorInstructionFunc) {
CodeDesc desc; CodeDesc desc;
assm.GetCode(isolate, &desc); assm.GetCode(isolate, &desc);
Handle<Code> code = Factory::CodeBuilder(isolate, desc, Code::STUB).Build(); Handle<Code> code =
Factory::CodeBuilder(isolate, desc, CodeKind::STUB).Build();
#ifdef OBJECT_PRINT #ifdef OBJECT_PRINT
code->Print(std::cout); code->Print(std::cout);
#endif #endif
@ -9619,7 +9709,8 @@ void run_msa_3r(struct TestCaseMsa3R* input, InstFunc GenerateI5InstructionFunc,
CodeDesc desc; CodeDesc desc;
assm.GetCode(isolate, &desc); assm.GetCode(isolate, &desc);
Handle<Code> code = Factory::CodeBuilder(isolate, desc, Code::STUB).Build(); Handle<Code> code =
Factory::CodeBuilder(isolate, desc, CodeKind::STUB).Build();
#ifdef OBJECT_PRINT #ifdef OBJECT_PRINT
code->Print(std::cout); code->Print(std::cout);
#endif #endif
@ -10623,7 +10714,8 @@ void run_msa_3rf(const struct TestCaseMsa3RF* input,
CodeDesc desc; CodeDesc desc;
assm.GetCode(isolate, &desc); assm.GetCode(isolate, &desc);
Handle<Code> code = Factory::CodeBuilder(isolate, desc, Code::STUB).Build(); Handle<Code> code =
Factory::CodeBuilder(isolate, desc, CodeKind::STUB).Build();
#ifdef OBJECT_PRINT #ifdef OBJECT_PRINT
code->Print(std::cout); code->Print(std::cout);
#endif #endif

View File

@ -60,7 +60,8 @@ TEST(0) {
CodeDesc desc; CodeDesc desc;
assm.GetCode(isolate, &desc); assm.GetCode(isolate, &desc);
Handle<Code> code = Factory::CodeBuilder(isolate, desc, Code::STUB).Build(); Handle<Code> code =
Factory::CodeBuilder(isolate, desc, CodeKind::STUB).Build();
#ifdef DEBUG #ifdef DEBUG
code->Print(); code->Print();
#endif #endif
@ -95,7 +96,8 @@ TEST(1) {
CodeDesc desc; CodeDesc desc;
assm.GetCode(isolate, &desc); assm.GetCode(isolate, &desc);
Handle<Code> code = Factory::CodeBuilder(isolate, desc, Code::STUB).Build(); Handle<Code> code =
Factory::CodeBuilder(isolate, desc, CodeKind::STUB).Build();
#ifdef DEBUG #ifdef DEBUG
code->Print(); code->Print();
#endif #endif
@ -142,7 +144,8 @@ TEST(2) {
CodeDesc desc; CodeDesc desc;
assm.GetCode(isolate, &desc); assm.GetCode(isolate, &desc);
Handle<Code> code = Factory::CodeBuilder(isolate, desc, Code::STUB).Build(); Handle<Code> code =
Factory::CodeBuilder(isolate, desc, CodeKind::STUB).Build();
#ifdef DEBUG #ifdef DEBUG
code->Print(); code->Print();
#endif #endif
@ -210,7 +213,8 @@ TEST(3) {
CodeDesc desc; CodeDesc desc;
assm.GetCode(isolate, &desc); assm.GetCode(isolate, &desc);
Handle<Code> code = Factory::CodeBuilder(isolate, desc, Code::STUB).Build(); Handle<Code> code =
Factory::CodeBuilder(isolate, desc, CodeKind::STUB).Build();
#ifdef DEBUG #ifdef DEBUG
code->Print(); code->Print();
#endif #endif
@ -323,7 +327,7 @@ TEST(4) {
assm.GetCode(isolate, &desc); assm.GetCode(isolate, &desc);
Object code = isolate->heap()->CreateCode( Object code = isolate->heap()->CreateCode(
desc, desc,
Code::STUB, CodeKind::STUB,
Handle<Code>())->ToObjectChecked(); Handle<Code>())->ToObjectChecked();
CHECK(code->IsCode()); CHECK(code->IsCode());
#ifdef DEBUG #ifdef DEBUG
@ -383,7 +387,7 @@ TEST(5) {
assm.GetCode(isolate, &desc); assm.GetCode(isolate, &desc);
Object code = isolate->heap()->CreateCode( Object code = isolate->heap()->CreateCode(
desc, desc,
Code::STUB, CodeKind::STUB,
Handle<Code>())->ToObjectChecked(); Handle<Code>())->ToObjectChecked();
CHECK(code->IsCode()); CHECK(code->IsCode());
#ifdef DEBUG #ifdef DEBUG
@ -418,7 +422,7 @@ TEST(6) {
assm.GetCode(isolate, &desc); assm.GetCode(isolate, &desc);
Object code = isolate->heap()->CreateCode( Object code = isolate->heap()->CreateCode(
desc, desc,
Code::STUB, CodeKind::STUB,
Handle<Code>())->ToObjectChecked(); Handle<Code>())->ToObjectChecked();
CHECK(code->IsCode()); CHECK(code->IsCode());
#ifdef DEBUG #ifdef DEBUG
@ -493,7 +497,7 @@ static void TestRoundingMode(VCVTTypes types,
assm.GetCode(isolate, &desc); assm.GetCode(isolate, &desc);
Object code = isolate->heap()->CreateCode( Object code = isolate->heap()->CreateCode(
desc, desc,
Code::STUB, CodeKind::STUB,
Handle<Code>())->ToObjectChecked(); Handle<Code>())->ToObjectChecked();
CHECK(code->IsCode()); CHECK(code->IsCode());
#ifdef DEBUG #ifdef DEBUG
@ -680,7 +684,7 @@ TEST(8) {
assm.GetCode(isolate, &desc); assm.GetCode(isolate, &desc);
Object code = isolate->heap()->CreateCode( Object code = isolate->heap()->CreateCode(
desc, desc,
Code::STUB, CodeKind::STUB,
Handle<Code>())->ToObjectChecked(); Handle<Code>())->ToObjectChecked();
CHECK(code->IsCode()); CHECK(code->IsCode());
#ifdef DEBUG #ifdef DEBUG
@ -795,7 +799,7 @@ TEST(9) {
assm.GetCode(isolate, &desc); assm.GetCode(isolate, &desc);
Object code = isolate->heap()->CreateCode( Object code = isolate->heap()->CreateCode(
desc, desc,
Code::STUB, CodeKind::STUB,
Handle<Code>())->ToObjectChecked(); Handle<Code>())->ToObjectChecked();
CHECK(code->IsCode()); CHECK(code->IsCode());
#ifdef DEBUG #ifdef DEBUG
@ -906,7 +910,7 @@ TEST(10) {
assm.GetCode(isolate, &desc); assm.GetCode(isolate, &desc);
Object code = isolate->heap()->CreateCode( Object code = isolate->heap()->CreateCode(
desc, desc,
Code::STUB, CodeKind::STUB,
Handle<Code>())->ToObjectChecked(); Handle<Code>())->ToObjectChecked();
CHECK(code->IsCode()); CHECK(code->IsCode());
#ifdef DEBUG #ifdef DEBUG
@ -1003,7 +1007,7 @@ TEST(11) {
assm.GetCode(isolate, &desc); assm.GetCode(isolate, &desc);
Object code = isolate->heap()->CreateCode( Object code = isolate->heap()->CreateCode(
desc, desc,
Code::STUB, CodeKind::STUB,
Handle<Code>())->ToObjectChecked(); Handle<Code>())->ToObjectChecked();
CHECK(code->IsCode()); CHECK(code->IsCode());
#ifdef DEBUG #ifdef DEBUG

View File

@ -63,7 +63,8 @@ TEST(0) {
CodeDesc desc; CodeDesc desc;
assm.GetCode(isolate, &desc); assm.GetCode(isolate, &desc);
Handle<Code> code = Factory::CodeBuilder(isolate, desc, Code::STUB).Build(); Handle<Code> code =
Factory::CodeBuilder(isolate, desc, CodeKind::STUB).Build();
#ifdef DEBUG #ifdef DEBUG
code->Print(); code->Print();
#endif #endif
@ -101,7 +102,8 @@ TEST(1) {
CodeDesc desc; CodeDesc desc;
assm.GetCode(isolate, &desc); assm.GetCode(isolate, &desc);
Handle<Code> code = Factory::CodeBuilder(isolate, desc, Code::STUB).Build(); Handle<Code> code =
Factory::CodeBuilder(isolate, desc, CodeKind::STUB).Build();
#ifdef DEBUG #ifdef DEBUG
code->Print(); code->Print();
#endif #endif
@ -151,7 +153,8 @@ TEST(2) {
CodeDesc desc; CodeDesc desc;
assm.GetCode(isolate, &desc); assm.GetCode(isolate, &desc);
Handle<Code> code = Factory::CodeBuilder(isolate, desc, Code::STUB).Build(); Handle<Code> code =
Factory::CodeBuilder(isolate, desc, CodeKind::STUB).Build();
#ifdef DEBUG #ifdef DEBUG
code->Print(); code->Print();
#endif #endif
@ -205,7 +208,8 @@ TEST(3) {
CodeDesc desc; CodeDesc desc;
assm.GetCode(isolate, &desc); assm.GetCode(isolate, &desc);
Handle<Code> code = Factory::CodeBuilder(isolate, desc, Code::STUB).Build(); Handle<Code> code =
Factory::CodeBuilder(isolate, desc, CodeKind::STUB).Build();
#ifdef DEBUG #ifdef DEBUG
code->Print(); code->Print();
#endif #endif
@ -246,7 +250,7 @@ TEST(4) {
CodeDesc desc; CodeDesc desc;
assm.GetCode(isolate, &desc); assm.GetCode(isolate, &desc);
Handle<Code> code = isolate->factory()->NewCode( Handle<Code> code = isolate->factory()->NewCode(
desc, Code::STUB, Handle<Code>()); desc, CodeKind::STUB, Handle<Code>());
#ifdef DEBUG #ifdef DEBUG
code->Print(); code->Print();
#endif #endif
@ -274,7 +278,7 @@ TEST(5) {
CodeDesc desc; CodeDesc desc;
assm.GetCode(isolate, &desc); assm.GetCode(isolate, &desc);
Handle<Code> code = isolate->factory()->NewCode( Handle<Code> code = isolate->factory()->NewCode(
desc, Code::STUB, Handle<Code>()); desc, CodeKind::STUB, Handle<Code>());
#ifdef DEBUG #ifdef DEBUG
code->Print(); code->Print();
#endif #endif
@ -308,7 +312,7 @@ TEST(6) {
CodeDesc desc; CodeDesc desc;
assm.GetCode(isolate, &desc); assm.GetCode(isolate, &desc);
Handle<Code> code = isolate->factory()->NewCode( Handle<Code> code = isolate->factory()->NewCode(
desc, Code::STUB, Handle<Code>()); desc, CodeKind::STUB, Handle<Code>());
#ifdef DEBUG #ifdef DEBUG
code->Print(); code->Print();
#endif #endif
@ -340,7 +344,7 @@ TEST(7) {
CodeDesc desc; CodeDesc desc;
assm.GetCode(isolate, &desc); assm.GetCode(isolate, &desc);
Handle<Code> code = isolate->factory()->NewCode( Handle<Code> code = isolate->factory()->NewCode(
desc, Code::STUB, Handle<Code>()); desc, CodeKind::STUB, Handle<Code>());
#ifdef DEBUG #ifdef DEBUG
code->Print(); code->Print();
#endif #endif
@ -371,7 +375,7 @@ TEST(8) {
CodeDesc desc; CodeDesc desc;
assm.GetCode(isolate, &desc); assm.GetCode(isolate, &desc);
Handle<Code> code = isolate->factory()->NewCode( Handle<Code> code = isolate->factory()->NewCode(
desc, Code::STUB, Handle<Code>()); desc, CodeKind::STUB, Handle<Code>());
#ifdef DEBUG #ifdef DEBUG
code->Print(); code->Print();
#endif #endif
@ -398,7 +402,7 @@ TEST(9) {
CodeDesc desc; CodeDesc desc;
assm.GetCode(isolate, &desc); assm.GetCode(isolate, &desc);
Handle<Code> code = isolate->factory()->NewCode( Handle<Code> code = isolate->factory()->NewCode(
desc, Code::STUB, Handle<Code>()); desc, CodeKind::STUB, Handle<Code>());
#ifdef DEBUG #ifdef DEBUG
code->Print(); code->Print();
#endif #endif
@ -482,7 +486,8 @@ TEST(10) {
CodeDesc desc; CodeDesc desc;
assm.GetCode(isolate, &desc); assm.GetCode(isolate, &desc);
Handle<Code> code = Factory::CodeBuilder(isolate, desc, Code::STUB).Build(); Handle<Code> code =
Factory::CodeBuilder(isolate, desc, CodeKind::STUB).Build();
#ifdef DEBUG #ifdef DEBUG
code->Print(); code->Print();
#endif #endif
@ -535,7 +540,8 @@ TEST(11) {
CodeDesc desc; CodeDesc desc;
assm.GetCode(isolate, &desc); assm.GetCode(isolate, &desc);
Handle<Code> code = Factory::CodeBuilder(isolate, desc, Code::STUB).Build(); Handle<Code> code =
Factory::CodeBuilder(isolate, desc, CodeKind::STUB).Build();
#ifdef DEBUG #ifdef DEBUG
code->Print(); code->Print();
#endif #endif
@ -588,7 +594,8 @@ TEST(12) {
CodeDesc desc; CodeDesc desc;
assm.GetCode(isolate, &desc); assm.GetCode(isolate, &desc);
Handle<Code> code = Factory::CodeBuilder(isolate, desc, Code::STUB).Build(); Handle<Code> code =
Factory::CodeBuilder(isolate, desc, CodeKind::STUB).Build();
#ifdef DEBUG #ifdef DEBUG
code->Print(); code->Print();
#endif #endif
@ -651,7 +658,8 @@ TEST(13) {
CodeDesc desc; CodeDesc desc;
assm.GetCode(isolate, &desc); assm.GetCode(isolate, &desc);
Handle<Code> code = Factory::CodeBuilder(isolate, desc, Code::STUB).Build(); Handle<Code> code =
Factory::CodeBuilder(isolate, desc, CodeKind::STUB).Build();
#ifdef DEBUG #ifdef DEBUG
code->Print(); code->Print();
#endif #endif
@ -741,7 +749,8 @@ TEST(14) {
CodeDesc desc; CodeDesc desc;
assm.GetCode(isolate, &desc); assm.GetCode(isolate, &desc);
Handle<Code> code = Factory::CodeBuilder(isolate, desc, Code::STUB).Build(); Handle<Code> code =
Factory::CodeBuilder(isolate, desc, CodeKind::STUB).Build();
#ifdef DEBUG #ifdef DEBUG
code->Print(); code->Print();
#endif #endif
@ -830,7 +839,8 @@ TEST(15) {
CodeDesc desc; CodeDesc desc;
assm.GetCode(isolate, &desc); assm.GetCode(isolate, &desc);
Handle<Code> code = Factory::CodeBuilder(isolate, desc, Code::STUB).Build(); Handle<Code> code =
Factory::CodeBuilder(isolate, desc, CodeKind::STUB).Build();
#ifdef DEBUG #ifdef DEBUG
code->Print(); code->Print();
#endif #endif
@ -876,7 +886,8 @@ TEST(16) {
CodeDesc desc; CodeDesc desc;
assm.GetCode(isolate, &desc); assm.GetCode(isolate, &desc);
Handle<Code> code = Factory::CodeBuilder(isolate, desc, Code::STUB).Build(); Handle<Code> code =
Factory::CodeBuilder(isolate, desc, CodeKind::STUB).Build();
#ifdef DEBUG #ifdef DEBUG
code->Print(); code->Print();
#endif #endif
@ -949,7 +960,8 @@ TEST(17) {
CodeDesc desc; CodeDesc desc;
assm.GetCode(isolate, &desc); assm.GetCode(isolate, &desc);
Handle<Code> code = Factory::CodeBuilder(isolate, desc, Code::STUB).Build(); Handle<Code> code =
Factory::CodeBuilder(isolate, desc, CodeKind::STUB).Build();
#ifdef DEBUG #ifdef DEBUG
code->Print(); code->Print();
#endif #endif
@ -1040,7 +1052,8 @@ TEST(18) {
CodeDesc desc; CodeDesc desc;
assm.GetCode(isolate, &desc); assm.GetCode(isolate, &desc);
Handle<Code> code = Factory::CodeBuilder(isolate, desc, Code::STUB).Build(); Handle<Code> code =
Factory::CodeBuilder(isolate, desc, CodeKind::STUB).Build();
#ifdef DEBUG #ifdef DEBUG
code->Print(); code->Print();
#endif #endif

View File

@ -743,7 +743,8 @@ TEST(AssemblerMultiByteNop) {
CodeDesc desc; CodeDesc desc;
masm.GetCode(isolate, &desc); masm.GetCode(isolate, &desc);
Handle<Code> code = Factory::CodeBuilder(isolate, desc, Code::STUB).Build(); Handle<Code> code =
Factory::CodeBuilder(isolate, desc, CodeKind::STUB).Build();
auto f = GeneratedCode<F0>::FromCode(*code); auto f = GeneratedCode<F0>::FromCode(*code);
int res = f.Call(); int res = f.Call();
@ -799,7 +800,8 @@ void DoSSE2(const v8::FunctionCallbackInfo<v8::Value>& args) {
CodeDesc desc; CodeDesc desc;
masm.GetCode(isolate, &desc); masm.GetCode(isolate, &desc);
Handle<Code> code = Factory::CodeBuilder(isolate, desc, Code::STUB).Build(); Handle<Code> code =
Factory::CodeBuilder(isolate, desc, CodeKind::STUB).Build();
auto f = GeneratedCode<F0>::FromCode(*code); auto f = GeneratedCode<F0>::FromCode(*code);
int res = f.Call(); int res = f.Call();
@ -863,7 +865,8 @@ TEST(AssemblerX64Extractps) {
CodeDesc desc; CodeDesc desc;
masm.GetCode(isolate, &desc); masm.GetCode(isolate, &desc);
Handle<Code> code = Factory::CodeBuilder(isolate, desc, Code::STUB).Build(); Handle<Code> code =
Factory::CodeBuilder(isolate, desc, CodeKind::STUB).Build();
#ifdef OBJECT_PRINT #ifdef OBJECT_PRINT
StdoutStream os; StdoutStream os;
code->Print(os); code->Print(os);
@ -899,7 +902,8 @@ TEST(AssemblerX64SSE) {
CodeDesc desc; CodeDesc desc;
masm.GetCode(isolate, &desc); masm.GetCode(isolate, &desc);
Handle<Code> code = Factory::CodeBuilder(isolate, desc, Code::STUB).Build(); Handle<Code> code =
Factory::CodeBuilder(isolate, desc, CodeKind::STUB).Build();
#ifdef OBJECT_PRINT #ifdef OBJECT_PRINT
StdoutStream os; StdoutStream os;
code->Print(os); code->Print(os);
@ -929,7 +933,8 @@ TEST(AssemblerX64SSE3) {
CodeDesc desc; CodeDesc desc;
masm.GetCode(isolate, &desc); masm.GetCode(isolate, &desc);
Handle<Code> code = Factory::CodeBuilder(isolate, desc, Code::STUB).Build(); Handle<Code> code =
Factory::CodeBuilder(isolate, desc, CodeKind::STUB).Build();
#ifdef OBJECT_PRINT #ifdef OBJECT_PRINT
StdoutStream os; StdoutStream os;
code->Print(os); code->Print(os);
@ -1153,7 +1158,8 @@ TEST(AssemblerX64FMA_sd) {
CodeDesc desc; CodeDesc desc;
masm.GetCode(isolate, &desc); masm.GetCode(isolate, &desc);
Handle<Code> code = Factory::CodeBuilder(isolate, desc, Code::STUB).Build(); Handle<Code> code =
Factory::CodeBuilder(isolate, desc, CodeKind::STUB).Build();
#ifdef OBJECT_PRINT #ifdef OBJECT_PRINT
StdoutStream os; StdoutStream os;
code->Print(os); code->Print(os);
@ -1378,7 +1384,8 @@ TEST(AssemblerX64FMA_ss) {
CodeDesc desc; CodeDesc desc;
masm.GetCode(isolate, &desc); masm.GetCode(isolate, &desc);
Handle<Code> code = Factory::CodeBuilder(isolate, desc, Code::STUB).Build(); Handle<Code> code =
Factory::CodeBuilder(isolate, desc, CodeKind::STUB).Build();
#ifdef OBJECT_PRINT #ifdef OBJECT_PRINT
StdoutStream os; StdoutStream os;
code->Print(os); code->Print(os);
@ -1453,7 +1460,8 @@ TEST(AssemblerX64SSE_ss) {
CodeDesc desc; CodeDesc desc;
masm.GetCode(isolate, &desc); masm.GetCode(isolate, &desc);
Handle<Code> code = Factory::CodeBuilder(isolate, desc, Code::STUB).Build(); Handle<Code> code =
Factory::CodeBuilder(isolate, desc, CodeKind::STUB).Build();
#ifdef OBJECT_PRINT #ifdef OBJECT_PRINT
StdoutStream os; StdoutStream os;
code->Print(os); code->Print(os);
@ -1538,7 +1546,8 @@ TEST(AssemblerX64AVX_ss) {
CodeDesc desc; CodeDesc desc;
masm.GetCode(isolate, &desc); masm.GetCode(isolate, &desc);
Handle<Code> code = Factory::CodeBuilder(isolate, desc, Code::STUB).Build(); Handle<Code> code =
Factory::CodeBuilder(isolate, desc, CodeKind::STUB).Build();
#ifdef OBJECT_PRINT #ifdef OBJECT_PRINT
StdoutStream os; StdoutStream os;
code->Print(os); code->Print(os);
@ -1777,7 +1786,8 @@ TEST(AssemblerX64AVX_sd) {
CodeDesc desc; CodeDesc desc;
masm.GetCode(isolate, &desc); masm.GetCode(isolate, &desc);
Handle<Code> code = Factory::CodeBuilder(isolate, desc, Code::STUB).Build(); Handle<Code> code =
Factory::CodeBuilder(isolate, desc, CodeKind::STUB).Build();
#ifdef OBJECT_PRINT #ifdef OBJECT_PRINT
StdoutStream os; StdoutStream os;
code->Print(os); code->Print(os);
@ -1968,7 +1978,8 @@ TEST(AssemblerX64BMI1) {
CodeDesc desc; CodeDesc desc;
masm.GetCode(isolate, &desc); masm.GetCode(isolate, &desc);
Handle<Code> code = Factory::CodeBuilder(isolate, desc, Code::STUB).Build(); Handle<Code> code =
Factory::CodeBuilder(isolate, desc, CodeKind::STUB).Build();
#ifdef OBJECT_PRINT #ifdef OBJECT_PRINT
StdoutStream os; StdoutStream os;
code->Print(os); code->Print(os);
@ -2027,7 +2038,8 @@ TEST(AssemblerX64LZCNT) {
CodeDesc desc; CodeDesc desc;
masm.GetCode(isolate, &desc); masm.GetCode(isolate, &desc);
Handle<Code> code = Factory::CodeBuilder(isolate, desc, Code::STUB).Build(); Handle<Code> code =
Factory::CodeBuilder(isolate, desc, CodeKind::STUB).Build();
#ifdef OBJECT_PRINT #ifdef OBJECT_PRINT
StdoutStream os; StdoutStream os;
code->Print(os); code->Print(os);
@ -2086,7 +2098,8 @@ TEST(AssemblerX64POPCNT) {
CodeDesc desc; CodeDesc desc;
masm.GetCode(isolate, &desc); masm.GetCode(isolate, &desc);
Handle<Code> code = Factory::CodeBuilder(isolate, desc, Code::STUB).Build(); Handle<Code> code =
Factory::CodeBuilder(isolate, desc, CodeKind::STUB).Build();
#ifdef OBJECT_PRINT #ifdef OBJECT_PRINT
StdoutStream os; StdoutStream os;
code->Print(os); code->Print(os);
@ -2348,7 +2361,8 @@ TEST(AssemblerX64BMI2) {
CodeDesc desc; CodeDesc desc;
masm.GetCode(isolate, &desc); masm.GetCode(isolate, &desc);
Handle<Code> code = Factory::CodeBuilder(isolate, desc, Code::STUB).Build(); Handle<Code> code =
Factory::CodeBuilder(isolate, desc, CodeKind::STUB).Build();
#ifdef OBJECT_PRINT #ifdef OBJECT_PRINT
StdoutStream os; StdoutStream os;
code->Print(os); code->Print(os);
@ -2391,7 +2405,8 @@ TEST(AssemblerX64JumpTables1) {
CodeDesc desc; CodeDesc desc;
masm.GetCode(isolate, &desc); masm.GetCode(isolate, &desc);
Handle<Code> code = Factory::CodeBuilder(isolate, desc, Code::STUB).Build(); Handle<Code> code =
Factory::CodeBuilder(isolate, desc, CodeKind::STUB).Build();
#ifdef OBJECT_PRINT #ifdef OBJECT_PRINT
code->Print(std::cout); code->Print(std::cout);
#endif #endif
@ -2438,7 +2453,8 @@ TEST(AssemblerX64JumpTables2) {
CodeDesc desc; CodeDesc desc;
masm.GetCode(isolate, &desc); masm.GetCode(isolate, &desc);
Handle<Code> code = Factory::CodeBuilder(isolate, desc, Code::STUB).Build(); Handle<Code> code =
Factory::CodeBuilder(isolate, desc, CodeKind::STUB).Build();
#ifdef OBJECT_PRINT #ifdef OBJECT_PRINT
code->Print(std::cout); code->Print(std::cout);
#endif #endif
@ -2494,7 +2510,8 @@ TEST(AssemblerX64vmovups) {
CodeDesc desc; CodeDesc desc;
masm.GetCode(isolate, &desc); masm.GetCode(isolate, &desc);
Handle<Code> code = Factory::CodeBuilder(isolate, desc, Code::STUB).Build(); Handle<Code> code =
Factory::CodeBuilder(isolate, desc, CodeKind::STUB).Build();
#ifdef OBJECT_PRINT #ifdef OBJECT_PRINT
StdoutStream os; StdoutStream os;
code->Print(os); code->Print(os);

View File

@ -40,7 +40,8 @@ TEST(CodeLayoutWithoutUnwindingInfo) {
code_desc.origin = nullptr; code_desc.origin = nullptr;
Handle<Code> code = Handle<Code> code =
Factory::CodeBuilder(CcTest::i_isolate(), code_desc, Code::STUB).Build(); Factory::CodeBuilder(CcTest::i_isolate(), code_desc, CodeKind::STUB)
.Build();
CHECK(!code->has_unwinding_info()); CHECK(!code->has_unwinding_info());
CHECK_EQ(code->raw_instruction_size(), buffer_size); CHECK_EQ(code->raw_instruction_size(), buffer_size);
@ -86,7 +87,8 @@ TEST(CodeLayoutWithUnwindingInfo) {
code_desc.origin = nullptr; code_desc.origin = nullptr;
Handle<Code> code = Handle<Code> code =
Factory::CodeBuilder(CcTest::i_isolate(), code_desc, Code::STUB).Build(); Factory::CodeBuilder(CcTest::i_isolate(), code_desc, CodeKind::STUB)
.Build();
CHECK(code->has_unwinding_info()); CHECK(code->has_unwinding_info());
CHECK_EQ(code->raw_instruction_size(), buffer_size); CHECK_EQ(code->raw_instruction_size(), buffer_size);

View File

@ -282,7 +282,7 @@ TEST(LargeCodeObject) {
{ {
HandleScope scope(i_isolate); HandleScope scope(i_isolate);
Handle<Code> foo_code = Handle<Code> foo_code =
Factory::CodeBuilder(i_isolate, desc, Code::WASM_FUNCTION).Build(); Factory::CodeBuilder(i_isolate, desc, CodeKind::WASM_FUNCTION).Build();
CHECK(i_isolate->heap()->InSpace(*foo_code, CODE_LO_SPACE)); CHECK(i_isolate->heap()->InSpace(*foo_code, CODE_LO_SPACE));
@ -407,7 +407,7 @@ TEST(LargeCodeObjectWithSignalHandler) {
{ {
HandleScope scope(i_isolate); HandleScope scope(i_isolate);
Handle<Code> foo_code = Handle<Code> foo_code =
Factory::CodeBuilder(i_isolate, desc, Code::WASM_FUNCTION).Build(); Factory::CodeBuilder(i_isolate, desc, CodeKind::WASM_FUNCTION).Build();
CHECK(i_isolate->heap()->InSpace(*foo_code, CODE_LO_SPACE)); CHECK(i_isolate->heap()->InSpace(*foo_code, CODE_LO_SPACE));
@ -482,7 +482,8 @@ TEST(Sorted) {
Handle<Code> code1, code3; Handle<Code> code1, code3;
Address code2_address; Address code2_address;
code1 = Factory::CodeBuilder(i_isolate, desc, Code::WASM_FUNCTION).Build(); code1 =
Factory::CodeBuilder(i_isolate, desc, CodeKind::WASM_FUNCTION).Build();
CHECK(i_isolate->heap()->InSpace(*code1, CODE_LO_SPACE)); CHECK(i_isolate->heap()->InSpace(*code1, CODE_LO_SPACE));
{ {
@ -491,10 +492,11 @@ TEST(Sorted) {
// Create three large code objects, we'll delete the middle one and check // Create three large code objects, we'll delete the middle one and check
// everything is still sorted. // everything is still sorted.
Handle<Code> code2 = Handle<Code> code2 =
Factory::CodeBuilder(i_isolate, desc, Code::WASM_FUNCTION).Build(); Factory::CodeBuilder(i_isolate, desc, CodeKind::WASM_FUNCTION)
.Build();
CHECK(i_isolate->heap()->InSpace(*code2, CODE_LO_SPACE)); CHECK(i_isolate->heap()->InSpace(*code2, CODE_LO_SPACE));
code3 = code3 = Factory::CodeBuilder(i_isolate, desc, CodeKind::WASM_FUNCTION)
Factory::CodeBuilder(i_isolate, desc, Code::WASM_FUNCTION).Build(); .Build();
CHECK(i_isolate->heap()->InSpace(*code3, CODE_LO_SPACE)); CHECK(i_isolate->heap()->InSpace(*code3, CODE_LO_SPACE));
code2_address = code2->address(); code2_address = code2->address();

View File

@ -4398,7 +4398,7 @@ TEST(BuiltinsExceptionPrediction) {
bool fail = false; bool fail = false;
for (int i = 0; i < i::Builtins::builtin_count; i++) { for (int i = 0; i < i::Builtins::builtin_count; i++) {
i::Code builtin = builtins->builtin(i); i::Code builtin = builtins->builtin(i);
if (builtin.kind() != i::Code::BUILTIN) continue; if (builtin.kind() != i::CodeKind::BUILTIN) continue;
auto prediction = builtin.GetBuiltinCatchPrediction(); auto prediction = builtin.GetBuiltinCatchPrediction();
USE(prediction); USE(prediction);
} }

View File

@ -984,7 +984,8 @@ TEST(DisasmIa320) {
CodeDesc desc; CodeDesc desc;
assm.GetCode(isolate, &desc); assm.GetCode(isolate, &desc);
Handle<Code> code = Factory::CodeBuilder(isolate, desc, Code::STUB).Build(); Handle<Code> code =
Factory::CodeBuilder(isolate, desc, CodeKind::STUB).Build();
USE(code); USE(code);
#ifdef OBJECT_PRINT #ifdef OBJECT_PRINT
StdoutStream os; StdoutStream os;

View File

@ -982,7 +982,8 @@ TEST(DisasmX64) {
CodeDesc desc; CodeDesc desc;
assm.GetCode(isolate, &desc); assm.GetCode(isolate, &desc);
Handle<Code> code = Factory::CodeBuilder(isolate, desc, Code::STUB).Build(); Handle<Code> code =
Factory::CodeBuilder(isolate, desc, CodeKind::STUB).Build();
USE(code); USE(code);
#ifdef OBJECT_PRINT #ifdef OBJECT_PRINT
StdoutStream os; StdoutStream os;

View File

@ -73,7 +73,7 @@ TEST(Factory_CodeBuilder) {
desc.unwinding_info_size = 0; desc.unwinding_info_size = 0;
desc.origin = nullptr; desc.origin = nullptr;
Handle<Code> code = Handle<Code> code =
Factory::CodeBuilder(isolate, desc, Code::WASM_FUNCTION).Build(); Factory::CodeBuilder(isolate, desc, CodeKind::WASM_FUNCTION).Build();
CHECK(isolate->heap()->InSpace(*code, CODE_LO_SPACE)); CHECK(isolate->heap()->InSpace(*code, CODE_LO_SPACE));
#if VERIFY_HEAP #if VERIFY_HEAP
@ -89,9 +89,9 @@ UNINITIALIZED_TEST(Factory_CodeBuilder_BuildOOM) {
desc.instr_size = kInstructionSize; desc.instr_size = kInstructionSize;
desc.buffer = instructions.get(); desc.buffer = instructions.get();
const Handle<Code> code = const Handle<Code> code = Factory::CodeBuilder(isolate_scope.isolate(), desc,
Factory::CodeBuilder(isolate_scope.isolate(), desc, Code::WASM_FUNCTION) CodeKind::WASM_FUNCTION)
.Build(); .Build();
CHECK(!code.is_null()); CHECK(!code.is_null());
CHECK(isolate_scope.oom_triggered()); CHECK(isolate_scope.oom_triggered());
@ -106,7 +106,8 @@ UNINITIALIZED_TEST(Factory_CodeBuilder_TryBuildOOM) {
desc.buffer = instructions.get(); desc.buffer = instructions.get();
const MaybeHandle<Code> code = const MaybeHandle<Code> code =
Factory::CodeBuilder(isolate_scope.isolate(), desc, Code::WASM_FUNCTION) Factory::CodeBuilder(isolate_scope.isolate(), desc,
CodeKind::WASM_FUNCTION)
.TryBuild(); .TryBuild();
CHECK(code.is_null()); CHECK(code.is_null());

View File

@ -585,7 +585,7 @@ Handle<Code> CreateDummyOptimizedCode(Isolate* isolate) {
desc.buffer = buffer; desc.buffer = buffer;
desc.buffer_size = arraysize(buffer); desc.buffer_size = arraysize(buffer);
desc.instr_size = arraysize(buffer); desc.instr_size = arraysize(buffer);
return Factory::CodeBuilder(isolate, desc, Code::OPTIMIZED_FUNCTION) return Factory::CodeBuilder(isolate, desc, CodeKind::OPTIMIZED_FUNCTION)
.set_is_turbofanned() .set_is_turbofanned()
.Build(); .Build();
} }

View File

@ -4075,7 +4075,7 @@ TEST(WeakReference) {
i::CodeDesc desc; i::CodeDesc desc;
assm.GetCode(i_isolate, &desc); assm.GetCode(i_isolate, &desc);
i::Handle<i::Code> code = i::Handle<i::Code> code =
i::Factory::CodeBuilder(i_isolate, desc, i::Code::STUB).Build(); i::Factory::CodeBuilder(i_isolate, desc, i::CodeKind::STUB).Build();
CHECK(code->IsCode()); CHECK(code->IsCode());
fv->set_optimized_code_weak_or_smi(i::HeapObjectReference::Weak(*code)); fv->set_optimized_code_weak_or_smi(i::HeapObjectReference::Weak(*code));

View File

@ -146,7 +146,8 @@ TEST(ExtractLane) {
CodeDesc desc; CodeDesc desc;
masm->GetCode(isolate, &desc); masm->GetCode(isolate, &desc);
Handle<Code> code = Factory::CodeBuilder(isolate, desc, Code::STUB).Build(); Handle<Code> code =
Factory::CodeBuilder(isolate, desc, CodeKind::STUB).Build();
#ifdef DEBUG #ifdef DEBUG
StdoutStream os; StdoutStream os;
code->Print(os); code->Print(os);
@ -276,7 +277,8 @@ TEST(ReplaceLane) {
CodeDesc desc; CodeDesc desc;
masm->GetCode(isolate, &desc); masm->GetCode(isolate, &desc);
Handle<Code> code = Factory::CodeBuilder(isolate, desc, Code::STUB).Build(); Handle<Code> code =
Factory::CodeBuilder(isolate, desc, CodeKind::STUB).Build();
#ifdef DEBUG #ifdef DEBUG
StdoutStream os; StdoutStream os;
code->Print(os); code->Print(os);

View File

@ -65,7 +65,8 @@ TEST(EmbeddedObj) {
CodeDesc desc; CodeDesc desc;
masm.GetCode(isolate, &desc); masm.GetCode(isolate, &desc);
Handle<Code> code = Factory::CodeBuilder(isolate, desc, Code::STUB).Build(); Handle<Code> code =
Factory::CodeBuilder(isolate, desc, CodeKind::STUB).Build();
#ifdef DEBUG #ifdef DEBUG
StdoutStream os; StdoutStream os;
code->Print(os); code->Print(os);

View File

@ -88,7 +88,8 @@ TEST(BYTESWAP) {
CodeDesc desc; CodeDesc desc;
masm->GetCode(isolate, &desc); masm->GetCode(isolate, &desc);
Handle<Code> code = Factory::CodeBuilder(isolate, desc, Code::STUB).Build(); Handle<Code> code =
Factory::CodeBuilder(isolate, desc, CodeKind::STUB).Build();
auto f = GeneratedCode<F3>::FromCode(*code); auto f = GeneratedCode<F3>::FromCode(*code);
for (size_t i = 0; i < arraysize(test_values); i++) { for (size_t i = 0; i < arraysize(test_values); i++) {
@ -197,7 +198,8 @@ TEST(jump_tables4) {
CodeDesc desc; CodeDesc desc;
masm->GetCode(isolate, &desc); masm->GetCode(isolate, &desc);
Handle<Code> code = Factory::CodeBuilder(isolate, desc, Code::STUB).Build(); Handle<Code> code =
Factory::CodeBuilder(isolate, desc, CodeKind::STUB).Build();
#ifdef OBJECT_PRINT #ifdef OBJECT_PRINT
code->Print(std::cout); code->Print(std::cout);
#endif #endif
@ -259,7 +261,8 @@ TEST(jump_tables5) {
CodeDesc desc; CodeDesc desc;
masm->GetCode(isolate, &desc); masm->GetCode(isolate, &desc);
Handle<Code> code = Factory::CodeBuilder(isolate, desc, Code::STUB).Build(); Handle<Code> code =
Factory::CodeBuilder(isolate, desc, CodeKind::STUB).Build();
#ifdef OBJECT_PRINT #ifdef OBJECT_PRINT
code->Print(std::cout); code->Print(std::cout);
#endif #endif
@ -346,7 +349,8 @@ TEST(jump_tables6) {
CodeDesc desc; CodeDesc desc;
masm->GetCode(isolate, &desc); masm->GetCode(isolate, &desc);
Handle<Code> code = Factory::CodeBuilder(isolate, desc, Code::STUB).Build(); Handle<Code> code =
Factory::CodeBuilder(isolate, desc, CodeKind::STUB).Build();
#ifdef OBJECT_PRINT #ifdef OBJECT_PRINT
code->Print(std::cout); code->Print(std::cout);
#endif #endif
@ -370,7 +374,8 @@ static uint32_t run_lsa(uint32_t rt, uint32_t rs, int8_t sa) {
CodeDesc desc; CodeDesc desc;
assembler.GetCode(isolate, &desc); assembler.GetCode(isolate, &desc);
Handle<Code> code = Factory::CodeBuilder(isolate, desc, Code::STUB).Build(); Handle<Code> code =
Factory::CodeBuilder(isolate, desc, CodeKind::STUB).Build();
auto f = GeneratedCode<F1>::FromCode(*code); auto f = GeneratedCode<F1>::FromCode(*code);
@ -497,7 +502,8 @@ RET_TYPE run_Cvt(IN_TYPE x, Func GenerateConvertInstructionFunc) {
CodeDesc desc; CodeDesc desc;
assm.GetCode(isolate, &desc); assm.GetCode(isolate, &desc);
Handle<Code> code = Factory::CodeBuilder(isolate, desc, Code::STUB).Build(); Handle<Code> code =
Factory::CodeBuilder(isolate, desc, CodeKind::STUB).Build();
auto f = GeneratedCode<F_CVT>::FromCode(*code); auto f = GeneratedCode<F_CVT>::FromCode(*code);
@ -609,7 +615,7 @@ TEST(OverflowInstructions) {
CodeDesc desc; CodeDesc desc;
masm->GetCode(isolate, &desc); masm->GetCode(isolate, &desc);
Handle<Code> code = Handle<Code> code =
Factory::CodeBuilder(isolate, desc, Code::STUB).Build(); Factory::CodeBuilder(isolate, desc, CodeKind::STUB).Build();
auto f = GeneratedCode<F3>::FromCode(*code); auto f = GeneratedCode<F3>::FromCode(*code);
t.lhs = ii; t.lhs = ii;
t.rhs = jj; t.rhs = jj;
@ -731,7 +737,8 @@ TEST(min_max_nan) {
CodeDesc desc; CodeDesc desc;
masm->GetCode(isolate, &desc); masm->GetCode(isolate, &desc);
Handle<Code> code = Factory::CodeBuilder(isolate, desc, Code::STUB).Build(); Handle<Code> code =
Factory::CodeBuilder(isolate, desc, CodeKind::STUB).Build();
auto f = GeneratedCode<F3>::FromCode(*code); auto f = GeneratedCode<F3>::FromCode(*code);
for (int i = 0; i < kTableLength; i++) { for (int i = 0; i < kTableLength; i++) {
test.a = inputsa[i]; test.a = inputsa[i];
@ -765,7 +772,8 @@ bool run_Unaligned(char* memory_buffer, int32_t in_offset, int32_t out_offset,
CodeDesc desc; CodeDesc desc;
assm.GetCode(isolate, &desc); assm.GetCode(isolate, &desc);
Handle<Code> code = Factory::CodeBuilder(isolate, desc, Code::STUB).Build(); Handle<Code> code =
Factory::CodeBuilder(isolate, desc, CodeKind::STUB).Build();
auto f = GeneratedCode<F_CVT>::FromCode(*code); auto f = GeneratedCode<F_CVT>::FromCode(*code);
@ -1011,7 +1019,8 @@ bool run_Sltu(uint32_t rs, uint32_t rd, Func GenerateSltuInstructionFunc) {
CodeDesc desc; CodeDesc desc;
assm.GetCode(isolate, &desc); assm.GetCode(isolate, &desc);
Handle<Code> code = Factory::CodeBuilder(isolate, desc, Code::STUB).Build(); Handle<Code> code =
Factory::CodeBuilder(isolate, desc, CodeKind::STUB).Build();
auto f = GeneratedCode<F_CVT>::FromCode(*code); auto f = GeneratedCode<F_CVT>::FromCode(*code);
int32_t res = reinterpret_cast<int32_t>(f.Call(rs, rd, 0, 0, 0)); int32_t res = reinterpret_cast<int32_t>(f.Call(rs, rd, 0, 0, 0));
@ -1105,7 +1114,7 @@ static GeneratedCode<F4> GenerateMacroFloat32MinMax(MacroAssembler* masm) {
CodeDesc desc; CodeDesc desc;
masm->GetCode(masm->isolate(), &desc); masm->GetCode(masm->isolate(), &desc);
Handle<Code> code = Handle<Code> code =
Factory::CodeBuilder(masm->isolate(), desc, Code::STUB).Build(); Factory::CodeBuilder(masm->isolate(), desc, CodeKind::STUB).Build();
#ifdef DEBUG #ifdef DEBUG
StdoutStream os; StdoutStream os;
code->Print(os); code->Print(os);
@ -1246,7 +1255,7 @@ static GeneratedCode<F4> GenerateMacroFloat64MinMax(MacroAssembler* masm) {
CodeDesc desc; CodeDesc desc;
masm->GetCode(masm->isolate(), &desc); masm->GetCode(masm->isolate(), &desc);
Handle<Code> code = Handle<Code> code =
Factory::CodeBuilder(masm->isolate(), desc, Code::STUB).Build(); Factory::CodeBuilder(masm->isolate(), desc, CodeKind::STUB).Build();
#ifdef DEBUG #ifdef DEBUG
StdoutStream os; StdoutStream os;
code->Print(os); code->Print(os);

View File

@ -108,7 +108,8 @@ TEST(BYTESWAP) {
CodeDesc desc; CodeDesc desc;
masm->GetCode(isolate, &desc); masm->GetCode(isolate, &desc);
Handle<Code> code = Factory::CodeBuilder(isolate, desc, Code::STUB).Build(); Handle<Code> code =
Factory::CodeBuilder(isolate, desc, CodeKind::STUB).Build();
auto f = GeneratedCode<F3>::FromCode(*code); auto f = GeneratedCode<F3>::FromCode(*code);
for (size_t i = 0; i < arraysize(test_values); i++) { for (size_t i = 0; i < arraysize(test_values); i++) {
@ -162,7 +163,8 @@ TEST(LoadConstants) {
CodeDesc desc; CodeDesc desc;
masm->GetCode(isolate, &desc); masm->GetCode(isolate, &desc);
Handle<Code> code = Factory::CodeBuilder(isolate, desc, Code::STUB).Build(); Handle<Code> code =
Factory::CodeBuilder(isolate, desc, CodeKind::STUB).Build();
auto f = GeneratedCode<FV>::FromCode(*code); auto f = GeneratedCode<FV>::FromCode(*code);
(void)f.Call(reinterpret_cast<int64_t>(result), 0, 0, 0, 0); (void)f.Call(reinterpret_cast<int64_t>(result), 0, 0, 0, 0);
@ -204,7 +206,8 @@ TEST(LoadAddress) {
CodeDesc desc; CodeDesc desc;
masm->GetCode(isolate, &desc); masm->GetCode(isolate, &desc);
Handle<Code> code = Factory::CodeBuilder(isolate, desc, Code::STUB).Build(); Handle<Code> code =
Factory::CodeBuilder(isolate, desc, CodeKind::STUB).Build();
auto f = GeneratedCode<FV>::FromCode(*code); auto f = GeneratedCode<FV>::FromCode(*code);
(void)f.Call(0, 0, 0, 0, 0); (void)f.Call(0, 0, 0, 0, 0);
@ -260,7 +263,8 @@ TEST(jump_tables4) {
CodeDesc desc; CodeDesc desc;
masm->GetCode(isolate, &desc); masm->GetCode(isolate, &desc);
Handle<Code> code = Factory::CodeBuilder(isolate, desc, Code::STUB).Build(); Handle<Code> code =
Factory::CodeBuilder(isolate, desc, CodeKind::STUB).Build();
#ifdef OBJECT_PRINT #ifdef OBJECT_PRINT
code->Print(std::cout); code->Print(std::cout);
#endif #endif
@ -329,7 +333,8 @@ TEST(jump_tables5) {
CodeDesc desc; CodeDesc desc;
masm->GetCode(isolate, &desc); masm->GetCode(isolate, &desc);
Handle<Code> code = Factory::CodeBuilder(isolate, desc, Code::STUB).Build(); Handle<Code> code =
Factory::CodeBuilder(isolate, desc, CodeKind::STUB).Build();
#ifdef OBJECT_PRINT #ifdef OBJECT_PRINT
code->Print(std::cout); code->Print(std::cout);
#endif #endif
@ -417,7 +422,8 @@ TEST(jump_tables6) {
CodeDesc desc; CodeDesc desc;
masm->GetCode(isolate, &desc); masm->GetCode(isolate, &desc);
Handle<Code> code = Factory::CodeBuilder(isolate, desc, Code::STUB).Build(); Handle<Code> code =
Factory::CodeBuilder(isolate, desc, CodeKind::STUB).Build();
#ifdef OBJECT_PRINT #ifdef OBJECT_PRINT
code->Print(std::cout); code->Print(std::cout);
#endif #endif
@ -441,7 +447,8 @@ static uint64_t run_lsa(uint32_t rt, uint32_t rs, int8_t sa) {
CodeDesc desc; CodeDesc desc;
assembler.GetCode(isolate, &desc); assembler.GetCode(isolate, &desc);
Handle<Code> code = Factory::CodeBuilder(isolate, desc, Code::STUB).Build(); Handle<Code> code =
Factory::CodeBuilder(isolate, desc, CodeKind::STUB).Build();
auto f = GeneratedCode<F1>::FromCode(*code); auto f = GeneratedCode<F1>::FromCode(*code);
@ -520,7 +527,8 @@ static uint64_t run_dlsa(uint64_t rt, uint64_t rs, int8_t sa) {
CodeDesc desc; CodeDesc desc;
assembler.GetCode(isolate, &desc); assembler.GetCode(isolate, &desc);
Handle<Code> code = Factory::CodeBuilder(isolate, desc, Code::STUB).Build(); Handle<Code> code =
Factory::CodeBuilder(isolate, desc, CodeKind::STUB).Build();
auto f = GeneratedCode<FV>::FromCode(*code); auto f = GeneratedCode<FV>::FromCode(*code);
@ -669,7 +677,8 @@ RET_TYPE run_Cvt(IN_TYPE x, Func GenerateConvertInstructionFunc) {
CodeDesc desc; CodeDesc desc;
assm.GetCode(isolate, &desc); assm.GetCode(isolate, &desc);
Handle<Code> code = Factory::CodeBuilder(isolate, desc, Code::STUB).Build(); Handle<Code> code =
Factory::CodeBuilder(isolate, desc, CodeKind::STUB).Build();
auto f = GeneratedCode<F_CVT>::FromCode(*code); auto f = GeneratedCode<F_CVT>::FromCode(*code);
@ -844,7 +853,7 @@ TEST(OverflowInstructions) {
CodeDesc desc; CodeDesc desc;
masm->GetCode(isolate, &desc); masm->GetCode(isolate, &desc);
Handle<Code> code = Handle<Code> code =
Factory::CodeBuilder(isolate, desc, Code::STUB).Build(); Factory::CodeBuilder(isolate, desc, CodeKind::STUB).Build();
auto f = GeneratedCode<F3>::FromCode(*code); auto f = GeneratedCode<F3>::FromCode(*code);
t.lhs = ii; t.lhs = ii;
t.rhs = jj; t.rhs = jj;
@ -966,7 +975,8 @@ TEST(min_max_nan) {
CodeDesc desc; CodeDesc desc;
masm->GetCode(isolate, &desc); masm->GetCode(isolate, &desc);
Handle<Code> code = Factory::CodeBuilder(isolate, desc, Code::STUB).Build(); Handle<Code> code =
Factory::CodeBuilder(isolate, desc, CodeKind::STUB).Build();
auto f = GeneratedCode<F3>::FromCode(*code); auto f = GeneratedCode<F3>::FromCode(*code);
for (int i = 0; i < kTableLength; i++) { for (int i = 0; i < kTableLength; i++) {
test.a = inputsa[i]; test.a = inputsa[i];
@ -1000,7 +1010,8 @@ bool run_Unaligned(char* memory_buffer, int32_t in_offset, int32_t out_offset,
CodeDesc desc; CodeDesc desc;
assm.GetCode(isolate, &desc); assm.GetCode(isolate, &desc);
Handle<Code> code = Factory::CodeBuilder(isolate, desc, Code::STUB).Build(); Handle<Code> code =
Factory::CodeBuilder(isolate, desc, CodeKind::STUB).Build();
auto f = GeneratedCode<F_CVT>::FromCode(*code); auto f = GeneratedCode<F_CVT>::FromCode(*code);
@ -1363,7 +1374,8 @@ bool run_Sltu(uint64_t rs, uint64_t rd, Func GenerateSltuInstructionFunc) {
CodeDesc desc; CodeDesc desc;
assm.GetCode(isolate, &desc); assm.GetCode(isolate, &desc);
Handle<Code> code = Factory::CodeBuilder(isolate, desc, Code::STUB).Build(); Handle<Code> code =
Factory::CodeBuilder(isolate, desc, CodeKind::STUB).Build();
auto f = GeneratedCode<F_CVT>::FromCode(*code); auto f = GeneratedCode<F_CVT>::FromCode(*code);
int64_t res = reinterpret_cast<int64_t>(f.Call(rs, rd, 0, 0, 0)); int64_t res = reinterpret_cast<int64_t>(f.Call(rs, rd, 0, 0, 0));
@ -1457,7 +1469,7 @@ static GeneratedCode<F4> GenerateMacroFloat32MinMax(MacroAssembler* masm) {
CodeDesc desc; CodeDesc desc;
masm->GetCode(masm->isolate(), &desc); masm->GetCode(masm->isolate(), &desc);
Handle<Code> code = Handle<Code> code =
Factory::CodeBuilder(masm->isolate(), desc, Code::STUB).Build(); Factory::CodeBuilder(masm->isolate(), desc, CodeKind::STUB).Build();
#ifdef DEBUG #ifdef DEBUG
StdoutStream os; StdoutStream os;
code->Print(os); code->Print(os);
@ -1598,7 +1610,7 @@ static GeneratedCode<F4> GenerateMacroFloat64MinMax(MacroAssembler* masm) {
CodeDesc desc; CodeDesc desc;
masm->GetCode(masm->isolate(), &desc); masm->GetCode(masm->isolate(), &desc);
Handle<Code> code = Handle<Code> code =
Factory::CodeBuilder(masm->isolate(), desc, Code::STUB).Build(); Factory::CodeBuilder(masm->isolate(), desc, CodeKind::STUB).Build();
#ifdef DEBUG #ifdef DEBUG
StdoutStream os; StdoutStream os;
code->Print(os); code->Print(os);

View File

@ -449,7 +449,8 @@ TEST(EmbeddedObj) {
CodeDesc desc; CodeDesc desc;
masm->GetCode(isolate, &desc); masm->GetCode(isolate, &desc);
Handle<Code> code = Factory::CodeBuilder(isolate, desc, Code::STUB).Build(); Handle<Code> code =
Factory::CodeBuilder(isolate, desc, CodeKind::STUB).Build();
#ifdef OBJECT_PRINT #ifdef OBJECT_PRINT
StdoutStream os; StdoutStream os;
code->Print(os); code->Print(os);

View File

@ -2359,7 +2359,7 @@ TEST(UnicodePropertyEscapeCodeSize) {
} else if (maybe_code.IsCode()) { } else if (maybe_code.IsCode()) {
// On x64, excessive inlining produced >360KB. // On x64, excessive inlining produced >360KB.
CHECK_LT(Code::cast(maybe_code).Size(), kMaxSize); CHECK_LT(Code::cast(maybe_code).Size(), kMaxSize);
CHECK_EQ(Code::cast(maybe_code).kind(), Code::REGEXP); CHECK_EQ(Code::cast(maybe_code).kind(), CodeKind::REGEXP);
} else { } else {
UNREACHABLE(); UNREACHABLE();
} }

View File

@ -1532,7 +1532,7 @@ int CountBuiltins() {
int counter = 0; int counter = 0;
for (HeapObject obj = iterator.Next(); !obj.is_null(); for (HeapObject obj = iterator.Next(); !obj.is_null();
obj = iterator.Next()) { obj = iterator.Next()) {
if (obj.IsCode() && Code::cast(obj).kind() == Code::BUILTIN) counter++; if (obj.IsCode() && Code::cast(obj).kind() == CodeKind::BUILTIN) counter++;
} }
return counter; return counter;
} }

View File

@ -204,7 +204,8 @@ void TestInvalidateExclusiveAccess(TestData initial_data, MemoryAccess access1,
CodeDesc desc; CodeDesc desc;
masm.GetCode(isolate, &desc); masm.GetCode(isolate, &desc);
Handle<Code> code = Factory::CodeBuilder(isolate, desc, Code::STUB).Build(); Handle<Code> code =
Factory::CodeBuilder(isolate, desc, CodeKind::STUB).Build();
TestData t = initial_data; TestData t = initial_data;
Simulator::current(isolate)->Call<void>(code->entry(), &t); Simulator::current(isolate)->Call<void>(code->entry(), &t);
@ -275,7 +276,8 @@ int ExecuteMemoryAccess(Isolate* isolate, TestData* test_data,
CodeDesc desc; CodeDesc desc;
masm.GetCode(isolate, &desc); masm.GetCode(isolate, &desc);
Handle<Code> code = Factory::CodeBuilder(isolate, desc, Code::STUB).Build(); Handle<Code> code =
Factory::CodeBuilder(isolate, desc, CodeKind::STUB).Build();
Simulator::current(isolate)->Call<void>(code->entry(), test_data); Simulator::current(isolate)->Call<void>(code->entry(), test_data);
return Simulator::current(isolate)->wreg(0); return Simulator::current(isolate)->wreg(0);
} }

View File

@ -577,7 +577,7 @@ TEST(PCIsInV8_LargeCodeObject_CodePagesAPI) {
desc.unwinding_info_size = 0; desc.unwinding_info_size = 0;
desc.origin = nullptr; desc.origin = nullptr;
Handle<Code> foo_code = Handle<Code> foo_code =
Factory::CodeBuilder(i_isolate, desc, Code::WASM_FUNCTION).Build(); Factory::CodeBuilder(i_isolate, desc, CodeKind::WASM_FUNCTION).Build();
CHECK(i_isolate->heap()->InSpace(*foo_code, CODE_LO_SPACE)); CHECK(i_isolate->heap()->InSpace(*foo_code, CODE_LO_SPACE));
byte* start = reinterpret_cast<byte*>(foo_code->InstructionStart()); byte* start = reinterpret_cast<byte*>(foo_code->InstructionStart());

View File

@ -546,7 +546,7 @@ TEST(PCIsInV8_LargeCodeObject) {
desc.unwinding_info_size = 0; desc.unwinding_info_size = 0;
desc.origin = nullptr; desc.origin = nullptr;
Handle<Code> foo_code = Handle<Code> foo_code =
Factory::CodeBuilder(i_isolate, desc, Code::WASM_FUNCTION).Build(); Factory::CodeBuilder(i_isolate, desc, CodeKind::WASM_FUNCTION).Build();
CHECK(i_isolate->heap()->InSpace(*foo_code, CODE_LO_SPACE)); CHECK(i_isolate->heap()->InSpace(*foo_code, CODE_LO_SPACE));
byte* start = reinterpret_cast<byte*>(foo_code->InstructionStart()); byte* start = reinterpret_cast<byte*>(foo_code->InstructionStart());

View File

@ -483,7 +483,7 @@ Handle<Code> WasmFunctionWrapper::GetWrapperCode() {
} }
OptimizedCompilationInfo info(ArrayVector("testing"), graph()->zone(), OptimizedCompilationInfo info(ArrayVector("testing"), graph()->zone(),
Code::C_WASM_ENTRY); CodeKind::C_WASM_ENTRY);
code_ = compiler::Pipeline::GenerateCodeForTesting( code_ = compiler::Pipeline::GenerateCodeForTesting(
&info, isolate, call_descriptor, graph(), &info, isolate, call_descriptor, graph(),
AssemblerOptions::Default(isolate)); AssemblerOptions::Default(isolate));

View File

@ -239,7 +239,7 @@ extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) {
} }
callee.Return(static_cast<int>(desc->ReturnCount()), returns.get()); callee.Return(static_cast<int>(desc->ReturnCount()), returns.get());
OptimizedCompilationInfo info(ArrayVector("testing"), &zone, Code::STUB); OptimizedCompilationInfo info(ArrayVector("testing"), &zone, CodeKind::STUB);
Handle<Code> code = Handle<Code> code =
Pipeline::GenerateCodeForTesting(&info, i_isolate, desc, callee.graph(), Pipeline::GenerateCodeForTesting(&info, i_isolate, desc, callee.graph(),
AssemblerOptions::Default(i_isolate), AssemblerOptions::Default(i_isolate),
@ -285,7 +285,7 @@ extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) {
// Call the wrapper. // Call the wrapper.
OptimizedCompilationInfo wrapper_info(ArrayVector("wrapper"), &zone, OptimizedCompilationInfo wrapper_info(ArrayVector("wrapper"), &zone,
Code::STUB); CodeKind::STUB);
Handle<Code> wrapper_code = Handle<Code> wrapper_code =
Pipeline::GenerateCodeForTesting( Pipeline::GenerateCodeForTesting(
&wrapper_info, i_isolate, wrapper_desc, caller.graph(), &wrapper_info, i_isolate, wrapper_desc, caller.graph(),

Some files were not shown because too many files have changed in this diff Show More