Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(4)

Side by Side Diff: src/isolate.cc

Issue 12475016: Maintain API compatibility with older versions of V8. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 7 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « src/isolate.h ('k') | src/log.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 1038 matching lines...) Expand 10 before | Expand all | Expand 10 after
1049 return Failure::Exception(); 1049 return Failure::Exception();
1050 } 1050 }
1051 1051
1052 1052
1053 Failure* Isolate::TerminateExecution() { 1053 Failure* Isolate::TerminateExecution() {
1054 DoThrow(heap_.termination_exception(), NULL); 1054 DoThrow(heap_.termination_exception(), NULL);
1055 return Failure::Exception(); 1055 return Failure::Exception();
1056 } 1056 }
1057 1057
1058 1058
1059 void Isolate::CancelTerminateExecution() {
1060 if (try_catch_handler()) {
1061 try_catch_handler()->has_terminated_ = false;
1062 }
1063 if (has_pending_exception() &&
1064 pending_exception() == heap_.termination_exception()) {
1065 thread_local_top()->external_caught_exception_ = false;
1066 clear_pending_exception();
1067 }
1068 if (has_scheduled_exception() &&
1069 scheduled_exception() == heap_.termination_exception()) {
1070 thread_local_top()->external_caught_exception_ = false;
1071 clear_scheduled_exception();
1072 }
1073 }
1074
1075
1076 Failure* Isolate::Throw(Object* exception, MessageLocation* location) { 1059 Failure* Isolate::Throw(Object* exception, MessageLocation* location) {
1077 DoThrow(exception, location); 1060 DoThrow(exception, location);
1078 return Failure::Exception(); 1061 return Failure::Exception();
1079 } 1062 }
1080 1063
1081 1064
1082 Failure* Isolate::ReThrow(MaybeObject* exception) { 1065 Failure* Isolate::ReThrow(MaybeObject* exception) {
1083 bool can_be_caught_externally = false; 1066 bool can_be_caught_externally = false;
1084 bool catchable_by_javascript = is_catchable_by_javascript(exception); 1067 bool catchable_by_javascript = is_catchable_by_javascript(exception);
1085 ShouldReportException(&can_be_caught_externally, catchable_by_javascript); 1068 ShouldReportException(&can_be_caught_externally, catchable_by_javascript);
(...skipping 602 matching lines...) Expand 10 before | Expand all | Expand 10 after
1688 global_handles_(NULL), 1671 global_handles_(NULL),
1689 context_switcher_(NULL), 1672 context_switcher_(NULL),
1690 thread_manager_(NULL), 1673 thread_manager_(NULL),
1691 fp_stubs_generated_(false), 1674 fp_stubs_generated_(false),
1692 has_installed_extensions_(false), 1675 has_installed_extensions_(false),
1693 string_tracker_(NULL), 1676 string_tracker_(NULL),
1694 regexp_stack_(NULL), 1677 regexp_stack_(NULL),
1695 date_cache_(NULL), 1678 date_cache_(NULL),
1696 code_stub_interface_descriptors_(NULL), 1679 code_stub_interface_descriptors_(NULL),
1697 context_exit_happened_(false), 1680 context_exit_happened_(false),
1698 cpu_profiler_(NULL),
1699 heap_profiler_(NULL),
1700 deferred_handles_head_(NULL), 1681 deferred_handles_head_(NULL),
1701 optimizing_compiler_thread_(this), 1682 optimizing_compiler_thread_(this),
1702 marking_thread_(NULL), 1683 marking_thread_(NULL),
1703 sweeper_thread_(NULL) { 1684 sweeper_thread_(NULL) {
1704 id_ = NoBarrier_AtomicIncrement(&isolate_counter_, 1); 1685 id_ = NoBarrier_AtomicIncrement(&isolate_counter_, 1);
1705 TRACE_ISOLATE(constructor); 1686 TRACE_ISOLATE(constructor);
1706 1687
1707 memset(isolate_addresses_, 0, 1688 memset(isolate_addresses_, 0,
1708 sizeof(isolate_addresses_[0]) * (kIsolateAddressCount + 1)); 1689 sizeof(isolate_addresses_[0]) * (kIsolateAddressCount + 1));
1709 1690
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after
1821 v8::Locker::StopPreemption(); 1802 v8::Locker::StopPreemption();
1822 } 1803 }
1823 builtins_.TearDown(); 1804 builtins_.TearDown();
1824 bootstrapper_->TearDown(); 1805 bootstrapper_->TearDown();
1825 1806
1826 // Remove the external reference to the preallocated stack memory. 1807 // Remove the external reference to the preallocated stack memory.
1827 delete preallocated_message_space_; 1808 delete preallocated_message_space_;
1828 preallocated_message_space_ = NULL; 1809 preallocated_message_space_ = NULL;
1829 PreallocatedMemoryThreadStop(); 1810 PreallocatedMemoryThreadStop();
1830 1811
1831 delete heap_profiler_; 1812 HeapProfiler::TearDown();
1832 heap_profiler_ = NULL; 1813 CpuProfiler::TearDown();
1833 delete cpu_profiler_;
1834 cpu_profiler_ = NULL;
1835
1836 if (runtime_profiler_ != NULL) { 1814 if (runtime_profiler_ != NULL) {
1837 runtime_profiler_->TearDown(); 1815 runtime_profiler_->TearDown();
1838 delete runtime_profiler_; 1816 delete runtime_profiler_;
1839 runtime_profiler_ = NULL; 1817 runtime_profiler_ = NULL;
1840 } 1818 }
1841 heap_.TearDown(); 1819 heap_.TearDown();
1842 logger_->TearDown(); 1820 logger_->TearDown();
1843 1821
1844 // The default isolate is re-initializable due to legacy API. 1822 // The default isolate is re-initializable due to legacy API.
1845 state_ = UNINITIALIZED; 1823 state_ = UNINITIALIZED;
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after
1970 bool external_caught = IsExternallyCaught(); 1948 bool external_caught = IsExternallyCaught();
1971 thread_local_top_.external_caught_exception_ = external_caught; 1949 thread_local_top_.external_caught_exception_ = external_caught;
1972 1950
1973 if (!external_caught) return; 1951 if (!external_caught) return;
1974 1952
1975 if (thread_local_top_.pending_exception_->IsOutOfMemory()) { 1953 if (thread_local_top_.pending_exception_->IsOutOfMemory()) {
1976 // Do not propagate OOM exception: we should kill VM asap. 1954 // Do not propagate OOM exception: we should kill VM asap.
1977 } else if (thread_local_top_.pending_exception_ == 1955 } else if (thread_local_top_.pending_exception_ ==
1978 heap()->termination_exception()) { 1956 heap()->termination_exception()) {
1979 try_catch_handler()->can_continue_ = false; 1957 try_catch_handler()->can_continue_ = false;
1980 try_catch_handler()->has_terminated_ = true;
1981 try_catch_handler()->exception_ = heap()->null_value(); 1958 try_catch_handler()->exception_ = heap()->null_value();
1982 } else { 1959 } else {
1983 // At this point all non-object (failure) exceptions have 1960 // At this point all non-object (failure) exceptions have
1984 // been dealt with so this shouldn't fail. 1961 // been dealt with so this shouldn't fail.
1985 ASSERT(!pending_exception()->IsFailure()); 1962 ASSERT(!pending_exception()->IsFailure());
1986 try_catch_handler()->can_continue_ = true; 1963 try_catch_handler()->can_continue_ = true;
1987 try_catch_handler()->has_terminated_ = false;
1988 try_catch_handler()->exception_ = pending_exception(); 1964 try_catch_handler()->exception_ = pending_exception();
1989 if (!thread_local_top_.pending_message_obj_->IsTheHole()) { 1965 if (!thread_local_top_.pending_message_obj_->IsTheHole()) {
1990 try_catch_handler()->message_ = thread_local_top_.pending_message_obj_; 1966 try_catch_handler()->message_ = thread_local_top_.pending_message_obj_;
1991 } 1967 }
1992 } 1968 }
1993 } 1969 }
1994 1970
1995 1971
1996 void Isolate::InitializeLoggingAndCounters() { 1972 void Isolate::InitializeLoggingAndCounters() {
1997 if (logger_ == NULL) { 1973 if (logger_ == NULL) {
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
2056 stub_cache_ = new StubCache(this, runtime_zone()); 2032 stub_cache_ = new StubCache(this, runtime_zone());
2057 regexp_stack_ = new RegExpStack(); 2033 regexp_stack_ = new RegExpStack();
2058 regexp_stack_->isolate_ = this; 2034 regexp_stack_->isolate_ = this;
2059 date_cache_ = new DateCache(); 2035 date_cache_ = new DateCache();
2060 code_stub_interface_descriptors_ = 2036 code_stub_interface_descriptors_ =
2061 new CodeStubInterfaceDescriptor[CodeStub::NUMBER_OF_IDS]; 2037 new CodeStubInterfaceDescriptor[CodeStub::NUMBER_OF_IDS];
2062 2038
2063 // Enable logging before setting up the heap 2039 // Enable logging before setting up the heap
2064 logger_->SetUp(); 2040 logger_->SetUp();
2065 2041
2066 cpu_profiler_ = new CpuProfiler(this); 2042 CpuProfiler::SetUp();
2067 heap_profiler_ = new HeapProfiler(heap()); 2043 HeapProfiler::SetUp();
2068 2044
2069 // Initialize other runtime facilities 2045 // Initialize other runtime facilities
2070 #if defined(USE_SIMULATOR) 2046 #if defined(USE_SIMULATOR)
2071 #if defined(V8_TARGET_ARCH_ARM) || defined(V8_TARGET_ARCH_MIPS) 2047 #if defined(V8_TARGET_ARCH_ARM) || defined(V8_TARGET_ARCH_MIPS)
2072 Simulator::Initialize(this); 2048 Simulator::Initialize(this);
2073 #endif 2049 #endif
2074 #endif 2050 #endif
2075 2051
2076 { // NOLINT 2052 { // NOLINT
2077 // Ensure that the thread has a valid stack guard. The v8::Locker object 2053 // Ensure that the thread has a valid stack guard. The v8::Locker object
(...skipping 311 matching lines...) Expand 10 before | Expand all | Expand 10 after
2389 2365
2390 #ifdef DEBUG 2366 #ifdef DEBUG
2391 #define ISOLATE_FIELD_OFFSET(type, name, ignored) \ 2367 #define ISOLATE_FIELD_OFFSET(type, name, ignored) \
2392 const intptr_t Isolate::name##_debug_offset_ = OFFSET_OF(Isolate, name##_); 2368 const intptr_t Isolate::name##_debug_offset_ = OFFSET_OF(Isolate, name##_);
2393 ISOLATE_INIT_LIST(ISOLATE_FIELD_OFFSET) 2369 ISOLATE_INIT_LIST(ISOLATE_FIELD_OFFSET)
2394 ISOLATE_INIT_ARRAY_LIST(ISOLATE_FIELD_OFFSET) 2370 ISOLATE_INIT_ARRAY_LIST(ISOLATE_FIELD_OFFSET)
2395 #undef ISOLATE_FIELD_OFFSET 2371 #undef ISOLATE_FIELD_OFFSET
2396 #endif 2372 #endif
2397 2373
2398 } } // namespace v8::internal 2374 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/isolate.h ('k') | src/log.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698