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() || | 284 DCHECK(obj.is_null() || !obj->IsTheHole()); |
285 (obj->IsSmi() || | |
286 !obj->IsTheHole(i::HeapObject::cast(*obj)->GetIsolate()))); | |
287 return Local<To>(reinterpret_cast<To*>(obj.location())); | 285 return Local<To>(reinterpret_cast<To*>(obj.location())); |
288 } | 286 } |
289 | 287 |
290 template <class T> | 288 template <class T> |
291 static inline v8::internal::Handle<v8::internal::Object> OpenPersistent( | 289 static inline v8::internal::Handle<v8::internal::Object> OpenPersistent( |
292 const v8::Persistent<T>& persistent) { | 290 const v8::Persistent<T>& persistent) { |
293 return v8::internal::Handle<v8::internal::Object>( | 291 return v8::internal::Handle<v8::internal::Object>( |
294 reinterpret_cast<v8::internal::Object**>(persistent.val_)); | 292 reinterpret_cast<v8::internal::Object**>(persistent.val_)); |
295 } | 293 } |
296 | 294 |
(...skipping 395 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
692 } | 690 } |
693 | 691 |
694 private: | 692 private: |
695 static v8::Testing::StressType stress_type_; | 693 static v8::Testing::StressType stress_type_; |
696 }; | 694 }; |
697 | 695 |
698 } // namespace internal | 696 } // namespace internal |
699 } // namespace v8 | 697 } // namespace v8 |
700 | 698 |
701 #endif // V8_API_H_ | 699 #endif // V8_API_H_ |
OLD | NEW |