| OLD | NEW |
| 1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include <stdlib.h> | 5 #include <stdlib.h> |
| 6 | 6 |
| 7 #include "v8.h" | 7 #include "v8.h" |
| 8 | 8 |
| 9 #include "ast.h" | 9 #include "ast.h" |
| 10 #include "bootstrapper.h" | 10 #include "bootstrapper.h" |
| (...skipping 1027 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1038 bool report_exception = catchable_by_javascript && should_report_exception; | 1038 bool report_exception = catchable_by_javascript && should_report_exception; |
| 1039 bool try_catch_needs_message = | 1039 bool try_catch_needs_message = |
| 1040 can_be_caught_externally && try_catch_handler()->capture_message_ && | 1040 can_be_caught_externally && try_catch_handler()->capture_message_ && |
| 1041 !thread_local_top()->rethrowing_message_; | 1041 !thread_local_top()->rethrowing_message_; |
| 1042 bool bootstrapping = bootstrapper()->IsActive(); | 1042 bool bootstrapping = bootstrapper()->IsActive(); |
| 1043 | 1043 |
| 1044 thread_local_top()->rethrowing_message_ = false; | 1044 thread_local_top()->rethrowing_message_ = false; |
| 1045 | 1045 |
| 1046 // Notify debugger of exception. | 1046 // Notify debugger of exception. |
| 1047 if (catchable_by_javascript) { | 1047 if (catchable_by_javascript) { |
| 1048 debugger_->OnException(exception_handle, report_exception); | 1048 debug()->OnException(exception_handle, report_exception); |
| 1049 } | 1049 } |
| 1050 | 1050 |
| 1051 // Generate the message if required. | 1051 // Generate the message if required. |
| 1052 if (report_exception || try_catch_needs_message) { | 1052 if (report_exception || try_catch_needs_message) { |
| 1053 MessageLocation potential_computed_location; | 1053 MessageLocation potential_computed_location; |
| 1054 if (location == NULL) { | 1054 if (location == NULL) { |
| 1055 // If no location was specified we use a computed one instead. | 1055 // If no location was specified we use a computed one instead. |
| 1056 ComputeLocation(&potential_computed_location); | 1056 ComputeLocation(&potential_computed_location); |
| 1057 location = &potential_computed_location; | 1057 location = &potential_computed_location; |
| 1058 } | 1058 } |
| (...skipping 266 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1325 } | 1325 } |
| 1326 | 1326 |
| 1327 | 1327 |
| 1328 Handle<Context> Isolate::global_context() { | 1328 Handle<Context> Isolate::global_context() { |
| 1329 return Handle<Context>(context()->global_object()->global_context()); | 1329 return Handle<Context>(context()->global_object()->global_context()); |
| 1330 } | 1330 } |
| 1331 | 1331 |
| 1332 | 1332 |
| 1333 Handle<Context> Isolate::GetCallingNativeContext() { | 1333 Handle<Context> Isolate::GetCallingNativeContext() { |
| 1334 JavaScriptFrameIterator it(this); | 1334 JavaScriptFrameIterator it(this); |
| 1335 if (debug_->InDebugger()) { | 1335 if (debug_->in_debug_scope()) { |
| 1336 while (!it.done()) { | 1336 while (!it.done()) { |
| 1337 JavaScriptFrame* frame = it.frame(); | 1337 JavaScriptFrame* frame = it.frame(); |
| 1338 Context* context = Context::cast(frame->context()); | 1338 Context* context = Context::cast(frame->context()); |
| 1339 if (context->native_context() == *debug_->debug_context()) { | 1339 if (context->native_context() == *debug_->debug_context()) { |
| 1340 it.Advance(); | 1340 it.Advance(); |
| 1341 } else { | 1341 } else { |
| 1342 break; | 1342 break; |
| 1343 } | 1343 } |
| 1344 } | 1344 } |
| 1345 } | 1345 } |
| (...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1521 ISOLATE_INIT_LIST(ISOLATE_INIT_EXECUTE) | 1521 ISOLATE_INIT_LIST(ISOLATE_INIT_EXECUTE) |
| 1522 #undef ISOLATE_INIT_EXECUTE | 1522 #undef ISOLATE_INIT_EXECUTE |
| 1523 | 1523 |
| 1524 #define ISOLATE_INIT_ARRAY_EXECUTE(type, name, length) \ | 1524 #define ISOLATE_INIT_ARRAY_EXECUTE(type, name, length) \ |
| 1525 memset(name##_, 0, sizeof(type) * length); | 1525 memset(name##_, 0, sizeof(type) * length); |
| 1526 ISOLATE_INIT_ARRAY_LIST(ISOLATE_INIT_ARRAY_EXECUTE) | 1526 ISOLATE_INIT_ARRAY_LIST(ISOLATE_INIT_ARRAY_EXECUTE) |
| 1527 #undef ISOLATE_INIT_ARRAY_EXECUTE | 1527 #undef ISOLATE_INIT_ARRAY_EXECUTE |
| 1528 | 1528 |
| 1529 InitializeLoggingAndCounters(); | 1529 InitializeLoggingAndCounters(); |
| 1530 debug_ = new Debug(this); | 1530 debug_ = new Debug(this); |
| 1531 debugger_ = new Debugger(this); | |
| 1532 } | 1531 } |
| 1533 | 1532 |
| 1534 | 1533 |
| 1535 void Isolate::TearDown() { | 1534 void Isolate::TearDown() { |
| 1536 TRACE_ISOLATE(tear_down); | 1535 TRACE_ISOLATE(tear_down); |
| 1537 | 1536 |
| 1538 // Temporarily set this isolate as current so that various parts of | 1537 // Temporarily set this isolate as current so that various parts of |
| 1539 // the isolate can access it in their destructors without having a | 1538 // the isolate can access it in their destructors without having a |
| 1540 // direct pointer. We don't use Enter/Exit here to avoid | 1539 // direct pointer. We don't use Enter/Exit here to avoid |
| 1541 // initializing the thread data. | 1540 // initializing the thread data. |
| (...skipping 189 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1731 | 1730 |
| 1732 delete string_stream_debug_object_cache_; | 1731 delete string_stream_debug_object_cache_; |
| 1733 string_stream_debug_object_cache_ = NULL; | 1732 string_stream_debug_object_cache_ = NULL; |
| 1734 | 1733 |
| 1735 delete external_reference_table_; | 1734 delete external_reference_table_; |
| 1736 external_reference_table_ = NULL; | 1735 external_reference_table_ = NULL; |
| 1737 | 1736 |
| 1738 delete random_number_generator_; | 1737 delete random_number_generator_; |
| 1739 random_number_generator_ = NULL; | 1738 random_number_generator_ = NULL; |
| 1740 | 1739 |
| 1741 delete debugger_; | |
| 1742 debugger_ = NULL; | |
| 1743 delete debug_; | 1740 delete debug_; |
| 1744 debug_ = NULL; | 1741 debug_ = NULL; |
| 1745 } | 1742 } |
| 1746 | 1743 |
| 1747 | 1744 |
| 1748 void Isolate::InitializeThreadLocal() { | 1745 void Isolate::InitializeThreadLocal() { |
| 1749 thread_local_top_.isolate_ = this; | 1746 thread_local_top_.isolate_ = this; |
| 1750 thread_local_top_.Initialize(); | 1747 thread_local_top_.Initialize(); |
| 1751 } | 1748 } |
| 1752 | 1749 |
| (...skipping 560 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2313 Execution::Call(this, microtask, factory()->undefined_value(), | 2310 Execution::Call(this, microtask, factory()->undefined_value(), |
| 2314 0, NULL).Check(); | 2311 0, NULL).Check(); |
| 2315 } | 2312 } |
| 2316 } | 2313 } |
| 2317 | 2314 |
| 2318 handle_scope_implementer()->DecrementCallDepth(); | 2315 handle_scope_implementer()->DecrementCallDepth(); |
| 2319 } | 2316 } |
| 2320 | 2317 |
| 2321 | 2318 |
| 2322 } } // namespace v8::internal | 2319 } } // namespace v8::internal |
| OLD | NEW |