Commit 2988633f authored by Dan Elphick's avatar Dan Elphick Committed by Commit Bot

[interpreter] Add more info to bytecode mismatch messages

Adds function name, script name/url and start (character) position to
the error message on a bytecode mismatch.

Bug: v8:8510
Change-Id: I8505d744eb4bbf5f0bab35e2db7f2867d2df49de
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/1869197Reviewed-by: 's avatarMythri Alle <mythria@chromium.org>
Commit-Queue: Dan Elphick <delphick@chromium.org>
Cr-Commit-Position: refs/heads/master@{#64385}
parent 94d8fcb8
......@@ -215,7 +215,24 @@ void InterpreterCompilationJob::CheckAndPrintBytecodeMismatch(
Handle<BytecodeArray> new_bytecode =
generator()->FinalizeBytecode(isolate, parse_info()->script());
std::cerr << "Bytecode mismatch\nOriginal bytecode:\n";
std::cerr << "Bytecode mismatch";
#ifdef OBJECT_PRINT
std::cerr << " found for function: ";
Handle<String> name = parse_info()->function_name()->string();
if (name->length() == 0) {
std::cerr << "anonymous";
} else {
name->StringPrint(std::cerr);
}
Object script_name = parse_info()->script()->GetNameOrSourceURL();
if (script_name.IsString()) {
std::cerr << " ";
String::cast(script_name).StringPrint(std::cerr);
std::cerr << ":" << parse_info()->start_position();
}
#endif
std::cerr << "\nOriginal bytecode:\n";
bytecode->Disassemble(std::cerr);
std::cerr << "\nNew bytecode:\n";
new_bytecode->Disassemble(std::cerr);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment