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 1656 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1667 | 1667 |
1668 | 1668 |
1669 v8::TryCatch::TryCatch() | 1669 v8::TryCatch::TryCatch() |
1670 : isolate_(i::Isolate::Current()), | 1670 : isolate_(i::Isolate::Current()), |
1671 next_(isolate_->try_catch_handler_address()), | 1671 next_(isolate_->try_catch_handler_address()), |
1672 exception_(isolate_->heap()->the_hole_value()), | 1672 exception_(isolate_->heap()->the_hole_value()), |
1673 message_(i::Smi::FromInt(0)), | 1673 message_(i::Smi::FromInt(0)), |
1674 is_verbose_(false), | 1674 is_verbose_(false), |
1675 can_continue_(true), | 1675 can_continue_(true), |
1676 capture_message_(true), | 1676 capture_message_(true), |
1677 rethrow_(false) { | 1677 rethrow_(false), |
| 1678 has_terminated_(false) { |
1678 isolate_->RegisterTryCatchHandler(this); | 1679 isolate_->RegisterTryCatchHandler(this); |
1679 } | 1680 } |
1680 | 1681 |
1681 | 1682 |
1682 v8::TryCatch::~TryCatch() { | 1683 v8::TryCatch::~TryCatch() { |
1683 ASSERT(isolate_ == i::Isolate::Current()); | 1684 ASSERT(isolate_ == i::Isolate::Current()); |
1684 if (rethrow_) { | 1685 if (rethrow_) { |
1685 v8::HandleScope scope; | 1686 v8::HandleScope scope; |
1686 v8::Local<v8::Value> exc = v8::Local<v8::Value>::New(Exception()); | 1687 v8::Local<v8::Value> exc = v8::Local<v8::Value>::New(Exception()); |
1687 isolate_->UnregisterTryCatchHandler(this); | 1688 isolate_->UnregisterTryCatchHandler(this); |
1688 v8::ThrowException(exc); | 1689 v8::ThrowException(exc); |
1689 } else { | 1690 } else { |
1690 isolate_->UnregisterTryCatchHandler(this); | 1691 isolate_->UnregisterTryCatchHandler(this); |
1691 } | 1692 } |
1692 } | 1693 } |
1693 | 1694 |
1694 | 1695 |
1695 bool v8::TryCatch::HasCaught() const { | 1696 bool v8::TryCatch::HasCaught() const { |
1696 return !reinterpret_cast<i::Object*>(exception_)->IsTheHole(); | 1697 return !reinterpret_cast<i::Object*>(exception_)->IsTheHole(); |
1697 } | 1698 } |
1698 | 1699 |
1699 | 1700 |
1700 bool v8::TryCatch::CanContinue() const { | 1701 bool v8::TryCatch::CanContinue() const { |
1701 return can_continue_; | 1702 return can_continue_; |
1702 } | 1703 } |
1703 | 1704 |
1704 | 1705 |
| 1706 bool v8::TryCatch::HasTerminated() const { |
| 1707 return has_terminated_; |
| 1708 } |
| 1709 |
| 1710 |
1705 v8::Handle<v8::Value> v8::TryCatch::ReThrow() { | 1711 v8::Handle<v8::Value> v8::TryCatch::ReThrow() { |
1706 if (!HasCaught()) return v8::Local<v8::Value>(); | 1712 if (!HasCaught()) return v8::Local<v8::Value>(); |
1707 rethrow_ = true; | 1713 rethrow_ = true; |
1708 return v8::Undefined(); | 1714 return v8::Undefined(); |
1709 } | 1715 } |
1710 | 1716 |
1711 | 1717 |
1712 v8::Local<Value> v8::TryCatch::Exception() const { | 1718 v8::Local<Value> v8::TryCatch::Exception() const { |
1713 ASSERT(isolate_ == i::Isolate::Current()); | 1719 ASSERT(isolate_ == i::Isolate::Current()); |
1714 if (HasCaught()) { | 1720 if (HasCaught()) { |
(...skipping 3749 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5464 } | 5470 } |
5465 | 5471 |
5466 | 5472 |
5467 bool V8::IsExecutionTerminating(Isolate* isolate) { | 5473 bool V8::IsExecutionTerminating(Isolate* isolate) { |
5468 i::Isolate* i_isolate = isolate != NULL ? | 5474 i::Isolate* i_isolate = isolate != NULL ? |
5469 reinterpret_cast<i::Isolate*>(isolate) : i::Isolate::Current(); | 5475 reinterpret_cast<i::Isolate*>(isolate) : i::Isolate::Current(); |
5470 return IsExecutionTerminatingCheck(i_isolate); | 5476 return IsExecutionTerminatingCheck(i_isolate); |
5471 } | 5477 } |
5472 | 5478 |
5473 | 5479 |
| 5480 void V8::ResumeExecution(Isolate* isolate) { |
| 5481 // If no isolate is supplied, use the default isolate. |
| 5482 if (isolate != NULL) { |
| 5483 reinterpret_cast<i::Isolate*>(isolate)->stack_guard()->ResumeExecution(); |
| 5484 } else { |
| 5485 i::Isolate::GetDefaultIsolateStackGuard()->ResumeExecution(); |
| 5486 } |
| 5487 } |
| 5488 |
| 5489 |
5474 Isolate* Isolate::GetCurrent() { | 5490 Isolate* Isolate::GetCurrent() { |
5475 i::Isolate* isolate = i::Isolate::UncheckedCurrent(); | 5491 i::Isolate* isolate = i::Isolate::UncheckedCurrent(); |
5476 return reinterpret_cast<Isolate*>(isolate); | 5492 return reinterpret_cast<Isolate*>(isolate); |
5477 } | 5493 } |
5478 | 5494 |
5479 | 5495 |
5480 Isolate* Isolate::New() { | 5496 Isolate* Isolate::New() { |
5481 i::Isolate* isolate = new i::Isolate(); | 5497 i::Isolate* isolate = new i::Isolate(); |
5482 return reinterpret_cast<Isolate*>(isolate); | 5498 return reinterpret_cast<Isolate*>(isolate); |
5483 } | 5499 } |
(...skipping 1106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6590 | 6606 |
6591 v->VisitPointers(blocks_.first(), first_block_limit_); | 6607 v->VisitPointers(blocks_.first(), first_block_limit_); |
6592 | 6608 |
6593 for (int i = 1; i < blocks_.length(); i++) { | 6609 for (int i = 1; i < blocks_.length(); i++) { |
6594 v->VisitPointers(blocks_[i], &blocks_[i][kHandleBlockSize]); | 6610 v->VisitPointers(blocks_[i], &blocks_[i][kHandleBlockSize]); |
6595 } | 6611 } |
6596 } | 6612 } |
6597 | 6613 |
6598 | 6614 |
6599 } } // namespace v8::internal | 6615 } } // namespace v8::internal |
OLD | NEW |