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 1858 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1869 | 1869 |
1870 | 1870 |
1871 v8::TryCatch::TryCatch() | 1871 v8::TryCatch::TryCatch() |
1872 : isolate_(i::Isolate::Current()), | 1872 : isolate_(i::Isolate::Current()), |
1873 next_(isolate_->try_catch_handler_address()), | 1873 next_(isolate_->try_catch_handler_address()), |
1874 exception_(isolate_->heap()->the_hole_value()), | 1874 exception_(isolate_->heap()->the_hole_value()), |
1875 message_(i::Smi::FromInt(0)), | 1875 message_(i::Smi::FromInt(0)), |
1876 is_verbose_(false), | 1876 is_verbose_(false), |
1877 can_continue_(true), | 1877 can_continue_(true), |
1878 capture_message_(true), | 1878 capture_message_(true), |
1879 rethrow_(false) { | 1879 rethrow_(false), |
| 1880 has_terminated_(false) { |
1880 isolate_->RegisterTryCatchHandler(this); | 1881 isolate_->RegisterTryCatchHandler(this); |
1881 } | 1882 } |
1882 | 1883 |
1883 | 1884 |
1884 v8::TryCatch::~TryCatch() { | 1885 v8::TryCatch::~TryCatch() { |
1885 ASSERT(isolate_ == i::Isolate::Current()); | 1886 ASSERT(isolate_ == i::Isolate::Current()); |
1886 if (rethrow_) { | 1887 if (rethrow_) { |
1887 v8::HandleScope scope; | 1888 v8::HandleScope scope; |
1888 v8::Local<v8::Value> exc = v8::Local<v8::Value>::New(Exception()); | 1889 v8::Local<v8::Value> exc = v8::Local<v8::Value>::New(Exception()); |
1889 isolate_->UnregisterTryCatchHandler(this); | 1890 isolate_->UnregisterTryCatchHandler(this); |
1890 v8::ThrowException(exc); | 1891 v8::ThrowException(exc); |
1891 } else { | 1892 } else { |
1892 isolate_->UnregisterTryCatchHandler(this); | 1893 isolate_->UnregisterTryCatchHandler(this); |
1893 } | 1894 } |
1894 } | 1895 } |
1895 | 1896 |
1896 | 1897 |
1897 bool v8::TryCatch::HasCaught() const { | 1898 bool v8::TryCatch::HasCaught() const { |
1898 return !reinterpret_cast<i::Object*>(exception_)->IsTheHole(); | 1899 return !reinterpret_cast<i::Object*>(exception_)->IsTheHole(); |
1899 } | 1900 } |
1900 | 1901 |
1901 | 1902 |
1902 bool v8::TryCatch::CanContinue() const { | 1903 bool v8::TryCatch::CanContinue() const { |
1903 return can_continue_; | 1904 return can_continue_; |
1904 } | 1905 } |
1905 | 1906 |
1906 | 1907 |
| 1908 bool v8::TryCatch::HasTerminated() const { |
| 1909 return has_terminated_; |
| 1910 } |
| 1911 |
| 1912 |
1907 v8::Handle<v8::Value> v8::TryCatch::ReThrow() { | 1913 v8::Handle<v8::Value> v8::TryCatch::ReThrow() { |
1908 if (!HasCaught()) return v8::Local<v8::Value>(); | 1914 if (!HasCaught()) return v8::Local<v8::Value>(); |
1909 rethrow_ = true; | 1915 rethrow_ = true; |
1910 return v8::Undefined(); | 1916 return v8::Undefined(); |
1911 } | 1917 } |
1912 | 1918 |
1913 | 1919 |
1914 v8::Local<Value> v8::TryCatch::Exception() const { | 1920 v8::Local<Value> v8::TryCatch::Exception() const { |
1915 ASSERT(isolate_ == i::Isolate::Current()); | 1921 ASSERT(isolate_ == i::Isolate::Current()); |
1916 if (HasCaught()) { | 1922 if (HasCaught()) { |
(...skipping 4009 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5926 } | 5932 } |
5927 | 5933 |
5928 | 5934 |
5929 bool V8::IsExecutionTerminating(Isolate* isolate) { | 5935 bool V8::IsExecutionTerminating(Isolate* isolate) { |
5930 i::Isolate* i_isolate = isolate != NULL ? | 5936 i::Isolate* i_isolate = isolate != NULL ? |
5931 reinterpret_cast<i::Isolate*>(isolate) : i::Isolate::Current(); | 5937 reinterpret_cast<i::Isolate*>(isolate) : i::Isolate::Current(); |
5932 return IsExecutionTerminatingCheck(i_isolate); | 5938 return IsExecutionTerminatingCheck(i_isolate); |
5933 } | 5939 } |
5934 | 5940 |
5935 | 5941 |
| 5942 void V8::CancelTerminateExecution(Isolate* isolate) { |
| 5943 i::Isolate* i_isolate = reinterpret_cast<i::Isolate*>(isolate); |
| 5944 i_isolate->stack_guard()->CancelTerminateExecution(); |
| 5945 } |
| 5946 |
| 5947 |
5936 Isolate* Isolate::GetCurrent() { | 5948 Isolate* Isolate::GetCurrent() { |
5937 i::Isolate* isolate = i::Isolate::UncheckedCurrent(); | 5949 i::Isolate* isolate = i::Isolate::UncheckedCurrent(); |
5938 return reinterpret_cast<Isolate*>(isolate); | 5950 return reinterpret_cast<Isolate*>(isolate); |
5939 } | 5951 } |
5940 | 5952 |
5941 | 5953 |
5942 Isolate* Isolate::New() { | 5954 Isolate* Isolate::New() { |
5943 i::Isolate* isolate = new i::Isolate(); | 5955 i::Isolate* isolate = new i::Isolate(); |
5944 return reinterpret_cast<Isolate*>(isolate); | 5956 return reinterpret_cast<Isolate*>(isolate); |
5945 } | 5957 } |
(...skipping 1122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7068 | 7080 |
7069 v->VisitPointers(blocks_.first(), first_block_limit_); | 7081 v->VisitPointers(blocks_.first(), first_block_limit_); |
7070 | 7082 |
7071 for (int i = 1; i < blocks_.length(); i++) { | 7083 for (int i = 1; i < blocks_.length(); i++) { |
7072 v->VisitPointers(blocks_[i], &blocks_[i][kHandleBlockSize]); | 7084 v->VisitPointers(blocks_[i], &blocks_[i][kHandleBlockSize]); |
7073 } | 7085 } |
7074 } | 7086 } |
7075 | 7087 |
7076 | 7088 |
7077 } } // namespace v8::internal | 7089 } } // namespace v8::internal |
OLD | NEW |