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 logging functions from log.h | 3 // Tests of logging functions from log.h |
4 | 4 |
5 #ifdef ENABLE_LOGGING_AND_PROFILING | 5 #ifdef ENABLE_LOGGING_AND_PROFILING |
6 | 6 |
7 #ifdef __linux__ | 7 #ifdef __linux__ |
8 #include <math.h> | 8 #include <math.h> |
9 #include <pthread.h> | 9 #include <pthread.h> |
10 #include <signal.h> | 10 #include <signal.h> |
(...skipping 492 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
503 v8::Persistent<v8::FunctionTemplate>::New(v8::FunctionTemplate::New()); | 503 v8::Persistent<v8::FunctionTemplate>::New(v8::FunctionTemplate::New()); |
504 obj->SetClassName(v8::String::New("Obj")); | 504 obj->SetClassName(v8::String::New("Obj")); |
505 v8::Handle<v8::ObjectTemplate> proto = obj->PrototypeTemplate(); | 505 v8::Handle<v8::ObjectTemplate> proto = obj->PrototypeTemplate(); |
506 v8::Local<v8::Signature> signature = v8::Signature::New(obj); | 506 v8::Local<v8::Signature> signature = v8::Signature::New(obj); |
507 proto->Set(v8::String::New("method1"), | 507 proto->Set(v8::String::New("method1"), |
508 v8::FunctionTemplate::New(ObjMethod1, | 508 v8::FunctionTemplate::New(ObjMethod1, |
509 v8::Handle<v8::Value>(), | 509 v8::Handle<v8::Value>(), |
510 signature), | 510 signature), |
511 static_cast<v8::PropertyAttribute>(v8::DontDelete)); | 511 static_cast<v8::PropertyAttribute>(v8::DontDelete)); |
512 | 512 |
513 i::Logger::LogCallbacks(); | 513 env->Global()->Set(v8_str("Obj"), obj->GetFunction()); |
| 514 CompileAndRunScript("Obj.prototype.method1.toString();"); |
| 515 |
| 516 i::Logger::LogCompiledFunctions(); |
514 log_pos = GetLogLines(log_pos, &buffer); | 517 log_pos = GetLogLines(log_pos, &buffer); |
515 CHECK_GT(log_pos, 0); | 518 CHECK_GT(log_pos, 0); |
516 buffer[log_pos] = 0; | 519 buffer[log_pos] = 0; |
517 | 520 |
518 const char* callback_rec = "code-creation,Callback,"; | 521 const char* callback_rec = "code-creation,Callback,"; |
519 const char* pos = strstr(buffer.start(), callback_rec); | 522 char* pos = strstr(buffer.start(), callback_rec); |
520 CHECK_NE(NULL, pos); | 523 CHECK_NE(NULL, pos); |
521 pos += strlen(callback_rec); | 524 pos += strlen(callback_rec); |
522 EmbeddedVector<char, 100> ref_data; | 525 EmbeddedVector<char, 100> ref_data; |
523 i::OS::SNPrintF(ref_data, | 526 i::OS::SNPrintF(ref_data, |
524 "0x%" V8PRIxPTR ",0,\"Obj.method1\"\n", ObjMethod1); | 527 "0x%" V8PRIxPTR ",0,\"method1\"", ObjMethod1); |
| 528 *(pos + strlen(ref_data.start())) = '\0'; |
525 CHECK_EQ(ref_data.start(), pos); | 529 CHECK_EQ(ref_data.start(), pos); |
526 | 530 |
527 obj.Dispose(); | 531 obj.Dispose(); |
528 | 532 |
529 env->Exit(); | 533 env->Exit(); |
530 Logger::TearDown(); | 534 Logger::TearDown(); |
531 i::FLAG_prof_lazy = saved_prof_lazy; | 535 i::FLAG_prof_lazy = saved_prof_lazy; |
532 i::FLAG_prof = saved_prof; | 536 i::FLAG_prof = saved_prof; |
533 i::FLAG_prof_auto = saved_prof_auto; | 537 i::FLAG_prof_auto = saved_prof_auto; |
534 } | 538 } |
(...skipping 458 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
993 // Make sure that all log data is written prior crash due to CHECK failure. | 997 // Make sure that all log data is written prior crash due to CHECK failure. |
994 fflush(stdout); | 998 fflush(stdout); |
995 CHECK(results_equal); | 999 CHECK(results_equal); |
996 | 1000 |
997 env->Exit(); | 1001 env->Exit(); |
998 Logger::TearDown(); | 1002 Logger::TearDown(); |
999 i::FLAG_always_compact = saved_always_compact; | 1003 i::FLAG_always_compact = saved_always_compact; |
1000 } | 1004 } |
1001 | 1005 |
1002 #endif // ENABLE_LOGGING_AND_PROFILING | 1006 #endif // ENABLE_LOGGING_AND_PROFILING |
OLD | NEW |