[liveedit] patch source position table for bytecode arrays.

R=mstarzinger@chromium.org
BUG=v8:4765

Review-Url: https://codereview.chromium.org/1976933002
Cr-Commit-Position: refs/heads/master@{#36240}
This commit is contained in:
yangguo 2016-05-13 06:20:55 -07:00 committed by Commit bot
parent 82db9dece3
commit 7b1fe365a9
2 changed files with 25 additions and 6 deletions

View File

@ -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,11 +1284,10 @@ 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<Code> PatchPositionsInCode(Handle<Code> code,
Handle<JSArray> position_change_array) {
Isolate* isolate = code->GetIsolate();
@ -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);
}
}

View File

@ -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],