OLD | NEW |
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 145 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
156 return Top::js_entry_sp(Top::GetCurrentThread()); | 156 return Top::js_entry_sp(Top::GetCurrentThread()); |
157 } | 157 } |
158 | 158 |
159 | 159 |
160 v8::Handle<v8::Value> TraceExtension::JSEntrySP(const v8::Arguments& args) { | 160 v8::Handle<v8::Value> TraceExtension::JSEntrySP(const v8::Arguments& args) { |
161 CHECK_NE(0, GetJsEntrySp()); | 161 CHECK_NE(0, GetJsEntrySp()); |
162 return v8::Undefined(); | 162 return v8::Undefined(); |
163 } | 163 } |
164 | 164 |
165 | 165 |
| 166 static void CompileRun(const char* source) { |
| 167 Script::Compile(String::New(source))->Run(); |
| 168 } |
| 169 |
| 170 |
166 v8::Handle<v8::Value> TraceExtension::JSEntrySPLevel2( | 171 v8::Handle<v8::Value> TraceExtension::JSEntrySPLevel2( |
167 const v8::Arguments& args) { | 172 const v8::Arguments& args) { |
168 v8::HandleScope scope; | 173 v8::HandleScope scope; |
169 const Address js_entry_sp = GetJsEntrySp(); | 174 const Address js_entry_sp = GetJsEntrySp(); |
170 CHECK_NE(0, js_entry_sp); | 175 CHECK_NE(0, js_entry_sp); |
171 CompileRun("js_entry_sp();"); | 176 CompileRun("js_entry_sp();"); |
172 CHECK_EQ(js_entry_sp, GetJsEntrySp()); | 177 CHECK_EQ(js_entry_sp, GetJsEntrySp()); |
173 return v8::Undefined(); | 178 return v8::Undefined(); |
174 } | 179 } |
175 | 180 |
(...skipping 188 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
364 CHECK_EQ(0, GetJsEntrySp()); | 369 CHECK_EQ(0, GetJsEntrySp()); |
365 CompileRun("a = 1; b = a + 1;"); | 370 CompileRun("a = 1; b = a + 1;"); |
366 CHECK_EQ(0, GetJsEntrySp()); | 371 CHECK_EQ(0, GetJsEntrySp()); |
367 CompileRun("js_entry_sp();"); | 372 CompileRun("js_entry_sp();"); |
368 CHECK_EQ(0, GetJsEntrySp()); | 373 CHECK_EQ(0, GetJsEntrySp()); |
369 CompileRun("js_entry_sp_level2();"); | 374 CompileRun("js_entry_sp_level2();"); |
370 CHECK_EQ(0, GetJsEntrySp()); | 375 CHECK_EQ(0, GetJsEntrySp()); |
371 } | 376 } |
372 | 377 |
373 #endif // ENABLE_LOGGING_AND_PROFILING | 378 #endif // ENABLE_LOGGING_AND_PROFILING |
OLD | NEW |