| 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 1164 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1175 // If the abort-on-uncaught-exception flag is specified, abort on any | 1175 // If the abort-on-uncaught-exception flag is specified, abort on any |
| 1176 // exception not caught by JavaScript, even when an external handler is | 1176 // exception not caught by JavaScript, even when an external handler is |
| 1177 // present. This flag is intended for use by JavaScript developers, so | 1177 // present. This flag is intended for use by JavaScript developers, so |
| 1178 // print a user-friendly stack trace (not an internal one). | 1178 // print a user-friendly stack trace (not an internal one). |
| 1179 if (fatal_exception_depth == 0 && | 1179 if (fatal_exception_depth == 0 && |
| 1180 FLAG_abort_on_uncaught_exception && | 1180 FLAG_abort_on_uncaught_exception && |
| 1181 (report_exception || can_be_caught_externally)) { | 1181 (report_exception || can_be_caught_externally)) { |
| 1182 fatal_exception_depth++; | 1182 fatal_exception_depth++; |
| 1183 PrintF(stderr, | 1183 PrintF(stderr, |
| 1184 "%s\n\nFROM\n", | 1184 "%s\n\nFROM\n", |
| 1185 *MessageHandler::GetLocalizedMessage(this, message_obj)); | 1185 MessageHandler::GetLocalizedMessage(this, message_obj).get()); |
| 1186 PrintCurrentStackTrace(stderr); | 1186 PrintCurrentStackTrace(stderr); |
| 1187 OS::Abort(); | 1187 OS::Abort(); |
| 1188 } | 1188 } |
| 1189 } else if (location != NULL && !location->script().is_null()) { | 1189 } else if (location != NULL && !location->script().is_null()) { |
| 1190 // We are bootstrapping and caught an error where the location is set | 1190 // We are bootstrapping and caught an error where the location is set |
| 1191 // and we have a script for the location. | 1191 // and we have a script for the location. |
| 1192 // In this case we could have an extension (or an internal error | 1192 // In this case we could have an extension (or an internal error |
| 1193 // somewhere) and we print out the line number at which the error occured | 1193 // somewhere) and we print out the line number at which the error occured |
| 1194 // to the console for easier debugging. | 1194 // to the console for easier debugging. |
| 1195 int line_number = GetScriptLineNumberSafe(location->script(), | 1195 int line_number = GetScriptLineNumberSafe(location->script(), |
| 1196 location->start_pos()); | 1196 location->start_pos()); |
| 1197 if (exception->IsString() && location->script()->name()->IsString()) { | 1197 if (exception->IsString() && location->script()->name()->IsString()) { |
| 1198 OS::PrintError( | 1198 OS::PrintError( |
| 1199 "Extension or internal compilation error: %s in %s at line %d.\n", | 1199 "Extension or internal compilation error: %s in %s at line %d.\n", |
| 1200 *String::cast(exception)->ToCString(), | 1200 String::cast(exception)->ToCString().get(), |
| 1201 *String::cast(location->script()->name())->ToCString(), | 1201 String::cast(location->script()->name())->ToCString().get(), |
| 1202 line_number + 1); | 1202 line_number + 1); |
| 1203 } else if (location->script()->name()->IsString()) { | 1203 } else if (location->script()->name()->IsString()) { |
| 1204 OS::PrintError( | 1204 OS::PrintError( |
| 1205 "Extension or internal compilation error in %s at line %d.\n", | 1205 "Extension or internal compilation error in %s at line %d.\n", |
| 1206 *String::cast(location->script()->name())->ToCString(), | 1206 String::cast(location->script()->name())->ToCString().get(), |
| 1207 line_number + 1); | 1207 line_number + 1); |
| 1208 } else { | 1208 } else { |
| 1209 OS::PrintError("Extension or internal compilation error.\n"); | 1209 OS::PrintError("Extension or internal compilation error.\n"); |
| 1210 } | 1210 } |
| 1211 } | 1211 } |
| 1212 } | 1212 } |
| 1213 | 1213 |
| 1214 // Save the message for reporting if the the exception remains uncaught. | 1214 // Save the message for reporting if the the exception remains uncaught. |
| 1215 thread_local_top()->has_pending_message_ = report_exception; | 1215 thread_local_top()->has_pending_message_ = report_exception; |
| 1216 | 1216 |
| (...skipping 308 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1525 counters_(NULL), | 1525 counters_(NULL), |
| 1526 code_range_(NULL), | 1526 code_range_(NULL), |
| 1527 debugger_initialized_(false), | 1527 debugger_initialized_(false), |
| 1528 logger_(NULL), | 1528 logger_(NULL), |
| 1529 stats_table_(NULL), | 1529 stats_table_(NULL), |
| 1530 stub_cache_(NULL), | 1530 stub_cache_(NULL), |
| 1531 deoptimizer_data_(NULL), | 1531 deoptimizer_data_(NULL), |
| 1532 capture_stack_trace_for_uncaught_exceptions_(false), | 1532 capture_stack_trace_for_uncaught_exceptions_(false), |
| 1533 stack_trace_for_uncaught_exceptions_frame_limit_(0), | 1533 stack_trace_for_uncaught_exceptions_frame_limit_(0), |
| 1534 stack_trace_for_uncaught_exceptions_options_(StackTrace::kOverview), | 1534 stack_trace_for_uncaught_exceptions_options_(StackTrace::kOverview), |
| 1535 transcendental_cache_(NULL), | |
| 1536 memory_allocator_(NULL), | 1535 memory_allocator_(NULL), |
| 1537 keyed_lookup_cache_(NULL), | 1536 keyed_lookup_cache_(NULL), |
| 1538 context_slot_cache_(NULL), | 1537 context_slot_cache_(NULL), |
| 1539 descriptor_lookup_cache_(NULL), | 1538 descriptor_lookup_cache_(NULL), |
| 1540 handle_scope_implementer_(NULL), | 1539 handle_scope_implementer_(NULL), |
| 1541 unicode_cache_(NULL), | 1540 unicode_cache_(NULL), |
| 1542 runtime_zone_(this), | 1541 runtime_zone_(this), |
| 1543 inner_pointer_to_code_cache_(NULL), | 1542 inner_pointer_to_code_cache_(NULL), |
| 1544 write_iterator_(NULL), | 1543 write_iterator_(NULL), |
| 1545 global_handles_(NULL), | 1544 global_handles_(NULL), |
| (...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1682 // We must stop the logger before we tear down other components. | 1681 // We must stop the logger before we tear down other components. |
| 1683 Sampler* sampler = logger_->sampler(); | 1682 Sampler* sampler = logger_->sampler(); |
| 1684 if (sampler && sampler->IsActive()) sampler->Stop(); | 1683 if (sampler && sampler->IsActive()) sampler->Stop(); |
| 1685 | 1684 |
| 1686 delete deoptimizer_data_; | 1685 delete deoptimizer_data_; |
| 1687 deoptimizer_data_ = NULL; | 1686 deoptimizer_data_ = NULL; |
| 1688 builtins_.TearDown(); | 1687 builtins_.TearDown(); |
| 1689 bootstrapper_->TearDown(); | 1688 bootstrapper_->TearDown(); |
| 1690 | 1689 |
| 1691 if (runtime_profiler_ != NULL) { | 1690 if (runtime_profiler_ != NULL) { |
| 1692 runtime_profiler_->TearDown(); | |
| 1693 delete runtime_profiler_; | 1691 delete runtime_profiler_; |
| 1694 runtime_profiler_ = NULL; | 1692 runtime_profiler_ = NULL; |
| 1695 } | 1693 } |
| 1696 heap_.TearDown(); | 1694 heap_.TearDown(); |
| 1697 logger_->TearDown(); | 1695 logger_->TearDown(); |
| 1698 | 1696 |
| 1699 delete heap_profiler_; | 1697 delete heap_profiler_; |
| 1700 heap_profiler_ = NULL; | 1698 heap_profiler_ = NULL; |
| 1701 delete cpu_profiler_; | 1699 delete cpu_profiler_; |
| 1702 cpu_profiler_ = NULL; | 1700 cpu_profiler_ = NULL; |
| (...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1764 delete regexp_stack_; | 1762 delete regexp_stack_; |
| 1765 regexp_stack_ = NULL; | 1763 regexp_stack_ = NULL; |
| 1766 | 1764 |
| 1767 delete descriptor_lookup_cache_; | 1765 delete descriptor_lookup_cache_; |
| 1768 descriptor_lookup_cache_ = NULL; | 1766 descriptor_lookup_cache_ = NULL; |
| 1769 delete context_slot_cache_; | 1767 delete context_slot_cache_; |
| 1770 context_slot_cache_ = NULL; | 1768 context_slot_cache_ = NULL; |
| 1771 delete keyed_lookup_cache_; | 1769 delete keyed_lookup_cache_; |
| 1772 keyed_lookup_cache_ = NULL; | 1770 keyed_lookup_cache_ = NULL; |
| 1773 | 1771 |
| 1774 delete transcendental_cache_; | |
| 1775 transcendental_cache_ = NULL; | |
| 1776 delete stub_cache_; | 1772 delete stub_cache_; |
| 1777 stub_cache_ = NULL; | 1773 stub_cache_ = NULL; |
| 1778 delete stats_table_; | 1774 delete stats_table_; |
| 1779 stats_table_ = NULL; | 1775 stats_table_ = NULL; |
| 1780 | 1776 |
| 1781 delete logger_; | 1777 delete logger_; |
| 1782 logger_ = NULL; | 1778 logger_ = NULL; |
| 1783 | 1779 |
| 1784 delete counters_; | 1780 delete counters_; |
| 1785 counters_ = NULL; | 1781 counters_ = NULL; |
| (...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1930 | 1926 |
| 1931 #define ASSIGN_ELEMENT(CamelName, hacker_name) \ | 1927 #define ASSIGN_ELEMENT(CamelName, hacker_name) \ |
| 1932 isolate_addresses_[Isolate::k##CamelName##Address] = \ | 1928 isolate_addresses_[Isolate::k##CamelName##Address] = \ |
| 1933 reinterpret_cast<Address>(hacker_name##_address()); | 1929 reinterpret_cast<Address>(hacker_name##_address()); |
| 1934 FOR_EACH_ISOLATE_ADDRESS_NAME(ASSIGN_ELEMENT) | 1930 FOR_EACH_ISOLATE_ADDRESS_NAME(ASSIGN_ELEMENT) |
| 1935 #undef ASSIGN_ELEMENT | 1931 #undef ASSIGN_ELEMENT |
| 1936 | 1932 |
| 1937 string_tracker_ = new StringTracker(); | 1933 string_tracker_ = new StringTracker(); |
| 1938 string_tracker_->isolate_ = this; | 1934 string_tracker_->isolate_ = this; |
| 1939 compilation_cache_ = new CompilationCache(this); | 1935 compilation_cache_ = new CompilationCache(this); |
| 1940 transcendental_cache_ = new TranscendentalCache(this); | |
| 1941 keyed_lookup_cache_ = new KeyedLookupCache(); | 1936 keyed_lookup_cache_ = new KeyedLookupCache(); |
| 1942 context_slot_cache_ = new ContextSlotCache(); | 1937 context_slot_cache_ = new ContextSlotCache(); |
| 1943 descriptor_lookup_cache_ = new DescriptorLookupCache(); | 1938 descriptor_lookup_cache_ = new DescriptorLookupCache(); |
| 1944 unicode_cache_ = new UnicodeCache(); | 1939 unicode_cache_ = new UnicodeCache(); |
| 1945 inner_pointer_to_code_cache_ = new InnerPointerToCodeCache(this); | 1940 inner_pointer_to_code_cache_ = new InnerPointerToCodeCache(this); |
| 1946 write_iterator_ = new ConsStringIteratorOp(); | 1941 write_iterator_ = new ConsStringIteratorOp(); |
| 1947 global_handles_ = new GlobalHandles(this); | 1942 global_handles_ = new GlobalHandles(this); |
| 1948 eternal_handles_ = new EternalHandles(); | 1943 eternal_handles_ = new EternalHandles(); |
| 1949 bootstrapper_ = new Bootstrapper(this); | 1944 bootstrapper_ = new Bootstrapper(this); |
| 1950 handle_scope_implementer_ = new HandleScopeImplementer(this); | 1945 handle_scope_implementer_ = new HandleScopeImplementer(this); |
| (...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2043 clear_scheduled_exception(); | 2038 clear_scheduled_exception(); |
| 2044 | 2039 |
| 2045 // Deserializing may put strange things in the root array's copy of the | 2040 // Deserializing may put strange things in the root array's copy of the |
| 2046 // stack guard. | 2041 // stack guard. |
| 2047 heap_.SetStackLimits(); | 2042 heap_.SetStackLimits(); |
| 2048 | 2043 |
| 2049 // Quiet the heap NaN if needed on target platform. | 2044 // Quiet the heap NaN if needed on target platform. |
| 2050 if (!create_heap_objects) Assembler::QuietNaN(heap_.nan_value()); | 2045 if (!create_heap_objects) Assembler::QuietNaN(heap_.nan_value()); |
| 2051 | 2046 |
| 2052 runtime_profiler_ = new RuntimeProfiler(this); | 2047 runtime_profiler_ = new RuntimeProfiler(this); |
| 2053 runtime_profiler_->SetUp(); | |
| 2054 | 2048 |
| 2055 // If we are deserializing, log non-function code objects and compiled | 2049 // If we are deserializing, log non-function code objects and compiled |
| 2056 // functions found in the snapshot. | 2050 // functions found in the snapshot. |
| 2057 if (!create_heap_objects && | 2051 if (!create_heap_objects && |
| 2058 (FLAG_log_code || | 2052 (FLAG_log_code || |
| 2059 FLAG_ll_prof || | 2053 FLAG_ll_prof || |
| 2060 FLAG_perf_jit_prof || | 2054 FLAG_perf_jit_prof || |
| 2061 FLAG_perf_basic_prof || | 2055 FLAG_perf_basic_prof || |
| 2062 logger_->is_logging_code_events())) { | 2056 logger_->is_logging_code_events())) { |
| 2063 HandleScope scope(this); | 2057 HandleScope scope(this); |
| (...skipping 235 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2299 | 2293 |
| 2300 #ifdef DEBUG | 2294 #ifdef DEBUG |
| 2301 #define ISOLATE_FIELD_OFFSET(type, name, ignored) \ | 2295 #define ISOLATE_FIELD_OFFSET(type, name, ignored) \ |
| 2302 const intptr_t Isolate::name##_debug_offset_ = OFFSET_OF(Isolate, name##_); | 2296 const intptr_t Isolate::name##_debug_offset_ = OFFSET_OF(Isolate, name##_); |
| 2303 ISOLATE_INIT_LIST(ISOLATE_FIELD_OFFSET) | 2297 ISOLATE_INIT_LIST(ISOLATE_FIELD_OFFSET) |
| 2304 ISOLATE_INIT_ARRAY_LIST(ISOLATE_FIELD_OFFSET) | 2298 ISOLATE_INIT_ARRAY_LIST(ISOLATE_FIELD_OFFSET) |
| 2305 #undef ISOLATE_FIELD_OFFSET | 2299 #undef ISOLATE_FIELD_OFFSET |
| 2306 #endif | 2300 #endif |
| 2307 | 2301 |
| 2308 } } // namespace v8::internal | 2302 } } // namespace v8::internal |
| OLD | NEW |