Commit d8cddade authored by yangguo's avatar yangguo Committed by Commit bot

[interpreter] Add field for source position table to byte code array.

R=mstarzinger@chromium.org
BUG=v8:4690
LOG=N

Review URL: https://codereview.chromium.org/1601813009

Cr-Commit-Position: refs/heads/master@{#33409}
parent 232e28d6
......@@ -3057,6 +3057,7 @@ AllocationResult Heap::AllocateBytecodeArray(int length,
instance->set_parameter_count(parameter_count);
instance->set_constant_pool(constant_pool);
instance->set_handler_table(empty_fixed_array());
instance->set_source_position_table(empty_fixed_array());
CopyBytes(instance->GetFirstBytecodeAddress(), raw_bytecodes, length);
return result;
......
......@@ -193,7 +193,8 @@ class JSArrayBuffer::BodyDescriptor final : public BodyDescriptorBase {
class BytecodeArray::BodyDescriptor final : public BodyDescriptorBase {
public:
static bool IsValidSlot(HeapObject* obj, int offset) {
return offset == kConstantPoolOffset || offset == kHandlerTableOffset;
return offset >= kConstantPoolOffset &&
offset <= kSourcePositionTableOffset;
}
template <typename ObjectVisitor>
......@@ -201,6 +202,7 @@ class BytecodeArray::BodyDescriptor final : public BodyDescriptorBase {
ObjectVisitor* v) {
IteratePointer(obj, kConstantPoolOffset, v);
IteratePointer(obj, kHandlerTableOffset, v);
IteratePointer(obj, kSourcePositionTableOffset, v);
}
template <typename StaticVisitor>
......@@ -208,6 +210,7 @@ class BytecodeArray::BodyDescriptor final : public BodyDescriptorBase {
Heap* heap = obj->GetHeap();
IteratePointer<StaticVisitor>(heap, obj, kConstantPoolOffset);
IteratePointer<StaticVisitor>(heap, obj, kHandlerTableOffset);
IteratePointer<StaticVisitor>(heap, obj, kSourcePositionTableOffset);
}
static inline int SizeOf(Map* map, HeapObject* obj) {
......
......@@ -4051,6 +4051,8 @@ int BytecodeArray::parameter_count() const {
ACCESSORS(BytecodeArray, constant_pool, FixedArray, kConstantPoolOffset)
ACCESSORS(BytecodeArray, handler_table, FixedArray, kHandlerTableOffset)
ACCESSORS(BytecodeArray, source_position_table, FixedArray,
kSourcePositionTableOffset)
Address BytecodeArray::GetFirstBytecodeAddress() {
......
......@@ -4379,6 +4379,10 @@ class BytecodeArray : public FixedArrayBase {
// Accessors for handler table containing offsets of exception handlers.
DECL_ACCESSORS(handler_table, FixedArray)
// Accessors for source position table containing mappings between byte code
// offset and source position.
DECL_ACCESSORS(source_position_table, FixedArray)
DECLARE_CAST(BytecodeArray)
// Dispatched behavior.
......@@ -4394,7 +4398,9 @@ class BytecodeArray : public FixedArrayBase {
static const int kParameterSizeOffset = kFrameSizeOffset + kIntSize;
static const int kConstantPoolOffset = kParameterSizeOffset + kIntSize;
static const int kHandlerTableOffset = kConstantPoolOffset + kPointerSize;
static const int kHeaderSize = kHandlerTableOffset + kPointerSize;
static const int kSourcePositionTableOffset =
kHandlerTableOffset + kPointerSize;
static const int kHeaderSize = kSourcePositionTableOffset + kPointerSize;
static const int kAlignedSize = OBJECT_POINTER_ALIGN(kHeaderSize);
......
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