| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent 42e9d80 commit af9d821
5 files changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -37,7 +37,7 @@ | |||
| 37 | 37 | ||
| 38 | 38 | # Reset this number to 0 on major V8 upgrades. | |
| 39 | 39 | # Increment by one for each non-official patch applied to deps/v8. | |
| 40 | - 'v8_embedder_string': '-node.22', | ||
| 40 | + 'v8_embedder_string': '-node.23', | ||
| 41 | 41 | ||
| 42 | 42 | ##### V8 defaults for Node.js ##### | |
| 43 | 43 | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -124,36 +124,41 @@ void StatisticsExtension::GetCounters( | |||
| 124 | 124 | ||
| 125 | 125 | AddNumber64(args.GetIsolate(), result, heap->external_memory(), | |
| 126 | 126 | "amount_of_external_allocated_memory"); | |
| 127 | - args.GetReturnValue().Set(result); | ||
| 128 | 127 | ||
| 129 | - DisallowGarbageCollection no_gc; | ||
| 130 | - HeapObjectIterator iterator( | ||
| 131 | - reinterpret_cast<Isolate*>(args.GetIsolate())->heap()); | ||
| 132 | 128 | int reloc_info_total = 0; | |
| 133 | 129 | int source_position_table_total = 0; | |
| 134 | - for (HeapObject obj = iterator.Next(); !obj.is_null(); | ||
| 135 | - obj = iterator.Next()) { | ||
| 136 | - Object maybe_source_positions; | ||
| 137 | - if (obj.IsCode()) { | ||
| 138 | - Code code = Code::cast(obj); | ||
| 139 | - reloc_info_total += code.relocation_info().Size(); | ||
| 140 | - maybe_source_positions = code.source_position_table(); | ||
| 141 | - } else if (obj.IsBytecodeArray()) { | ||
| 142 | - maybe_source_positions = | ||
| 143 | - BytecodeArray::cast(obj).source_position_table(kAcquireLoad); | ||
| 144 | - } else { | ||
| 145 | - continue; | ||
| 130 | + { | ||
| 131 | + HeapObjectIterator iterator( | ||
| 132 | + reinterpret_cast<Isolate*>(args.GetIsolate())->heap()); | ||
| 133 | + DCHECK(!AllowGarbageCollection::IsAllowed()); | ||
| 134 | + for (HeapObject obj = iterator.Next(); !obj.is_null(); | ||
| 135 | + obj = iterator.Next()) { | ||
| 136 | + Object maybe_source_positions; | ||
| 137 | + if (obj.IsCode()) { | ||
| 138 | + Code code = Code::cast(obj); | ||
| 139 | + reloc_info_total += code.relocation_info().Size(); | ||
| 140 | + // Baseline code doesn't have source positions since it uses | ||
| 141 | + // interpreter code positions. | ||
| 142 | + if (code.kind() == CodeKind::BASELINE) continue; | ||
| 143 | + maybe_source_positions = code.source_position_table(); | ||
| 144 | + } else if (obj.IsBytecodeArray()) { | ||
| 145 | + maybe_source_positions = | ||
| 146 | + BytecodeArray::cast(obj).source_position_table(kAcquireLoad); | ||
| 147 | + } else { | ||
| 148 | + continue; | ||
| 149 | + } | ||
| 150 | + if (!maybe_source_positions.IsByteArray()) continue; | ||
| 151 | + ByteArray source_positions = ByteArray::cast(maybe_source_positions); | ||
| 152 | + if (source_positions.length() == 0) continue; | ||
| 153 | + source_position_table_total += source_positions.Size(); | ||
| 146 | 154 | } | |
| 147 | - if (!maybe_source_positions.IsByteArray()) continue; | ||
| 148 | - ByteArray source_positions = ByteArray::cast(maybe_source_positions); | ||
| 149 | - if (source_positions.length() == 0) continue; | ||
| 150 | - source_position_table_total += source_positions.Size(); | ||
| 151 | 155 | } | |
| 152 | 156 | ||
| 153 | 157 | AddNumber(args.GetIsolate(), result, reloc_info_total, | |
| 154 | 158 | "reloc_info_total_size"); | |
| 155 | 159 | AddNumber(args.GetIsolate(), result, source_position_table_total, | |
| 156 | 160 | "source_position_table_total_size"); | |
| 161 | + args.GetReturnValue().Set(result); | ||
| 157 | 162 | } | |
| 158 | 163 | ||
| 159 | 164 | } // namespace internal | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -1390,6 +1390,7 @@ DEFINE_STRING(expose_gc_as, nullptr, | |||
| 1390 | 1390 | DEFINE_IMPLICATION(expose_gc_as, expose_gc) | |
| 1391 | 1391 | DEFINE_BOOL(expose_externalize_string, false, | |
| 1392 | 1392 | "expose externalize string extension") | |
| 1393 | + DEFINE_BOOL(expose_statistics, false, "expose statistics extension") | ||
| 1393 | 1394 | DEFINE_BOOL(expose_trigger_failure, false, "expose trigger-failure extension") | |
| 1394 | 1395 | DEFINE_BOOL(expose_ignition_statistics, false, | |
| 1395 | 1396 | "expose ignition-statistics extension (requires building with " | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -5089,7 +5089,7 @@ bool Genesis::InstallExtensions(Isolate* isolate, | |||
| 5089 | 5089 | InstallExtension(isolate, "v8/gc", &extension_states)) && | |
| 5090 | 5090 | (!FLAG_expose_externalize_string || | |
| 5091 | 5091 | InstallExtension(isolate, "v8/externalize", &extension_states)) && | |
| 5092 | - (!TracingFlags::is_gc_stats_enabled() || | ||
| 5092 | + (!(FLAG_expose_statistics || TracingFlags::is_gc_stats_enabled()) || | ||
| 5093 | 5093 | InstallExtension(isolate, "v8/statistics", &extension_states)) && | |
| 5094 | 5094 | (!FLAG_expose_trigger_failure || | |
| 5095 | 5095 | InstallExtension(isolate, "v8/trigger-failure", &extension_states)) && | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -0,0 +1,12 @@ | |||
| 1 | + // Copyright 2022 the V8 project authors. All rights reserved. | ||
| 2 | + // Use of this source code is governed by a BSD-style license that can be | ||
| 3 | + // found in the LICENSE file. | ||
| 4 | + | ||
| 5 | + // Flags: --expose-statistics | ||
| 6 | + | ||
| 7 | + assertEquals(typeof getV8Statistics, 'function'); | ||
| 8 | + var result = getV8Statistics(); | ||
| 9 | + assertEquals(typeof result, 'object'); | ||
| 10 | + for (let key of Object.keys(result)) { | ||
| 11 | + assertEquals(typeof result[key], 'number'); | ||
| 12 | + } | ||
| Back | FazBrowse Home | New Git URL |
0 commit comments