remove Isolate::Current from most files starting with 'j' through 'o'

R=bmeurer@chromium.org
BUG=

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

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@16520 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
This commit is contained in:
dcarney@chromium.org 2013-09-04 10:34:42 +00:00
parent 924463984c
commit 2b7efe05ae
9 changed files with 89 additions and 80 deletions

View File

@ -60,7 +60,7 @@ static void AddNumber(v8::Local<v8::Object> object,
void StatisticsExtension::GetCounters( void StatisticsExtension::GetCounters(
const v8::FunctionCallbackInfo<v8::Value>& args) { const v8::FunctionCallbackInfo<v8::Value>& args) {
Isolate* isolate = Isolate::Current(); Isolate* isolate = reinterpret_cast<Isolate*>(args.GetIsolate());
Heap* heap = isolate->heap(); Heap* heap = isolate->heap();
if (args.Length() > 0) { // GC if first argument evaluates to true. if (args.Length() > 0) { // GC if first argument evaluates to true.

View File

@ -130,7 +130,8 @@ Handle<DescriptorArray> Factory::NewDescriptorArray(int number_of_descriptors,
int slack) { int slack) {
ASSERT(0 <= number_of_descriptors); ASSERT(0 <= number_of_descriptors);
CALL_HEAP_FUNCTION(isolate(), CALL_HEAP_FUNCTION(isolate(),
DescriptorArray::Allocate(number_of_descriptors, slack), DescriptorArray::Allocate(
isolate(), number_of_descriptors, slack),
DescriptorArray); DescriptorArray);
} }

View File

@ -1027,7 +1027,7 @@ bool Heap::PerformGarbageCollection(GarbageCollector collector,
isolate_->eternal_handles()->PostGarbageCollectionProcessing(this); isolate_->eternal_handles()->PostGarbageCollectionProcessing(this);
// Update relocatables. // Update relocatables.
Relocatable::PostGarbageCollectionProcessing(); Relocatable::PostGarbageCollectionProcessing(isolate_);
if (collector == MARK_COMPACTOR) { if (collector == MARK_COMPACTOR) {
// Register the amount of external allocated memory. // Register the amount of external allocated memory.
@ -2938,7 +2938,7 @@ MaybeObject* Heap::CreateOddball(const char* to_string,
{ MaybeObject* maybe_result = Allocate(oddball_map(), OLD_POINTER_SPACE); { MaybeObject* maybe_result = Allocate(oddball_map(), OLD_POINTER_SPACE);
if (!maybe_result->ToObject(&result)) return maybe_result; if (!maybe_result->ToObject(&result)) return maybe_result;
} }
return Oddball::cast(result)->Initialize(to_string, to_number, kind); return Oddball::cast(result)->Initialize(this, to_string, to_number, kind);
} }
@ -3042,15 +3042,16 @@ bool Heap::CreateInitialObjects() {
// Finish initializing oddballs after creating the string table. // Finish initializing oddballs after creating the string table.
{ MaybeObject* maybe_obj = { MaybeObject* maybe_obj =
undefined_value()->Initialize("undefined", undefined_value()->Initialize(this,
"undefined",
nan_value(), nan_value(),
Oddball::kUndefined); Oddball::kUndefined);
if (!maybe_obj->ToObject(&obj)) return false; if (!maybe_obj->ToObject(&obj)) return false;
} }
// Initialize the null_value. // Initialize the null_value.
{ MaybeObject* maybe_obj = { MaybeObject* maybe_obj = null_value()->Initialize(
null_value()->Initialize("null", Smi::FromInt(0), Oddball::kNull); this, "null", Smi::FromInt(0), Oddball::kNull);
if (!maybe_obj->ToObject(&obj)) return false; if (!maybe_obj->ToObject(&obj)) return false;
} }
@ -6574,7 +6575,7 @@ void Heap::IterateStrongRoots(ObjectVisitor* v, VisitMode mode) {
v->Synchronize(VisitorSynchronization::kBootstrapper); v->Synchronize(VisitorSynchronization::kBootstrapper);
isolate_->Iterate(v); isolate_->Iterate(v);
v->Synchronize(VisitorSynchronization::kTop); v->Synchronize(VisitorSynchronization::kTop);
Relocatable::Iterate(v); Relocatable::Iterate(isolate_, v);
v->Synchronize(VisitorSynchronization::kRelocatable); v->Synchronize(VisitorSynchronization::kRelocatable);
#ifdef ENABLE_DEBUGGER_SUPPORT #ifdef ENABLE_DEBUGGER_SUPPORT

View File

@ -1869,7 +1869,7 @@ static void EmitUseLookupTable(
for (int i = j; i < kSize; i++) { for (int i = j; i < kSize; i++) {
templ[i] = bit; templ[i] = bit;
} }
Factory* factory = Isolate::Current()->factory(); Factory* factory = masm->zone()->isolate()->factory();
// TODO(erikcorry): Cache these. // TODO(erikcorry): Cache these.
Handle<ByteArray> ba = factory->NewByteArray(kSize, TENURED); Handle<ByteArray> ba = factory->NewByteArray(kSize, TENURED);
for (int i = 0; i < kSize; i++) { for (int i = 0; i < kSize; i++) {
@ -2548,7 +2548,7 @@ void TextNode::GetQuickCheckDetails(QuickCheckDetails* details,
RegExpCompiler* compiler, RegExpCompiler* compiler,
int characters_filled_in, int characters_filled_in,
bool not_at_start) { bool not_at_start) {
Isolate* isolate = Isolate::Current(); Isolate* isolate = compiler->macro_assembler()->zone()->isolate();
ASSERT(characters_filled_in < details->characters()); ASSERT(characters_filled_in < details->characters());
int characters = details->characters(); int characters = details->characters();
int char_mask; int char_mask;
@ -3246,8 +3246,8 @@ void TextNode::TextEmitPass(RegExpCompiler* compiler,
Trace* trace, Trace* trace,
bool first_element_checked, bool first_element_checked,
int* checked_up_to) { int* checked_up_to) {
Isolate* isolate = Isolate::Current();
RegExpMacroAssembler* assembler = compiler->macro_assembler(); RegExpMacroAssembler* assembler = compiler->macro_assembler();
Isolate* isolate = assembler->zone()->isolate();
bool ascii = compiler->ascii(); bool ascii = compiler->ascii();
Label* backtrack = trace->backtrack(); Label* backtrack = trace->backtrack();
QuickCheckDetails* quick_check = trace->quick_check_performed(); QuickCheckDetails* quick_check = trace->quick_check_performed();
@ -3820,7 +3820,7 @@ bool BoyerMooreLookahead::EmitSkipInstructions(RegExpMacroAssembler* masm) {
return true; return true;
} }
Factory* factory = Isolate::Current()->factory(); Factory* factory = masm->zone()->isolate()->factory();
Handle<ByteArray> boolean_skip_table = factory->NewByteArray(kSize, TENURED); Handle<ByteArray> boolean_skip_table = factory->NewByteArray(kSize, TENURED);
int skip_distance = GetSkipTable( int skip_distance = GetSkipTable(
min_lookahead, max_lookahead, boolean_skip_table); min_lookahead, max_lookahead, boolean_skip_table);
@ -5292,7 +5292,7 @@ void CharacterRange::Split(ZoneList<CharacterRange>* base,
void CharacterRange::AddCaseEquivalents(ZoneList<CharacterRange>* ranges, void CharacterRange::AddCaseEquivalents(ZoneList<CharacterRange>* ranges,
bool is_ascii, bool is_ascii,
Zone* zone) { Zone* zone) {
Isolate* isolate = Isolate::Current(); Isolate* isolate = zone->isolate();
uc16 bottom = from(); uc16 bottom = from();
uc16 top = to(); uc16 top = to();
if (is_ascii && !RangeContainsLatin1Equivalents(*this)) { if (is_ascii && !RangeContainsLatin1Equivalents(*this)) {
@ -5680,7 +5680,7 @@ OutSet* DispatchTable::Get(uc16 value) {
void Analysis::EnsureAnalyzed(RegExpNode* that) { void Analysis::EnsureAnalyzed(RegExpNode* that) {
StackLimitCheck check(Isolate::Current()); StackLimitCheck check(that->zone()->isolate());
if (check.HasOverflowed()) { if (check.HasOverflowed()) {
fail("Stack overflow"); fail("Stack overflow");
return; return;

View File

@ -631,8 +631,8 @@ static Handle<Object> UnwrapJSValue(Handle<JSValue> jsValue) {
// Wraps any object into a OpaqueReference, that will hide the object // Wraps any object into a OpaqueReference, that will hide the object
// from JavaScript. // from JavaScript.
static Handle<JSValue> WrapInJSValue(Handle<Object> object) { static Handle<JSValue> WrapInJSValue(Handle<HeapObject> object) {
Isolate* isolate = Isolate::Current(); Isolate* isolate = object->GetIsolate();
Handle<JSFunction> constructor = isolate->opaque_reference_function(); Handle<JSFunction> constructor = isolate->opaque_reference_function();
Handle<JSValue> result = Handle<JSValue> result =
Handle<JSValue>::cast(isolate->factory()->NewJSObject(constructor)); Handle<JSValue>::cast(isolate->factory()->NewJSObject(constructor));
@ -662,8 +662,8 @@ static int GetArrayLength(Handle<JSArray> array) {
template<typename S> template<typename S>
class JSArrayBasedStruct { class JSArrayBasedStruct {
public: public:
static S Create() { static S Create(Isolate* isolate) {
Factory* factory = Isolate::Current()->factory(); Factory* factory = isolate->factory();
Handle<JSArray> array = factory->NewJSArray(S::kSize_); Handle<JSArray> array = factory->NewJSArray(S::kSize_);
return S(array); return S(array);
} }
@ -724,7 +724,7 @@ class FunctionInfoWrapper : public JSArrayBasedStruct<FunctionInfoWrapper> {
this->SetSmiValueField(kParentIndexOffset_, parent_index); this->SetSmiValueField(kParentIndexOffset_, parent_index);
} }
void SetFunctionCode(Handle<Code> function_code, void SetFunctionCode(Handle<Code> function_code,
Handle<Object> code_scope_info) { Handle<HeapObject> code_scope_info) {
Handle<JSValue> code_wrapper = WrapInJSValue(function_code); Handle<JSValue> code_wrapper = WrapInJSValue(function_code);
this->SetField(kCodeOffset_, code_wrapper); this->SetField(kCodeOffset_, code_wrapper);
@ -833,7 +833,7 @@ class FunctionInfoListener {
void FunctionStarted(FunctionLiteral* fun) { void FunctionStarted(FunctionLiteral* fun) {
HandleScope scope(isolate()); HandleScope scope(isolate());
FunctionInfoWrapper info = FunctionInfoWrapper::Create(); FunctionInfoWrapper info = FunctionInfoWrapper::Create(isolate());
info.SetInitialProperties(fun->name(), fun->start_position(), info.SetInitialProperties(fun->name(), fun->start_position(),
fun->end_position(), fun->parameter_count(), fun->end_position(), fun->parameter_count(),
fun->materialized_literal_count(), fun->materialized_literal_count(),
@ -860,8 +860,7 @@ class FunctionInfoListener {
result_->GetElementNoExceptionThrown( result_->GetElementNoExceptionThrown(
isolate(), current_parent_index_)); isolate(), current_parent_index_));
info.SetFunctionCode(function_code, info.SetFunctionCode(function_code,
Handle<Object>(isolate()->heap()->null_value(), Handle<HeapObject>(isolate()->heap()->null_value()));
isolate()));
} }
// Saves full information about a function: its code, its scope info // Saves full information about a function: its code, its scope info
@ -876,7 +875,7 @@ class FunctionInfoListener {
result_->GetElementNoExceptionThrown( result_->GetElementNoExceptionThrown(
isolate(), current_parent_index_)); isolate(), current_parent_index_));
info.SetFunctionCode(Handle<Code>(shared->code()), info.SetFunctionCode(Handle<Code>(shared->code()),
Handle<Object>(shared->scope_info(), isolate())); Handle<HeapObject>(shared->scope_info()));
info.SetSharedFunctionInfo(shared); info.SetSharedFunctionInfo(shared);
Handle<Object> scope_info_list(SerializeFunctionScope(scope, zone), Handle<Object> scope_info_list(SerializeFunctionScope(scope, zone),
@ -939,7 +938,7 @@ class FunctionInfoListener {
JSArray* LiveEdit::GatherCompileInfo(Handle<Script> script, JSArray* LiveEdit::GatherCompileInfo(Handle<Script> script,
Handle<String> source) { Handle<String> source) {
Isolate* isolate = Isolate::Current(); Isolate* isolate = script->GetIsolate();
FunctionInfoListener listener(isolate); FunctionInfoListener listener(isolate);
Handle<Object> original_source = Handle<Object> original_source =
@ -1011,8 +1010,8 @@ void LiveEdit::WrapSharedFunctionInfos(Handle<JSArray> array) {
for (int i = 0; i < len; i++) { for (int i = 0; i < len; i++) {
Handle<SharedFunctionInfo> info( Handle<SharedFunctionInfo> info(
SharedFunctionInfo::cast( SharedFunctionInfo::cast(
array->GetElementNoExceptionThrown(array->GetIsolate(), i))); array->GetElementNoExceptionThrown(isolate, i)));
SharedInfoWrapper info_wrapper = SharedInfoWrapper::Create(); SharedInfoWrapper info_wrapper = SharedInfoWrapper::Create(isolate);
Handle<String> name_handle(String::cast(info->name())); Handle<String> name_handle(String::cast(info->name()));
info_wrapper.SetProperties(name_handle, info->start_position(), info_wrapper.SetProperties(name_handle, info->start_position(),
info->end_position(), info); info->end_position(), info);
@ -1275,7 +1274,7 @@ static void DeoptimizeDependentFunctions(SharedFunctionInfo* function_info) {
MaybeObject* LiveEdit::ReplaceFunctionCode( MaybeObject* LiveEdit::ReplaceFunctionCode(
Handle<JSArray> new_compile_info_array, Handle<JSArray> new_compile_info_array,
Handle<JSArray> shared_info_array) { Handle<JSArray> shared_info_array) {
Isolate* isolate = Isolate::Current(); Isolate* isolate = new_compile_info_array->GetIsolate();
HandleScope scope(isolate); HandleScope scope(isolate);
if (!SharedInfoWrapper::IsInstance(shared_info_array)) { if (!SharedInfoWrapper::IsInstance(shared_info_array)) {
@ -1349,7 +1348,7 @@ void LiveEdit::SetFunctionScript(Handle<JSValue> function_wrapper,
CHECK(script_handle->IsScript() || script_handle->IsUndefined()); CHECK(script_handle->IsScript() || script_handle->IsUndefined());
shared_info->set_script(*script_handle); shared_info->set_script(*script_handle);
Isolate::Current()->compilation_cache()->Remove(shared_info); function_wrapper->GetIsolate()->compilation_cache()->Remove(shared_info);
} }
@ -1518,7 +1517,7 @@ static Handle<Code> PatchPositionsInCode(
MaybeObject* LiveEdit::PatchFunctionPositions( MaybeObject* LiveEdit::PatchFunctionPositions(
Handle<JSArray> shared_info_array, Handle<JSArray> position_change_array) { Handle<JSArray> shared_info_array, Handle<JSArray> position_change_array) {
if (!SharedInfoWrapper::IsInstance(shared_info_array)) { if (!SharedInfoWrapper::IsInstance(shared_info_array)) {
return Isolate::Current()->ThrowIllegalOperation(); return shared_info_array->GetIsolate()->ThrowIllegalOperation();
} }
SharedInfoWrapper shared_info_wrapper(shared_info_array); SharedInfoWrapper shared_info_wrapper(shared_info_array);
@ -1662,7 +1661,7 @@ static bool CheckActivation(Handle<JSArray> shared_info_array,
static bool FixTryCatchHandler(StackFrame* top_frame, static bool FixTryCatchHandler(StackFrame* top_frame,
StackFrame* bottom_frame) { StackFrame* bottom_frame) {
Address* pointer_address = Address* pointer_address =
&Memory::Address_at(Isolate::Current()->get_address_from_id( &Memory::Address_at(top_frame->isolate()->get_address_from_id(
Isolate::kHandlerAddress)); Isolate::kHandlerAddress));
while (*pointer_address < top_frame->sp()) { while (*pointer_address < top_frame->sp()) {
@ -1698,7 +1697,7 @@ static const char* DropFrames(Vector<StackFrame*> frames,
ASSERT(bottom_js_frame->is_java_script()); ASSERT(bottom_js_frame->is_java_script());
// Check the nature of the top frame. // Check the nature of the top frame.
Isolate* isolate = Isolate::Current(); Isolate* isolate = bottom_js_frame->isolate();
Code* pre_top_frame_code = pre_top_frame->LookupCode(); Code* pre_top_frame_code = pre_top_frame->LookupCode();
bool frame_has_padding; bool frame_has_padding;
if (pre_top_frame_code->is_inline_cache_stub() && if (pre_top_frame_code->is_inline_cache_stub() &&
@ -1801,7 +1800,7 @@ static const char* DropFrames(Vector<StackFrame*> frames,
// Make sure FixTryCatchHandler is idempotent. // Make sure FixTryCatchHandler is idempotent.
ASSERT(!FixTryCatchHandler(pre_top_frame, bottom_js_frame)); ASSERT(!FixTryCatchHandler(pre_top_frame, bottom_js_frame));
Handle<Code> code = Isolate::Current()->builtins()->FrameDropper_LiveEdit(); Handle<Code> code = isolate->builtins()->FrameDropper_LiveEdit();
*top_frame_pc_address = code->entry(); *top_frame_pc_address = code->entry();
pre_top_frame->SetCallerFp(bottom_js_frame->fp()); pre_top_frame->SetCallerFp(bottom_js_frame->fp());
@ -1849,8 +1848,7 @@ class MultipleFunctionTarget {
// Drops all call frame matched by target and all frames above them. // Drops all call frame matched by target and all frames above them.
template<typename TARGET> template<typename TARGET>
static const char* DropActivationsInActiveThreadImpl( static const char* DropActivationsInActiveThreadImpl(
TARGET& target, bool do_drop) { Isolate* isolate, TARGET& target, bool do_drop) {
Isolate* isolate = Isolate::Current();
Debug* debug = isolate->debug(); Debug* debug = isolate->debug();
Zone zone(isolate); Zone zone(isolate);
Vector<StackFrame*> frames = CreateStackMap(isolate, &zone); Vector<StackFrame*> frames = CreateStackMap(isolate, &zone);
@ -1949,8 +1947,8 @@ static const char* DropActivationsInActiveThread(
Handle<JSArray> shared_info_array, Handle<JSArray> result, bool do_drop) { Handle<JSArray> shared_info_array, Handle<JSArray> result, bool do_drop) {
MultipleFunctionTarget target(shared_info_array, result); MultipleFunctionTarget target(shared_info_array, result);
const char* message = const char* message = DropActivationsInActiveThreadImpl(
DropActivationsInActiveThreadImpl(target, do_drop); shared_info_array->GetIsolate(), target, do_drop);
if (message) { if (message) {
return message; return message;
} }
@ -2015,7 +2013,7 @@ Handle<JSArray> LiveEdit::CheckAndDropActivations(
// First check inactive threads. Fail if some functions are blocked there. // First check inactive threads. Fail if some functions are blocked there.
InactiveThreadActivationsChecker inactive_threads_checker(shared_info_array, InactiveThreadActivationsChecker inactive_threads_checker(shared_info_array,
result); result);
Isolate::Current()->thread_manager()->IterateArchivedThreads( isolate->thread_manager()->IterateArchivedThreads(
&inactive_threads_checker); &inactive_threads_checker);
if (inactive_threads_checker.HasBlockedFunctions()) { if (inactive_threads_checker.HasBlockedFunctions()) {
return result; return result;
@ -2067,7 +2065,8 @@ class SingleFrameTarget {
const char* LiveEdit::RestartFrame(JavaScriptFrame* frame) { const char* LiveEdit::RestartFrame(JavaScriptFrame* frame) {
SingleFrameTarget target(frame); SingleFrameTarget target(frame);
const char* result = DropActivationsInActiveThreadImpl(target, true); const char* result = DropActivationsInActiveThreadImpl(
frame->isolate(), target, true);
if (result != NULL) { if (result != NULL) {
return result; return result;
} }

View File

@ -1764,21 +1764,21 @@ void Logger::LogAccessorCallbacks() {
} }
static void AddIsolateIdIfNeeded(StringStream* stream) { static void AddIsolateIdIfNeeded(Isolate* isolate, StringStream* stream) {
Isolate* isolate = Isolate::Current();
if (isolate->IsDefaultIsolate()) return; if (isolate->IsDefaultIsolate()) return;
stream->Add("isolate-%p-", isolate); stream->Add("isolate-%p-", isolate);
} }
static SmartArrayPointer<const char> PrepareLogFileName(const char* file_name) { static SmartArrayPointer<const char> PrepareLogFileName(
Isolate* isolate, const char* file_name) {
if (strchr(file_name, '%') != NULL || if (strchr(file_name, '%') != NULL ||
!Isolate::Current()->IsDefaultIsolate()) { !isolate->IsDefaultIsolate()) {
// If there's a '%' in the log file name we have to expand // If there's a '%' in the log file name we have to expand
// placeholders. // placeholders.
HeapStringAllocator allocator; HeapStringAllocator allocator;
StringStream stream(&allocator); StringStream stream(&allocator);
AddIsolateIdIfNeeded(&stream); AddIsolateIdIfNeeded(isolate, &stream);
for (const char* p = file_name; *p; p++) { for (const char* p = file_name; *p; p++) {
if (*p == '%') { if (*p == '%') {
p++; p++;
@ -1832,7 +1832,7 @@ bool Logger::SetUp(Isolate* isolate) {
} }
SmartArrayPointer<const char> log_file_name = SmartArrayPointer<const char> log_file_name =
PrepareLogFileName(FLAG_logfile); PrepareLogFileName(isolate, FLAG_logfile);
log_->Initialize(*log_file_name); log_->Initialize(*log_file_name);
if (FLAG_ll_prof) { if (FLAG_ll_prof) {

View File

@ -6584,7 +6584,7 @@ MaybeObject* Map::ShareDescriptor(DescriptorArray* descriptors,
} else { } else {
// Descriptor arrays grow by 50%. // Descriptor arrays grow by 50%.
MaybeObject* maybe_descriptors = DescriptorArray::Allocate( MaybeObject* maybe_descriptors = DescriptorArray::Allocate(
old_size, old_size < 4 ? 1 : old_size / 2); GetIsolate(), old_size, old_size < 4 ? 1 : old_size / 2);
if (!maybe_descriptors->To(&new_descriptors)) return maybe_descriptors; if (!maybe_descriptors->To(&new_descriptors)) return maybe_descriptors;
DescriptorArray::WhitenessWitness witness(new_descriptors); DescriptorArray::WhitenessWitness witness(new_descriptors);
@ -6834,7 +6834,8 @@ MaybeObject* Map::CopyAddDescriptor(Descriptor* descriptor,
} }
DescriptorArray* new_descriptors; DescriptorArray* new_descriptors;
MaybeObject* maybe_descriptors = DescriptorArray::Allocate(old_size, 1); MaybeObject* maybe_descriptors =
DescriptorArray::Allocate(GetIsolate(), old_size, 1);
if (!maybe_descriptors->To(&new_descriptors)) return maybe_descriptors; if (!maybe_descriptors->To(&new_descriptors)) return maybe_descriptors;
DescriptorArray::WhitenessWitness witness(new_descriptors); DescriptorArray::WhitenessWitness witness(new_descriptors);
@ -6881,7 +6882,7 @@ MaybeObject* DescriptorArray::CopyUpToAddAttributes(
int size = enumeration_index; int size = enumeration_index;
DescriptorArray* descriptors; DescriptorArray* descriptors;
MaybeObject* maybe_descriptors = Allocate(size); MaybeObject* maybe_descriptors = Allocate(GetIsolate(), size);
if (!maybe_descriptors->To(&descriptors)) return maybe_descriptors; if (!maybe_descriptors->To(&descriptors)) return maybe_descriptors;
DescriptorArray::WhitenessWitness witness(descriptors); DescriptorArray::WhitenessWitness witness(descriptors);
@ -6928,7 +6929,8 @@ MaybeObject* Map::CopyReplaceDescriptor(DescriptorArray* descriptors,
ASSERT_LT(insertion_index, new_size); ASSERT_LT(insertion_index, new_size);
DescriptorArray* new_descriptors; DescriptorArray* new_descriptors;
MaybeObject* maybe_descriptors = DescriptorArray::Allocate(new_size); MaybeObject* maybe_descriptors =
DescriptorArray::Allocate(GetIsolate(), new_size);
if (!maybe_descriptors->To(&new_descriptors)) return maybe_descriptors; if (!maybe_descriptors->To(&new_descriptors)) return maybe_descriptors;
DescriptorArray::WhitenessWitness witness(new_descriptors); DescriptorArray::WhitenessWitness witness(new_descriptors);
@ -7718,8 +7720,10 @@ bool FixedArray::IsEqualTo(FixedArray* other) {
#endif #endif
MaybeObject* DescriptorArray::Allocate(int number_of_descriptors, int slack) { MaybeObject* DescriptorArray::Allocate(Isolate* isolate,
Heap* heap = Isolate::Current()->heap(); int number_of_descriptors,
int slack) {
Heap* heap = isolate->heap();
// Do not use DescriptorArray::cast on incomplete object. // Do not use DescriptorArray::cast on incomplete object.
int size = number_of_descriptors + slack; int size = number_of_descriptors + slack;
if (size == 0) return heap->empty_descriptor_array(); if (size == 0) return heap->empty_descriptor_array();
@ -7787,7 +7791,8 @@ MaybeObject* DescriptorArray::Merge(int verbatim,
// Allocate a new descriptor array large enough to hold the required // Allocate a new descriptor array large enough to hold the required
// descriptors, with minimally the exact same size as this descriptor array. // descriptors, with minimally the exact same size as this descriptor array.
MaybeObject* maybe_descriptors = DescriptorArray::Allocate( MaybeObject* maybe_descriptors = DescriptorArray::Allocate(
new_size, Max(new_size, other->number_of_descriptors()) - new_size); GetIsolate(), new_size,
Max(new_size, other->number_of_descriptors()) - new_size);
if (!maybe_descriptors->To(&result)) return maybe_descriptors; if (!maybe_descriptors->To(&result)) return maybe_descriptors;
ASSERT(result->length() > length() || ASSERT(result->length() > length() ||
result->NumberOfSlackDescriptors() > 0 || result->NumberOfSlackDescriptors() > 0 ||
@ -8003,7 +8008,7 @@ bool Name::IsCacheable(Isolate* isolate) {
bool String::LooksValid() { bool String::LooksValid() {
if (!Isolate::Current()->heap()->Contains(this)) return false; if (!GetIsolate()->heap()->Contains(this)) return false;
return true; return true;
} }
@ -8163,8 +8168,7 @@ const uc16* SeqTwoByteString::SeqTwoByteStringGetData(unsigned start) {
} }
void Relocatable::PostGarbageCollectionProcessing() { void Relocatable::PostGarbageCollectionProcessing(Isolate* isolate) {
Isolate* isolate = Isolate::Current();
Relocatable* current = isolate->relocatable_top(); Relocatable* current = isolate->relocatable_top();
while (current != NULL) { while (current != NULL) {
current->PostGarbageCollection(); current->PostGarbageCollection();
@ -8174,8 +8178,8 @@ void Relocatable::PostGarbageCollectionProcessing() {
// Reserve space for statics needing saving and restoring. // Reserve space for statics needing saving and restoring.
int Relocatable::ArchiveSpacePerThread() { int Relocatable::ArchiveSpacePerThread(Isolate* isolate) {
return sizeof(Isolate::Current()->relocatable_top()); return sizeof(isolate->relocatable_top());
} }
@ -8183,26 +8187,26 @@ int Relocatable::ArchiveSpacePerThread() {
char* Relocatable::ArchiveState(Isolate* isolate, char* to) { char* Relocatable::ArchiveState(Isolate* isolate, char* to) {
*reinterpret_cast<Relocatable**>(to) = isolate->relocatable_top(); *reinterpret_cast<Relocatable**>(to) = isolate->relocatable_top();
isolate->set_relocatable_top(NULL); isolate->set_relocatable_top(NULL);
return to + ArchiveSpacePerThread(); return to + ArchiveSpacePerThread(isolate);
} }
// Restore statics that are thread local. // Restore statics that are thread local.
char* Relocatable::RestoreState(Isolate* isolate, char* from) { char* Relocatable::RestoreState(Isolate* isolate, char* from) {
isolate->set_relocatable_top(*reinterpret_cast<Relocatable**>(from)); isolate->set_relocatable_top(*reinterpret_cast<Relocatable**>(from));
return from + ArchiveSpacePerThread(); return from + ArchiveSpacePerThread(isolate);
} }
char* Relocatable::Iterate(ObjectVisitor* v, char* thread_storage) { char* Relocatable::Iterate(
Isolate* isolate, ObjectVisitor* v, char* thread_storage) {
Relocatable* top = *reinterpret_cast<Relocatable**>(thread_storage); Relocatable* top = *reinterpret_cast<Relocatable**>(thread_storage);
Iterate(v, top); Iterate(v, top);
return thread_storage + ArchiveSpacePerThread(); return thread_storage + ArchiveSpacePerThread(isolate);
} }
void Relocatable::Iterate(ObjectVisitor* v) { void Relocatable::Iterate(Isolate* isolate, ObjectVisitor* v) {
Isolate* isolate = Isolate::Current();
Iterate(v, isolate->relocatable_top()); Iterate(v, isolate->relocatable_top());
} }
@ -9316,7 +9320,7 @@ static bool CompileLazyHelper(CompilationInfo* info,
ASSERT(info->IsOptimizing() || !info->shared_info()->is_compiled()); ASSERT(info->IsOptimizing() || !info->shared_info()->is_compiled());
ASSERT(!info->isolate()->has_pending_exception()); ASSERT(!info->isolate()->has_pending_exception());
bool result = Compiler::CompileLazy(info); bool result = Compiler::CompileLazy(info);
ASSERT(result != Isolate::Current()->has_pending_exception()); ASSERT(result != info->isolate()->has_pending_exception());
if (!result && flag == CLEAR_EXCEPTION) { if (!result && flag == CLEAR_EXCEPTION) {
info->isolate()->clear_pending_exception(); info->isolate()->clear_pending_exception();
} }
@ -9706,12 +9710,13 @@ bool JSFunction::PassesFilter(const char* raw_filter) {
} }
MaybeObject* Oddball::Initialize(const char* to_string, MaybeObject* Oddball::Initialize(Heap* heap,
const char* to_string,
Object* to_number, Object* to_number,
byte kind) { byte kind) {
String* internalized_to_string; String* internalized_to_string;
{ MaybeObject* maybe_string = { MaybeObject* maybe_string =
Isolate::Current()->heap()->InternalizeUtf8String( heap->InternalizeUtf8String(
CStrVector(to_string)); CStrVector(to_string));
if (!maybe_string->To(&internalized_to_string)) return maybe_string; if (!maybe_string->To(&internalized_to_string)) return maybe_string;
} }
@ -10432,7 +10437,7 @@ int Code::GetAge() {
void Code::GetCodeAgeAndParity(Code* code, Age* age, void Code::GetCodeAgeAndParity(Code* code, Age* age,
MarkingParity* parity) { MarkingParity* parity) {
Isolate* isolate = Isolate::Current(); Isolate* isolate = code->GetIsolate();
Builtins* builtins = isolate->builtins(); Builtins* builtins = isolate->builtins();
Code* stub = NULL; Code* stub = NULL;
#define HANDLE_CODE_AGE(AGE) \ #define HANDLE_CODE_AGE(AGE) \
@ -15263,7 +15268,7 @@ MaybeObject* NameDictionary::TransformPropertiesToFastFor(
// Allocate the instance descriptor. // Allocate the instance descriptor.
DescriptorArray* descriptors; DescriptorArray* descriptors;
MaybeObject* maybe_descriptors = MaybeObject* maybe_descriptors =
DescriptorArray::Allocate(instance_descriptor_length); DescriptorArray::Allocate(GetIsolate(), instance_descriptor_length);
if (!maybe_descriptors->To(&descriptors)) { if (!maybe_descriptors->To(&descriptors)) {
return maybe_descriptors; return maybe_descriptors;
} }
@ -15556,7 +15561,7 @@ void DebugInfo::ClearBreakPoint(Handle<DebugInfo> debug_info,
int code_position, int code_position,
Handle<Object> break_point_object) { Handle<Object> break_point_object) {
Handle<Object> break_point_info(debug_info->GetBreakPointInfo(code_position), Handle<Object> break_point_info(debug_info->GetBreakPointInfo(code_position),
Isolate::Current()); debug_info->GetIsolate());
if (break_point_info->IsUndefined()) return; if (break_point_info->IsUndefined()) return;
BreakPointInfo::ClearBreakPoint( BreakPointInfo::ClearBreakPoint(
Handle<BreakPointInfo>::cast(break_point_info), Handle<BreakPointInfo>::cast(break_point_info),
@ -15569,7 +15574,7 @@ void DebugInfo::SetBreakPoint(Handle<DebugInfo> debug_info,
int source_position, int source_position,
int statement_position, int statement_position,
Handle<Object> break_point_object) { Handle<Object> break_point_object) {
Isolate* isolate = Isolate::Current(); Isolate* isolate = debug_info->GetIsolate();
Handle<Object> break_point_info(debug_info->GetBreakPointInfo(code_position), Handle<Object> break_point_info(debug_info->GetBreakPointInfo(code_position),
isolate); isolate);
if (!break_point_info->IsUndefined()) { if (!break_point_info->IsUndefined()) {
@ -15683,7 +15688,7 @@ int DebugInfo::GetBreakPointInfoIndex(int code_position) {
// Remove the specified break point object. // Remove the specified break point object.
void BreakPointInfo::ClearBreakPoint(Handle<BreakPointInfo> break_point_info, void BreakPointInfo::ClearBreakPoint(Handle<BreakPointInfo> break_point_info,
Handle<Object> break_point_object) { Handle<Object> break_point_object) {
Isolate* isolate = Isolate::Current(); Isolate* isolate = break_point_info->GetIsolate();
// If there are no break points just ignore. // If there are no break points just ignore.
if (break_point_info->break_point_objects()->IsUndefined()) return; if (break_point_info->break_point_objects()->IsUndefined()) return;
// If there is a single break point clear it if it is the same. // If there is a single break point clear it if it is the same.

View File

@ -3186,7 +3186,8 @@ class DescriptorArray: public FixedArray {
// Allocates a DescriptorArray, but returns the singleton // Allocates a DescriptorArray, but returns the singleton
// empty descriptor array object if number_of_descriptors is 0. // empty descriptor array object if number_of_descriptors is 0.
MUST_USE_RESULT static MaybeObject* Allocate(int number_of_descriptors, MUST_USE_RESULT static MaybeObject* Allocate(Isolate* isolate,
int number_of_descriptors,
int slack = 0); int slack = 0);
// Casting. // Casting.
@ -8724,13 +8725,14 @@ class Relocatable BASE_EMBEDDED {
virtual void IterateInstance(ObjectVisitor* v) { } virtual void IterateInstance(ObjectVisitor* v) { }
virtual void PostGarbageCollection() { } virtual void PostGarbageCollection() { }
static void PostGarbageCollectionProcessing(); static void PostGarbageCollectionProcessing(Isolate* isolate);
static int ArchiveSpacePerThread(); static int ArchiveSpacePerThread(Isolate* isolate);
static char* ArchiveState(Isolate* isolate, char* to); static char* ArchiveState(Isolate* isolate, char* to);
static char* RestoreState(Isolate* isolate, char* from); static char* RestoreState(Isolate* isolate, char* from);
static void Iterate(ObjectVisitor* v); static void Iterate(Isolate* isolate, ObjectVisitor* v);
static void Iterate(ObjectVisitor* v, Relocatable* top); static void Iterate(ObjectVisitor* v, Relocatable* top);
static char* Iterate(ObjectVisitor* v, char* t); static char* Iterate(Isolate* isolate, ObjectVisitor* v, char* t);
private: private:
Isolate* isolate_; Isolate* isolate_;
Relocatable* prev_; Relocatable* prev_;
@ -8866,7 +8868,8 @@ class Oddball: public HeapObject {
DECLARE_VERIFIER(Oddball) DECLARE_VERIFIER(Oddball)
// Initialize the fields. // Initialize the fields.
MUST_USE_RESULT MaybeObject* Initialize(const char* to_string, MUST_USE_RESULT MaybeObject* Initialize(Heap* heap,
const char* to_string,
Object* to_number, Object* to_number,
byte kind); byte kind);

View File

@ -227,7 +227,7 @@ void ThreadManager::Unlock() {
} }
static int ArchiveSpacePerThread() { static int ArchiveSpacePerThread(Isolate* isolate) {
return HandleScopeImplementer::ArchiveSpacePerThread() + return HandleScopeImplementer::ArchiveSpacePerThread() +
Isolate::ArchiveSpacePerThread() + Isolate::ArchiveSpacePerThread() +
#ifdef ENABLE_DEBUGGER_SUPPORT #ifdef ENABLE_DEBUGGER_SUPPORT
@ -236,7 +236,7 @@ static int ArchiveSpacePerThread() {
StackGuard::ArchiveSpacePerThread() + StackGuard::ArchiveSpacePerThread() +
RegExpStack::ArchiveSpacePerThread() + RegExpStack::ArchiveSpacePerThread() +
Bootstrapper::ArchiveSpacePerThread() + Bootstrapper::ArchiveSpacePerThread() +
Relocatable::ArchiveSpacePerThread(); Relocatable::ArchiveSpacePerThread(isolate);
} }
@ -256,7 +256,7 @@ ThreadState::~ThreadState() {
void ThreadState::AllocateSpace() { void ThreadState::AllocateSpace() {
data_ = NewArray<char>(ArchiveSpacePerThread()); data_ = NewArray<char>(ArchiveSpacePerThread(Isolate::Current()));
} }
@ -396,7 +396,7 @@ void ThreadManager::Iterate(ObjectVisitor* v) {
char* data = state->data(); char* data = state->data();
data = HandleScopeImplementer::Iterate(v, data); data = HandleScopeImplementer::Iterate(v, data);
data = isolate_->Iterate(v, data); data = isolate_->Iterate(v, data);
data = Relocatable::Iterate(v, data); data = Relocatable::Iterate(Isolate::Current(), v, data);
} }
} }