Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(151)

Unified Diff: src/debug/liveedit.cc

Issue 1976933002: [liveedit] patch source position table for bytecode arrays. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@liveedit
Patch Set: Created 4 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | test/mjsunit/mjsunit.status » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/debug/liveedit.cc
diff --git a/src/debug/liveedit.cc b/src/debug/liveedit.cc
index 0aa9063184a445e382f78adce8a77aef1043811b..de0eaef76b8b0e11ba549d9507afcb3958b9b46b 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<Code> PatchPositionsInCode(
- Handle<Code> code,
- Handle<JSArray> position_change_array) {
+Handle<Code> PatchPositionsInCode(Handle<Code> code,
+ Handle<JSArray> position_change_array) {
Isolate* isolate = code->GetIsolate();
RelocInfoBuffer buffer_writer(code->relocation_size(),
@@ -1329,6 +1329,24 @@ static Handle<Code> PatchPositionsInCode(
}
}
+void PatchPositionsInBytecodeArray(Handle<BytecodeArray> bytecode,
+ Handle<JSArray> 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<JSArray> shared_info_array,
Handle<JSArray> position_change_array) {
@@ -1359,6 +1377,9 @@ void LiveEdit::PatchFunctionPositions(Handle<JSArray> shared_info_array,
// untouched).
ReplaceCodeObject(Handle<Code>(info->code()), patched_code);
}
+ } else if (info->HasBytecodeArray()) {
+ PatchPositionsInBytecodeArray(Handle<BytecodeArray>(info->bytecode_array()),
+ position_change_array);
}
}
« no previous file with comments | « no previous file | test/mjsunit/mjsunit.status » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698