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; |
} |