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

Unified Diff: src/isolate.cc

Issue 2788413004: [inspector] cache stack frame for call sites (Closed)
Patch Set: ready for review Created 3 years, 9 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/heap/heap.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 f12b84813bc01257393af7fdeb54435496eaf343..55d6738e1001105639a3518d8ad9c8d7a27da6e6 100644
--- a/src/isolate.cc
+++ b/src/isolate.cc
@@ -625,6 +625,20 @@ class CaptureStackTraceHelper {
Handle<StackFrameInfo> NewStackFrameObject(
const FrameSummary::JavaScriptFrameSummary& summ) {
+ int code_offset = summ.code_offset();
+ Handle<AbstractCode> code = summ.abstract_code();
+ Object* maybe_cache = code->stack_frame_cache();
+ Handle<UnseededNumberDictionary> cache;
+ if (maybe_cache->IsUnseededNumberDictionary()) {
+ cache = handle(UnseededNumberDictionary::cast(maybe_cache));
+ } else {
+ cache = UnseededNumberDictionary::NewEmpty(isolate_);
+ code->set_stack_frame_cache(*cache);
+ }
+ int entry = cache->FindEntry(code_offset);
+ if (entry != UnseededNumberDictionary::kNotFound) {
+ return handle(StackFrameInfo::cast(cache->ValueAt(entry)), isolate_);
+ }
rmcilroy 2017/04/04 09:22:49 Rather than requiring a new field in both code and
Yang 2017/04/04 13:51:58 +1 for a side table. If you use code objects as ha
kozy 2017/04/04 19:11:07 Done.
kozy 2017/04/04 19:11:07 Done.
Handle<StackFrameInfo> frame = factory()->NewStackFrameInfo();
Handle<Script> script = Handle<Script>::cast(summ.script());
if (options_ & StackTrace::kLineNumber) {
@@ -657,6 +671,9 @@ class CaptureStackTraceHelper {
if (options_ & StackTrace::kIsConstructor) {
frame->set_is_constructor(summ.is_constructor());
}
+ auto new_cache =
+ UnseededNumberDictionary::AtNumberPut(cache, code_offset, frame);
+ if (*new_cache != *cache) code->set_stack_frame_cache(*new_cache);
return frame;
}
« no previous file with comments | « src/heap/heap.cc ('k') | src/objects.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698