Reviewers: Sven Panne,
Description:
some random isolate threading
[email protected]
BUG=
Please review this at https://codereview.chromium.org/23494046/
SVN Base: https://v8.googlecode.com/svn/branches/bleeding_edge
Affected files (+29, -41 lines):
M src/bootstrapper.h
M src/bootstrapper.cc
M src/checks.cc
M src/isolate.h
M src/jsregexp.h
M src/jsregexp.cc
M src/mark-compact.cc
M src/objects.cc
Index: src/bootstrapper.cc
diff --git a/src/bootstrapper.cc b/src/bootstrapper.cc
index
764c8462f870665ea87348c8f9f10a1c04d59cfc..58b115d82840a96d9b610b26be3e5a164e13fc59
100644
--- a/src/bootstrapper.cc
+++ b/src/bootstrapper.cc
@@ -98,7 +98,7 @@ Handle<String> Bootstrapper::NativesSourceLookup(int
index) {
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;
}
- extensions_cache_.Initialize(false); // Yes, symmetrical
+ extensions_cache_.Initialize(isolate_, false); // Yes, symmetrical
}
Index: src/bootstrapper.h
diff --git a/src/bootstrapper.h b/src/bootstrapper.h
index
e6456bd707e6a3c984f424bacd7cbc3c021e3a2a..bac9f40372d9039041014cd6ba84209057d70223
100644
--- a/src/bootstrapper.h
+++ b/src/bootstrapper.h
@@ -44,9 +44,8 @@ class SourceCodeCache BASE_EMBEDDED {
public:
explicit SourceCodeCache(Script::Type type): type_(type), cache_(NULL) {
}
- void Initialize(bool create_heap_objects) {
- cache_ = create_heap_objects ?
- Isolate::Current()->heap()->empty_fixed_array() : NULL;
+ void Initialize(Isolate* isolate, bool create_heap_objects) {
+ cache_ = create_heap_objects ? isolate->heap()->empty_fixed_array() :
NULL;
}
void Iterate(ObjectVisitor* v) {
Index: src/checks.cc
diff --git a/src/checks.cc b/src/checks.cc
index
82086824dd2ba6e64cbb8c2339c170e073ab61d7..7108d18892e37efd8b3e80ede0d539f408c74768
100644
--- a/src/checks.cc
+++ b/src/checks.cc
@@ -31,33 +31,19 @@
#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).
extern "C" void V8_Fatal(const char* file, int line, const char*
format, ...) {
i::AllowHandleDereference allow_deref;
i::AllowDeferredHandleDereference allow_deferred_deref;
fflush(stdout);
fflush(stderr);
- fatal_error_handler_nesting_depth++;
- // First time we try to print an error message
- if (fatal_error_handler_nesting_depth < 2) {
- i::OS::PrintError("\n\n#\n# Fatal error in %s, line %d\n# ", file,
line);
- va_list arguments;
- va_start(arguments, format);
- i::OS::VPrintError(format, arguments);
- 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::PrintError("\n\n#\n# Fatal error in %s, line %d\n# ", file, line);
+ va_list arguments;
+ va_start(arguments, format);
+ i::OS::VPrintError(format, arguments);
+ va_end(arguments);
+ i::OS::PrintError("\n#\n");
+ i::OS::DumpBacktrace();
i::OS::Abort();
}
Index: src/isolate.h
diff --git a/src/isolate.h b/src/isolate.h
index
99283c9238683d1b09fcbbcf8e6178e4c9fb45cf..b826ec596abaa1225b66f4b8ff926e5726b6ddbe
100644
--- a/src/isolate.h
+++ b/src/isolate.h
@@ -1426,12 +1426,15 @@ class SaveContext BASE_EMBEDDED {
class AssertNoContextChange BASE_EMBEDDED {
#ifdef DEBUG
public:
- AssertNoContextChange() : context_(Isolate::Current()->context()) { }
+ AssertNoContextChange()
+ : isolate_(Isolate::Current()),
+ context_(isolate_->context()) { }
~AssertNoContextChange() {
- ASSERT(Isolate::Current()->context() == *context_);
+ ASSERT(isolate_->context() == *context_);
}
private:
+ Isolate* isolate_;
Handle<Context> context_;
#else
public:
@@ -1445,15 +1448,17 @@ class AssertNoContextChangeWithHandleScope
BASE_EMBEDDED {
#ifdef DEBUG
public:
AssertNoContextChangeWithHandleScope() :
- scope_(Isolate::Current()),
- context_(Isolate::Current()->context(), Isolate::Current()) {
+ isolate_(Isolate::Current()),
+ scope_(isolate_),
+ context_(isolate_->context(), isolate_) {
}
~AssertNoContextChangeWithHandleScope() {
- ASSERT(Isolate::Current()->context() == *context_);
+ ASSERT(isolate_->context() == *context_);
}
private:
+ Isolate* isolate_;
HandleScope scope_;
Handle<Context> context_;
#else
Index: src/jsregexp.cc
diff --git a/src/jsregexp.cc b/src/jsregexp.cc
index
f1cb96dba87ca6098dfb7504ebe08a180d930e19..3a3d91599c3ea045893f7b0ef773c6533499ed5a
100644
--- a/src/jsregexp.cc
+++ b/src/jsregexp.cc
@@ -1085,8 +1085,8 @@ class RecursionCheck {
};
-static RegExpEngine::CompilationResult IrregexpRegExpTooBig() {
- return RegExpEngine::CompilationResult("RegExp too big");
+static RegExpEngine::CompilationResult IrregexpRegExpTooBig(Isolate*
isolate) {
+ return RegExpEngine::CompilationResult(isolate, "RegExp too big");
}
@@ -1143,7 +1143,7 @@ RegExpEngine::CompilationResult
RegExpCompiler::Assemble(
while (!work_list.is_empty()) {
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);
heap->IncreaseTotalRegexpCodeGenerated(code->Size());
@@ -5999,7 +5999,7 @@ RegExpEngine::CompilationResult RegExpEngine::Compile(
bool is_ascii,
Zone* zone) {
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);
@@ -6063,7 +6063,7 @@ RegExpEngine::CompilationResult RegExpEngine::Compile(
analysis.EnsureAnalyzed(node);
if (analysis.has_failed()) {
const char* error_message = analysis.error_message();
- return CompilationResult(error_message);
+ return CompilationResult(zone->isolate(), error_message);
}
// Create the correct assembler for the architecture.
Index: src/jsregexp.h
diff --git a/src/jsregexp.h b/src/jsregexp.h
index
01ceaf4be281abef784dfab157d3f8d207cbe446..dfd415d5af8ad041a6959016d046b3a9a6a87610
100644
--- a/src/jsregexp.h
+++ b/src/jsregexp.h
@@ -1615,9 +1615,9 @@ struct RegExpCompileData {
class RegExpEngine: public AllStatic {
public:
struct CompilationResult {
- explicit CompilationResult(const char* error_message)
+ CompilationResult(Isolate* isolate, const char* error_message)
: error_message(error_message),
- code(Isolate::Current()->heap()->the_hole_value()),
+ code(isolate->heap()->the_hole_value()),
num_registers(0) {}
CompilationResult(Object* code, int registers)
: error_message(NULL),
Index: src/mark-compact.cc
diff --git a/src/mark-compact.cc b/src/mark-compact.cc
index
17ac4a8bcd583726136e157f56cdcc275c84158b..901674d700ae665ba86cf8bdc25a98268c30170c
100644
--- a/src/mark-compact.cc
+++ b/src/mark-compact.cc
@@ -1788,8 +1788,6 @@ void
MarkCompactCollector::PrepareThreadForCodeFlushing(Isolate* isolate,
void MarkCompactCollector::PrepareForCodeFlushing() {
- ASSERT(heap() == Isolate::Current()->heap());
-
// Enable code flushing for non-incremental cycles.
if (FLAG_flush_code && !FLAG_flush_code_incrementally) {
EnableCodeFlushing(!was_marked_incrementally_);
Index: src/objects.cc
diff --git a/src/objects.cc b/src/objects.cc
index
027506f433c53c404fed51ee818ddbb100df09eb..f329c274dc643592bf8621ce4c2a3e2be03d6648
100644
--- a/src/objects.cc
+++ b/src/objects.cc
@@ -9892,7 +9892,7 @@ void
SharedFunctionInfo::DisableOptimization(BailoutReason reason) {
if (code()->kind() == Code::FUNCTION) {
code()->set_optimizable(false);
}
- PROFILE(Isolate::Current(),
+ PROFILE(GetIsolate(),
LogExistingFunction(Handle<SharedFunctionInfo>(this),
Handle<Code>(code())));
if (FLAG_trace_opt) {
--
--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev
---
You received this message because you are subscribed to the Google Groups "v8-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.