e5ba156d88
After we landed the tracing runtime call stats, which gave us a lot of V8 insight in tracing, we noticed that there is some arising issues and discrepancies. Issues include: Missing trace events, that happened due to transforming those trace events into runtime calls Discrepancies include: Missing categories in Runtime call stats like GC, because we are not handling the Scoped runtime calls properly in the tracing version. To reduce/eliminate those issue, we are taking a small step back. We are unifying the RuntimeStats code and using the original one. That would allow us to use all the original probes but emit trace events from them. We are also putting back the trace-events in their place. The output from both system should be intact (Except of the addition of the missing trace-events). Also as a byproduct, we are reducing the number of context scopes by half since we are using the same scope as runtime call stats. As a follow up to this CL, we will address the non-scoped Runtime Call Stats (mainly in GC). BUG=642373 Review-Url: https://codereview.chromium.org/2296243002 Cr-Commit-Position: refs/heads/master@{#39180}
136 lines
6.0 KiB
C++
136 lines
6.0 KiB
C++
// Copyright 2016 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/api-arguments.h"
|
|
|
|
#include "src/tracing/trace-event.h"
|
|
#include "src/vm-state-inl.h"
|
|
|
|
namespace v8 {
|
|
namespace internal {
|
|
|
|
#define FOR_EACH_CALLBACK_TABLE_MAPPING_1_NAME(F) \
|
|
F(AccessorNameGetterCallback, "get", v8::Value, Object) \
|
|
F(GenericNamedPropertyQueryCallback, "has", v8::Integer, Object) \
|
|
F(GenericNamedPropertyDeleterCallback, "delete", v8::Boolean, Object)
|
|
|
|
#define WRITE_CALL_1_NAME(Function, type, ApiReturn, InternalReturn) \
|
|
Handle<InternalReturn> PropertyCallbackArguments::Call(Function f, \
|
|
Handle<Name> name) { \
|
|
Isolate* isolate = this->isolate(); \
|
|
RuntimeCallTimerScope timer(isolate, &RuntimeCallStats::Function); \
|
|
VMState<EXTERNAL> state(isolate); \
|
|
ExternalCallbackScope call_scope(isolate, FUNCTION_ADDR(f)); \
|
|
PropertyCallbackInfo<ApiReturn> info(begin()); \
|
|
LOG(isolate, \
|
|
ApiNamedPropertyAccess("interceptor-named-" type, holder(), *name)); \
|
|
f(v8::Utils::ToLocal(name), info); \
|
|
return GetReturnValue<InternalReturn>(isolate); \
|
|
}
|
|
|
|
FOR_EACH_CALLBACK_TABLE_MAPPING_1_NAME(WRITE_CALL_1_NAME)
|
|
|
|
#undef FOR_EACH_CALLBACK_TABLE_MAPPING_1_NAME
|
|
#undef WRITE_CALL_1_NAME
|
|
|
|
#define FOR_EACH_CALLBACK_TABLE_MAPPING_1_INDEX(F) \
|
|
F(IndexedPropertyGetterCallback, "get", v8::Value, Object) \
|
|
F(IndexedPropertyQueryCallback, "has", v8::Integer, Object) \
|
|
F(IndexedPropertyDeleterCallback, "delete", v8::Boolean, Object)
|
|
|
|
#define WRITE_CALL_1_INDEX(Function, type, ApiReturn, InternalReturn) \
|
|
Handle<InternalReturn> PropertyCallbackArguments::Call(Function f, \
|
|
uint32_t index) { \
|
|
Isolate* isolate = this->isolate(); \
|
|
RuntimeCallTimerScope timer(isolate, &RuntimeCallStats::Function); \
|
|
VMState<EXTERNAL> state(isolate); \
|
|
ExternalCallbackScope call_scope(isolate, FUNCTION_ADDR(f)); \
|
|
PropertyCallbackInfo<ApiReturn> info(begin()); \
|
|
LOG(isolate, ApiIndexedPropertyAccess("interceptor-indexed-" type, \
|
|
holder(), index)); \
|
|
f(index, info); \
|
|
return GetReturnValue<InternalReturn>(isolate); \
|
|
}
|
|
|
|
FOR_EACH_CALLBACK_TABLE_MAPPING_1_INDEX(WRITE_CALL_1_INDEX)
|
|
|
|
#undef FOR_EACH_CALLBACK_TABLE_MAPPING_1_INDEX
|
|
#undef WRITE_CALL_1_INDEX
|
|
|
|
Handle<Object> PropertyCallbackArguments::Call(
|
|
GenericNamedPropertySetterCallback f, Handle<Name> name,
|
|
Handle<Object> value) {
|
|
Isolate* isolate = this->isolate();
|
|
RuntimeCallTimerScope timer(
|
|
isolate, &RuntimeCallStats::GenericNamedPropertySetterCallback);
|
|
VMState<EXTERNAL> state(isolate);
|
|
ExternalCallbackScope call_scope(isolate, FUNCTION_ADDR(f));
|
|
PropertyCallbackInfo<v8::Value> info(begin());
|
|
LOG(isolate,
|
|
ApiNamedPropertyAccess("interceptor-named-set", holder(), *name));
|
|
f(v8::Utils::ToLocal(name), v8::Utils::ToLocal(value), info);
|
|
return GetReturnValue<Object>(isolate);
|
|
}
|
|
|
|
Handle<Object> PropertyCallbackArguments::Call(
|
|
GenericNamedPropertyDefinerCallback f, Handle<Name> name,
|
|
const v8::PropertyDescriptor& desc) {
|
|
Isolate* isolate = this->isolate();
|
|
RuntimeCallTimerScope timer(
|
|
isolate, &RuntimeCallStats::GenericNamedPropertyDefinerCallback);
|
|
VMState<EXTERNAL> state(isolate);
|
|
ExternalCallbackScope call_scope(isolate, FUNCTION_ADDR(f));
|
|
PropertyCallbackInfo<v8::Value> info(begin());
|
|
LOG(isolate,
|
|
ApiNamedPropertyAccess("interceptor-named-define", holder(), *name));
|
|
f(v8::Utils::ToLocal(name), desc, info);
|
|
return GetReturnValue<Object>(isolate);
|
|
}
|
|
|
|
Handle<Object> PropertyCallbackArguments::Call(IndexedPropertySetterCallback f,
|
|
uint32_t index,
|
|
Handle<Object> value) {
|
|
Isolate* isolate = this->isolate();
|
|
RuntimeCallTimerScope timer(isolate,
|
|
&RuntimeCallStats::IndexedPropertySetterCallback);
|
|
VMState<EXTERNAL> state(isolate);
|
|
ExternalCallbackScope call_scope(isolate, FUNCTION_ADDR(f));
|
|
PropertyCallbackInfo<v8::Value> info(begin());
|
|
LOG(isolate,
|
|
ApiIndexedPropertyAccess("interceptor-indexed-set", holder(), index));
|
|
f(index, v8::Utils::ToLocal(value), info);
|
|
return GetReturnValue<Object>(isolate);
|
|
}
|
|
|
|
Handle<Object> PropertyCallbackArguments::Call(
|
|
IndexedPropertyDefinerCallback f, uint32_t index,
|
|
const v8::PropertyDescriptor& desc) {
|
|
Isolate* isolate = this->isolate();
|
|
RuntimeCallTimerScope timer(
|
|
isolate, &RuntimeCallStats::IndexedPropertyDefinerCallback);
|
|
VMState<EXTERNAL> state(isolate);
|
|
ExternalCallbackScope call_scope(isolate, FUNCTION_ADDR(f));
|
|
PropertyCallbackInfo<v8::Value> info(begin());
|
|
LOG(isolate,
|
|
ApiIndexedPropertyAccess("interceptor-indexed-define", holder(), index));
|
|
f(index, desc, info);
|
|
return GetReturnValue<Object>(isolate);
|
|
}
|
|
|
|
void PropertyCallbackArguments::Call(AccessorNameSetterCallback f,
|
|
Handle<Name> name, Handle<Object> value) {
|
|
Isolate* isolate = this->isolate();
|
|
RuntimeCallTimerScope timer(isolate,
|
|
&RuntimeCallStats::AccessorNameSetterCallback);
|
|
VMState<EXTERNAL> state(isolate);
|
|
ExternalCallbackScope call_scope(isolate, FUNCTION_ADDR(f));
|
|
PropertyCallbackInfo<void> info(begin());
|
|
LOG(isolate,
|
|
ApiNamedPropertyAccess("interceptor-named-set", holder(), *name));
|
|
f(v8::Utils::ToLocal(name), v8::Utils::ToLocal(value), info);
|
|
}
|
|
|
|
} // namespace internal
|
|
} // namespace v8
|