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 |