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 459 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
470 logger->StringEvent("test-traversal-done", ""); | 470 logger->StringEvent("test-traversal-done", ""); |
471 | 471 |
472 bool exists = false; | 472 bool exists = false; |
473 i::Vector<const char> log( | 473 i::Vector<const char> log( |
474 i::ReadFile(initialize_logger.StopLoggingGetTempFile(), &exists, true)); | 474 i::ReadFile(initialize_logger.StopLoggingGetTempFile(), &exists, true)); |
475 CHECK(exists); | 475 CHECK(exists); |
476 v8::Handle<v8::String> log_str = v8::String::NewFromUtf8( | 476 v8::Handle<v8::String> log_str = v8::String::NewFromUtf8( |
477 isolate, log.start(), v8::String::kNormalString, log.length()); | 477 isolate, log.start(), v8::String::kNormalString, log.length()); |
478 initialize_logger.env()->Global()->Set(v8_str("_log"), log_str); | 478 initialize_logger.env()->Global()->Set(v8_str("_log"), log_str); |
479 | 479 |
480 i::Vector<const unsigned char> source = TestSources::GetScriptsSource(); | 480 i::Vector<const char> source = TestSources::GetScriptsSource(); |
481 v8::Handle<v8::String> source_str = v8::String::NewFromUtf8( | 481 v8::Handle<v8::String> source_str = v8::String::NewFromUtf8( |
482 isolate, reinterpret_cast<const char*>(source.start()), | 482 isolate, source.start(), v8::String::kNormalString, source.length()); |
483 v8::String::kNormalString, source.length()); | |
484 v8::TryCatch try_catch; | 483 v8::TryCatch try_catch; |
485 v8::Handle<v8::Script> script = CompileWithOrigin(source_str, ""); | 484 v8::Handle<v8::Script> script = CompileWithOrigin(source_str, ""); |
486 if (script.IsEmpty()) { | 485 if (script.IsEmpty()) { |
487 v8::String::Utf8Value exception(try_catch.Exception()); | 486 v8::String::Utf8Value exception(try_catch.Exception()); |
488 printf("compile: %s\n", *exception); | 487 printf("compile: %s\n", *exception); |
489 CHECK(false); | 488 CHECK(false); |
490 } | 489 } |
491 v8::Handle<v8::Value> result = script->Run(); | 490 v8::Handle<v8::Value> result = script->Run(); |
492 if (result.IsEmpty()) { | 491 if (result.IsEmpty()) { |
493 v8::String::Utf8Value exception(try_catch.Exception()); | 492 v8::String::Utf8Value exception(try_catch.Exception()); |
494 printf("run: %s\n", *exception); | 493 printf("run: %s\n", *exception); |
495 CHECK(false); | 494 CHECK(false); |
496 } | 495 } |
497 // The result either be a "true" literal or problem description. | 496 // The result either be a "true" literal or problem description. |
498 if (!result->IsTrue()) { | 497 if (!result->IsTrue()) { |
499 v8::Local<v8::String> s = result->ToString(isolate); | 498 v8::Local<v8::String> s = result->ToString(isolate); |
500 i::ScopedVector<char> data(s->Utf8Length() + 1); | 499 i::ScopedVector<char> data(s->Utf8Length() + 1); |
501 CHECK_NE(NULL, data.start()); | 500 CHECK_NE(NULL, data.start()); |
502 s->WriteUtf8(data.start()); | 501 s->WriteUtf8(data.start()); |
503 printf("%s\n", data.start()); | 502 printf("%s\n", data.start()); |
504 // Make sure that our output is written prior crash due to CHECK failure. | 503 // Make sure that our output is written prior crash due to CHECK failure. |
505 fflush(stdout); | 504 fflush(stdout); |
506 CHECK(false); | 505 CHECK(false); |
507 } | 506 } |
508 } | 507 } |
509 isolate->Dispose(); | 508 isolate->Dispose(); |
510 } | 509 } |
OLD | NEW |