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

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

Issue 40290: Experimental: Merge 1395:1441 from bleeding_edge branch to the... (Closed) Base URL: http://v8.googlecode.com/svn/branches/experimental/global/
Patch Set: 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 | Annotate | Revision Log
« no previous file with comments | « test/cctest/test-debug.cc ('k') | test/cctest/test-sockets.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Property Changes:
Name: svn:eol-style
+ native
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 25 matching lines...) Expand all
36 36
37 static void InitTraceEnv(StackTracer* tracer, TickSample* sample) { 37 static void InitTraceEnv(StackTracer* tracer, TickSample* sample) {
38 trace_env.tracer = tracer; 38 trace_env.tracer = tracer;
39 trace_env.sample = sample; 39 trace_env.sample = sample;
40 } 40 }
41 41
42 42
43 static void DoTrace(unsigned int fp) { 43 static void DoTrace(unsigned int fp) {
44 trace_env.sample->fp = fp; 44 trace_env.sample->fp = fp;
45 // something that is less than fp 45 // something that is less than fp
46 trace_env.sample->sp = trace_env.sample->fp - sizeof(unsigned int); 46 trace_env.sample->sp = trace_env.sample->fp - 100;
47 trace_env.tracer->Trace(trace_env.sample); 47 trace_env.tracer->Trace(trace_env.sample);
48 } 48 }
49 49
50 50
51 static void CFuncDoTrace() { 51 static void CFuncDoTrace() {
52 unsigned int fp; 52 unsigned int fp;
53 #ifdef __GNUC__ 53 #ifdef __GNUC__
54 fp = reinterpret_cast<unsigned int>(__builtin_frame_address(0)); 54 fp = reinterpret_cast<unsigned int>(__builtin_frame_address(0));
55 #elif defined _MSC_VER 55 #elif defined _MSC_VER
56 __asm mov [fp], ebp // NOLINT 56 __asm mov [fp], ebp // NOLINT
(...skipping 30 matching lines...) Expand all
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_GT(sample.frames_count, 1);
221 CheckRetAddrIsInFunction(
222 reinterpret_cast<unsigned int>(sample.stack[0]),
223 reinterpret_cast<unsigned int>(call_trace_code->instruction_start()),
224 call_trace_code->instruction_size());
220 Handle<JSFunction> js_trace(JSFunction::cast(*(v8::Utils::OpenHandle( 225 Handle<JSFunction> js_trace(JSFunction::cast(*(v8::Utils::OpenHandle(
221 *GetGlobalProperty("JSTrace"))))); 226 *GetGlobalProperty("JSTrace")))));
222 v8::internal::Code* js_trace_code = js_trace->code(); 227 v8::internal::Code* js_trace_code = js_trace->code();
223 CheckRetAddrIsInFunction( 228 CheckRetAddrIsInFunction(
224 reinterpret_cast<unsigned int>(sample.stack[0]), 229 reinterpret_cast<unsigned int>(sample.stack[1]),
225 reinterpret_cast<unsigned int>(js_trace_code->instruction_start()), 230 reinterpret_cast<unsigned int>(js_trace_code->instruction_start()),
226 js_trace_code->instruction_size()); 231 js_trace_code->instruction_size());
227 CHECK_EQ(0, sample.stack[1]);
228 } 232 }
229 233
230 #endif // ENABLE_LOGGING_AND_PROFILING 234 #endif // ENABLE_LOGGING_AND_PROFILING
231
OLDNEW
« no previous file with comments | « test/cctest/test-debug.cc ('k') | test/cctest/test-sockets.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698