Fix external callback logging in profiler.
For platforms that use function descriptors (currently AIX and PPC64BE), log an external callback's entrypoint address rather than its function descriptor address. This allows proper lookup in the tick processor's symbol table. R=jkummerow@chromium.org, michael_dawson@ca.ibm.com BUG= Review URL: https://codereview.chromium.org/1409993006 Cr-Commit-Position: refs/heads/master@{#31633}
This commit is contained in:
parent
9ada38b4c6
commit
2bd5914bc3
@ -334,11 +334,8 @@ void SafeStackFrameIterator::Advance() {
|
||||
// ExternalCallbackScope, just skip them as we cannot collect any useful
|
||||
// information about them.
|
||||
if (external_callback_scope_->scope_address() < frame_->fp()) {
|
||||
Address* callback_address =
|
||||
external_callback_scope_->callback_address();
|
||||
if (*callback_address != NULL) {
|
||||
frame_->state_.pc_address = callback_address;
|
||||
}
|
||||
frame_->state_.pc_address =
|
||||
external_callback_scope_->callback_entrypoint_address();
|
||||
external_callback_scope_ = external_callback_scope_->previous();
|
||||
DCHECK(external_callback_scope_ == NULL ||
|
||||
external_callback_scope_->scope_address() > frame_->fp());
|
||||
|
@ -217,6 +217,20 @@ F FUNCTION_CAST(Address addr) {
|
||||
}
|
||||
|
||||
|
||||
// Determine whether the architecture uses function descriptors
|
||||
// which provide a level of indirection between the function pointer
|
||||
// and the function entrypoint.
|
||||
#if V8_HOST_ARCH_PPC && \
|
||||
(V8_OS_AIX || (V8_TARGET_ARCH_PPC64 && V8_TARGET_BIG_ENDIAN))
|
||||
#define USES_FUNCTION_DESCRIPTORS 1
|
||||
#define FUNCTION_ENTRYPOINT_ADDRESS(f) \
|
||||
(reinterpret_cast<v8::internal::Address*>( \
|
||||
&(reinterpret_cast<intptr_t*>(f)[0])))
|
||||
#else
|
||||
#define USES_FUNCTION_DESCRIPTORS 0
|
||||
#endif
|
||||
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
// Forward declarations for frequently used classes
|
||||
// (sorted alphabetically)
|
||||
|
@ -1497,7 +1497,11 @@ void Logger::TickEvent(TickSample* sample, bool overflow) {
|
||||
msg.Append(",%ld", static_cast<int>(timer_.Elapsed().InMicroseconds()));
|
||||
if (sample->has_external_callback) {
|
||||
msg.Append(",1,");
|
||||
#if USES_FUNCTION_DESCRIPTORS
|
||||
msg.AppendAddress(*FUNCTION_ENTRYPOINT_ADDRESS(sample->external_callback));
|
||||
#else
|
||||
msg.AppendAddress(sample->external_callback);
|
||||
#endif
|
||||
} else {
|
||||
msg.Append(",0,");
|
||||
msg.AppendAddress(sample->tos);
|
||||
|
@ -33,7 +33,14 @@ class ExternalCallbackScope BASE_EMBEDDED {
|
||||
inline ExternalCallbackScope(Isolate* isolate, Address callback);
|
||||
inline ~ExternalCallbackScope();
|
||||
Address callback() { return callback_; }
|
||||
Address* callback_address() { return &callback_; }
|
||||
Address* callback_entrypoint_address() {
|
||||
if (callback_ == nullptr) return nullptr;
|
||||
#if USES_FUNCTION_DESCRIPTORS
|
||||
return FUNCTION_ENTRYPOINT_ADDRESS(callback_);
|
||||
#else
|
||||
return &callback_;
|
||||
#endif
|
||||
}
|
||||
ExternalCallbackScope* previous() { return previous_scope_; }
|
||||
inline Address scope_address();
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user