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 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
4 // met: | 4 // met: |
5 // | 5 // |
6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
(...skipping 345 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
356 i::Vector<const char> log( | 356 i::Vector<const char> log( |
357 i::ReadFile(initialize_logger.StopLoggingGetTempFile(), &exists, true)); | 357 i::ReadFile(initialize_logger.StopLoggingGetTempFile(), &exists, true)); |
358 CHECK(exists); | 358 CHECK(exists); |
359 | 359 |
360 i::EmbeddedVector<char, 100> ref_data; | 360 i::EmbeddedVector<char, 100> ref_data; |
361 i::OS::SNPrintF(ref_data, | 361 i::OS::SNPrintF(ref_data, |
362 "code-creation,Callback,-2,0x%" V8PRIxPTR ",1,\"method1\"\0", | 362 "code-creation,Callback,-2,0x%" V8PRIxPTR ",1,\"method1\"\0", |
363 ObjMethod1); | 363 ObjMethod1); |
364 | 364 |
365 CHECK_NE(NULL, StrNStr(log.start(), ref_data.start(), log.length())); | 365 CHECK_NE(NULL, StrNStr(log.start(), ref_data.start(), log.length())); |
| 366 log.Dispose(); |
366 } | 367 } |
367 | 368 |
368 | 369 |
369 static void Prop1Getter(v8::Local<v8::String> property, | 370 static void Prop1Getter(v8::Local<v8::String> property, |
370 const v8::PropertyCallbackInfo<v8::Value>& info) { | 371 const v8::PropertyCallbackInfo<v8::Value>& info) { |
371 } | 372 } |
372 | 373 |
373 static void Prop1Setter(v8::Local<v8::String> property, | 374 static void Prop1Setter(v8::Local<v8::String> property, |
374 v8::Local<v8::Value> value, | 375 v8::Local<v8::Value> value, |
375 const v8::PropertyCallbackInfo<void>& info) { | 376 const v8::PropertyCallbackInfo<void>& info) { |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
413 Prop1Setter); | 414 Prop1Setter); |
414 CHECK_NE(NULL, | 415 CHECK_NE(NULL, |
415 StrNStr(log.start(), prop1_setter_record.start(), log.length())); | 416 StrNStr(log.start(), prop1_setter_record.start(), log.length())); |
416 | 417 |
417 EmbeddedVector<char, 100> prop2_getter_record; | 418 EmbeddedVector<char, 100> prop2_getter_record; |
418 i::OS::SNPrintF(prop2_getter_record, | 419 i::OS::SNPrintF(prop2_getter_record, |
419 "code-creation,Callback,-2,0x%" V8PRIxPTR ",1,\"get prop2\"", | 420 "code-creation,Callback,-2,0x%" V8PRIxPTR ",1,\"get prop2\"", |
420 Prop2Getter); | 421 Prop2Getter); |
421 CHECK_NE(NULL, | 422 CHECK_NE(NULL, |
422 StrNStr(log.start(), prop2_getter_record.start(), log.length())); | 423 StrNStr(log.start(), prop2_getter_record.start(), log.length())); |
| 424 log.Dispose(); |
423 } | 425 } |
424 | 426 |
425 | 427 |
426 typedef i::NativesCollection<i::TEST> TestSources; | 428 typedef i::NativesCollection<i::TEST> TestSources; |
427 | 429 |
428 | 430 |
429 // Test that logging of code create / move events is equivalent to traversal of | 431 // Test that logging of code create / move events is equivalent to traversal of |
430 // a resulting heap. | 432 // a resulting heap. |
431 TEST(EquivalenceOfLoggingAndTraversal) { | 433 TEST(EquivalenceOfLoggingAndTraversal) { |
432 // This test needs to be run on a "clean" V8 to ensure that snapshot log | 434 // This test needs to be run on a "clean" V8 to ensure that snapshot log |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
483 v8::Local<v8::String> s = result->ToString(); | 485 v8::Local<v8::String> s = result->ToString(); |
484 i::ScopedVector<char> data(s->Utf8Length() + 1); | 486 i::ScopedVector<char> data(s->Utf8Length() + 1); |
485 CHECK_NE(NULL, data.start()); | 487 CHECK_NE(NULL, data.start()); |
486 s->WriteUtf8(data.start()); | 488 s->WriteUtf8(data.start()); |
487 printf("%s\n", data.start()); | 489 printf("%s\n", data.start()); |
488 // Make sure that our output is written prior crash due to CHECK failure. | 490 // Make sure that our output is written prior crash due to CHECK failure. |
489 fflush(stdout); | 491 fflush(stdout); |
490 CHECK(false); | 492 CHECK(false); |
491 } | 493 } |
492 } | 494 } |
OLD | NEW |