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

Unified Diff: src/isolate.cc

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/factory.cc ('k') | src/objects.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/isolate.cc
diff --git a/src/isolate.cc b/src/isolate.cc
index ffed04d6e075daa6a0b219723bf8cdfdb6234ade..a990af56993057f1844e6bc85ed892792806794e 100644
--- a/src/isolate.cc
+++ b/src/isolate.cc
@@ -666,6 +666,32 @@ class CaptureStackTraceHelper {
Handle<StackFrameInfo> NewStackFrameObject(
const FrameSummary::JavaScriptFrameSummary& summ) {
+ int code_offset;
+ Handle<ByteArray> source_position_table;
+ Object* maybe_cache;
+ Handle<UnseededNumberDictionary> cache;
+ if (!FLAG_optimize_for_size) {
+ code_offset = summ.code_offset();
+ source_position_table =
+ handle(summ.abstract_code()->source_position_table(), isolate_);
+ maybe_cache = summ.abstract_code()->stack_frame_cache();
+ if (maybe_cache->IsUnseededNumberDictionary()) {
+ cache = handle(UnseededNumberDictionary::cast(maybe_cache));
+ } else {
+ cache = UnseededNumberDictionary::New(isolate_, 1);
+ }
+ int entry = cache->FindEntry(code_offset);
+ if (entry != UnseededNumberDictionary::kNotFound) {
+ Handle<StackFrameInfo> frame(
+ StackFrameInfo::cast(cache->ValueAt(entry)));
+ DCHECK(frame->function_name()->IsString());
+ Handle<String> function_name = summ.FunctionName();
+ if (function_name->Equals(String::cast(frame->function_name()))) {
+ return frame;
+ }
+ }
+ }
+
Handle<StackFrameInfo> frame = factory()->NewStackFrameInfo();
Handle<Script> script = Handle<Script>::cast(summ.script());
Script::PositionInfo info;
@@ -684,6 +710,13 @@ class CaptureStackTraceHelper {
frame->set_function_name(*function_name);
frame->set_is_constructor(summ.is_constructor());
frame->set_is_wasm(false);
+ if (!FLAG_optimize_for_size) {
+ auto new_cache =
+ UnseededNumberDictionary::AtNumberPut(cache, code_offset, frame);
+ if (*new_cache != *cache || !maybe_cache->IsUnseededNumberDictionary()) {
+ AbstractCode::SetStackFrameCache(summ.abstract_code(), new_cache);
+ }
+ }
return frame;
}
« no previous file with comments | « src/factory.cc ('k') | src/objects.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698