diff --git a/src/debug/liveedit.cc b/src/debug/liveedit.cc index 0aa9063184..de0eaef76b 100644 --- a/src/debug/liveedit.cc +++ b/src/debug/liveedit.cc @@ -13,6 +13,7 @@ #include "src/deoptimizer.h" #include "src/frames-inl.h" #include "src/global-handles.h" +#include "src/interpreter/source-position-table.h" #include "src/isolate-inl.h" #include "src/messages.h" #include "src/parsing/parser.h" @@ -1283,12 +1284,11 @@ class RelocInfoBuffer { static const int kMaximalBufferSize = 512*MB; }; - +namespace { // Patch positions in code (changes relocation info section) and possibly // returns new instance of code. -static Handle PatchPositionsInCode( - Handle code, - Handle position_change_array) { +Handle PatchPositionsInCode(Handle code, + Handle position_change_array) { Isolate* isolate = code->GetIsolate(); RelocInfoBuffer buffer_writer(code->relocation_size(), @@ -1329,6 +1329,24 @@ static Handle PatchPositionsInCode( } } +void PatchPositionsInBytecodeArray(Handle bytecode, + Handle position_change_array) { + Isolate* isolate = bytecode->GetIsolate(); + Zone zone(isolate->allocator()); + interpreter::SourcePositionTableBuilder builder(isolate, &zone); + + for (interpreter::SourcePositionTableIterator iterator( + bytecode->source_position_table()); + !iterator.done(); iterator.Advance()) { + int position = iterator.source_position(); + int new_position = TranslatePosition(position, position_change_array); + builder.AddPosition(iterator.bytecode_offset(), new_position, + iterator.is_statement()); + } + + bytecode->set_source_position_table(*builder.ToSourcePositionTable()); +} +} // namespace void LiveEdit::PatchFunctionPositions(Handle shared_info_array, Handle position_change_array) { @@ -1359,6 +1377,9 @@ void LiveEdit::PatchFunctionPositions(Handle shared_info_array, // untouched). ReplaceCodeObject(Handle(info->code()), patched_code); } + } else if (info->HasBytecodeArray()) { + PatchPositionsInBytecodeArray(Handle(info->bytecode_array()), + position_change_array); } } diff --git a/test/mjsunit/mjsunit.status b/test/mjsunit/mjsunit.status index 5a83b66b70..bb90311767 100644 --- a/test/mjsunit/mjsunit.status +++ b/test/mjsunit/mjsunit.status @@ -290,7 +290,6 @@ # TODO(rmcilroy,4765): assertion failures in LiveEdit tests. 'debug-liveedit-stepin': [PASS, NO_IGNITION], 'debug-liveedit-stack-padding': [PASS, NO_IGNITION], - 'debug-liveedit-breakpoints': [PASS, NO_IGNITION], # TODO(mythria, 4780): Related to type feedback for calls in interpreter. 'array-literal-feedback': [PASS, NO_IGNITION], @@ -845,7 +844,6 @@ # TODO(rmcilroy,4765): assertion failures in LiveEdit tests. 'debug-liveedit-stepin': [FAIL], 'debug-liveedit-stack-padding': [SKIP], - 'debug-liveedit-breakpoints': [FAIL], # TODO(mythria, 4780): Related to type feedback for calls in interpreter. 'array-literal-feedback': [FAIL],