Thread the current isolate through a few places, avoiding Isolate::Current().

This removes approx. 12k calls of Isolate::Current() in string-tagcloud.

Review URL: https://chromiumcodereview.appspot.com/9490004

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@10856 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
parent 564a6f03
......@@ -1055,7 +1055,7 @@ int RegExpMacroAssemblerARM::CheckStackGuardState(Address* return_address,
ASSERT(*return_address <=
re_code->instruction_start() + re_code->instruction_size());
MaybeObject* result = Execution::HandleStackGuardInterrupt();
MaybeObject* result = Execution::HandleStackGuardInterrupt(isolate);
if (*code_handle != re_code) { // Return address no longer valid
int delta = code_handle->address() - re_code->address();
......
......@@ -872,8 +872,7 @@ void Execution::ProcessDebugMessages(bool debug_command_only) {
#endif
MaybeObject* Execution::HandleStackGuardInterrupt() {
Isolate* isolate = Isolate::Current();
MaybeObject* Execution::HandleStackGuardInterrupt(Isolate* isolate) {
StackGuard* stack_guard = isolate->stack_guard();
if (stack_guard->IsGCRequest()) {
......
......@@ -45,6 +45,10 @@ enum InterruptFlag {
GC_REQUEST = 1 << 6
};
class Isolate;
class Execution : public AllStatic {
public:
// Call a function, the caller supplies a receiver and an array
......@@ -141,7 +145,8 @@ class Execution : public AllStatic {
// If the stack guard is triggered, but it is not an actual
// stack overflow, then handle the interruption accordingly.
MUST_USE_RESULT static MaybeObject* HandleStackGuardInterrupt();
MUST_USE_RESULT static MaybeObject* HandleStackGuardInterrupt(
Isolate* isolate);
// Get a function delegate (or undefined) for the given non-function
// object. Used for support calling objects as functions.
......@@ -158,7 +163,6 @@ class Execution : public AllStatic {
class ExecutionAccess;
class Isolate;
// StackGuard contains the handling of the limits that are used to limit the
......
......@@ -1085,7 +1085,7 @@ int RegExpMacroAssemblerIA32::CheckStackGuardState(Address* return_address,
ASSERT(*return_address <=
re_code->instruction_start() + re_code->instruction_size());
MaybeObject* result = Execution::HandleStackGuardInterrupt();
MaybeObject* result = Execution::HandleStackGuardInterrupt(isolate);
if (*code_handle != re_code) { // Return address no longer valid
int delta = code_handle->address() - re_code->address();
......
......@@ -175,7 +175,8 @@ Handle<Object> RegExpImpl::Exec(Handle<JSRegExp> regexp,
case JSRegExp::IRREGEXP: {
Handle<Object> result =
IrregexpExec(regexp, subject, index, last_match_info);
ASSERT(!result.is_null() || Isolate::Current()->has_pending_exception());
ASSERT(!result.is_null() ||
regexp->GetIsolate()->has_pending_exception());
return result;
}
default:
......@@ -527,6 +528,7 @@ Handle<Object> RegExpImpl::IrregexpExec(Handle<JSRegExp> jsregexp,
Handle<String> subject,
int previous_index,
Handle<JSArray> last_match_info) {
Isolate* isolate = jsregexp->GetIsolate();
ASSERT_EQ(jsregexp->TypeTag(), JSRegExp::IRREGEXP);
// Prepare space for the return values.
......@@ -542,11 +544,11 @@ Handle<Object> RegExpImpl::IrregexpExec(Handle<JSRegExp> jsregexp,
int required_registers = RegExpImpl::IrregexpPrepare(jsregexp, subject);
if (required_registers < 0) {
// Compiling failed with an exception.
ASSERT(Isolate::Current()->has_pending_exception());
ASSERT(isolate->has_pending_exception());
return Handle<Object>::null();
}
OffsetsVector registers(required_registers);
OffsetsVector registers(required_registers, isolate);
IrregexpResult res = RegExpImpl::IrregexpExecOnce(
jsregexp, subject, previous_index, Vector<int>(registers.vector(),
......@@ -568,11 +570,11 @@ Handle<Object> RegExpImpl::IrregexpExec(Handle<JSRegExp> jsregexp,
return last_match_info;
}
if (res == RE_EXCEPTION) {
ASSERT(Isolate::Current()->has_pending_exception());
ASSERT(isolate->has_pending_exception());
return Handle<Object>::null();
}
ASSERT(res == RE_FAILURE);
return Isolate::Current()->factory()->null_value();
return isolate->factory()->null_value();
}
......
......@@ -1466,12 +1466,12 @@ class RegExpEngine: public AllStatic {
class OffsetsVector {
public:
explicit inline OffsetsVector(int num_registers)
inline OffsetsVector(int num_registers, Isolate* isolate)
: offsets_vector_length_(num_registers) {
if (offsets_vector_length_ > Isolate::kJSRegexpStaticOffsetsVectorSize) {
vector_ = NewArray<int>(offsets_vector_length_);
} else {
vector_ = Isolate::Current()->jsregexp_static_offsets_vector();
vector_ = isolate->jsregexp_static_offsets_vector();
}
}
inline ~OffsetsVector() {
......
......@@ -1056,7 +1056,7 @@ int RegExpMacroAssemblerMIPS::CheckStackGuardState(Address* return_address,
ASSERT(*return_address <=
re_code->instruction_start() + re_code->instruction_size());
MaybeObject* result = Execution::HandleStackGuardInterrupt();
MaybeObject* result = Execution::HandleStackGuardInterrupt(isolate);
if (*code_handle != re_code) { // Return address no longer valid.
int delta = code_handle->address() - re_code->address();
......
......@@ -3763,7 +3763,7 @@ static RegExpImpl::IrregexpResult SearchRegExpNoCaptureMultiple(
int required_registers = RegExpImpl::IrregexpPrepare(regexp, subject);
if (required_registers < 0) return RegExpImpl::RE_EXCEPTION;
OffsetsVector registers(required_registers);
OffsetsVector registers(required_registers, isolate);
Vector<int32_t> register_vector(registers.vector(), registers.length());
int subject_length = subject->length();
bool first = true;
......@@ -3836,7 +3836,7 @@ static RegExpImpl::IrregexpResult SearchRegExpMultiple(
int required_registers = RegExpImpl::IrregexpPrepare(regexp, subject);
if (required_registers < 0) return RegExpImpl::RE_EXCEPTION;
OffsetsVector registers(required_registers);
OffsetsVector registers(required_registers, isolate);
Vector<int32_t> register_vector(registers.vector(), registers.length());
RegExpImpl::IrregexpResult result =
......@@ -3855,7 +3855,7 @@ static RegExpImpl::IrregexpResult SearchRegExpMultiple(
if (result == RegExpImpl::RE_SUCCESS) {
// Need to keep a copy of the previous match for creating last_match_info
// at the end, so we have two vectors that we swap between.
OffsetsVector registers2(required_registers);
OffsetsVector registers2(required_registers, isolate);
Vector<int> prev_register_vector(registers2.vector(), registers2.length());
bool first = true;
do {
......@@ -9200,13 +9200,13 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_StackGuard) {
return isolate->StackOverflow();
}
return Execution::HandleStackGuardInterrupt();
return Execution::HandleStackGuardInterrupt(isolate);
}
RUNTIME_FUNCTION(MaybeObject*, Runtime_Interrupt) {
ASSERT(args.length() == 0);
return Execution::HandleStackGuardInterrupt();
return Execution::HandleStackGuardInterrupt(isolate);
}
......
......@@ -1192,7 +1192,7 @@ int RegExpMacroAssemblerX64::CheckStackGuardState(Address* return_address,
ASSERT(*return_address <=
re_code->instruction_start() + re_code->instruction_size());
MaybeObject* result = Execution::HandleStackGuardInterrupt();
MaybeObject* result = Execution::HandleStackGuardInterrupt(isolate);
if (*code_handle != re_code) { // Return address no longer valid
intptr_t delta = code_handle->address() - re_code->address();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment