Index: src/objects-inl.h |
diff --git a/src/objects-inl.h b/src/objects-inl.h |
index 04e0511a57846fcda7a9734c8c49c4cf06fa1f1d..ebce933e77102326a3aa6fc6d891d40f8c2f4e0d 100644 |
--- a/src/objects-inl.h |
+++ b/src/objects-inl.h |
@@ -4021,13 +4021,20 @@ int BytecodeArray::parameter_count() const { |
ACCESSORS(BytecodeArray, constant_pool, FixedArray, kConstantPoolOffset) |
ACCESSORS(BytecodeArray, handler_table, FixedArray, kHandlerTableOffset) |
-ACCESSORS(BytecodeArray, source_position_table, ByteArray, |
+ACCESSORS(BytecodeArray, source_position_table, Object, |
kSourcePositionTableOffset) |
Address BytecodeArray::GetFirstBytecodeAddress() { |
return reinterpret_cast<Address>(this) - kHeapObjectTag + kHeaderSize; |
} |
+ByteArray* BytecodeArray::SourcePositionTable() { |
+ Object* maybe_table = source_position_table(); |
+ if (maybe_table->IsByteArray()) return ByteArray::cast(maybe_table); |
+ DCHECK(maybe_table->IsSourcePositionTableWithFrameCache()); |
+ return SourcePositionTableWithFrameCache::cast(maybe_table) |
+ ->source_position_table(); |
+} |
int BytecodeArray::BytecodeArraySize() { return SizeFor(this->length()); } |
@@ -4035,7 +4042,7 @@ int BytecodeArray::SizeIncludingMetadata() { |
int size = BytecodeArraySize(); |
size += constant_pool()->Size(); |
size += handler_table()->Size(); |
- size += source_position_table()->Size(); |
+ size += SourcePositionTable()->Size(); |
return size; |
} |
@@ -5235,9 +5242,9 @@ int AbstractCode::instruction_size() { |
ByteArray* AbstractCode::source_position_table() { |
if (IsCode()) { |
- return GetCode()->source_position_table(); |
+ return GetCode()->SourcePositionTable(); |
} else { |
- return GetBytecodeArray()->source_position_table(); |
+ return GetBytecodeArray()->SourcePositionTable(); |
} |
} |
@@ -5249,6 +5256,20 @@ void AbstractCode::set_source_position_table(ByteArray* source_position_table) { |
} |
} |
+Object* AbstractCode::stack_frame_cache() { |
+ Object* maybe_table; |
+ if (IsCode()) { |
+ maybe_table = GetCode()->source_position_table(); |
+ } else { |
+ maybe_table = GetBytecodeArray()->source_position_table(); |
+ } |
+ if (maybe_table->IsSourcePositionTableWithFrameCache()) { |
+ return SourcePositionTableWithFrameCache::cast(maybe_table) |
+ ->stack_frame_cache(); |
+ } |
+ return Smi::kZero; |
+} |
+ |
int AbstractCode::SizeIncludingMetadata() { |
if (IsCode()) { |
return GetCode()->SizeIncludingMetadata(); |
@@ -5821,6 +5842,11 @@ BOOL_ACCESSORS(StackFrameInfo, flag, is_eval, kIsEvalBit) |
BOOL_ACCESSORS(StackFrameInfo, flag, is_constructor, kIsConstructorBit) |
BOOL_ACCESSORS(StackFrameInfo, flag, is_wasm, kIsWasmBit) |
+ACCESSORS(SourcePositionTableWithFrameCache, source_position_table, ByteArray, |
+ kSourcePositionTableIndex) |
+ACCESSORS(SourcePositionTableWithFrameCache, stack_frame_cache, |
+ UnseededNumberDictionary, kStackFrameCacheIndex) |
+ |
ACCESSORS(SharedFunctionInfo, name, Object, kNameOffset) |
ACCESSORS(SharedFunctionInfo, optimized_code_map, FixedArray, |
kOptimizedCodeMapOffset) |
@@ -6647,7 +6673,7 @@ INT_ACCESSORS(Code, constant_pool_offset, kConstantPoolOffset) |
CODE_ACCESSORS(relocation_info, ByteArray, kRelocationInfoOffset) |
CODE_ACCESSORS(handler_table, FixedArray, kHandlerTableOffset) |
CODE_ACCESSORS(deoptimization_data, FixedArray, kDeoptimizationDataOffset) |
-CODE_ACCESSORS(source_position_table, ByteArray, kSourcePositionTableOffset) |
+CODE_ACCESSORS(source_position_table, Object, kSourcePositionTableOffset) |
CODE_ACCESSORS(trap_handler_index, Smi, kTrapHandlerIndex) |
CODE_ACCESSORS(raw_type_feedback_info, Object, kTypeFeedbackInfoOffset) |
CODE_ACCESSORS(next_code_link, Object, kNextCodeLinkOffset) |
@@ -6680,6 +6706,13 @@ void Code::set_type_feedback_info(Object* value, WriteBarrierMode mode) { |
value, mode); |
} |
+ByteArray* Code::SourcePositionTable() { |
+ Object* maybe_table = source_position_table(); |
+ if (maybe_table->IsByteArray()) return ByteArray::cast(maybe_table); |
+ DCHECK(maybe_table->IsSourcePositionTableWithFrameCache()); |
+ return SourcePositionTableWithFrameCache::cast(maybe_table) |
+ ->source_position_table(); |
+} |
uint32_t Code::stub_key() { |
DCHECK(IsCodeStubOrIC()); |
@@ -6746,7 +6779,9 @@ int Code::SizeIncludingMetadata() { |
size += relocation_info()->Size(); |
size += deoptimization_data()->Size(); |
size += handler_table()->Size(); |
- if (kind() == FUNCTION) size += source_position_table()->Size(); |
+ if (kind() == FUNCTION) { |
+ size += SourcePositionTable()->Size(); |
+ } |
return size; |
} |