[builtins] Add IsBuiltin convenience predicate
With this, `Builtins::IsBuiltinId(code->builtin_index())` turns into `Builtins::IsBuiltin(code)`. Bug: v8:6666 Change-Id: Id731299cf5eb3f213933d3a9b3ae78d9bb95e757 Reviewed-on: https://chromium-review.googlesource.com/937205 Commit-Queue: Jakob Gruber <jgruber@chromium.org> Reviewed-by: Yang Guo <yangguo@chromium.org> Cr-Commit-Position: refs/heads/master@{#51562}
This commit is contained in:
parent
d7a9ca5de9
commit
9cd019543c
@ -679,7 +679,7 @@ void RelocInfo::Print(Isolate* isolate, std::ostream& os) { // NOLINT
|
||||
Code* code = Code::GetCodeFromTargetAddress(code_target);
|
||||
DCHECK(code->IsCode());
|
||||
os << " (" << Code::Kind2String(code->kind());
|
||||
if (Builtins::IsBuiltinId(code->builtin_index())) {
|
||||
if (Builtins::IsBuiltin(code)) {
|
||||
os << " " << Builtins::name(code->builtin_index());
|
||||
} else if (code->kind() == Code::STUB) {
|
||||
os << " " << CodeStub::MajorName(CodeStub::GetMajorKey(code));
|
||||
|
@ -194,6 +194,11 @@ Address Builtins::CppEntryOf(int index) {
|
||||
return builtin_metadata[index].kind_specific_data.cpp_entry;
|
||||
}
|
||||
|
||||
// static
|
||||
bool Builtins::IsBuiltin(Code* code) {
|
||||
return Builtins::IsBuiltinId(code->builtin_index());
|
||||
}
|
||||
|
||||
// static
|
||||
bool Builtins::IsLazy(int index) {
|
||||
DCHECK(IsBuiltinId(index));
|
||||
|
@ -109,6 +109,10 @@ class Builtins {
|
||||
static bool IsCpp(int index);
|
||||
static bool HasCppImplementation(int index);
|
||||
|
||||
// True, iff the given code object is a builtin. Note that this does not
|
||||
// necessarily mean that its kind is Code::BUILTIN.
|
||||
static bool IsBuiltin(Code* code);
|
||||
|
||||
// Returns true iff the given builtin can be lazy-loaded from the snapshot.
|
||||
// This is true in general for most builtins with the exception of a few
|
||||
// special cases such as CompileLazy and DeserializeLazy.
|
||||
|
@ -1728,7 +1728,7 @@ void Logger::LogCodeObject(Object* object) {
|
||||
}
|
||||
|
||||
void Logger::LogInstructionStream(Code* code, const InstructionStream* stream) {
|
||||
DCHECK(Builtins::IsBuiltinId(code->builtin_index()));
|
||||
DCHECK(Builtins::IsBuiltin(code));
|
||||
const char* description = isolate_->builtins()->name(code->builtin_index());
|
||||
CodeEventListener::LogEventsAndTags tag = CodeEventListener::BUILTIN_TAG;
|
||||
PROFILE(isolate_, InstructionStreamCreateEvent(tag, stream, description));
|
||||
|
@ -55,8 +55,7 @@ SafepointTable::SafepointTable(Code* code)
|
||||
: SafepointTable(code->instruction_start(), code->safepoint_table_offset(),
|
||||
code->stack_slots(), true) {
|
||||
#ifdef V8_EMBEDDED_BUILTINS
|
||||
if (FLAG_stress_off_heap_code &&
|
||||
Builtins::IsBuiltinId(code->builtin_index()) &&
|
||||
if (FLAG_stress_off_heap_code && Builtins::IsBuiltin(code) &&
|
||||
Builtins::IsOffHeapSafe(code->builtin_index())) {
|
||||
InstructionStream* stream =
|
||||
InstructionStream::TryLookupInstructionStream(code->GetIsolate(), code);
|
||||
|
Loading…
Reference in New Issue
Block a user