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 class : public i::CodeEventLogger { |
| 540 public: |
| 541 virtual void CodeMoveEvent(Address from, Address to) {} |
| 542 virtual void CodeDeleteEvent(Address from) {} |
| 543 virtual void CodeDisableOptEvent(i::Code* code, |
| 544 i::SharedFunctionInfo* shared) {} |
| 545 |
| 546 private: |
| 547 virtual void LogRecordedBuffer(i::Code* code, i::SharedFunctionInfo* shared, |
| 548 const char* name, int length) {} |
| 549 } code_event_logger; |
| 550 SETUP_FLAGS(); |
| 551 v8::Isolate::CreateParams create_params; |
| 552 create_params.array_buffer_allocator = CcTest::array_buffer_allocator(); |
| 553 v8::Isolate* isolate = v8::Isolate::New(create_params); |
| 554 |
| 555 { |
| 556 ScopedLoggerInitializer initialize_logger(saved_log, saved_prof, isolate); |
| 557 Logger* logger = initialize_logger.logger(); |
| 558 logger->addCodeEventListener(&code_event_logger); |
| 559 |
| 560 // Function with a really large name. |
| 561 const char* source_text = |
| 562 "(function " |
| 563 "baaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" |
| 564 "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" |
| 565 "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" |
| 566 "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" |
| 567 "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" |
| 568 "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" |
| 569 "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" |
| 570 "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" |
| 571 "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" |
| 572 "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" |
| 573 "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" |
| 574 "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" |
| 575 "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" |
| 576 "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" |
| 577 "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" |
| 578 "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" |
| 579 "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaac" |
| 580 "(){})();"; |
| 581 |
| 582 CompileRun(source_text); |
| 583 |
| 584 // Must not crash. |
| 585 logger->LogCompiledFunctions(); |
| 586 } |
| 587 isolate->Dispose(); |
| 588 } |
OLD | NEW |