Commit 652061ed authored by wingo's avatar wingo Committed by Commit bot

Rebase GDBJIT interface solely on JITCodeEvent

R=mstarzinger@chromium.org
BUG=

Review URL: https://codereview.chromium.org/958623002

Cr-Commit-Position: refs/heads/master@{#26858}
parent 68c8073a
......@@ -719,10 +719,6 @@ static void RecordFunctionCompilation(Logger::LogEventsAndTags tag,
CodeCreateEvent(log_tag, *code, *shared, info, script_name,
line_num, column_num));
}
GDBJIT(AddCode(Handle<String>(shared->DebugName()),
Handle<Script>(info->script()), Handle<Code>(info->code()),
info));
}
......@@ -1183,7 +1179,6 @@ static Handle<SharedFunctionInfo> CompileToplevel(CompilationInfo* info) {
PROFILE(isolate, CodeCreateEvent(
log_tag, *info->code(), *result, info, *script_name));
GDBJIT(AddCode(script_name, script, info->code(), info));
// Hint to the runtime system used when allocating space for initial
// property space by setting the expected number of properties for
......
......@@ -752,6 +752,14 @@ DEFINE_NEG_IMPLICATION(predictable, concurrent_recompilation)
DEFINE_NEG_IMPLICATION(predictable, concurrent_osr)
DEFINE_NEG_IMPLICATION(predictable, concurrent_sweeping)
// mark-compact.cc
DEFINE_BOOL(force_marking_deque_overflows, false,
"force overflows of marking deque by reducing it's size "
"to 64 words")
DEFINE_BOOL(stress_compaction, false,
"stress the GC compactor to flush out bugs (implies "
"--force_marking_deque_overflows)")
//
// Dev shell flags
......@@ -769,21 +777,24 @@ DEFINE_ARGS(js_arguments,
//
// GDB JIT integration flags.
//
#undef FLAG
#ifdef ENABLE_GDB_JIT_INTERFACE
#define FLAG FLAG_FULL
#else
#define FLAG FLAG_READONLY
#endif
DEFINE_BOOL(gdbjit, false, "enable GDBJIT interface (disables compacting GC)")
DEFINE_BOOL(gdbjit, false, "enable GDBJIT interface")
DEFINE_BOOL(gdbjit_full, false, "enable GDBJIT interface for all code objects")
DEFINE_BOOL(gdbjit_dump, false, "dump elf objects with debug info to disk")
DEFINE_STRING(gdbjit_dump_filter, "",
"dump only objects containing this substring")
// mark-compact.cc
DEFINE_BOOL(force_marking_deque_overflows, false,
"force overflows of marking deque by reducing it's size "
"to 64 words")
DEFINE_BOOL(stress_compaction, false,
"stress the GC compactor to flush out bugs (implies "
"--force_marking_deque_overflows)")
#ifdef ENABLE_GDB_JIT_INTERFACE
DEFINE_IMPLICATION(gdbjit_full, gdbjit)
DEFINE_IMPLICATION(gdbjit_dump, gdbjit)
#endif
DEFINE_NEG_IMPLICATION(gdbjit, compact_code_space)
//
// Debug only flags
......
This diff is collapsed.
......@@ -5,50 +5,35 @@
#ifndef V8_GDB_JIT_H_
#define V8_GDB_JIT_H_
#include "src/allocation.h"
#include "src/v8.h"
//
// Basic implementation of GDB JIT Interface client.
// GBD JIT Interface is supported in GDB 7.0 and above.
// Currently on x64 and ia32 architectures and Linux OS are supported.
// GDB has two ways of interacting with JIT code. With the "JIT compilation
// interface", V8 can tell GDB when it emits JIT code. Unfortunately to do so,
// it has to create platform-native object files, possibly with platform-native
// debugging information. Currently only ELF and Mach-O are supported, which
// limits this interface to Linux and Mac OS. This JIT compilation interface
// was introduced in GDB 7.0. V8 support can be enabled with the --gdbjit flag.
//
// The other way that GDB can know about V8 code is via the "custom JIT reader"
// interface, in which a GDB extension parses V8's private data to determine the
// function, file, and line of a JIT frame, and how to unwind those frames.
// This interface was introduced in GDB 7.6. This interface still relies on V8
// to register its code via the JIT compilation interface, but doesn't require
// that V8 create ELF images. Support will be added for this interface in the
// future.
//
#ifdef ENABLE_GDB_JIT_INTERFACE
#include "src/v8.h"
#include "src/factory.h"
namespace v8 {
namespace internal {
class CompilationInfo;
class GDBJITInterface: public AllStatic {
public:
enum CodeTag { NON_FUNCTION, FUNCTION };
// Main entry point into GDB JIT realized as a JitCodeEventHandler.
static void EventHandler(const v8::JitCodeEvent* event);
static void AddCode(Handle<Name> name,
Handle<Script> script,
Handle<Code> code,
CompilationInfo* info);
static void RemoveCodeRange(Address start, Address end);
private:
static void AddCode(const char* name, Code* code, CodeTag tag, Script* script,
CompilationInfo* info);
static void RemoveCode(Code* code);
};
#define GDBJIT(action) GDBJITInterface::action
} } // namespace v8::internal
#else
#define GDBJIT(action) ((void) 0)
namespace GDBJITInterface {
#ifdef ENABLE_GDB_JIT_INTERFACE
// JitCodeEventHandler that creates ELF/Mach-O objects and registers them with
// GDB.
void EventHandler(const v8::JitCodeEvent* event);
#endif
} // namespace GDBJITInterface
} // namespace internal
} // namespace v8
#endif
......@@ -262,11 +262,6 @@ bool MarkCompactCollector::StartCompaction(CompactionMode mode) {
if (!compacting_) {
DCHECK(evacuation_candidates_.length() == 0);
#ifdef ENABLE_GDB_JIT_INTERFACE
// If GDBJIT interface is active disable compaction.
if (FLAG_gdbjit) return false;
#endif
CollectEvacuationCandidates(heap()->old_pointer_space());
CollectEvacuationCandidates(heap()->old_data_space());
......@@ -3223,11 +3218,6 @@ static int Sweep(PagedSpace* space, FreeList* free_list, Page* p,
}
freed_bytes = Free<parallelism>(space, free_list, free_start, size);
max_freed_bytes = Max(freed_bytes, max_freed_bytes);
#ifdef ENABLE_GDB_JIT_INTERFACE
if (FLAG_gdbjit && space->identity() == CODE_SPACE) {
GDBJITInterface::RemoveCodeRange(free_start, free_end);
}
#endif
}
HeapObject* live_object = HeapObject::FromAddress(free_end);
DCHECK(Marking::IsBlack(Marking::MarkBitFrom(live_object)));
......@@ -3257,11 +3247,6 @@ static int Sweep(PagedSpace* space, FreeList* free_list, Page* p,
}
freed_bytes = Free<parallelism>(space, free_list, free_start, size);
max_freed_bytes = Max(freed_bytes, max_freed_bytes);
#ifdef ENABLE_GDB_JIT_INTERFACE
if (FLAG_gdbjit && space->identity() == CODE_SPACE) {
GDBJITInterface::RemoveCodeRange(free_start, p->area_end());
}
#endif
}
p->ResetLiveBytes();
......
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