Revision: 7677
Author: [email protected]
Date: Thu Apr 21 23:40:22 2011
Log: Avoid hidden TLS access in CpuProfiler::is_profiling().
Review URL: http://codereview.chromium.org/6895014
http://code.google.com/p/v8/source/detail?r=7677
Modified:
/branches/bleeding_edge/src/codegen.cc
/branches/bleeding_edge/src/compiler.cc
/branches/bleeding_edge/src/cpu-profiler.cc
/branches/bleeding_edge/src/cpu-profiler.h
/branches/bleeding_edge/src/heap.cc
=======================================
--- /branches/bleeding_edge/src/codegen.cc Thu Apr 7 07:42:37 2011
+++ /branches/bleeding_edge/src/codegen.cc Thu Apr 21 23:40:22 2011
@@ -176,7 +176,10 @@
bool CodeGenerator::ShouldGenerateLog(Expression* type) {
ASSERT(type != NULL);
- if (!LOGGER->is_logging() && !CpuProfiler::is_profiling()) return false;
+ Isolate* isolate = Isolate::Current();
+ if (!isolate->logger()->is_logging()
&& !CpuProfiler::is_profiling(isolate)) {
+ return false;
+ }
Handle<String> name = Handle<String>::cast(type->AsLiteral()->handle());
if (FLAG_log_regexp) {
if (name->IsEqualTo(kRegexp))
=======================================
--- /branches/bleeding_edge/src/compiler.cc Fri Apr 8 07:30:10 2011
+++ /branches/bleeding_edge/src/compiler.cc Thu Apr 21 23:40:22 2011
@@ -767,7 +767,8 @@
// Log the code generation. If source information is available include
// script name and line number. Check explicitly whether logging is
// enabled as finding the line number is not free.
- if (info->isolate()->logger()->is_logging() ||
CpuProfiler::is_profiling()) {
+ if (info->isolate()->logger()->is_logging() ||
+ CpuProfiler::is_profiling(info->isolate())) {
Handle<Script> script = info->script();
Handle<Code> code = info->code();
if (*code ==
info->isolate()->builtins()->builtin(Builtins::kLazyCompile))
=======================================
--- /branches/bleeding_edge/src/cpu-profiler.cc Tue Apr 5 02:01:47 2011
+++ /branches/bleeding_edge/src/cpu-profiler.cc Thu Apr 21 23:40:22 2011
@@ -288,14 +288,16 @@
CpuProfile* CpuProfiler::StopProfiling(const char* title) {
- return is_profiling() ?
- Isolate::Current()->cpu_profiler()->StopCollectingProfile(title) :
NULL;
+ Isolate* isolate = Isolate::Current();
+ return is_profiling(isolate) ?
+ isolate->cpu_profiler()->StopCollectingProfile(title) : NULL;
}
CpuProfile* CpuProfiler::StopProfiling(Object* security_token, String*
title) {
- return is_profiling() ?
- Isolate::Current()->cpu_profiler()->StopCollectingProfile(
+ Isolate* isolate = Isolate::Current();
+ return is_profiling(isolate) ?
+ isolate->cpu_profiler()->StopCollectingProfile(
security_token, title) : NULL;
}
@@ -336,8 +338,9 @@
void CpuProfiler::DeleteAllProfiles() {
Isolate* isolate = Isolate::Current();
ASSERT(isolate->cpu_profiler() != NULL);
- if (is_profiling())
+ if (is_profiling(isolate)) {
isolate->cpu_profiler()->StopProcessor();
+ }
isolate->cpu_profiler()->ResetProfiles();
}
=======================================
--- /branches/bleeding_edge/src/cpu-profiler.h Tue Mar 22 09:10:01 2011
+++ /branches/bleeding_edge/src/cpu-profiler.h Thu Apr 21 23:40:22 2011
@@ -197,12 +197,12 @@
} } // namespace v8::internal
-#define PROFILE(isolate, Call) \
- LOG(isolate, Call); \
- do { \
- if (v8::internal::CpuProfiler::is_profiling()) { \
- v8::internal::CpuProfiler::Call; \
- } \
+#define PROFILE(isolate, Call) \
+ LOG(isolate, Call); \
+ do { \
+ if (v8::internal::CpuProfiler::is_profiling(isolate)) { \
+ v8::internal::CpuProfiler::Call; \
+ } \
} while (false)
#else
#define PROFILE(isolate, Call) LOG(isolate, Call)
@@ -261,10 +261,6 @@
// TODO(isolates): this doesn't have to use atomics anymore.
- static INLINE(bool is_profiling()) {
- return is_profiling(Isolate::Current());
- }
-
static INLINE(bool is_profiling(Isolate* isolate)) {
CpuProfiler* profiler = isolate->cpu_profiler();
return profiler != NULL && NoBarrier_Load(&profiler->is_profiling_);
@@ -292,7 +288,7 @@
Atomic32 is_profiling_;
#else
- static INLINE(bool is_profiling()) { return false; }
+ static INLINE(bool is_profiling(Isolate* isolate)) { return false; }
#endif // ENABLE_LOGGING_AND_PROFILING
private:
=======================================
--- /branches/bleeding_edge/src/heap.cc Thu Apr 21 00:15:43 2011
+++ /branches/bleeding_edge/src/heap.cc Thu Apr 21 23:40:22 2011
@@ -1347,7 +1347,7 @@
#if defined(ENABLE_LOGGING_AND_PROFILING)
Isolate* isolate = heap->isolate();
if (isolate->logger()->is_logging() ||
- isolate->cpu_profiler()->is_profiling()) {
+ CpuProfiler::is_profiling(isolate)) {
if (target->IsSharedFunctionInfo()) {
PROFILE(isolate, SharedFunctionInfoMoveEvent(
source->address(), target->address()));
@@ -1522,8 +1522,8 @@
return;
}
- if (isolate()->logger()->is_logging() ||
- isolate()->cpu_profiler()->is_profiling() ||
+ if (isolate()->logger()->is_logging() |
+ CpuProfiler::is_profiling(isolate()) ||
(isolate()->heap_profiler() != NULL &&
isolate()->heap_profiler()->is_profiling())) {
// If one of the isolates is doing scavenge at this moment of time
--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev