OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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 472 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
483 static int NumberOfHandles(); | 483 static int NumberOfHandles(); |
484 | 484 |
485 /** | 485 /** |
486 * Creates a new handle with the given value. | 486 * Creates a new handle with the given value. |
487 */ | 487 */ |
488 static internal::Object** CreateHandle(internal::Object* value); | 488 static internal::Object** CreateHandle(internal::Object* value); |
489 // Faster version, uses HeapObject to obtain the current Isolate. | 489 // Faster version, uses HeapObject to obtain the current Isolate. |
490 static internal::Object** CreateHandle(internal::HeapObject* value); | 490 static internal::Object** CreateHandle(internal::HeapObject* value); |
491 | 491 |
492 private: | 492 private: |
493 // Make it impossible to create heap-allocated or illegal handle | 493 // Make it hard to create heap-allocated or illegal handle scopes by |
494 // scopes by disallowing certain operations. | 494 // disallowing certain operations. |
495 HandleScope(const HandleScope&); | 495 HandleScope(const HandleScope&); |
496 void operator=(const HandleScope&); | 496 void operator=(const HandleScope&); |
497 void* operator new(size_t size); | 497 void* operator new(size_t size); |
498 void operator delete(void*, size_t); | 498 void operator delete(void*, size_t); |
499 | 499 |
500 // This Data class is accessible internally as HandleScopeData through a | 500 // This Data class is accessible internally as HandleScopeData through a |
501 // typedef in the ImplementationUtilities class. | 501 // typedef in the ImplementationUtilities class. |
502 class V8EXPORT Data { | 502 class V8EXPORT Data { |
503 public: | 503 public: |
504 internal::Object** next; | 504 internal::Object** next; |
(...skipping 3047 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3552 friend class Context; | 3552 friend class Context; |
3553 }; | 3553 }; |
3554 | 3554 |
3555 | 3555 |
3556 /** | 3556 /** |
3557 * An external exception handler. | 3557 * An external exception handler. |
3558 */ | 3558 */ |
3559 class V8EXPORT TryCatch { | 3559 class V8EXPORT TryCatch { |
3560 public: | 3560 public: |
3561 /** | 3561 /** |
3562 * Creates a new try/catch block and registers it with v8. | 3562 * Creates a new try/catch block and registers it with v8. Note that |
| 3563 * all TryCatch blocks should be stack allocated because the memory |
| 3564 * location itself is compared against JavaScript try/catch blocks. |
3563 */ | 3565 */ |
3564 TryCatch(); | 3566 TryCatch(); |
3565 | 3567 |
3566 /** | 3568 /** |
3567 * Unregisters and deletes this try/catch block. | 3569 * Unregisters and deletes this try/catch block. |
3568 */ | 3570 */ |
3569 ~TryCatch(); | 3571 ~TryCatch(); |
3570 | 3572 |
3571 /** | 3573 /** |
3572 * Returns true if an exception has been caught by this try/catch block. | 3574 * Returns true if an exception has been caught by this try/catch block. |
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3642 void SetVerbose(bool value); | 3644 void SetVerbose(bool value); |
3643 | 3645 |
3644 /** | 3646 /** |
3645 * Set whether or not this TryCatch should capture a Message object | 3647 * Set whether or not this TryCatch should capture a Message object |
3646 * which holds source information about where the exception | 3648 * which holds source information about where the exception |
3647 * occurred. True by default. | 3649 * occurred. True by default. |
3648 */ | 3650 */ |
3649 void SetCaptureMessage(bool value); | 3651 void SetCaptureMessage(bool value); |
3650 | 3652 |
3651 private: | 3653 private: |
| 3654 // Make it hard to create heap-allocated TryCatch blocks. |
| 3655 TryCatch(const TryCatch&); |
| 3656 void operator=(const TryCatch&); |
| 3657 void* operator new(size_t size); |
| 3658 void operator delete(void*, size_t); |
| 3659 |
3652 v8::internal::Isolate* isolate_; | 3660 v8::internal::Isolate* isolate_; |
3653 void* next_; | 3661 void* next_; |
3654 void* exception_; | 3662 void* exception_; |
3655 void* message_; | 3663 void* message_; |
3656 bool is_verbose_ : 1; | 3664 bool is_verbose_ : 1; |
3657 bool can_continue_ : 1; | 3665 bool can_continue_ : 1; |
3658 bool capture_message_ : 1; | 3666 bool capture_message_ : 1; |
3659 bool rethrow_ : 1; | 3667 bool rethrow_ : 1; |
3660 | 3668 |
3661 friend class v8::internal::Isolate; | 3669 friend class v8::internal::Isolate; |
(...skipping 1144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4806 | 4814 |
4807 | 4815 |
4808 } // namespace v8 | 4816 } // namespace v8 |
4809 | 4817 |
4810 | 4818 |
4811 #undef V8EXPORT | 4819 #undef V8EXPORT |
4812 #undef TYPE_CHECK | 4820 #undef TYPE_CHECK |
4813 | 4821 |
4814 | 4822 |
4815 #endif // V8_H_ | 4823 #endif // V8_H_ |
OLD | NEW |