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

Unified Diff: src/isolate.h

Issue 7575013: Merge r8833 "Minimize malloc heap allocation on process startup" to 3.2. (Closed) Base URL: http://v8.googlecode.com/svn/branches/3.2/
Patch Set: '' Created 9 years, 4 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/execution.cc ('k') | src/isolate.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/isolate.h
===================================================================
--- src/isolate.h (revision 8834)
+++ src/isolate.h (working copy)
@@ -267,6 +267,9 @@
// Call back function to report unsafe JS accesses.
v8::FailedAccessCheckCallback failed_access_check_callback_;
+ // Whether out of memory exceptions should be ignored.
+ bool ignore_out_of_memory_;
+
private:
void InitializeInternal();
@@ -466,6 +469,13 @@
return reinterpret_cast<Isolate*>(Thread::GetThreadLocal(isolate_key_));
}
+ // Usually called by Init(), but can be called early e.g. to allow
+ // testing components that require logging but not the whole
+ // isolate.
+ //
+ // Safe to call more than once.
+ void InitializeLoggingAndCounters();
+
bool Init(Deserializer* des);
bool IsInitialized() { return state_ == INITIALIZED; }
@@ -512,10 +522,12 @@
// switched to non-legacy behavior).
static void EnterDefaultIsolate();
- // Debug.
// Mutex for serializing access to break control structures.
Mutex* break_access() { return break_access_; }
+ // Mutex for serializing access to debugger.
+ Mutex* debugger_access() { return debugger_access_; }
+
Address get_address_from_id(AddressId id);
// Access to top context (where the current function object was created).
@@ -676,6 +688,12 @@
// Tells whether the current context has experienced an out of memory
// exception.
bool is_out_of_memory();
+ bool ignore_out_of_memory() {
+ return thread_local_top_.ignore_out_of_memory_;
+ }
+ void set_ignore_out_of_memory(bool value) {
+ thread_local_top_.ignore_out_of_memory_ = value;
+ }
void PrintCurrentStackTrace(FILE* out);
void PrintStackTrace(FILE* out, char* thread_data);
@@ -784,14 +802,24 @@
#undef GLOBAL_CONTEXT_FIELD_ACCESSOR
Bootstrapper* bootstrapper() { return bootstrapper_; }
- Counters* counters() { return counters_; }
+ Counters* counters() {
+ // Call InitializeLoggingAndCounters() if logging is needed before
+ // the isolate is fully initialized.
+ ASSERT(counters_ != NULL);
+ return counters_;
+ }
CodeRange* code_range() { return code_range_; }
RuntimeProfiler* runtime_profiler() { return runtime_profiler_; }
CompilationCache* compilation_cache() { return compilation_cache_; }
- Logger* logger() { return logger_; }
+ Logger* logger() {
+ // Call InitializeLoggingAndCounters() if logging is needed before
+ // the isolate is fully initialized.
+ ASSERT(logger_ != NULL);
+ return logger_;
+ }
StackGuard* stack_guard() { return &stack_guard_; }
Heap* heap() { return &heap_; }
- StatsTable* stats_table() { return stats_table_; }
+ StatsTable* stats_table();
StubCache* stub_cache() { return stub_cache_; }
DeoptimizerData* deoptimizer_data() { return deoptimizer_data_; }
ThreadLocalTop* thread_local_top() { return &thread_local_top_; }
@@ -908,8 +936,14 @@
void PreallocatedStorageInit(size_t size);
#ifdef ENABLE_DEBUGGER_SUPPORT
- Debugger* debugger() { return debugger_; }
- Debug* debug() { return debug_; }
+ Debugger* debugger() {
+ if (!NoBarrier_Load(&debugger_initialized_)) InitializeDebugger();
+ return debugger_;
+ }
+ Debug* debug() {
+ if (!NoBarrier_Load(&debugger_initialized_)) InitializeDebugger();
+ return debug_;
+ }
#endif
#ifdef ENABLE_LOGGING_AND_PROFILING
@@ -1045,8 +1079,6 @@
static Isolate* default_isolate_;
static ThreadDataTable* thread_data_table_;
- bool PreInit();
-
void Deinit();
static void SetIsolateThreadLocals(Isolate* isolate,
@@ -1054,7 +1086,6 @@
enum State {
UNINITIALIZED, // Some components may not have been allocated.
- PREINITIALIZED, // Components have been allocated but not initialized.
INITIALIZED // All components are fully initialized.
};
@@ -1098,6 +1129,8 @@
void PropagatePendingExceptionToExternalTryCatch();
+ void InitializeDebugger();
+
int stack_trace_nesting_level_;
StringStream* incomplete_message_;
// The preallocated memory thread singleton.
@@ -1111,6 +1144,8 @@
Counters* counters_;
CodeRange* code_range_;
Mutex* break_access_;
+ Atomic32 debugger_initialized_;
+ Mutex* debugger_access_;
Heap heap_;
Logger* logger_;
StackGuard stack_guard_;
@@ -1204,6 +1239,7 @@
friend class ExecutionAccess;
friend class IsolateInitializer;
friend class ThreadId;
+ friend class TestMemoryAllocatorScope;
friend class v8::Isolate;
friend class v8::Locker;
« no previous file with comments | « src/execution.cc ('k') | src/isolate.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698