| 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 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 55 public: | 55 public: |
| 56 explicit ScopedLoggerInitializer(bool prof_lazy) | 56 explicit ScopedLoggerInitializer(bool prof_lazy) |
| 57 : saved_log_(i::FLAG_log), | 57 : saved_log_(i::FLAG_log), |
| 58 saved_prof_lazy_(i::FLAG_prof_lazy), | 58 saved_prof_lazy_(i::FLAG_prof_lazy), |
| 59 saved_prof_(i::FLAG_prof), | 59 saved_prof_(i::FLAG_prof), |
| 60 saved_prof_auto_(i::FLAG_prof_auto), | 60 saved_prof_auto_(i::FLAG_prof_auto), |
| 61 temp_file_(NULL), | 61 temp_file_(NULL), |
| 62 // Need to run this prior to creating the scope. | 62 // Need to run this prior to creating the scope. |
| 63 trick_to_run_init_flags_(init_flags_(prof_lazy)), | 63 trick_to_run_init_flags_(init_flags_(prof_lazy)), |
| 64 scope_(v8::Isolate::GetCurrent()), | 64 scope_(v8::Isolate::GetCurrent()), |
| 65 env_(v8::Context::New()) { | 65 env_(v8::Context::New()), |
| 66 logger_(i::Isolate::Current()->logger()) { |
| 66 env_->Enter(); | 67 env_->Enter(); |
| 67 } | 68 } |
| 68 | 69 |
| 69 ~ScopedLoggerInitializer() { | 70 ~ScopedLoggerInitializer() { |
| 70 env_->Exit(); | 71 env_->Exit(); |
| 71 LOGGER->TearDown(); | 72 logger_->TearDown(); |
| 72 if (temp_file_ != NULL) fclose(temp_file_); | 73 if (temp_file_ != NULL) fclose(temp_file_); |
| 73 i::FLAG_prof_lazy = saved_prof_lazy_; | 74 i::FLAG_prof_lazy = saved_prof_lazy_; |
| 74 i::FLAG_prof = saved_prof_; | 75 i::FLAG_prof = saved_prof_; |
| 75 i::FLAG_prof_auto = saved_prof_auto_; | 76 i::FLAG_prof_auto = saved_prof_auto_; |
| 76 i::FLAG_log = saved_log_; | 77 i::FLAG_log = saved_log_; |
| 77 } | 78 } |
| 78 | 79 |
| 79 v8::Handle<v8::Context>& env() { return env_; } | 80 v8::Handle<v8::Context>& env() { return env_; } |
| 80 | 81 |
| 82 Logger* logger() { return logger_; } |
| 83 |
| 81 FILE* StopLoggingGetTempFile() { | 84 FILE* StopLoggingGetTempFile() { |
| 82 temp_file_ = LOGGER->TearDown(); | 85 temp_file_ = logger_->TearDown(); |
| 83 CHECK_NE(NULL, temp_file_); | 86 CHECK_NE(NULL, temp_file_); |
| 84 fflush(temp_file_); | 87 fflush(temp_file_); |
| 85 rewind(temp_file_); | 88 rewind(temp_file_); |
| 86 return temp_file_; | 89 return temp_file_; |
| 87 } | 90 } |
| 88 | 91 |
| 89 private: | 92 private: |
| 90 static bool init_flags_(bool prof_lazy) { | 93 static bool init_flags_(bool prof_lazy) { |
| 91 i::FLAG_log = true; | 94 i::FLAG_log = true; |
| 92 i::FLAG_prof = true; | 95 i::FLAG_prof = true; |
| 93 i::FLAG_prof_lazy = prof_lazy; | 96 i::FLAG_prof_lazy = prof_lazy; |
| 94 i::FLAG_prof_auto = false; | 97 i::FLAG_prof_auto = false; |
| 95 i::FLAG_logfile = i::Log::kLogToTemporaryFile; | 98 i::FLAG_logfile = i::Log::kLogToTemporaryFile; |
| 96 return prof_lazy; | 99 return prof_lazy; |
| 97 } | 100 } |
| 98 | 101 |
| 99 const bool saved_log_; | 102 const bool saved_log_; |
| 100 const bool saved_prof_lazy_; | 103 const bool saved_prof_lazy_; |
| 101 const bool saved_prof_; | 104 const bool saved_prof_; |
| 102 const bool saved_prof_auto_; | 105 const bool saved_prof_auto_; |
| 103 FILE* temp_file_; | 106 FILE* temp_file_; |
| 104 const bool trick_to_run_init_flags_; | 107 const bool trick_to_run_init_flags_; |
| 105 v8::HandleScope scope_; | 108 v8::HandleScope scope_; |
| 106 v8::Handle<v8::Context> env_; | 109 v8::Handle<v8::Context> env_; |
| 110 Logger* logger_; |
| 107 | 111 |
| 108 DISALLOW_COPY_AND_ASSIGN(ScopedLoggerInitializer); | 112 DISALLOW_COPY_AND_ASSIGN(ScopedLoggerInitializer); |
| 109 }; | 113 }; |
| 110 | 114 |
| 111 } // namespace | 115 } // namespace |
| 112 | 116 |
| 113 | 117 |
| 114 static const char* StrNStr(const char* s1, const char* s2, int n) { | 118 static const char* StrNStr(const char* s1, const char* s2, int n) { |
| 115 if (s1[n] == '\0') return strstr(s1, s2); | 119 if (s1[n] == '\0') return strstr(s1, s2); |
| 116 i::ScopedVector<char> str(n + 1); | 120 i::ScopedVector<char> str(n + 1); |
| 117 i::OS::StrNCpy(str, s1, static_cast<size_t>(n)); | 121 i::OS::StrNCpy(str, s1, static_cast<size_t>(n)); |
| 118 str[n] = '\0'; | 122 str[n] = '\0'; |
| 119 char* found = strstr(str.start(), s2); | 123 char* found = strstr(str.start(), s2); |
| 120 return found != NULL ? s1 + (found - str.start()) : NULL; | 124 return found != NULL ? s1 + (found - str.start()) : NULL; |
| 121 } | 125 } |
| 122 | 126 |
| 123 | 127 |
| 124 TEST(ProfLazyMode) { | 128 TEST(ProfLazyMode) { |
| 125 ScopedLoggerInitializer initialize_logger(true); | 129 ScopedLoggerInitializer initialize_logger(true); |
| 130 Logger* logger = initialize_logger.logger(); |
| 126 | 131 |
| 127 if (!i::V8::UseCrankshaft()) return; | 132 if (!i::V8::UseCrankshaft()) return; |
| 128 | 133 |
| 129 LOGGER->StringEvent("test-start", ""); | 134 logger->StringEvent("test-start", ""); |
| 130 CompileRun("var a = (function(x) { return x + 1; })(10);"); | 135 CompileRun("var a = (function(x) { return x + 1; })(10);"); |
| 131 LOGGER->StringEvent("test-profiler-start", ""); | 136 logger->StringEvent("test-profiler-start", ""); |
| 132 v8::V8::ResumeProfiler(); | 137 v8::V8::ResumeProfiler(); |
| 133 CompileRun( | 138 CompileRun( |
| 134 "var b = (function(x) { return x + 2; })(10);\n" | 139 "var b = (function(x) { return x + 2; })(10);\n" |
| 135 "var c = (function(x) { return x + 3; })(10);\n" | 140 "var c = (function(x) { return x + 3; })(10);\n" |
| 136 "var d = (function(x) { return x + 4; })(10);\n" | 141 "var d = (function(x) { return x + 4; })(10);\n" |
| 137 "var e = (function(x) { return x + 5; })(10);"); | 142 "var e = (function(x) { return x + 5; })(10);"); |
| 138 v8::V8::PauseProfiler(); | 143 v8::V8::PauseProfiler(); |
| 139 LOGGER->StringEvent("test-profiler-stop", ""); | 144 logger->StringEvent("test-profiler-stop", ""); |
| 140 CompileRun("var f = (function(x) { return x + 6; })(10);"); | 145 CompileRun("var f = (function(x) { return x + 6; })(10);"); |
| 141 // Check that profiling can be resumed again. | 146 // Check that profiling can be resumed again. |
| 142 LOGGER->StringEvent("test-profiler-start-2", ""); | 147 logger->StringEvent("test-profiler-start-2", ""); |
| 143 v8::V8::ResumeProfiler(); | 148 v8::V8::ResumeProfiler(); |
| 144 CompileRun( | 149 CompileRun( |
| 145 "var g = (function(x) { return x + 7; })(10);\n" | 150 "var g = (function(x) { return x + 7; })(10);\n" |
| 146 "var h = (function(x) { return x + 8; })(10);\n" | 151 "var h = (function(x) { return x + 8; })(10);\n" |
| 147 "var i = (function(x) { return x + 9; })(10);\n" | 152 "var i = (function(x) { return x + 9; })(10);\n" |
| 148 "var j = (function(x) { return x + 10; })(10);"); | 153 "var j = (function(x) { return x + 10; })(10);"); |
| 149 v8::V8::PauseProfiler(); | 154 v8::V8::PauseProfiler(); |
| 150 LOGGER->StringEvent("test-profiler-stop-2", ""); | 155 logger->StringEvent("test-profiler-stop-2", ""); |
| 151 LOGGER->StringEvent("test-stop", ""); | 156 logger->StringEvent("test-stop", ""); |
| 152 | 157 |
| 153 bool exists = false; | 158 bool exists = false; |
| 154 i::Vector<const char> log( | 159 i::Vector<const char> log( |
| 155 i::ReadFile(initialize_logger.StopLoggingGetTempFile(), &exists, true)); | 160 i::ReadFile(initialize_logger.StopLoggingGetTempFile(), &exists, true)); |
| 156 CHECK(exists); | 161 CHECK(exists); |
| 157 | 162 |
| 158 const char* test_start_position = | 163 const char* test_start_position = |
| 159 StrNStr(log.start(), "test-start,", log.length()); | 164 StrNStr(log.start(), "test-start,", log.length()); |
| 160 CHECK_NE(NULL, test_start_position); | 165 CHECK_NE(NULL, test_start_position); |
| 161 const char* test_profiler_start_position = | 166 const char* test_profiler_start_position = |
| (...skipping 214 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 376 v8::Handle<v8::Script> evil_script = v8::Script::Compile(source, origin); | 381 v8::Handle<v8::Script> evil_script = v8::Script::Compile(source, origin); |
| 377 CHECK(!evil_script.IsEmpty()); | 382 CHECK(!evil_script.IsEmpty()); |
| 378 CHECK(!evil_script->Run().IsEmpty()); | 383 CHECK(!evil_script->Run().IsEmpty()); |
| 379 i::Handle<i::ExternalTwoByteString> i_source( | 384 i::Handle<i::ExternalTwoByteString> i_source( |
| 380 i::ExternalTwoByteString::cast(*v8::Utils::OpenHandle(*source))); | 385 i::ExternalTwoByteString::cast(*v8::Utils::OpenHandle(*source))); |
| 381 // This situation can happen if source was an external string disposed | 386 // This situation can happen if source was an external string disposed |
| 382 // by its owner. | 387 // by its owner. |
| 383 i_source->set_resource(NULL); | 388 i_source->set_resource(NULL); |
| 384 | 389 |
| 385 // Must not crash. | 390 // Must not crash. |
| 386 LOGGER->LogCompiledFunctions(); | 391 i::Isolate::Current()->logger()->LogCompiledFunctions(); |
| 387 } | 392 } |
| 388 | 393 |
| 389 | 394 |
| 390 static v8::Handle<v8::Value> ObjMethod1(const v8::Arguments& args) { | 395 static v8::Handle<v8::Value> ObjMethod1(const v8::Arguments& args) { |
| 391 return v8::Handle<v8::Value>(); | 396 return v8::Handle<v8::Value>(); |
| 392 } | 397 } |
| 393 | 398 |
| 394 TEST(LogCallbacks) { | 399 TEST(LogCallbacks) { |
| 395 ScopedLoggerInitializer initialize_logger(false); | 400 ScopedLoggerInitializer initialize_logger(false); |
| 401 Logger* logger = initialize_logger.logger(); |
| 396 | 402 |
| 397 v8::Persistent<v8::FunctionTemplate> obj = | 403 v8::Persistent<v8::FunctionTemplate> obj = |
| 398 v8::Persistent<v8::FunctionTemplate>::New(v8::Isolate::GetCurrent(), | 404 v8::Persistent<v8::FunctionTemplate>::New(v8::Isolate::GetCurrent(), |
| 399 v8::FunctionTemplate::New()); | 405 v8::FunctionTemplate::New()); |
| 400 obj->SetClassName(v8_str("Obj")); | 406 obj->SetClassName(v8_str("Obj")); |
| 401 v8::Handle<v8::ObjectTemplate> proto = obj->PrototypeTemplate(); | 407 v8::Handle<v8::ObjectTemplate> proto = obj->PrototypeTemplate(); |
| 402 v8::Local<v8::Signature> signature = v8::Signature::New(obj); | 408 v8::Local<v8::Signature> signature = v8::Signature::New(obj); |
| 403 proto->Set(v8_str("method1"), | 409 proto->Set(v8_str("method1"), |
| 404 v8::FunctionTemplate::New(ObjMethod1, | 410 v8::FunctionTemplate::New(ObjMethod1, |
| 405 v8::Handle<v8::Value>(), | 411 v8::Handle<v8::Value>(), |
| 406 signature), | 412 signature), |
| 407 static_cast<v8::PropertyAttribute>(v8::DontDelete)); | 413 static_cast<v8::PropertyAttribute>(v8::DontDelete)); |
| 408 | 414 |
| 409 initialize_logger.env()->Global()->Set(v8_str("Obj"), obj->GetFunction()); | 415 initialize_logger.env()->Global()->Set(v8_str("Obj"), obj->GetFunction()); |
| 410 CompileRun("Obj.prototype.method1.toString();"); | 416 CompileRun("Obj.prototype.method1.toString();"); |
| 411 | 417 |
| 412 LOGGER->LogCompiledFunctions(); | 418 logger->LogCompiledFunctions(); |
| 413 | 419 |
| 414 bool exists = false; | 420 bool exists = false; |
| 415 i::Vector<const char> log( | 421 i::Vector<const char> log( |
| 416 i::ReadFile(initialize_logger.StopLoggingGetTempFile(), &exists, true)); | 422 i::ReadFile(initialize_logger.StopLoggingGetTempFile(), &exists, true)); |
| 417 CHECK(exists); | 423 CHECK(exists); |
| 418 | 424 |
| 419 i::EmbeddedVector<char, 100> ref_data; | 425 i::EmbeddedVector<char, 100> ref_data; |
| 420 i::OS::SNPrintF(ref_data, | 426 i::OS::SNPrintF(ref_data, |
| 421 "code-creation,Callback,-3,0x%" V8PRIxPTR ",1,\"method1\"\0", | 427 "code-creation,Callback,-3,0x%" V8PRIxPTR ",1,\"method1\"\0", |
| 422 ObjMethod1); | 428 ObjMethod1); |
| (...skipping 14 matching lines...) Expand all Loading... |
| 437 const v8::AccessorInfo& info) { | 443 const v8::AccessorInfo& info) { |
| 438 } | 444 } |
| 439 | 445 |
| 440 static v8::Handle<v8::Value> Prop2Getter(v8::Local<v8::String> property, | 446 static v8::Handle<v8::Value> Prop2Getter(v8::Local<v8::String> property, |
| 441 const v8::AccessorInfo& info) { | 447 const v8::AccessorInfo& info) { |
| 442 return v8::Handle<v8::Value>(); | 448 return v8::Handle<v8::Value>(); |
| 443 } | 449 } |
| 444 | 450 |
| 445 TEST(LogAccessorCallbacks) { | 451 TEST(LogAccessorCallbacks) { |
| 446 ScopedLoggerInitializer initialize_logger(false); | 452 ScopedLoggerInitializer initialize_logger(false); |
| 453 Logger* logger = initialize_logger.logger(); |
| 447 | 454 |
| 448 v8::Persistent<v8::FunctionTemplate> obj = | 455 v8::Persistent<v8::FunctionTemplate> obj = |
| 449 v8::Persistent<v8::FunctionTemplate>::New(v8::Isolate::GetCurrent(), | 456 v8::Persistent<v8::FunctionTemplate>::New(v8::Isolate::GetCurrent(), |
| 450 v8::FunctionTemplate::New()); | 457 v8::FunctionTemplate::New()); |
| 451 obj->SetClassName(v8_str("Obj")); | 458 obj->SetClassName(v8_str("Obj")); |
| 452 v8::Handle<v8::ObjectTemplate> inst = obj->InstanceTemplate(); | 459 v8::Handle<v8::ObjectTemplate> inst = obj->InstanceTemplate(); |
| 453 inst->SetAccessor(v8_str("prop1"), Prop1Getter, Prop1Setter); | 460 inst->SetAccessor(v8_str("prop1"), Prop1Getter, Prop1Setter); |
| 454 inst->SetAccessor(v8_str("prop2"), Prop2Getter); | 461 inst->SetAccessor(v8_str("prop2"), Prop2Getter); |
| 455 | 462 |
| 456 LOGGER->LogAccessorCallbacks(); | 463 logger->LogAccessorCallbacks(); |
| 457 | 464 |
| 458 bool exists = false; | 465 bool exists = false; |
| 459 i::Vector<const char> log( | 466 i::Vector<const char> log( |
| 460 i::ReadFile(initialize_logger.StopLoggingGetTempFile(), &exists, true)); | 467 i::ReadFile(initialize_logger.StopLoggingGetTempFile(), &exists, true)); |
| 461 CHECK(exists); | 468 CHECK(exists); |
| 462 | 469 |
| 463 EmbeddedVector<char, 100> prop1_getter_record; | 470 EmbeddedVector<char, 100> prop1_getter_record; |
| 464 i::OS::SNPrintF(prop1_getter_record, | 471 i::OS::SNPrintF(prop1_getter_record, |
| 465 "code-creation,Callback,-3,0x%" V8PRIxPTR ",1,\"get prop1\"", | 472 "code-creation,Callback,-3,0x%" V8PRIxPTR ",1,\"get prop1\"", |
| 466 Prop1Getter); | 473 Prop1Getter); |
| (...skipping 13 matching lines...) Expand all Loading... |
| 480 Prop2Getter); | 487 Prop2Getter); |
| 481 CHECK_NE(NULL, | 488 CHECK_NE(NULL, |
| 482 StrNStr(log.start(), prop2_getter_record.start(), log.length())); | 489 StrNStr(log.start(), prop2_getter_record.start(), log.length())); |
| 483 | 490 |
| 484 obj.Dispose(v8::Isolate::GetCurrent()); | 491 obj.Dispose(v8::Isolate::GetCurrent()); |
| 485 } | 492 } |
| 486 | 493 |
| 487 | 494 |
| 488 TEST(IsLoggingPreserved) { | 495 TEST(IsLoggingPreserved) { |
| 489 ScopedLoggerInitializer initialize_logger(false); | 496 ScopedLoggerInitializer initialize_logger(false); |
| 497 Logger* logger = initialize_logger.logger(); |
| 490 | 498 |
| 491 CHECK(LOGGER->is_logging()); | 499 CHECK(logger->is_logging()); |
| 492 LOGGER->ResumeProfiler(); | 500 logger->ResumeProfiler(); |
| 493 CHECK(LOGGER->is_logging()); | 501 CHECK(logger->is_logging()); |
| 494 LOGGER->PauseProfiler(); | 502 logger->PauseProfiler(); |
| 495 CHECK(LOGGER->is_logging()); | 503 CHECK(logger->is_logging()); |
| 496 } | 504 } |
| 497 | 505 |
| 498 | 506 |
| 499 typedef i::NativesCollection<i::TEST> TestSources; | 507 typedef i::NativesCollection<i::TEST> TestSources; |
| 500 | 508 |
| 501 | 509 |
| 502 // Test that logging of code create / move events is equivalent to traversal of | 510 // Test that logging of code create / move events is equivalent to traversal of |
| 503 // a resulting heap. | 511 // a resulting heap. |
| 504 TEST(EquivalenceOfLoggingAndTraversal) { | 512 TEST(EquivalenceOfLoggingAndTraversal) { |
| 505 // This test needs to be run on a "clean" V8 to ensure that snapshot log | 513 // This test needs to be run on a "clean" V8 to ensure that snapshot log |
| 506 // is loaded. This is always true when running using tools/test.py because | 514 // is loaded. This is always true when running using tools/test.py because |
| 507 // it launches a new cctest instance for every test. To be sure that launching | 515 // it launches a new cctest instance for every test. To be sure that launching |
| 508 // cctest manually also works, please be sure that no tests below | 516 // cctest manually also works, please be sure that no tests below |
| 509 // are using V8. | 517 // are using V8. |
| 510 // | 518 // |
| 511 // P.S. No, V8 can't be re-initialized after disposal, see include/v8.h. | 519 // P.S. No, V8 can't be re-initialized after disposal, see include/v8.h. |
| 512 CHECK(!i::V8::IsRunning()); | 520 CHECK(!i::V8::IsRunning()); |
| 513 | 521 |
| 514 // Start with profiling to capture all code events from the beginning. | 522 // Start with profiling to capture all code events from the beginning. |
| 515 ScopedLoggerInitializer initialize_logger(false); | 523 ScopedLoggerInitializer initialize_logger(false); |
| 524 Logger* logger = initialize_logger.logger(); |
| 516 | 525 |
| 517 // Compile and run a function that creates other functions. | 526 // Compile and run a function that creates other functions. |
| 518 CompileRun( | 527 CompileRun( |
| 519 "(function f(obj) {\n" | 528 "(function f(obj) {\n" |
| 520 " obj.test =\n" | 529 " obj.test =\n" |
| 521 " (function a(j) { return function b() { return j; } })(100);\n" | 530 " (function a(j) { return function b() { return j; } })(100);\n" |
| 522 "})(this);"); | 531 "})(this);"); |
| 523 v8::V8::PauseProfiler(); | 532 v8::V8::PauseProfiler(); |
| 524 HEAP->CollectAllGarbage(i::Heap::kMakeHeapIterableMask); | 533 HEAP->CollectAllGarbage(i::Heap::kMakeHeapIterableMask); |
| 525 LOGGER->StringEvent("test-logging-done", ""); | 534 logger->StringEvent("test-logging-done", ""); |
| 526 | 535 |
| 527 // Iterate heap to find compiled functions, will write to log. | 536 // Iterate heap to find compiled functions, will write to log. |
| 528 LOGGER->LogCompiledFunctions(); | 537 logger->LogCompiledFunctions(); |
| 529 LOGGER->StringEvent("test-traversal-done", ""); | 538 logger->StringEvent("test-traversal-done", ""); |
| 530 | 539 |
| 531 bool exists = false; | 540 bool exists = false; |
| 532 i::Vector<const char> log( | 541 i::Vector<const char> log( |
| 533 i::ReadFile(initialize_logger.StopLoggingGetTempFile(), &exists, true)); | 542 i::ReadFile(initialize_logger.StopLoggingGetTempFile(), &exists, true)); |
| 534 CHECK(exists); | 543 CHECK(exists); |
| 535 v8::Handle<v8::String> log_str = v8::String::New(log.start(), log.length()); | 544 v8::Handle<v8::String> log_str = v8::String::New(log.start(), log.length()); |
| 536 initialize_logger.env()->Global()->Set(v8_str("_log"), log_str); | 545 initialize_logger.env()->Global()->Set(v8_str("_log"), log_str); |
| 537 | 546 |
| 538 i::Vector<const unsigned char> source = TestSources::GetScriptsSource(); | 547 i::Vector<const unsigned char> source = TestSources::GetScriptsSource(); |
| 539 v8::Handle<v8::String> source_str = v8::String::New( | 548 v8::Handle<v8::String> source_str = v8::String::New( |
| (...skipping 16 matching lines...) Expand all Loading... |
| 556 v8::Local<v8::String> s = result->ToString(); | 565 v8::Local<v8::String> s = result->ToString(); |
| 557 i::ScopedVector<char> data(s->Length() + 1); | 566 i::ScopedVector<char> data(s->Length() + 1); |
| 558 CHECK_NE(NULL, data.start()); | 567 CHECK_NE(NULL, data.start()); |
| 559 s->WriteAscii(data.start()); | 568 s->WriteAscii(data.start()); |
| 560 printf("%s\n", data.start()); | 569 printf("%s\n", data.start()); |
| 561 // Make sure that our output is written prior crash due to CHECK failure. | 570 // Make sure that our output is written prior crash due to CHECK failure. |
| 562 fflush(stdout); | 571 fflush(stdout); |
| 563 CHECK(false); | 572 CHECK(false); |
| 564 } | 573 } |
| 565 } | 574 } |
| OLD | NEW |