OLD | NEW |
1 // Copyright 2006-2010 the V8 project authors. All rights reserved. | 1 // Copyright 2006-2010 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 615 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
626 | 626 |
627 | 627 |
628 void Isolate::InitializeThreadLocal() { | 628 void Isolate::InitializeThreadLocal() { |
629 thread_local_top_.Initialize(); | 629 thread_local_top_.Initialize(); |
630 clear_pending_exception(); | 630 clear_pending_exception(); |
631 clear_pending_message(); | 631 clear_pending_message(); |
632 clear_scheduled_exception(); | 632 clear_scheduled_exception(); |
633 } | 633 } |
634 | 634 |
635 | 635 |
| 636 void Isolate::PropagatePendingExceptionToExternalTryCatch() { |
| 637 ASSERT(has_pending_exception()); |
| 638 |
| 639 bool external_caught = IsExternallyCaught(); |
| 640 thread_local_top_.external_caught_exception_ = external_caught; |
| 641 |
| 642 if (!external_caught) return; |
| 643 |
| 644 if (thread_local_top_.pending_exception_ == Failure::OutOfMemoryException()) { |
| 645 // Do not propagate OOM exception: we should kill VM asap. |
| 646 } else if (thread_local_top_.pending_exception_ == |
| 647 heap()->termination_exception()) { |
| 648 try_catch_handler()->can_continue_ = false; |
| 649 try_catch_handler()->exception_ = heap()->null_value(); |
| 650 } else { |
| 651 // At this point all non-object (failure) exceptions have |
| 652 // been dealt with so this shouldn't fail. |
| 653 ASSERT(!pending_exception()->IsFailure()); |
| 654 try_catch_handler()->can_continue_ = true; |
| 655 try_catch_handler()->exception_ = pending_exception(); |
| 656 if (!thread_local_top_.pending_message_obj_->IsTheHole()) { |
| 657 try_catch_handler()->message_ = thread_local_top_.pending_message_obj_; |
| 658 } |
| 659 } |
| 660 } |
| 661 |
| 662 |
636 bool Isolate::Init(Deserializer* des) { | 663 bool Isolate::Init(Deserializer* des) { |
637 ASSERT(state_ != INITIALIZED); | 664 ASSERT(state_ != INITIALIZED); |
638 | 665 |
639 TRACE_ISOLATE(init); | 666 TRACE_ISOLATE(init); |
640 | 667 |
641 bool create_heap_objects = des == NULL; | 668 bool create_heap_objects = des == NULL; |
642 | 669 |
643 #ifdef DEBUG | 670 #ifdef DEBUG |
644 // The initialization process does not handle memory exhaustion. | 671 // The initialization process does not handle memory exhaustion. |
645 DisallowAllocationFailure disallow_allocation_failure; | 672 DisallowAllocationFailure disallow_allocation_failure; |
(...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
816 | 843 |
817 #ifdef DEBUG | 844 #ifdef DEBUG |
818 #define ISOLATE_FIELD_OFFSET(type, name, ignored) \ | 845 #define ISOLATE_FIELD_OFFSET(type, name, ignored) \ |
819 const intptr_t Isolate::name##_debug_offset_ = OFFSET_OF(Isolate, name##_); | 846 const intptr_t Isolate::name##_debug_offset_ = OFFSET_OF(Isolate, name##_); |
820 ISOLATE_INIT_LIST(ISOLATE_FIELD_OFFSET) | 847 ISOLATE_INIT_LIST(ISOLATE_FIELD_OFFSET) |
821 ISOLATE_INIT_ARRAY_LIST(ISOLATE_FIELD_OFFSET) | 848 ISOLATE_INIT_ARRAY_LIST(ISOLATE_FIELD_OFFSET) |
822 #undef ISOLATE_FIELD_OFFSET | 849 #undef ISOLATE_FIELD_OFFSET |
823 #endif | 850 #endif |
824 | 851 |
825 } } // namespace v8::internal | 852 } } // namespace v8::internal |
OLD | NEW |