OLD | NEW |
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 #ifndef V8_API_H_ | 5 #ifndef V8_API_H_ |
6 #define V8_API_H_ | 6 #define V8_API_H_ |
7 | 7 |
8 #include "include/v8-testing.h" | 8 #include "include/v8-testing.h" |
9 #include "src/contexts.h" | 9 #include "src/contexts.h" |
10 #include "src/factory.h" | 10 #include "src/factory.h" |
(...skipping 263 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
274 #define DECLARE_OPEN_HANDLE(From, To) \ | 274 #define DECLARE_OPEN_HANDLE(From, To) \ |
275 static inline v8::internal::Handle<v8::internal::To> \ | 275 static inline v8::internal::Handle<v8::internal::To> \ |
276 OpenHandle(const From* that, bool allow_empty_handle = false); | 276 OpenHandle(const From* that, bool allow_empty_handle = false); |
277 | 277 |
278 OPEN_HANDLE_LIST(DECLARE_OPEN_HANDLE) | 278 OPEN_HANDLE_LIST(DECLARE_OPEN_HANDLE) |
279 | 279 |
280 #undef DECLARE_OPEN_HANDLE | 280 #undef DECLARE_OPEN_HANDLE |
281 | 281 |
282 template<class From, class To> | 282 template<class From, class To> |
283 static inline Local<To> Convert(v8::internal::Handle<From> obj) { | 283 static inline Local<To> Convert(v8::internal::Handle<From> obj) { |
284 DCHECK(obj.is_null() || !obj->IsTheHole()); | 284 DCHECK(obj.is_null() || |
| 285 (obj->IsSmi() || |
| 286 !obj->IsTheHole(i::HeapObject::cast(*obj)->GetIsolate()))); |
285 return Local<To>(reinterpret_cast<To*>(obj.location())); | 287 return Local<To>(reinterpret_cast<To*>(obj.location())); |
286 } | 288 } |
287 | 289 |
288 template <class T> | 290 template <class T> |
289 static inline v8::internal::Handle<v8::internal::Object> OpenPersistent( | 291 static inline v8::internal::Handle<v8::internal::Object> OpenPersistent( |
290 const v8::Persistent<T>& persistent) { | 292 const v8::Persistent<T>& persistent) { |
291 return v8::internal::Handle<v8::internal::Object>( | 293 return v8::internal::Handle<v8::internal::Object>( |
292 reinterpret_cast<v8::internal::Object**>(persistent.val_)); | 294 reinterpret_cast<v8::internal::Object**>(persistent.val_)); |
293 } | 295 } |
294 | 296 |
(...skipping 395 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
690 } | 692 } |
691 | 693 |
692 private: | 694 private: |
693 static v8::Testing::StressType stress_type_; | 695 static v8::Testing::StressType stress_type_; |
694 }; | 696 }; |
695 | 697 |
696 } // namespace internal | 698 } // namespace internal |
697 } // namespace v8 | 699 } // namespace v8 |
698 | 700 |
699 #endif // V8_API_H_ | 701 #endif // V8_API_H_ |
OLD | NEW |