Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(905)

Unified Diff: src/objects-inl.h

Issue 2788413004: [inspector] cache stack frame for call sites (Closed)
Patch Set: reverted v8-debugger change Created 3 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/objects.cc ('k') | src/perf-jit.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/objects-inl.h
diff --git a/src/objects-inl.h b/src/objects-inl.h
index ecf821f2e7ca0d02d3f8e79b0f15b4a72362647e..963160b8f8f313cf445c4a34c11b1e41a549400a 100644
--- a/src/objects-inl.h
+++ b/src/objects-inl.h
@@ -178,6 +178,7 @@ TYPE_CHECKER(MutableHeapNumber, MUTABLE_HEAP_NUMBER_TYPE)
TYPE_CHECKER(Oddball, ODDBALL_TYPE)
TYPE_CHECKER(PropertyCell, PROPERTY_CELL_TYPE)
TYPE_CHECKER(SharedFunctionInfo, SHARED_FUNCTION_INFO_TYPE)
+TYPE_CHECKER(SourcePositionTableWithFrameCache, TUPLE2_TYPE)
TYPE_CHECKER(Symbol, SYMBOL_TYPE)
TYPE_CHECKER(TransitionArray, TRANSITION_ARRAY_TYPE)
TYPE_CHECKER(WeakCell, WEAK_CELL_TYPE)
@@ -684,6 +685,7 @@ CAST_ACCESSOR(SeqOneByteString)
CAST_ACCESSOR(SeqString)
CAST_ACCESSOR(SeqTwoByteString)
CAST_ACCESSOR(SharedFunctionInfo)
+CAST_ACCESSOR(SourcePositionTableWithFrameCache)
CAST_ACCESSOR(SlicedString)
CAST_ACCESSOR(Smi)
CAST_ACCESSOR(String)
@@ -4025,13 +4027,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()); }
@@ -4039,7 +4048,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;
}
@@ -5239,9 +5248,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();
}
}
@@ -5253,6 +5262,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();
@@ -5825,6 +5848,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)
@@ -6651,7 +6679,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)
@@ -6684,6 +6712,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());
@@ -6750,7 +6785,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;
}
« no previous file with comments | « src/objects.cc ('k') | src/perf-jit.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698