Commit 16c1cb83 authored by Jaroslav Sevcik's avatar Jaroslav Sevcik Committed by Commit Bot

[turbofan] Serialize source position table

... for concurrent graph building.

Bug: v8:7790
Change-Id: I55eb419bda843670eff7de31e942dd8406c792f9
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/1682027
Commit-Queue: Jaroslav Sevcik <jarin@chromium.org>
Reviewed-by: 's avatarGeorg Neis <neis@chromium.org>
Cr-Commit-Position: refs/heads/master@{#62455}
parent 6b9ab7e5
......@@ -958,8 +958,8 @@ BytecodeGraphBuilder::BytecodeGraphBuilder(
bytecode_array.parameter_count(), bytecode_array.register_count(),
shared_info)),
source_position_iterator_(
handle(bytecode_array.object()->SourcePositionTableIfCollected(),
isolate())),
Vector<const byte>(bytecode_array.source_positions_address(),
bytecode_array.source_positions_size())),
bytecode_iterator_(
base::make_unique<OffHeapBytecodeArray>(bytecode_array)),
bytecode_analysis_(
......
......@@ -1358,9 +1358,22 @@ class BytecodeArrayData : public FixedArrayBaseData {
constant_pool_.push_back(broker->GetOrCreateData(constant_pool->get(i)));
}
Handle<ByteArray> source_position_table(
bytecode_array->SourcePositionTableIfCollected(), broker->isolate());
source_positions_.reserve(source_position_table->length());
for (int i = 0; i < source_position_table->length(); i++) {
source_positions_.push_back(source_position_table->get(i));
}
is_serialized_for_compilation_ = true;
}
const byte* source_positions_address() const {
return source_positions_.data();
}
size_t source_positions_size() const { return source_positions_.size(); }
BytecodeArrayData(JSHeapBroker* broker, ObjectData** storage,
Handle<BytecodeArray> object)
: FixedArrayBaseData(broker, storage, object),
......@@ -1369,6 +1382,7 @@ class BytecodeArrayData : public FixedArrayBaseData {
incoming_new_target_or_generator_register_(
object->incoming_new_target_or_generator_register()),
bytecodes_(broker->zone()),
source_positions_(broker->zone()),
constant_pool_(broker->zone()) {}
private:
......@@ -1378,6 +1392,7 @@ class BytecodeArrayData : public FixedArrayBaseData {
bool is_serialized_for_compilation_ = false;
ZoneVector<uint8_t> bytecodes_;
ZoneVector<uint8_t> source_positions_;
ZoneVector<ObjectData*> constant_pool_;
};
......@@ -2751,6 +2766,22 @@ void BytecodeArrayRef::SerializeForCompilation() {
data()->AsBytecodeArray()->SerializeForCompilation(broker());
}
const byte* BytecodeArrayRef::source_positions_address() const {
if (broker()->mode() == JSHeapBroker::kDisabled) {
AllowHandleDereference allow_handle_dereference;
return object()->SourcePositionTableIfCollected().GetDataStartAddress();
}
return data()->AsBytecodeArray()->source_positions_address();
}
int BytecodeArrayRef::source_positions_size() const {
if (broker()->mode() == JSHeapBroker::kDisabled) {
AllowHandleDereference allow_handle_dereference;
return object()->SourcePositionTableIfCollected().length();
}
return static_cast<int>(data()->AsBytecodeArray()->source_positions_size());
}
#define IF_BROKER_DISABLED_ACCESS_HANDLE_C(holder, name) \
if (broker()->mode() == JSHeapBroker::kDisabled) { \
AllowHandleAllocation handle_allocation; \
......
......@@ -611,6 +611,10 @@ class BytecodeArrayRef : public FixedArrayBaseRef {
uint8_t get(int index) const;
Address GetFirstBytecodeAddress() const;
// Source position table.
const byte* source_positions_address() const;
int source_positions_size() const;
// Constant pool access.
Handle<Object> GetConstantAtIndex(int index) const;
bool IsConstantAtIndexSmi(int index) const;
......
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