Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(256)

Side by Side Diff: test/cctest/test-log-ia32.cc

Issue 40219: Get rid or heap allocation in stack sampler to avoid deadlocks. (Closed)
Patch Set: CHECK(a > b) -> CHECK_GT Created 11 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/platform.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2006-2009 the V8 project authors. All rights reserved. 1 // Copyright 2006-2009 the V8 project authors. All rights reserved.
2 // 2 //
3 // Tests of profiler-related functions from log.h 3 // Tests of profiler-related functions from log.h
4 4
5 #ifdef ENABLE_LOGGING_AND_PROFILING 5 #ifdef ENABLE_LOGGING_AND_PROFILING
6 6
7 #include <stdlib.h> 7 #include <stdlib.h>
8 8
9 #include "v8.h" 9 #include "v8.h"
10 10
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
87 87
88 88
89 TEST(PureCStackTrace) { 89 TEST(PureCStackTrace) {
90 TickSample sample; 90 TickSample sample;
91 StackTracer tracer(reinterpret_cast<unsigned int>(&sample)); 91 StackTracer tracer(reinterpret_cast<unsigned int>(&sample));
92 InitTraceEnv(&tracer, &sample); 92 InitTraceEnv(&tracer, &sample);
93 CFunc(0); 93 CFunc(0);
94 #ifdef DEBUG 94 #ifdef DEBUG
95 // C stack trace works only in debug mode, in release mode EBP is 95 // C stack trace works only in debug mode, in release mode EBP is
96 // usually treated as a general-purpose register 96 // usually treated as a general-purpose register
97 CHECK_GT(sample.frames_count, 0);
97 CheckRetAddrIsInCFunction(reinterpret_cast<unsigned int>(sample.stack[0]), 98 CheckRetAddrIsInCFunction(reinterpret_cast<unsigned int>(sample.stack[0]),
98 reinterpret_cast<unsigned int>(&CFunc)); 99 reinterpret_cast<unsigned int>(&CFunc));
99 CHECK_EQ(0, sample.stack[1]);
100 #endif 100 #endif
101 } 101 }
102 102
103 103
104 // --- T r a c e E x t e n s i o n --- 104 // --- T r a c e E x t e n s i o n ---
105 105
106 class TraceExtension : public v8::Extension { 106 class TraceExtension : public v8::Extension {
107 public: 107 public:
108 TraceExtension() : v8::Extension("v8/trace", kSource) { } 108 TraceExtension() : v8::Extension("v8/trace", kSource) { }
109 virtual v8::Handle<v8::FunctionTemplate> GetNativeFunction( 109 virtual v8::Handle<v8::FunctionTemplate> GetNativeFunction(
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after
210 call_trace_code->instruction_size(), 210 call_trace_code->instruction_size(),
211 original, patch, sizeof(patch))); 211 original, patch, sizeof(patch)));
212 212
213 SetGlobalProperty("JSFuncDoTrace", v8::ToApi<Value>(call_trace)); 213 SetGlobalProperty("JSFuncDoTrace", v8::ToApi<Value>(call_trace));
214 214
215 CompileRun( 215 CompileRun(
216 "function JSTrace() {" 216 "function JSTrace() {"
217 " JSFuncDoTrace();" 217 " JSFuncDoTrace();"
218 "};\n" 218 "};\n"
219 "JSTrace();"); 219 "JSTrace();");
220 CHECK_NE(0, *(sample.stack)); 220 CHECK_GT(sample.frames_count, 1);
221 CheckRetAddrIsInFunction( 221 CheckRetAddrIsInFunction(
222 reinterpret_cast<unsigned int>(sample.stack[0]), 222 reinterpret_cast<unsigned int>(sample.stack[0]),
223 reinterpret_cast<unsigned int>(call_trace_code->instruction_start()), 223 reinterpret_cast<unsigned int>(call_trace_code->instruction_start()),
224 call_trace_code->instruction_size()); 224 call_trace_code->instruction_size());
225 Handle<JSFunction> js_trace(JSFunction::cast(*(v8::Utils::OpenHandle( 225 Handle<JSFunction> js_trace(JSFunction::cast(*(v8::Utils::OpenHandle(
226 *GetGlobalProperty("JSTrace"))))); 226 *GetGlobalProperty("JSTrace")))));
227 v8::internal::Code* js_trace_code = js_trace->code(); 227 v8::internal::Code* js_trace_code = js_trace->code();
228 CheckRetAddrIsInFunction( 228 CheckRetAddrIsInFunction(
229 reinterpret_cast<unsigned int>(sample.stack[1]), 229 reinterpret_cast<unsigned int>(sample.stack[1]),
230 reinterpret_cast<unsigned int>(js_trace_code->instruction_start()), 230 reinterpret_cast<unsigned int>(js_trace_code->instruction_start()),
231 js_trace_code->instruction_size()); 231 js_trace_code->instruction_size());
232 } 232 }
233 233
234 #endif // ENABLE_LOGGING_AND_PROFILING 234 #endif // ENABLE_LOGGING_AND_PROFILING
OLDNEW
« no previous file with comments | « src/platform.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698