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

Side by Side Diff: include/v8.h

Issue 1057873003: Revert of make ToLocalCheck crash in release mode (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 unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 /** \mainpage V8 API Reference Guide 5 /** \mainpage V8 API Reference Guide
6 * 6 *
7 * V8 is Google's open source JavaScript engine. 7 * V8 is Google's open source JavaScript engine.
8 * 8 *
9 * This set of documents provides reference material generated from the 9 * This set of documents provides reference material generated from the
10 * V8 header file, include/v8.h. 10 * V8 header file, include/v8.h.
(...skipping 421 matching lines...) Expand 10 before | Expand all | Expand 10 after
432 } 432 }
433 433
434 V8_INLINE bool IsEmpty() const { return val_ == nullptr; } 434 V8_INLINE bool IsEmpty() const { return val_ == nullptr; }
435 435
436 template <class S> 436 template <class S>
437 V8_WARN_UNUSED_RESULT V8_INLINE bool ToLocal(Local<S>* out) const { 437 V8_WARN_UNUSED_RESULT V8_INLINE bool ToLocal(Local<S>* out) const {
438 out->val_ = IsEmpty() ? nullptr : this->val_; 438 out->val_ = IsEmpty() ? nullptr : this->val_;
439 return !IsEmpty(); 439 return !IsEmpty();
440 } 440 }
441 441
442 // Will crash if the MaybeLocal<> is empty. 442 // Will crash when checks are enabled if the MaybeLocal<> is empty.
443 V8_INLINE Local<T> ToLocalChecked(); 443 V8_INLINE Local<T> ToLocalChecked();
444 444
445 template <class S> 445 template <class S>
446 V8_INLINE Local<S> FromMaybe(Local<S> default_value) const { 446 V8_INLINE Local<S> FromMaybe(Local<S> default_value) const {
447 return IsEmpty() ? default_value : Local<S>(val_); 447 return IsEmpty() ? default_value : Local<S>(val_);
448 } 448 }
449 449
450 private: 450 private:
451 T* val_; 451 T* val_;
452 }; 452 };
(...skipping 6449 matching lines...) Expand 10 before | Expand all | Expand 10 after
6902 6902
6903 6903
6904 template<class T> 6904 template<class T>
6905 Local<T> Eternal<T>::Get(Isolate* isolate) { 6905 Local<T> Eternal<T>::Get(Isolate* isolate) {
6906 return Local<T>(reinterpret_cast<T*>(*V8::GetEternal(isolate, index_))); 6906 return Local<T>(reinterpret_cast<T*>(*V8::GetEternal(isolate, index_)));
6907 } 6907 }
6908 6908
6909 6909
6910 template <class T> 6910 template <class T>
6911 Local<T> MaybeLocal<T>::ToLocalChecked() { 6911 Local<T> MaybeLocal<T>::ToLocalChecked() {
6912 if (V8_UNLIKELY(val_ == nullptr)) V8::ToLocalEmpty(); 6912 #ifdef V8_ENABLE_CHECKS
6913 if (val_ == nullptr) V8::ToLocalEmpty();
6914 #endif
6913 return Local<T>(val_); 6915 return Local<T>(val_);
6914 } 6916 }
6915 6917
6916 6918
6917 template <class T> 6919 template <class T>
6918 void* WeakCallbackInfo<T>::GetInternalField(int index) const { 6920 void* WeakCallbackInfo<T>::GetInternalField(int index) const {
6919 #ifdef V8_ENABLE_CHECKS 6921 #ifdef V8_ENABLE_CHECKS
6920 if (index < 0 || index >= kInternalFieldsInWeakCallback) { 6922 if (index < 0 || index >= kInternalFieldsInWeakCallback) {
6921 V8::InternalFieldOutOfBounds(index); 6923 V8::InternalFieldOutOfBounds(index);
6922 } 6924 }
(...skipping 1145 matching lines...) Expand 10 before | Expand all | Expand 10 after
8068 */ 8070 */
8069 8071
8070 8072
8071 } // namespace v8 8073 } // namespace v8
8072 8074
8073 8075
8074 #undef TYPE_CHECK 8076 #undef TYPE_CHECK
8075 8077
8076 8078
8077 #endif // V8_H_ 8079 #endif // V8_H_
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698