| 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 1891 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1902 | 1902 |
| 1903 | 1903 |
| 1904 v8::TryCatch::TryCatch() | 1904 v8::TryCatch::TryCatch() |
| 1905 : isolate_(i::Isolate::Current()), | 1905 : isolate_(i::Isolate::Current()), |
| 1906 next_(isolate_->try_catch_handler_address()), | 1906 next_(isolate_->try_catch_handler_address()), |
| 1907 exception_(isolate_->heap()->the_hole_value()), | 1907 exception_(isolate_->heap()->the_hole_value()), |
| 1908 message_(i::Smi::FromInt(0)), | 1908 message_(i::Smi::FromInt(0)), |
| 1909 is_verbose_(false), | 1909 is_verbose_(false), |
| 1910 can_continue_(true), | 1910 can_continue_(true), |
| 1911 capture_message_(true), | 1911 capture_message_(true), |
| 1912 rethrow_(false) { | 1912 rethrow_(false), |
| 1913 has_terminated_(false) { |
| 1913 isolate_->RegisterTryCatchHandler(this); | 1914 isolate_->RegisterTryCatchHandler(this); |
| 1914 } | 1915 } |
| 1915 | 1916 |
| 1916 | 1917 |
| 1917 v8::TryCatch::~TryCatch() { | 1918 v8::TryCatch::~TryCatch() { |
| 1918 ASSERT(isolate_ == i::Isolate::Current()); | 1919 ASSERT(isolate_ == i::Isolate::Current()); |
| 1919 if (rethrow_) { | 1920 if (rethrow_) { |
| 1920 v8::HandleScope scope(reinterpret_cast<Isolate*>(isolate_)); | 1921 v8::HandleScope scope(reinterpret_cast<Isolate*>(isolate_)); |
| 1921 v8::Local<v8::Value> exc = v8::Local<v8::Value>::New(Exception()); | 1922 v8::Local<v8::Value> exc = v8::Local<v8::Value>::New(Exception()); |
| 1922 isolate_->UnregisterTryCatchHandler(this); | 1923 isolate_->UnregisterTryCatchHandler(this); |
| 1923 v8::ThrowException(exc); | 1924 v8::ThrowException(exc); |
| 1924 } else { | 1925 } else { |
| 1925 isolate_->UnregisterTryCatchHandler(this); | 1926 isolate_->UnregisterTryCatchHandler(this); |
| 1926 } | 1927 } |
| 1927 } | 1928 } |
| 1928 | 1929 |
| 1929 | 1930 |
| 1930 bool v8::TryCatch::HasCaught() const { | 1931 bool v8::TryCatch::HasCaught() const { |
| 1931 return !reinterpret_cast<i::Object*>(exception_)->IsTheHole(); | 1932 return !reinterpret_cast<i::Object*>(exception_)->IsTheHole(); |
| 1932 } | 1933 } |
| 1933 | 1934 |
| 1934 | 1935 |
| 1935 bool v8::TryCatch::CanContinue() const { | 1936 bool v8::TryCatch::CanContinue() const { |
| 1936 return can_continue_; | 1937 return can_continue_; |
| 1937 } | 1938 } |
| 1938 | 1939 |
| 1939 | 1940 |
| 1941 bool v8::TryCatch::HasTerminated() const { |
| 1942 return has_terminated_; |
| 1943 } |
| 1944 |
| 1945 |
| 1940 v8::Handle<v8::Value> v8::TryCatch::ReThrow() { | 1946 v8::Handle<v8::Value> v8::TryCatch::ReThrow() { |
| 1941 if (!HasCaught()) return v8::Local<v8::Value>(); | 1947 if (!HasCaught()) return v8::Local<v8::Value>(); |
| 1942 rethrow_ = true; | 1948 rethrow_ = true; |
| 1943 return v8::Undefined(); | 1949 return v8::Undefined(); |
| 1944 } | 1950 } |
| 1945 | 1951 |
| 1946 | 1952 |
| 1947 v8::Local<Value> v8::TryCatch::Exception() const { | 1953 v8::Local<Value> v8::TryCatch::Exception() const { |
| 1948 ASSERT(isolate_ == i::Isolate::Current()); | 1954 ASSERT(isolate_ == i::Isolate::Current()); |
| 1949 if (HasCaught()) { | 1955 if (HasCaught()) { |
| (...skipping 4159 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6109 } | 6115 } |
| 6110 | 6116 |
| 6111 | 6117 |
| 6112 bool V8::IsExecutionTerminating(Isolate* isolate) { | 6118 bool V8::IsExecutionTerminating(Isolate* isolate) { |
| 6113 i::Isolate* i_isolate = isolate != NULL ? | 6119 i::Isolate* i_isolate = isolate != NULL ? |
| 6114 reinterpret_cast<i::Isolate*>(isolate) : i::Isolate::Current(); | 6120 reinterpret_cast<i::Isolate*>(isolate) : i::Isolate::Current(); |
| 6115 return IsExecutionTerminatingCheck(i_isolate); | 6121 return IsExecutionTerminatingCheck(i_isolate); |
| 6116 } | 6122 } |
| 6117 | 6123 |
| 6118 | 6124 |
| 6125 void V8::CancelTerminateExecution(Isolate* isolate) { |
| 6126 i::Isolate* i_isolate = reinterpret_cast<i::Isolate*>(isolate); |
| 6127 i_isolate->stack_guard()->CancelTerminateExecution(); |
| 6128 } |
| 6129 |
| 6130 |
| 6119 Isolate* Isolate::GetCurrent() { | 6131 Isolate* Isolate::GetCurrent() { |
| 6120 i::Isolate* isolate = i::Isolate::UncheckedCurrent(); | 6132 i::Isolate* isolate = i::Isolate::UncheckedCurrent(); |
| 6121 return reinterpret_cast<Isolate*>(isolate); | 6133 return reinterpret_cast<Isolate*>(isolate); |
| 6122 } | 6134 } |
| 6123 | 6135 |
| 6124 | 6136 |
| 6125 Isolate* Isolate::New() { | 6137 Isolate* Isolate::New() { |
| 6126 i::Isolate* isolate = new i::Isolate(); | 6138 i::Isolate* isolate = new i::Isolate(); |
| 6127 return reinterpret_cast<Isolate*>(isolate); | 6139 return reinterpret_cast<Isolate*>(isolate); |
| 6128 } | 6140 } |
| (...skipping 1252 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 7381 | 7393 |
| 7382 v->VisitPointers(blocks_.first(), first_block_limit_); | 7394 v->VisitPointers(blocks_.first(), first_block_limit_); |
| 7383 | 7395 |
| 7384 for (int i = 1; i < blocks_.length(); i++) { | 7396 for (int i = 1; i < blocks_.length(); i++) { |
| 7385 v->VisitPointers(blocks_[i], &blocks_[i][kHandleBlockSize]); | 7397 v->VisitPointers(blocks_[i], &blocks_[i][kHandleBlockSize]); |
| 7386 } | 7398 } |
| 7387 } | 7399 } |
| 7388 | 7400 |
| 7389 | 7401 |
| 7390 } } // namespace v8::internal | 7402 } } // namespace v8::internal |
| OLD | NEW |