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

Unified Diff: include/v8.h

Issue 1083943002: When converting Maybe and MaybeLocal values with a check, always check (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 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 | « no previous file | src/api.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: include/v8.h
diff --git a/include/v8.h b/include/v8.h
index cdb23b4655d6b2caadde4a9bd16f45d99902e4fd..d8ef81e66facbc9db67efdf714a0a8a31aeef8ae 100644
--- a/include/v8.h
+++ b/include/v8.h
@@ -439,7 +439,7 @@ class MaybeLocal {
return !IsEmpty();
}
- // Will crash when checks are enabled if the MaybeLocal<> is empty.
+ // Will crash if the MaybeLocal<> is empty.
V8_INLINE Local<T> ToLocalChecked();
template <class S>
@@ -6074,7 +6074,7 @@ class V8_EXPORT V8 {
int* index);
static Local<Value> GetEternal(Isolate* isolate, int index);
- static void CheckIsJust(bool is_just);
+ static void FromJustIsNothing();
static void ToLocalEmpty();
static void InternalFieldOutOfBounds(int index);
@@ -6109,11 +6109,9 @@ class Maybe {
V8_INLINE bool IsNothing() const { return !has_value; }
V8_INLINE bool IsJust() const { return has_value; }
- // Will crash when checks are enabled if the Maybe<> is nothing.
+ // Will crash if the Maybe<> is nothing.
V8_INLINE T FromJust() const {
-#ifdef V8_ENABLE_CHECKS
- V8::CheckIsJust(IsJust());
-#endif
+ if (V8_UNLIKELY(!IsJust())) V8::FromJustIsNothing();
return value;
}
@@ -6931,9 +6929,7 @@ Local<T> Eternal<T>::Get(Isolate* isolate) {
template <class T>
Local<T> MaybeLocal<T>::ToLocalChecked() {
-#ifdef V8_ENABLE_CHECKS
- if (val_ == nullptr) V8::ToLocalEmpty();
-#endif
+ if (V8_UNLIKELY(val_ == nullptr)) V8::ToLocalEmpty();
return Local<T>(val_);
}
« no previous file with comments | « no previous file | src/api.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698