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 "src/v8.h" | 8 #include "src/v8.h" |
9 | 9 |
10 #include "include/v8-testing.h" | 10 #include "include/v8-testing.h" |
(...skipping 291 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
302 static inline v8::internal::Handle<To> OpenHandle(v8::Local<From> handle) { | 302 static inline v8::internal::Handle<To> OpenHandle(v8::Local<From> handle) { |
303 return OpenHandle(*handle); | 303 return OpenHandle(*handle); |
304 } | 304 } |
305 | 305 |
306 private: | 306 private: |
307 static void ReportApiFailure(const char* location, const char* message); | 307 static void ReportApiFailure(const char* location, const char* message); |
308 }; | 308 }; |
309 | 309 |
310 | 310 |
311 template <class T> | 311 template <class T> |
| 312 v8::internal::Handle<T> v8::internal::Handle<T>::EscapeFrom( |
| 313 v8::EscapableHandleScope* scope) { |
| 314 v8::internal::Handle<T> handle; |
| 315 if (!is_null()) { |
| 316 handle = *this; |
| 317 } |
| 318 return Utils::OpenHandle(*scope->Escape(Utils::ToLocal(handle)), true); |
| 319 } |
| 320 |
| 321 |
| 322 template <class T> |
312 inline T* ToApi(v8::internal::Handle<v8::internal::Object> obj) { | 323 inline T* ToApi(v8::internal::Handle<v8::internal::Object> obj) { |
313 return reinterpret_cast<T*>(obj.location()); | 324 return reinterpret_cast<T*>(obj.location()); |
314 } | 325 } |
315 | 326 |
316 template <class T> | 327 template <class T> |
317 inline v8::Local<T> ToApiHandle( | 328 inline v8::Local<T> ToApiHandle( |
318 v8::internal::Handle<v8::internal::Object> obj) { | 329 v8::internal::Handle<v8::internal::Object> obj) { |
319 return Utils::Convert<v8::internal::Object, T>(obj); | 330 return Utils::Convert<v8::internal::Object, T>(obj); |
320 } | 331 } |
321 | 332 |
(...skipping 383 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
705 stress_type_ = stress_type; | 716 stress_type_ = stress_type; |
706 } | 717 } |
707 | 718 |
708 private: | 719 private: |
709 static v8::Testing::StressType stress_type_; | 720 static v8::Testing::StressType stress_type_; |
710 }; | 721 }; |
711 | 722 |
712 } } // namespace v8::internal | 723 } } // namespace v8::internal |
713 | 724 |
714 #endif // V8_API_H_ | 725 #endif // V8_API_H_ |
OLD | NEW |