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 1770 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1781 | 1781 |
1782 | 1782 |
1783 v8::TryCatch::TryCatch() | 1783 v8::TryCatch::TryCatch() |
1784 : isolate_(i::Isolate::Current()), | 1784 : isolate_(i::Isolate::Current()), |
1785 next_(isolate_->try_catch_handler_address()), | 1785 next_(isolate_->try_catch_handler_address()), |
1786 exception_(isolate_->heap()->the_hole_value()), | 1786 exception_(isolate_->heap()->the_hole_value()), |
1787 message_(i::Smi::FromInt(0)), | 1787 message_(i::Smi::FromInt(0)), |
1788 is_verbose_(false), | 1788 is_verbose_(false), |
1789 can_continue_(true), | 1789 can_continue_(true), |
1790 capture_message_(true), | 1790 capture_message_(true), |
1791 rethrow_(false), | 1791 rethrow_(false) { |
1792 has_terminated_(false) { | |
1793 isolate_->RegisterTryCatchHandler(this); | 1792 isolate_->RegisterTryCatchHandler(this); |
1794 } | 1793 } |
1795 | 1794 |
1796 | 1795 |
1797 v8::TryCatch::~TryCatch() { | 1796 v8::TryCatch::~TryCatch() { |
1798 ASSERT(isolate_ == i::Isolate::Current()); | 1797 ASSERT(isolate_ == i::Isolate::Current()); |
1799 if (rethrow_) { | 1798 if (rethrow_) { |
1800 v8::HandleScope scope; | 1799 v8::HandleScope scope; |
1801 v8::Local<v8::Value> exc = v8::Local<v8::Value>::New(Exception()); | 1800 v8::Local<v8::Value> exc = v8::Local<v8::Value>::New(Exception()); |
1802 isolate_->UnregisterTryCatchHandler(this); | 1801 isolate_->UnregisterTryCatchHandler(this); |
1803 v8::ThrowException(exc); | 1802 v8::ThrowException(exc); |
1804 } else { | 1803 } else { |
1805 isolate_->UnregisterTryCatchHandler(this); | 1804 isolate_->UnregisterTryCatchHandler(this); |
1806 } | 1805 } |
1807 } | 1806 } |
1808 | 1807 |
1809 | 1808 |
1810 bool v8::TryCatch::HasCaught() const { | 1809 bool v8::TryCatch::HasCaught() const { |
1811 return !reinterpret_cast<i::Object*>(exception_)->IsTheHole(); | 1810 return !reinterpret_cast<i::Object*>(exception_)->IsTheHole(); |
1812 } | 1811 } |
1813 | 1812 |
1814 | 1813 |
1815 bool v8::TryCatch::CanContinue() const { | 1814 bool v8::TryCatch::CanContinue() const { |
1816 return can_continue_; | 1815 return can_continue_; |
1817 } | 1816 } |
1818 | 1817 |
1819 | 1818 |
1820 bool v8::TryCatch::HasTerminated() const { | |
1821 return has_terminated_; | |
1822 } | |
1823 | |
1824 | |
1825 v8::Handle<v8::Value> v8::TryCatch::ReThrow() { | 1819 v8::Handle<v8::Value> v8::TryCatch::ReThrow() { |
1826 if (!HasCaught()) return v8::Local<v8::Value>(); | 1820 if (!HasCaught()) return v8::Local<v8::Value>(); |
1827 rethrow_ = true; | 1821 rethrow_ = true; |
1828 return v8::Undefined(); | 1822 return v8::Undefined(); |
1829 } | 1823 } |
1830 | 1824 |
1831 | 1825 |
1832 v8::Local<Value> v8::TryCatch::Exception() const { | 1826 v8::Local<Value> v8::TryCatch::Exception() const { |
1833 ASSERT(isolate_ == i::Isolate::Current()); | 1827 ASSERT(isolate_ == i::Isolate::Current()); |
1834 if (HasCaught()) { | 1828 if (HasCaught()) { |
(...skipping 3747 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5582 } | 5576 } |
5583 | 5577 |
5584 | 5578 |
5585 bool V8::IsExecutionTerminating(Isolate* isolate) { | 5579 bool V8::IsExecutionTerminating(Isolate* isolate) { |
5586 i::Isolate* i_isolate = isolate != NULL ? | 5580 i::Isolate* i_isolate = isolate != NULL ? |
5587 reinterpret_cast<i::Isolate*>(isolate) : i::Isolate::Current(); | 5581 reinterpret_cast<i::Isolate*>(isolate) : i::Isolate::Current(); |
5588 return IsExecutionTerminatingCheck(i_isolate); | 5582 return IsExecutionTerminatingCheck(i_isolate); |
5589 } | 5583 } |
5590 | 5584 |
5591 | 5585 |
5592 void V8::ResumeExecution(Isolate* isolate) { | |
5593 reinterpret_cast<i::Isolate*>(isolate)->stack_guard()->ResumeExecution(); | |
5594 } | |
5595 | |
5596 | |
5597 Isolate* Isolate::GetCurrent() { | 5586 Isolate* Isolate::GetCurrent() { |
5598 i::Isolate* isolate = i::Isolate::UncheckedCurrent(); | 5587 i::Isolate* isolate = i::Isolate::UncheckedCurrent(); |
5599 return reinterpret_cast<Isolate*>(isolate); | 5588 return reinterpret_cast<Isolate*>(isolate); |
5600 } | 5589 } |
5601 | 5590 |
5602 | 5591 |
5603 Isolate* Isolate::New() { | 5592 Isolate* Isolate::New() { |
5604 i::Isolate* isolate = new i::Isolate(); | 5593 i::Isolate* isolate = new i::Isolate(); |
5605 return reinterpret_cast<Isolate*>(isolate); | 5594 return reinterpret_cast<Isolate*>(isolate); |
5606 } | 5595 } |
(...skipping 1108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6715 | 6704 |
6716 v->VisitPointers(blocks_.first(), first_block_limit_); | 6705 v->VisitPointers(blocks_.first(), first_block_limit_); |
6717 | 6706 |
6718 for (int i = 1; i < blocks_.length(); i++) { | 6707 for (int i = 1; i < blocks_.length(); i++) { |
6719 v->VisitPointers(blocks_[i], &blocks_[i][kHandleBlockSize]); | 6708 v->VisitPointers(blocks_[i], &blocks_[i][kHandleBlockSize]); |
6720 } | 6709 } |
6721 } | 6710 } |
6722 | 6711 |
6723 | 6712 |
6724 } } // namespace v8::internal | 6713 } } // namespace v8::internal |
OLD | NEW |