| 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 513 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 524 CHECK(exists); | 524 CHECK(exists); |
| 525 i::EmbeddedVector<char, 100> ref_data; | 525 i::EmbeddedVector<char, 100> ref_data; |
| 526 i::SNPrintF(ref_data, "v8-version,%d,%d,%d,%d,%d", i::Version::GetMajor(), | 526 i::SNPrintF(ref_data, "v8-version,%d,%d,%d,%d,%d", i::Version::GetMajor(), |
| 527 i::Version::GetMinor(), i::Version::GetBuild(), | 527 i::Version::GetMinor(), i::Version::GetBuild(), |
| 528 i::Version::GetPatch(), i::Version::IsCandidate()); | 528 i::Version::GetPatch(), i::Version::IsCandidate()); |
| 529 CHECK(StrNStr(log.start(), ref_data.start(), log.length())); | 529 CHECK(StrNStr(log.start(), ref_data.start(), log.length())); |
| 530 log.Dispose(); | 530 log.Dispose(); |
| 531 } | 531 } |
| 532 isolate->Dispose(); | 532 isolate->Dispose(); |
| 533 } | 533 } |
| 534 | |
| 535 | |
| 536 // https://crbug.com/539892 | |
| 537 // CodeCreateEvents with really large names should not crash. | |
| 538 TEST(Issue539892) { | |
| 539 SETUP_FLAGS(); | |
| 540 bool saved_perf_basic_prof = i::FLAG_perf_basic_prof; | |
| 541 i::FLAG_perf_basic_prof = true; | |
| 542 | |
| 543 v8::Isolate::CreateParams create_params; | |
| 544 create_params.array_buffer_allocator = CcTest::array_buffer_allocator(); | |
| 545 v8::Isolate* isolate = v8::Isolate::New(create_params); | |
| 546 | |
| 547 { | |
| 548 ScopedLoggerInitializer initialize_logger(saved_log, saved_prof, isolate); | |
| 549 Logger* logger = initialize_logger.logger(); | |
| 550 | |
| 551 // Function with a really large name. | |
| 552 const char* source_text = | |
| 553 "(function " | |
| 554 "baaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" | |
| 555 "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" | |
| 556 "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" | |
| 557 "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" | |
| 558 "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" | |
| 559 "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" | |
| 560 "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" | |
| 561 "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" | |
| 562 "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" | |
| 563 "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" | |
| 564 "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" | |
| 565 "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" | |
| 566 "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" | |
| 567 "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" | |
| 568 "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" | |
| 569 "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" | |
| 570 "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaac" | |
| 571 "(){})();"; | |
| 572 | |
| 573 CompileRun(source_text); | |
| 574 | |
| 575 // Must not crash. | |
| 576 logger->LogCompiledFunctions(); | |
| 577 } | |
| 578 isolate->Dispose(); | |
| 579 i::FLAG_perf_basic_prof = saved_perf_basic_prof; | |
| 580 } | |
| OLD | NEW |