Commit 9d3cca1c authored by Milad Farazmand's avatar Milad Farazmand Committed by Commit Bot

s390: [arm] Add missing RELATIVE_CODE_TARGET iteration

Port b766299d
Port 9592b043
Port d915b8d6

Original Commit Message:

    Code object iteration was missing logic for RELATIVE_CODE_TARGET
    reloc entries. Garbage collection could thus miss objects that were
    referenced only as targets of pc-relative calls or jumps.

    RELATIVE_CODE_TARGETs are only used on arm, mips, and s390 and only
    at mksnapshot-time.

    This exposed another issue in that the interpreter entry trampoline
    copy we generate for profiling *did* contain relative calls in
    runtime-accessible code. This is a problem, since code space on arm is,
    by default, too large to be fully addressable through pc-relative
    calls. This CL thus also disables the related
    FLAG_interpreted_frames_native_stack feature on arm.

    objects.

R=jgruber@chromium.org, joransiu@ca.ibm.com, jyan@ca.ibm.com, michael_dawson@ca.ibm.com
BUG=
LOG=N

Change-Id: Ifbcaed98d90a2730f0d6a8a7d32c621dab1ff5b2
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2087693Reviewed-by: 's avatarJakob Gruber <jgruber@chromium.org>
Reviewed-by: 's avatarJunliang Yan <jyan@ca.ibm.com>
Commit-Queue: Milad Farazmand <miladfar@ca.ibm.com>
Cr-Commit-Position: refs/heads/master@{#66644}
parent 4f3b0990
......@@ -3429,15 +3429,15 @@ bool Isolate::Init(ReadOnlyDeserializer* read_only_deserializer,
setup_delegate_->SetupBuiltins(this);
#ifndef V8_TARGET_ARCH_ARM
#if !defined(V8_TARGET_ARCH_ARM) && !defined(V8_TARGET_ARCH_S390X)
// Store the interpreter entry trampoline on the root list. It is used as a
// template for further copies that may later be created to help profile
// interpreted code.
// We currently cannot do this on arm due to RELATIVE_CODE_TARGETs
// assuming that all possible Code targets may be addressed with an int24
// offset, effectively limiting code space size to 32MB. We can guarantee
// this at mksnapshot-time, but not at runtime.
// See also: https://crbug.com/v8/8713.
// We currently cannot do this on above architectures due to
// RELATIVE_CODE_TARGETs assuming that all possible Code targets may be
// addressed with an int24 offset, effectively limiting code space size to
// 32MB. We can guarantee this at mksnapshot-time, but not at runtime. See
// also: https://crbug.com/v8/8713.
heap_.SetInterpreterEntryTrampolineForProfiling(
heap_.builtin(Builtins::kInterpreterEntryTrampoline));
#endif
......@@ -3512,11 +3512,11 @@ bool Isolate::Init(ReadOnlyDeserializer* read_only_deserializer,
}
#endif // DEBUG
#ifndef V8_TARGET_ARCH_ARM
#if !defined(V8_TARGET_ARCH_ARM) && !defined(V8_TARGET_ARCH_S390X)
// The IET for profiling should always be a full on-heap Code object.
DCHECK(!Code::cast(heap_.interpreter_entry_trampoline_for_profiling())
.is_off_heap_trampoline());
#endif // V8_TARGET_ARCH_ARM
#endif // !V8_TARGET_ARCH_ARM && !V8_TARGET_ARCH_S390X
if (FLAG_print_builtin_code) builtins()->PrintBuiltinCode();
if (FLAG_print_builtin_size) builtins()->PrintBuiltinSize();
......
......@@ -1620,8 +1620,8 @@ DEFINE_BOOL(vtune_prof_annotate_wasm, false,
DEFINE_BOOL(win64_unwinding_info, true, "Enable unwinding info for Windows/x64")
#ifdef V8_TARGET_ARCH_ARM
// Unsupported on arm. See https://crbug.com/v8/8713.
#if defined(V8_TARGET_ARCH_ARM) || defined(V8_TARGET_ARCH_S390X)
// Unsupported on above architectures. See https://crbug.com/v8/8713.
DEFINE_BOOL_READONLY(
interpreted_frames_native_stack, false,
"Show interpreted frames on the native stack (useful for external "
......
......@@ -190,12 +190,12 @@ void CodeSerializer::SerializeObject(HeapObject obj) {
// bytecode array stored within the InterpreterData, which is the important
// information. On deserialization we'll create our code objects again, if
// --interpreted-frames-native-stack is on. See v8:9122 for more context
#ifndef V8_TARGET_ARCH_ARM
#if !defined(V8_TARGET_ARCH_ARM) && !defined(V8_TARGET_ARCH_S390X)
if (V8_UNLIKELY(FLAG_interpreted_frames_native_stack) &&
obj.IsInterpreterData()) {
obj = InterpreterData::cast(obj).bytecode_array();
}
#endif // V8_TARGET_ARCH_ARM
#endif // !V8_TARGET_ARCH_ARM && !V8_TARGET_ARCH_S390X
// Past this point we should not see any (context-specific) maps anymore.
CHECK(!obj.IsMap());
......@@ -215,7 +215,7 @@ void CodeSerializer::SerializeGeneric(HeapObject heap_object) {
serializer.Serialize();
}
#ifndef V8_TARGET_ARCH_ARM
#if !defined(V8_TARGET_ARCH_ARM) && !defined(V8_TARGET_ARCH_S390X)
// NOTE(mmarchini): when FLAG_interpreted_frames_native_stack is on, we want to
// create duplicates of InterpreterEntryTrampoline for the deserialized
// functions, otherwise we'll call the builtin IET for those functions (which
......@@ -255,7 +255,7 @@ void CreateInterpreterDataForDeserializedCode(Isolate* isolate,
column_num));
}
}
#endif // V8_TARGET_ARCH_ARM
#endif // !V8_TARGET_ARCH_ARM && !V8_TARGET_ARCH_S390X
MaybeHandle<SharedFunctionInfo> CodeSerializer::Deserialize(
Isolate* isolate, ScriptData* cached_data, Handle<String> source,
......@@ -301,11 +301,11 @@ MaybeHandle<SharedFunctionInfo> CodeSerializer::Deserialize(
isolate->is_profiling() ||
isolate->code_event_dispatcher()->IsListeningToCodeEvents();
#ifndef V8_TARGET_ARCH_ARM
#if !defined(V8_TARGET_ARCH_ARM) && !defined(V8_TARGET_ARCH_S390X)
if (V8_UNLIKELY(FLAG_interpreted_frames_native_stack))
CreateInterpreterDataForDeserializedCode(isolate, result,
log_code_creation);
#endif // V8_TARGET_ARCH_ARM
#endif // !V8_TARGET_ARCH_ARM && !V8_TARGET_ARCH_S390X
bool needs_source_positions = isolate->NeedsSourcePositionsForProfiling();
......
......@@ -5011,7 +5011,7 @@ TEST(InterpreterGenerators) {
}
}
#ifndef V8_TARGET_ARCH_ARM
#if !defined(V8_TARGET_ARCH_ARM) && !defined(V8_TARGET_ARCH_S390X)
TEST(InterpreterWithNativeStack) {
i::FLAG_interpreted_frames_native_stack = true;
......@@ -5033,7 +5033,7 @@ TEST(InterpreterWithNativeStack) {
CHECK(code.is_interpreter_trampoline_builtin());
CHECK_NE(code.address(), interpreter_entry_trampoline->address());
}
#endif // V8_TARGET_ARCH_ARM
#endif // !V8_TARGET_ARCH_ARM && !V8_TARGET_ARCH_S390X
TEST(InterpreterGetBytecodeHandler) {
HandleAndZoneScope handles;
......
......@@ -565,7 +565,7 @@ UNINITIALIZED_TEST(LogAll) {
isolate->Dispose();
}
#ifndef V8_TARGET_ARCH_ARM
#if !defined(V8_TARGET_ARCH_ARM) && !defined(V8_TARGET_ARCH_S390X)
UNINITIALIZED_TEST(LogInterpretedFramesNativeStack) {
SETUP_FLAGS();
i::FLAG_interpreted_frames_native_stack = true;
......@@ -650,7 +650,7 @@ UNINITIALIZED_TEST(LogInterpretedFramesNativeStackWithSerialization) {
} while (!has_cache);
delete cache;
}
#endif // V8_TARGET_ARCH_ARM
#endif // !V8_TARGET_ARCH_ARM && !V8_TARGET_ARCH_S390X
UNINITIALIZED_TEST(ExternalCodeEventListener) {
i::FLAG_log = false;
......@@ -753,7 +753,7 @@ UNINITIALIZED_TEST(ExternalCodeEventListenerInnerFunctions) {
isolate2->Dispose();
}
#ifndef V8_TARGET_ARCH_ARM
#if !defined(V8_TARGET_ARCH_ARM) && !defined(V8_TARGET_ARCH_S390X)
UNINITIALIZED_TEST(ExternalCodeEventListenerWithInterpretedFramesNativeStack) {
i::FLAG_log = false;
i::FLAG_prof = false;
......@@ -803,7 +803,7 @@ UNINITIALIZED_TEST(ExternalCodeEventListenerWithInterpretedFramesNativeStack) {
}
isolate->Dispose();
}
#endif // V8_TARGET_ARCH_ARM
#endif // !V8_TARGET_ARCH_ARM && !V8_TARGET_ARCH_S390X
UNINITIALIZED_TEST(TraceMaps) {
SETUP_FLAGS();
......
......@@ -1672,7 +1672,7 @@ void TestCodeSerializerOnePlusOneImpl(bool verify_builtins_count = true) {
TEST(CodeSerializerOnePlusOne) { TestCodeSerializerOnePlusOneImpl(); }
// See bug v8:9122
#ifndef V8_TARGET_ARCH_ARM
#if !defined(V8_TARGET_ARCH_ARM) && !defined(V8_TARGET_ARCH_S390X)
TEST(CodeSerializerOnePlusOneWithInterpretedFramesNativeStack) {
FLAG_interpreted_frames_native_stack = true;
// We pass false because this test will create IET copies (which are
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment