| 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 2118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2527 | 2533 |
| 2528 size_t total_heap_size_; | 2534 size_t total_heap_size_; |
| 2529 size_t total_heap_size_executable_; | 2535 size_t total_heap_size_executable_; |
| 2530 size_t used_heap_size_; | 2536 size_t used_heap_size_; |
| 2531 size_t heap_size_limit_; | 2537 size_t heap_size_limit_; |
| 2532 | 2538 |
| 2533 friend class V8; | 2539 friend class V8; |
| 2534 }; | 2540 }; |
| 2535 | 2541 |
| 2536 | 2542 |
| 2543 class RetainedObjectInfo; |
| 2544 |
| 2537 /** | 2545 /** |
| 2538 * Container class for static utility functions. | 2546 * Container class for static utility functions. |
| 2539 */ | 2547 */ |
| 2540 class V8EXPORT V8 { | 2548 class V8EXPORT V8 { |
| 2541 public: | 2549 public: |
| 2542 /** Set the callback to invoke in case of fatal errors. */ | 2550 /** Set the callback to invoke in case of fatal errors. */ |
| 2543 static void SetFatalErrorHandler(FatalErrorCallback that); | 2551 static void SetFatalErrorHandler(FatalErrorCallback that); |
| 2544 | 2552 |
| 2545 /** | 2553 /** |
| 2546 * Ignore out-of-memory exceptions. | 2554 * Ignore out-of-memory exceptions. |
| (...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2696 */ | 2704 */ |
| 2697 static void RemoveMemoryAllocationCallback(MemoryAllocationCallback callback); | 2705 static void RemoveMemoryAllocationCallback(MemoryAllocationCallback callback); |
| 2698 | 2706 |
| 2699 /** | 2707 /** |
| 2700 * Allows the host application to group objects together. If one | 2708 * Allows the host application to group objects together. If one |
| 2701 * object in the group is alive, all objects in the group are alive. | 2709 * object in the group is alive, all objects in the group are alive. |
| 2702 * After each garbage collection, object groups are removed. It is | 2710 * After each garbage collection, object groups are removed. It is |
| 2703 * intended to be used in the before-garbage-collection callback | 2711 * intended to be used in the before-garbage-collection callback |
| 2704 * function, for instance to simulate DOM tree connections among JS | 2712 * function, for instance to simulate DOM tree connections among JS |
| 2705 * wrapper objects. | 2713 * wrapper objects. |
| 2714 * See v8-profiler.h for RetainedObjectInfo interface description. |
| 2706 */ | 2715 */ |
| 2707 static void AddObjectGroup(Persistent<Value>* objects, size_t length); | 2716 static void AddObjectGroup(Persistent<Value>* objects, |
| 2717 size_t length, |
| 2718 RetainedObjectInfo* info = NULL); |
| 2708 | 2719 |
| 2709 /** | 2720 /** |
| 2710 * Initializes from snapshot if possible. Otherwise, attempts to | 2721 * Initializes from snapshot if possible. Otherwise, attempts to |
| 2711 * initialize from scratch. This function is called implicitly if | 2722 * initialize from scratch. This function is called implicitly if |
| 2712 * you use the API without calling it first. | 2723 * you use the API without calling it first. |
| 2713 */ | 2724 */ |
| 2714 static bool Initialize(); | 2725 static bool Initialize(); |
| 2715 | 2726 |
| 2716 /** | 2727 /** |
| 2717 * Adjusts the amount of registered external memory. Used to give | 2728 * Adjusts the amount of registered external memory. Used to give |
| (...skipping 188 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2906 V8(); | 2917 V8(); |
| 2907 | 2918 |
| 2908 static internal::Object** GlobalizeReference(internal::Object** handle); | 2919 static internal::Object** GlobalizeReference(internal::Object** handle); |
| 2909 static void DisposeGlobal(internal::Object** global_handle); | 2920 static void DisposeGlobal(internal::Object** global_handle); |
| 2910 static void MakeWeak(internal::Object** global_handle, | 2921 static void MakeWeak(internal::Object** global_handle, |
| 2911 void* data, | 2922 void* data, |
| 2912 WeakReferenceCallback); | 2923 WeakReferenceCallback); |
| 2913 static void ClearWeak(internal::Object** global_handle); | 2924 static void ClearWeak(internal::Object** global_handle); |
| 2914 static bool IsGlobalNearDeath(internal::Object** global_handle); | 2925 static bool IsGlobalNearDeath(internal::Object** global_handle); |
| 2915 static bool IsGlobalWeak(internal::Object** global_handle); | 2926 static bool IsGlobalWeak(internal::Object** global_handle); |
| 2927 static void SetWrapperClassId(internal::Object** global_handle, |
| 2928 uint16_t class_id); |
| 2916 | 2929 |
| 2917 template <class T> friend class Handle; | 2930 template <class T> friend class Handle; |
| 2918 template <class T> friend class Local; | 2931 template <class T> friend class Local; |
| 2919 template <class T> friend class Persistent; | 2932 template <class T> friend class Persistent; |
| 2920 friend class Context; | 2933 friend class Context; |
| 2921 }; | 2934 }; |
| 2922 | 2935 |
| 2923 | 2936 |
| 2924 /** | 2937 /** |
| 2925 * An external exception handler. | 2938 * An external exception handler. |
| (...skipping 628 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3554 V8::MakeWeak(reinterpret_cast<internal::Object**>(**this), | 3567 V8::MakeWeak(reinterpret_cast<internal::Object**>(**this), |
| 3555 parameters, | 3568 parameters, |
| 3556 callback); | 3569 callback); |
| 3557 } | 3570 } |
| 3558 | 3571 |
| 3559 template <class T> | 3572 template <class T> |
| 3560 void Persistent<T>::ClearWeak() { | 3573 void Persistent<T>::ClearWeak() { |
| 3561 V8::ClearWeak(reinterpret_cast<internal::Object**>(**this)); | 3574 V8::ClearWeak(reinterpret_cast<internal::Object**>(**this)); |
| 3562 } | 3575 } |
| 3563 | 3576 |
| 3577 template <class T> |
| 3578 void Persistent<T>::SetWrapperClassId(uint16_t class_id) { |
| 3579 V8::SetWrapperClassId(reinterpret_cast<internal::Object**>(**this), class_id); |
| 3580 } |
| 3564 | 3581 |
| 3565 Arguments::Arguments(internal::Object** implicit_args, | 3582 Arguments::Arguments(internal::Object** implicit_args, |
| 3566 internal::Object** values, int length, | 3583 internal::Object** values, int length, |
| 3567 bool is_construct_call) | 3584 bool is_construct_call) |
| 3568 : implicit_args_(implicit_args), | 3585 : implicit_args_(implicit_args), |
| 3569 values_(values), | 3586 values_(values), |
| 3570 length_(length), | 3587 length_(length), |
| 3571 is_construct_call_(is_construct_call) { } | 3588 is_construct_call_(is_construct_call) { } |
| 3572 | 3589 |
| 3573 | 3590 |
| (...skipping 264 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3838 | 3855 |
| 3839 | 3856 |
| 3840 } // namespace v8 | 3857 } // namespace v8 |
| 3841 | 3858 |
| 3842 | 3859 |
| 3843 #undef V8EXPORT | 3860 #undef V8EXPORT |
| 3844 #undef TYPE_CHECK | 3861 #undef TYPE_CHECK |
| 3845 | 3862 |
| 3846 | 3863 |
| 3847 #endif // V8_H_ | 3864 #endif // V8_H_ |
| OLD | NEW |