some random isolate threading

R=svenpanne@chromium.org
BUG=

Review URL: https://codereview.chromium.org/23494046

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@16636 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
This commit is contained in:
dcarney@chromium.org 2013-09-11 08:39:38 +00:00
parent 4537c07354
commit 9a8344b1e7
8 changed files with 29 additions and 41 deletions

View File

@ -98,7 +98,7 @@ Handle<String> Bootstrapper::NativesSourceLookup(int index) {
void Bootstrapper::Initialize(bool create_heap_objects) { void Bootstrapper::Initialize(bool create_heap_objects) {
extensions_cache_.Initialize(create_heap_objects); extensions_cache_.Initialize(isolate_, create_heap_objects);
} }
@ -147,7 +147,7 @@ void Bootstrapper::TearDown() {
delete_these_arrays_on_tear_down_ = NULL; delete_these_arrays_on_tear_down_ = NULL;
} }
extensions_cache_.Initialize(false); // Yes, symmetrical extensions_cache_.Initialize(isolate_, false); // Yes, symmetrical
} }

View File

@ -44,9 +44,8 @@ class SourceCodeCache BASE_EMBEDDED {
public: public:
explicit SourceCodeCache(Script::Type type): type_(type), cache_(NULL) { } explicit SourceCodeCache(Script::Type type): type_(type), cache_(NULL) { }
void Initialize(bool create_heap_objects) { void Initialize(Isolate* isolate, bool create_heap_objects) {
cache_ = create_heap_objects ? cache_ = create_heap_objects ? isolate->heap()->empty_fixed_array() : NULL;
Isolate::Current()->heap()->empty_fixed_array() : NULL;
} }
void Iterate(ObjectVisitor* v) { void Iterate(ObjectVisitor* v) {

View File

@ -31,33 +31,19 @@
#include "platform.h" #include "platform.h"
// TODO(isolates): is it necessary to lift this?
static int fatal_error_handler_nesting_depth = 0;
// Contains protection against recursive calls (faults while handling faults). // Contains protection against recursive calls (faults while handling faults).
extern "C" void V8_Fatal(const char* file, int line, const char* format, ...) { extern "C" void V8_Fatal(const char* file, int line, const char* format, ...) {
i::AllowHandleDereference allow_deref; i::AllowHandleDereference allow_deref;
i::AllowDeferredHandleDereference allow_deferred_deref; i::AllowDeferredHandleDereference allow_deferred_deref;
fflush(stdout); fflush(stdout);
fflush(stderr); fflush(stderr);
fatal_error_handler_nesting_depth++; i::OS::PrintError("\n\n#\n# Fatal error in %s, line %d\n# ", file, line);
// First time we try to print an error message va_list arguments;
if (fatal_error_handler_nesting_depth < 2) { va_start(arguments, format);
i::OS::PrintError("\n\n#\n# Fatal error in %s, line %d\n# ", file, line); i::OS::VPrintError(format, arguments);
va_list arguments; va_end(arguments);
va_start(arguments, format); i::OS::PrintError("\n#\n");
i::OS::VPrintError(format, arguments); i::OS::DumpBacktrace();
va_end(arguments);
i::OS::PrintError("\n#\n");
i::OS::DumpBacktrace();
}
// First two times we may try to print a stack dump.
if (fatal_error_handler_nesting_depth < 3) {
if (i::FLAG_stack_trace_on_abort) {
// Call this one twice on double fault
i::Isolate::Current()->PrintStack(stderr);
}
}
i::OS::Abort(); i::OS::Abort();
} }

View File

@ -1426,12 +1426,15 @@ class SaveContext BASE_EMBEDDED {
class AssertNoContextChange BASE_EMBEDDED { class AssertNoContextChange BASE_EMBEDDED {
#ifdef DEBUG #ifdef DEBUG
public: public:
AssertNoContextChange() : context_(Isolate::Current()->context()) { } AssertNoContextChange()
: isolate_(Isolate::Current()),
context_(isolate_->context()) { }
~AssertNoContextChange() { ~AssertNoContextChange() {
ASSERT(Isolate::Current()->context() == *context_); ASSERT(isolate_->context() == *context_);
} }
private: private:
Isolate* isolate_;
Handle<Context> context_; Handle<Context> context_;
#else #else
public: public:
@ -1445,15 +1448,17 @@ class AssertNoContextChangeWithHandleScope BASE_EMBEDDED {
#ifdef DEBUG #ifdef DEBUG
public: public:
AssertNoContextChangeWithHandleScope() : AssertNoContextChangeWithHandleScope() :
scope_(Isolate::Current()), isolate_(Isolate::Current()),
context_(Isolate::Current()->context(), Isolate::Current()) { scope_(isolate_),
context_(isolate_->context(), isolate_) {
} }
~AssertNoContextChangeWithHandleScope() { ~AssertNoContextChangeWithHandleScope() {
ASSERT(Isolate::Current()->context() == *context_); ASSERT(isolate_->context() == *context_);
} }
private: private:
Isolate* isolate_;
HandleScope scope_; HandleScope scope_;
Handle<Context> context_; Handle<Context> context_;
#else #else

View File

@ -1085,8 +1085,8 @@ class RecursionCheck {
}; };
static RegExpEngine::CompilationResult IrregexpRegExpTooBig() { static RegExpEngine::CompilationResult IrregexpRegExpTooBig(Isolate* isolate) {
return RegExpEngine::CompilationResult("RegExp too big"); return RegExpEngine::CompilationResult(isolate, "RegExp too big");
} }
@ -1143,7 +1143,7 @@ RegExpEngine::CompilationResult RegExpCompiler::Assemble(
while (!work_list.is_empty()) { while (!work_list.is_empty()) {
work_list.RemoveLast()->Emit(this, &new_trace); work_list.RemoveLast()->Emit(this, &new_trace);
} }
if (reg_exp_too_big_) return IrregexpRegExpTooBig(); if (reg_exp_too_big_) return IrregexpRegExpTooBig(zone_->isolate());
Handle<HeapObject> code = macro_assembler_->GetCode(pattern); Handle<HeapObject> code = macro_assembler_->GetCode(pattern);
heap->IncreaseTotalRegexpCodeGenerated(code->Size()); heap->IncreaseTotalRegexpCodeGenerated(code->Size());
@ -5999,7 +5999,7 @@ RegExpEngine::CompilationResult RegExpEngine::Compile(
bool is_ascii, bool is_ascii,
Zone* zone) { Zone* zone) {
if ((data->capture_count + 1) * 2 - 1 > RegExpMacroAssembler::kMaxRegister) { if ((data->capture_count + 1) * 2 - 1 > RegExpMacroAssembler::kMaxRegister) {
return IrregexpRegExpTooBig(); return IrregexpRegExpTooBig(zone->isolate());
} }
RegExpCompiler compiler(data->capture_count, ignore_case, is_ascii, zone); RegExpCompiler compiler(data->capture_count, ignore_case, is_ascii, zone);
@ -6063,7 +6063,7 @@ RegExpEngine::CompilationResult RegExpEngine::Compile(
analysis.EnsureAnalyzed(node); analysis.EnsureAnalyzed(node);
if (analysis.has_failed()) { if (analysis.has_failed()) {
const char* error_message = analysis.error_message(); const char* error_message = analysis.error_message();
return CompilationResult(error_message); return CompilationResult(zone->isolate(), error_message);
} }
// Create the correct assembler for the architecture. // Create the correct assembler for the architecture.

View File

@ -1615,9 +1615,9 @@ struct RegExpCompileData {
class RegExpEngine: public AllStatic { class RegExpEngine: public AllStatic {
public: public:
struct CompilationResult { struct CompilationResult {
explicit CompilationResult(const char* error_message) CompilationResult(Isolate* isolate, const char* error_message)
: error_message(error_message), : error_message(error_message),
code(Isolate::Current()->heap()->the_hole_value()), code(isolate->heap()->the_hole_value()),
num_registers(0) {} num_registers(0) {}
CompilationResult(Object* code, int registers) CompilationResult(Object* code, int registers)
: error_message(NULL), : error_message(NULL),

View File

@ -1788,8 +1788,6 @@ void MarkCompactCollector::PrepareThreadForCodeFlushing(Isolate* isolate,
void MarkCompactCollector::PrepareForCodeFlushing() { void MarkCompactCollector::PrepareForCodeFlushing() {
ASSERT(heap() == Isolate::Current()->heap());
// Enable code flushing for non-incremental cycles. // Enable code flushing for non-incremental cycles.
if (FLAG_flush_code && !FLAG_flush_code_incrementally) { if (FLAG_flush_code && !FLAG_flush_code_incrementally) {
EnableCodeFlushing(!was_marked_incrementally_); EnableCodeFlushing(!was_marked_incrementally_);

View File

@ -9892,7 +9892,7 @@ void SharedFunctionInfo::DisableOptimization(BailoutReason reason) {
if (code()->kind() == Code::FUNCTION) { if (code()->kind() == Code::FUNCTION) {
code()->set_optimizable(false); code()->set_optimizable(false);
} }
PROFILE(Isolate::Current(), PROFILE(GetIsolate(),
LogExistingFunction(Handle<SharedFunctionInfo>(this), LogExistingFunction(Handle<SharedFunctionInfo>(this),
Handle<Code>(code()))); Handle<Code>(code())));
if (FLAG_trace_opt) { if (FLAG_trace_opt) {