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

Unified Diff: src/contexts.cc

Issue 1413503007: Provide a counter for thrown JavaScript errors per context (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Per context counting implemented Created 5 years, 2 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/contexts.h ('k') | src/counters.h » ('j') | src/counters.h » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/contexts.cc
diff --git a/src/contexts.cc b/src/contexts.cc
index a18f181bef8ccb3e0ca80d43dc5a1f3107105d73..202d50d0063a23289c707d7cb1c066fbcda953c1 100644
--- a/src/contexts.cc
+++ b/src/contexts.cc
@@ -589,5 +589,27 @@ bool Context::IsBootstrappingOrGlobalObject(Isolate* isolate, Object* object) {
}
#endif
+void Context::IncrementExceptionsThrown() {
+ if (!IsNativeContext()) return;
jochen (gone - plz use gerrit) 2015/10/29 14:37:07 just DCHECK(IsNativeContext())
Michael Hablich 2015/10/29 15:23:34 Done.
+ if (exceptions_thrown()->IsUndefined()) {
jochen (gone - plz use gerrit) 2015/10/29 14:37:07 just initialize exceptions_thrown() to 0 in Factor
Michael Hablich 2015/10/29 15:23:34 Done.
+ set_exceptions_thrown(Smi::FromInt(1));
+ return;
+ }
+
+ int previous_value = Smi::cast(exceptions_thrown())->value();
+ set_exceptions_thrown(Smi::FromInt(previous_value+1));
+}
+
+
+int Context::GetExceptionsThrown() {
+ // return -1 so we can identify stats by non-native contexts
+ if (!IsNativeContext()) return -1;
jochen (gone - plz use gerrit) 2015/10/29 14:37:07 should never happen
Michael Hablich 2015/10/29 15:23:34 Done.
+ if (exceptions_thrown()->IsUndefined()) {
+ return 0;
+ }
+
+ return Smi::cast(exceptions_thrown())->value();
+}
+
} // namespace internal
} // namespace v8
« no previous file with comments | « src/contexts.h ('k') | src/counters.h » ('j') | src/counters.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698