Commit 7b1fe365 authored by yangguo's avatar yangguo Committed by Commit bot

[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}
parent 82db9dec
...@@ -13,6 +13,7 @@ ...@@ -13,6 +13,7 @@
#include "src/deoptimizer.h" #include "src/deoptimizer.h"
#include "src/frames-inl.h" #include "src/frames-inl.h"
#include "src/global-handles.h" #include "src/global-handles.h"
#include "src/interpreter/source-position-table.h"
#include "src/isolate-inl.h" #include "src/isolate-inl.h"
#include "src/messages.h" #include "src/messages.h"
#include "src/parsing/parser.h" #include "src/parsing/parser.h"
...@@ -1283,12 +1284,11 @@ class RelocInfoBuffer { ...@@ -1283,12 +1284,11 @@ class RelocInfoBuffer {
static const int kMaximalBufferSize = 512*MB; static const int kMaximalBufferSize = 512*MB;
}; };
namespace {
// Patch positions in code (changes relocation info section) and possibly // Patch positions in code (changes relocation info section) and possibly
// returns new instance of code. // returns new instance of code.
static Handle<Code> PatchPositionsInCode( Handle<Code> PatchPositionsInCode(Handle<Code> code,
Handle<Code> code, Handle<JSArray> position_change_array) {
Handle<JSArray> position_change_array) {
Isolate* isolate = code->GetIsolate(); Isolate* isolate = code->GetIsolate();
RelocInfoBuffer buffer_writer(code->relocation_size(), RelocInfoBuffer buffer_writer(code->relocation_size(),
...@@ -1329,6 +1329,24 @@ static Handle<Code> PatchPositionsInCode( ...@@ -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, void LiveEdit::PatchFunctionPositions(Handle<JSArray> shared_info_array,
Handle<JSArray> position_change_array) { Handle<JSArray> position_change_array) {
...@@ -1359,6 +1377,9 @@ void LiveEdit::PatchFunctionPositions(Handle<JSArray> shared_info_array, ...@@ -1359,6 +1377,9 @@ void LiveEdit::PatchFunctionPositions(Handle<JSArray> shared_info_array,
// untouched). // untouched).
ReplaceCodeObject(Handle<Code>(info->code()), patched_code); ReplaceCodeObject(Handle<Code>(info->code()), patched_code);
} }
} else if (info->HasBytecodeArray()) {
PatchPositionsInBytecodeArray(Handle<BytecodeArray>(info->bytecode_array()),
position_change_array);
} }
} }
......
...@@ -290,7 +290,6 @@ ...@@ -290,7 +290,6 @@
# TODO(rmcilroy,4765): assertion failures in LiveEdit tests. # TODO(rmcilroy,4765): assertion failures in LiveEdit tests.
'debug-liveedit-stepin': [PASS, NO_IGNITION], 'debug-liveedit-stepin': [PASS, NO_IGNITION],
'debug-liveedit-stack-padding': [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. # TODO(mythria, 4780): Related to type feedback for calls in interpreter.
'array-literal-feedback': [PASS, NO_IGNITION], 'array-literal-feedback': [PASS, NO_IGNITION],
...@@ -845,7 +844,6 @@ ...@@ -845,7 +844,6 @@
# TODO(rmcilroy,4765): assertion failures in LiveEdit tests. # TODO(rmcilroy,4765): assertion failures in LiveEdit tests.
'debug-liveedit-stepin': [FAIL], 'debug-liveedit-stepin': [FAIL],
'debug-liveedit-stack-padding': [SKIP], 'debug-liveedit-stack-padding': [SKIP],
'debug-liveedit-breakpoints': [FAIL],
# TODO(mythria, 4780): Related to type feedback for calls in interpreter. # TODO(mythria, 4780): Related to type feedback for calls in interpreter.
'array-literal-feedback': [FAIL], 'array-literal-feedback': [FAIL],
......
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