OLD | NEW |
1 // Copyright 2007-2009 the V8 project authors. All rights reserved. | 1 // Copyright 2007-2009 the V8 project authors. All rights reserved. |
2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
4 // met: | 4 // met: |
5 // | 5 // |
6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
(...skipping 378 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
389 /** | 389 /** |
390 *Checks if the handle holds the only reference to an object. | 390 *Checks if the handle holds the only reference to an object. |
391 */ | 391 */ |
392 inline bool IsNearDeath() const; | 392 inline bool IsNearDeath() const; |
393 | 393 |
394 /** | 394 /** |
395 * Returns true if the handle's reference is weak. | 395 * Returns true if the handle's reference is weak. |
396 */ | 396 */ |
397 inline bool IsWeak() const; | 397 inline bool IsWeak() const; |
398 | 398 |
| 399 /** |
| 400 * Assigns a wrapper class ID to the handle. See RetainedObjectInfo |
| 401 * interface description in v8-profiler.h for details. |
| 402 */ |
| 403 inline void SetWrapperClassId(uint16_t class_id); |
| 404 |
399 private: | 405 private: |
400 friend class ImplementationUtilities; | 406 friend class ImplementationUtilities; |
401 friend class ObjectTemplate; | 407 friend class ObjectTemplate; |
402 }; | 408 }; |
403 | 409 |
404 | 410 |
405 /** | 411 /** |
406 * A stack-allocated class that governs a number of local handles. | 412 * A stack-allocated class that governs a number of local handles. |
407 * After a handle scope has been created, all local handles will be | 413 * After a handle scope has been created, all local handles will be |
408 * allocated within that handle scope until either the handle scope is | 414 * allocated within that handle scope until either the handle scope is |
(...skipping 2117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2526 | 2532 |
2527 size_t total_heap_size_; | 2533 size_t total_heap_size_; |
2528 size_t total_heap_size_executable_; | 2534 size_t total_heap_size_executable_; |
2529 size_t used_heap_size_; | 2535 size_t used_heap_size_; |
2530 size_t heap_size_limit_; | 2536 size_t heap_size_limit_; |
2531 | 2537 |
2532 friend class V8; | 2538 friend class V8; |
2533 }; | 2539 }; |
2534 | 2540 |
2535 | 2541 |
| 2542 class RetainedObjectInfo; |
| 2543 |
2536 /** | 2544 /** |
2537 * Container class for static utility functions. | 2545 * Container class for static utility functions. |
2538 */ | 2546 */ |
2539 class V8EXPORT V8 { | 2547 class V8EXPORT V8 { |
2540 public: | 2548 public: |
2541 /** Set the callback to invoke in case of fatal errors. */ | 2549 /** Set the callback to invoke in case of fatal errors. */ |
2542 static void SetFatalErrorHandler(FatalErrorCallback that); | 2550 static void SetFatalErrorHandler(FatalErrorCallback that); |
2543 | 2551 |
2544 /** | 2552 /** |
2545 * Ignore out-of-memory exceptions. | 2553 * Ignore out-of-memory exceptions. |
(...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2695 */ | 2703 */ |
2696 static void RemoveMemoryAllocationCallback(MemoryAllocationCallback callback); | 2704 static void RemoveMemoryAllocationCallback(MemoryAllocationCallback callback); |
2697 | 2705 |
2698 /** | 2706 /** |
2699 * Allows the host application to group objects together. If one | 2707 * Allows the host application to group objects together. If one |
2700 * object in the group is alive, all objects in the group are alive. | 2708 * object in the group is alive, all objects in the group are alive. |
2701 * After each garbage collection, object groups are removed. It is | 2709 * After each garbage collection, object groups are removed. It is |
2702 * intended to be used in the before-garbage-collection callback | 2710 * intended to be used in the before-garbage-collection callback |
2703 * function, for instance to simulate DOM tree connections among JS | 2711 * function, for instance to simulate DOM tree connections among JS |
2704 * wrapper objects. | 2712 * wrapper objects. |
| 2713 * See v8-profiler.h for RetainedObjectInfo interface description. |
2705 */ | 2714 */ |
2706 static void AddObjectGroup(Persistent<Value>* objects, size_t length); | 2715 static void AddObjectGroup(Persistent<Value>* objects, |
| 2716 size_t length, |
| 2717 RetainedObjectInfo* info = NULL); |
2707 | 2718 |
2708 /** | 2719 /** |
2709 * Initializes from snapshot if possible. Otherwise, attempts to | 2720 * Initializes from snapshot if possible. Otherwise, attempts to |
2710 * initialize from scratch. This function is called implicitly if | 2721 * initialize from scratch. This function is called implicitly if |
2711 * you use the API without calling it first. | 2722 * you use the API without calling it first. |
2712 */ | 2723 */ |
2713 static bool Initialize(); | 2724 static bool Initialize(); |
2714 | 2725 |
2715 /** | 2726 /** |
2716 * Adjusts the amount of registered external memory. Used to give | 2727 * Adjusts the amount of registered external memory. Used to give |
(...skipping 188 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2905 V8(); | 2916 V8(); |
2906 | 2917 |
2907 static internal::Object** GlobalizeReference(internal::Object** handle); | 2918 static internal::Object** GlobalizeReference(internal::Object** handle); |
2908 static void DisposeGlobal(internal::Object** global_handle); | 2919 static void DisposeGlobal(internal::Object** global_handle); |
2909 static void MakeWeak(internal::Object** global_handle, | 2920 static void MakeWeak(internal::Object** global_handle, |
2910 void* data, | 2921 void* data, |
2911 WeakReferenceCallback); | 2922 WeakReferenceCallback); |
2912 static void ClearWeak(internal::Object** global_handle); | 2923 static void ClearWeak(internal::Object** global_handle); |
2913 static bool IsGlobalNearDeath(internal::Object** global_handle); | 2924 static bool IsGlobalNearDeath(internal::Object** global_handle); |
2914 static bool IsGlobalWeak(internal::Object** global_handle); | 2925 static bool IsGlobalWeak(internal::Object** global_handle); |
| 2926 static void SetWrapperClassId(internal::Object** global_handle, |
| 2927 uint16_t class_id); |
2915 | 2928 |
2916 template <class T> friend class Handle; | 2929 template <class T> friend class Handle; |
2917 template <class T> friend class Local; | 2930 template <class T> friend class Local; |
2918 template <class T> friend class Persistent; | 2931 template <class T> friend class Persistent; |
2919 friend class Context; | 2932 friend class Context; |
2920 }; | 2933 }; |
2921 | 2934 |
2922 | 2935 |
2923 /** | 2936 /** |
2924 * An external exception handler. | 2937 * An external exception handler. |
(...skipping 628 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3553 V8::MakeWeak(reinterpret_cast<internal::Object**>(**this), | 3566 V8::MakeWeak(reinterpret_cast<internal::Object**>(**this), |
3554 parameters, | 3567 parameters, |
3555 callback); | 3568 callback); |
3556 } | 3569 } |
3557 | 3570 |
3558 template <class T> | 3571 template <class T> |
3559 void Persistent<T>::ClearWeak() { | 3572 void Persistent<T>::ClearWeak() { |
3560 V8::ClearWeak(reinterpret_cast<internal::Object**>(**this)); | 3573 V8::ClearWeak(reinterpret_cast<internal::Object**>(**this)); |
3561 } | 3574 } |
3562 | 3575 |
| 3576 template <class T> |
| 3577 void Persistent<T>::SetWrapperClassId(uint16_t class_id) { |
| 3578 V8::SetWrapperClassId(reinterpret_cast<internal::Object**>(**this), class_id); |
| 3579 } |
3563 | 3580 |
3564 Arguments::Arguments(internal::Object** implicit_args, | 3581 Arguments::Arguments(internal::Object** implicit_args, |
3565 internal::Object** values, int length, | 3582 internal::Object** values, int length, |
3566 bool is_construct_call) | 3583 bool is_construct_call) |
3567 : implicit_args_(implicit_args), | 3584 : implicit_args_(implicit_args), |
3568 values_(values), | 3585 values_(values), |
3569 length_(length), | 3586 length_(length), |
3570 is_construct_call_(is_construct_call) { } | 3587 is_construct_call_(is_construct_call) { } |
3571 | 3588 |
3572 | 3589 |
(...skipping 264 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3837 | 3854 |
3838 | 3855 |
3839 } // namespace v8 | 3856 } // namespace v8 |
3840 | 3857 |
3841 | 3858 |
3842 #undef V8EXPORT | 3859 #undef V8EXPORT |
3843 #undef TYPE_CHECK | 3860 #undef TYPE_CHECK |
3844 | 3861 |
3845 | 3862 |
3846 #endif // V8_H_ | 3863 #endif // V8_H_ |
OLD | NEW |