Index: test/cctest/test-log.cc |
diff --git a/test/cctest/test-log.cc b/test/cctest/test-log.cc |
index 9ca2f839631fe1c3a5b4fcb7f0df0693f5f306e9..925803cc150d8d05f909aa23aefe180a81444bc3 100644 |
--- a/test/cctest/test-log.cc |
+++ b/test/cctest/test-log.cc |
@@ -531,3 +531,58 @@ TEST(LogVersion) { |
} |
isolate->Dispose(); |
} |
+ |
+ |
+// https://crbug.com/539892 |
+// CodeCreateEvents with really large names should not crash. |
+TEST(Issue539892) { |
+ class : public i::CodeEventLogger { |
+ public: |
+ virtual void CodeMoveEvent(Address from, Address to) {} |
+ virtual void CodeDeleteEvent(Address from) {} |
+ virtual void CodeDisableOptEvent(i::Code* code, |
+ i::SharedFunctionInfo* shared) {} |
+ |
+ private: |
+ virtual void LogRecordedBuffer(i::Code* code, i::SharedFunctionInfo* shared, |
+ const char* name, int length) {} |
+ } code_event_logger; |
+ SETUP_FLAGS(); |
+ v8::Isolate::CreateParams create_params; |
+ create_params.array_buffer_allocator = CcTest::array_buffer_allocator(); |
+ v8::Isolate* isolate = v8::Isolate::New(create_params); |
+ |
+ { |
+ ScopedLoggerInitializer initialize_logger(saved_log, saved_prof, isolate); |
+ Logger* logger = initialize_logger.logger(); |
+ logger->addCodeEventListener(&code_event_logger); |
+ |
+ // Function with a really large name. |
+ const char* source_text = |
+ "(function " |
+ "baaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" |
+ "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" |
+ "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" |
+ "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" |
+ "aaaaaaaaaaaaaaaaaaaaaaaaaa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