remove Isolate::Current from most files starting with 'f' through 'i'

R=svenpanne@chromium.org
BUG=

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

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@16506 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
This commit is contained in:
dcarney@chromium.org 2013-09-03 11:47:16 +00:00
parent 0e29b3d237
commit 4f5ef30280
15 changed files with 80 additions and 79 deletions

View File

@ -814,8 +814,7 @@ void JavaScriptFrame::PrintTop(Isolate* isolate,
PrintF("+%d", code_offset);
SharedFunctionInfo* shared = fun->shared();
if (print_line_number) {
Code* code = Code::cast(
v8::internal::Isolate::Current()->FindCodeObject(pc));
Code* code = Code::cast(isolate->FindCodeObject(pc));
int source_pos = code->SourcePosition(pc);
Object* maybe_script = shared->script();
if (maybe_script->IsScript()) {

View File

@ -766,7 +766,7 @@ void Heap::CompletelyClearInstanceofCache() {
MaybeObject* TranscendentalCache::Get(Type type, double input) {
SubCache* cache = caches_[type];
if (cache == NULL) {
caches_[type] = cache = new SubCache(type);
caches_[type] = cache = new SubCache(isolate_, type);
}
return cache->Get(input);
}

View File

@ -732,7 +732,7 @@ V8HeapExplorer::V8HeapExplorer(
HeapSnapshot* snapshot,
SnapshottingProgressReportingInterface* progress,
v8::HeapProfiler::ObjectNameResolver* resolver)
: heap_(Isolate::Current()->heap()),
: heap_(snapshot->collection()->heap()),
snapshot_(snapshot),
collection_(snapshot_->collection()),
progress_(progress),
@ -1852,7 +1852,7 @@ class GlobalObjectsEnumerator : public ObjectVisitor {
// Modifies heap. Must not be run during heap traversal.
void V8HeapExplorer::TagGlobalObjects() {
Isolate* isolate = Isolate::Current();
Isolate* isolate = heap_->isolate();
HandleScope scope(isolate);
GlobalObjectsEnumerator enumerator;
isolate->global_handles()->IterateAllRoots(&enumerator);
@ -1927,8 +1927,10 @@ HeapEntry* BasicHeapEntriesAllocator::AllocateEntry(HeapThing ptr) {
NativeObjectsExplorer::NativeObjectsExplorer(
HeapSnapshot* snapshot, SnapshottingProgressReportingInterface* progress)
: snapshot_(snapshot),
HeapSnapshot* snapshot,
SnapshottingProgressReportingInterface* progress)
: isolate_(snapshot->collection()->heap()->isolate()),
snapshot_(snapshot),
collection_(snapshot_->collection()),
progress_(progress),
embedder_queried_(false),
@ -1973,7 +1975,7 @@ int NativeObjectsExplorer::EstimateObjectsCount() {
void NativeObjectsExplorer::FillRetainedObjects() {
if (embedder_queried_) return;
Isolate* isolate = Isolate::Current();
Isolate* isolate = isolate_;
const GCType major_gc_type = kGCTypeMarkSweepCompact;
// Record objects that are joined into ObjectGroups.
isolate->heap()->CallGCPrologueCallbacks(
@ -2000,7 +2002,7 @@ void NativeObjectsExplorer::FillRetainedObjects() {
void NativeObjectsExplorer::FillImplicitReferences() {
Isolate* isolate = Isolate::Current();
Isolate* isolate = isolate_;
List<ImplicitRefGroup*>* groups =
isolate->global_handles()->implicit_ref_groups();
for (int i = 0; i < groups->length(); ++i) {
@ -2157,7 +2159,7 @@ void NativeObjectsExplorer::SetRootNativeRootsReference() {
void NativeObjectsExplorer::VisitSubtreeWrapper(Object** p, uint16_t class_id) {
if (in_groups_.Contains(*p)) return;
Isolate* isolate = Isolate::Current();
Isolate* isolate = isolate_;
v8::RetainedObjectInfo* info =
isolate->heap_profiler()->ExecuteWrapperClassCallback(class_id, p);
if (info == NULL) return;
@ -2243,15 +2245,15 @@ bool HeapSnapshotGenerator::GenerateSnapshot() {
// full GC is reachable from the root when computing dominators.
// This is not true for weakly reachable objects.
// As a temporary solution we call GC twice.
Isolate::Current()->heap()->CollectAllGarbage(
heap_->CollectAllGarbage(
Heap::kMakeHeapIterableMask,
"HeapSnapshotGenerator::GenerateSnapshot");
Isolate::Current()->heap()->CollectAllGarbage(
heap_->CollectAllGarbage(
Heap::kMakeHeapIterableMask,
"HeapSnapshotGenerator::GenerateSnapshot");
#ifdef VERIFY_HEAP
Heap* debug_heap = Isolate::Current()->heap();
Heap* debug_heap = heap_;
CHECK(!debug_heap->old_data_space()->was_swept_conservatively());
CHECK(!debug_heap->old_pointer_space()->was_swept_conservatively());
CHECK(!debug_heap->code_space()->was_swept_conservatively());

View File

@ -538,7 +538,7 @@ class NativeGroupRetainedObjectInfo;
class NativeObjectsExplorer {
public:
NativeObjectsExplorer(HeapSnapshot* snapshot,
SnapshottingProgressReportingInterface* progress);
SnapshottingProgressReportingInterface* progress);
virtual ~NativeObjectsExplorer();
void AddRootEntries(SnapshotFillerInterface* filler);
int EstimateObjectsCount();
@ -570,6 +570,7 @@ class NativeObjectsExplorer {
NativeGroupRetainedObjectInfo* FindOrAddGroupInfo(const char* label);
Isolate* isolate_;
HeapSnapshot* snapshot_;
HeapSnapshotsCollection* collection_;
SnapshottingProgressReportingInterface* progress_;

View File

@ -7239,12 +7239,12 @@ class HeapObjectsFilter {
class UnreachableObjectsFilter : public HeapObjectsFilter {
public:
UnreachableObjectsFilter() {
explicit UnreachableObjectsFilter(Heap* heap) : heap_(heap) {
MarkReachableObjects();
}
~UnreachableObjectsFilter() {
Isolate::Current()->heap()->mark_compact_collector()->ClearMarkbits();
heap_->mark_compact_collector()->ClearMarkbits();
}
bool SkipObject(HeapObject* object) {
@ -7281,12 +7281,12 @@ class UnreachableObjectsFilter : public HeapObjectsFilter {
};
void MarkReachableObjects() {
Heap* heap = Isolate::Current()->heap();
MarkingVisitor visitor;
heap->IterateRoots(&visitor, VISIT_ALL);
heap_->IterateRoots(&visitor, VISIT_ALL);
visitor.TransitiveClosure();
}
Heap* heap_;
DisallowHeapAllocation no_allocation_;
};
@ -7318,7 +7318,7 @@ void HeapIterator::Init() {
space_iterator_ = new SpaceIterator(heap_);
switch (filtering_) {
case kFilterUnreachable:
filter_ = new UnreachableObjectsFilter;
filter_ = new UnreachableObjectsFilter(heap_);
break;
default:
break;
@ -7863,9 +7863,9 @@ void Heap::GarbageCollectionGreedyCheck() {
#endif
TranscendentalCache::SubCache::SubCache(Type t)
TranscendentalCache::SubCache::SubCache(Isolate* isolate, Type t)
: type_(t),
isolate_(Isolate::Current()) {
isolate_(isolate) {
uint32_t in0 = 0xffffffffu; // Bit-pattern for a NaN that isn't
uint32_t in1 = 0xffffffffu; // generated by the FPU.
for (int i = 0; i < kCacheSize; i++) {

View File

@ -2881,7 +2881,7 @@ class TranscendentalCache {
class SubCache {
static const int kCacheSize = 512;
explicit SubCache(Type t);
explicit SubCache(Isolate* isolate, Type t);
MUST_USE_RESULT inline MaybeObject* Get(double input);
@ -2918,7 +2918,7 @@ class TranscendentalCache {
DISALLOW_COPY_AND_ASSIGN(SubCache);
};
TranscendentalCache() {
explicit TranscendentalCache(Isolate* isolate) : isolate_(isolate) {
for (int i = 0; i < kNumberOfCaches; ++i) caches_[i] = NULL;
}
@ -2936,6 +2936,7 @@ class TranscendentalCache {
// Allow access to the caches_ array as an ExternalReference.
friend class ExternalReference;
Isolate* isolate_;
SubCache* caches_[kNumberOfCaches];
DISALLOW_COPY_AND_ASSIGN(TranscendentalCache);
};

View File

@ -3668,7 +3668,7 @@ HInstruction* HStringCharFromCode::New(
Zone* zone, HValue* context, HValue* char_code) {
if (FLAG_fold_constants && char_code->IsConstant()) {
HConstant* c_code = HConstant::cast(char_code);
Isolate* isolate = Isolate::Current();
Isolate* isolate = zone->isolate();
if (c_code->HasNumberValue()) {
if (std::isfinite(c_code->DoubleValue())) {
uint32_t code = c_code->NumberValueAsInteger32() & 0xffff;

View File

@ -2159,7 +2159,7 @@ class HCallConstantFunction V8_FINAL : public HCall<0> {
bool IsApplyFunction() const {
return function_->code() ==
Isolate::Current()->builtins()->builtin(Builtins::kFunctionApply);
function_->GetIsolate()->builtins()->builtin(Builtins::kFunctionApply);
}
virtual void PrintDataTo(StringStream* stream) V8_OVERRIDE;
@ -2629,7 +2629,7 @@ class HCheckValue V8_FINAL : public HUnaryOperation {
public:
static HCheckValue* New(Zone* zone, HValue* context,
HValue* value, Handle<JSFunction> target) {
bool in_new_space = Isolate::Current()->heap()->InNewSpace(*target);
bool in_new_space = zone->isolate()->heap()->InNewSpace(*target);
HCheckValue* check = new(zone) HCheckValue(value, target, in_new_space);
return check;
}

View File

@ -375,20 +375,22 @@ void IC::PostPatching(Address address, Code* target, Code* old_target) {
}
void IC::Clear(Address address) {
void IC::Clear(Isolate* isolate, Address address) {
Code* target = GetTargetAtAddress(address);
// Don't clear debug break inline cache as it will remove the break point.
if (target->is_debug_stub()) return;
switch (target->kind()) {
case Code::LOAD_IC: return LoadIC::Clear(address, target);
case Code::KEYED_LOAD_IC: return KeyedLoadIC::Clear(address, target);
case Code::STORE_IC: return StoreIC::Clear(address, target);
case Code::KEYED_STORE_IC: return KeyedStoreIC::Clear(address, target);
case Code::LOAD_IC: return LoadIC::Clear(isolate, address, target);
case Code::KEYED_LOAD_IC:
return KeyedLoadIC::Clear(isolate, address, target);
case Code::STORE_IC: return StoreIC::Clear(isolate, address, target);
case Code::KEYED_STORE_IC:
return KeyedStoreIC::Clear(isolate, address, target);
case Code::CALL_IC: return CallIC::Clear(address, target);
case Code::KEYED_CALL_IC: return KeyedCallIC::Clear(address, target);
case Code::COMPARE_IC: return CompareIC::Clear(address, target);
case Code::COMPARE_IC: return CompareIC::Clear(isolate, address, target);
case Code::COMPARE_NIL_IC: return CompareNilIC::Clear(address, target);
case Code::BINARY_OP_IC:
case Code::TO_BOOLEAN_IC:
@ -404,7 +406,7 @@ void CallICBase::Clear(Address address, Code* target) {
if (target->ic_state() == UNINITIALIZED) return;
bool contextual = CallICBase::Contextual::decode(target->extra_ic_state());
Code* code =
Isolate::Current()->stub_cache()->FindCallInitialize(
target->GetIsolate()->stub_cache()->FindCallInitialize(
target->arguments_count(),
contextual ? RelocInfo::CODE_TARGET_CONTEXT : RelocInfo::CODE_TARGET,
target->kind());
@ -412,40 +414,40 @@ void CallICBase::Clear(Address address, Code* target) {
}
void KeyedLoadIC::Clear(Address address, Code* target) {
void KeyedLoadIC::Clear(Isolate* isolate, Address address, Code* target) {
if (target->ic_state() == UNINITIALIZED) return;
// Make sure to also clear the map used in inline fast cases. If we
// do not clear these maps, cached code can keep objects alive
// through the embedded maps.
SetTargetAtAddress(address, *initialize_stub());
SetTargetAtAddress(address, *initialize_stub(isolate));
}
void LoadIC::Clear(Address address, Code* target) {
void LoadIC::Clear(Isolate* isolate, Address address, Code* target) {
if (target->ic_state() == UNINITIALIZED) return;
SetTargetAtAddress(address, *initialize_stub());
SetTargetAtAddress(address, *initialize_stub(isolate));
}
void StoreIC::Clear(Address address, Code* target) {
void StoreIC::Clear(Isolate* isolate, Address address, Code* target) {
if (target->ic_state() == UNINITIALIZED) return;
SetTargetAtAddress(address,
(Code::GetStrictMode(target->extra_ic_state()) == kStrictMode)
? *initialize_stub_strict()
: *initialize_stub());
? *initialize_stub_strict(isolate)
: *initialize_stub(isolate));
}
void KeyedStoreIC::Clear(Address address, Code* target) {
void KeyedStoreIC::Clear(Isolate* isolate, Address address, Code* target) {
if (target->ic_state() == UNINITIALIZED) return;
SetTargetAtAddress(address,
(Code::GetStrictMode(target->extra_ic_state()) == kStrictMode)
? *initialize_stub_strict()
: *initialize_stub());
? *initialize_stub_strict(isolate)
: *initialize_stub(isolate));
}
void CompareIC::Clear(Address address, Code* target) {
void CompareIC::Clear(Isolate* isolate, Address address, Code* target) {
ASSERT(target->major_key() == CodeStub::CompareIC);
CompareIC::State handler_state;
Token::Value op;
@ -453,7 +455,7 @@ void CompareIC::Clear(Address address, Code* target) {
&handler_state, &op);
// Only clear CompareICs that can retain objects.
if (handler_state != KNOWN_OBJECT) return;
SetTargetAtAddress(address, GetRawUninitialized(op));
SetTargetAtAddress(address, GetRawUninitialized(isolate, op));
PatchInlinedSmiCode(address, DISABLE_INLINED_SMI_CHECK);
}
@ -2771,10 +2773,10 @@ RUNTIME_FUNCTION(MaybeObject*, BinaryOp_Patch) {
}
Code* CompareIC::GetRawUninitialized(Token::Value op) {
Code* CompareIC::GetRawUninitialized(Isolate* isolate, Token::Value op) {
ICCompareStub stub(op, UNINITIALIZED, UNINITIALIZED, UNINITIALIZED);
Code* code = NULL;
CHECK(stub.FindCodeInCache(&code, Isolate::Current()));
CHECK(stub.FindCodeInCache(&code, isolate));
return code;
}

View File

@ -102,7 +102,7 @@ class IC {
static State StateFrom(Code* target, Object* receiver, Object* name);
// Clear the inline cache to initial state.
static void Clear(Address address);
static void Clear(Isolate* isolate, Address address);
// Computes the reloc info for this IC. This is a fairly expensive
// operation as it has to search through the heap to find the code
@ -420,14 +420,14 @@ class LoadIC: public IC {
private:
// Stub accessors.
static Handle<Code> initialize_stub() {
return Isolate::Current()->builtins()->LoadIC_Initialize();
static Handle<Code> initialize_stub(Isolate* isolate) {
return isolate->builtins()->LoadIC_Initialize();
}
virtual Handle<Code> pre_monomorphic_stub() {
return isolate()->builtins()->LoadIC_PreMonomorphic();
}
static void Clear(Address address, Code* target);
static void Clear(Isolate* isolate, Address address, Code* target);
friend class IC;
};
@ -496,8 +496,8 @@ class KeyedLoadIC: public LoadIC {
private:
// Stub accessors.
static Handle<Code> initialize_stub() {
return Isolate::Current()->builtins()->KeyedLoadIC_Initialize();
static Handle<Code> initialize_stub(Isolate* isolate) {
return isolate->builtins()->KeyedLoadIC_Initialize();
}
virtual Handle<Code> pre_monomorphic_stub() {
return isolate()->builtins()->KeyedLoadIC_PreMonomorphic();
@ -512,7 +512,7 @@ class KeyedLoadIC: public LoadIC {
return isolate()->builtins()->KeyedLoadIC_String();
}
static void Clear(Address address, Code* target);
static void Clear(Isolate* isolate, Address address, Code* target);
friend class IC;
};
@ -601,13 +601,13 @@ class StoreIC: public IC {
IC::set_target(code);
}
static Handle<Code> initialize_stub() {
return Isolate::Current()->builtins()->StoreIC_Initialize();
static Handle<Code> initialize_stub(Isolate* isolate) {
return isolate->builtins()->StoreIC_Initialize();
}
static Handle<Code> initialize_stub_strict() {
return Isolate::Current()->builtins()->StoreIC_Initialize_Strict();
static Handle<Code> initialize_stub_strict(Isolate* isolate) {
return isolate->builtins()->StoreIC_Initialize_Strict();
}
static void Clear(Address address, Code* target);
static void Clear(Isolate* isolate, Address address, Code* target);
friend class IC;
};
@ -685,11 +685,11 @@ class KeyedStoreIC: public StoreIC {
}
// Stub accessors.
static Handle<Code> initialize_stub() {
return Isolate::Current()->builtins()->KeyedStoreIC_Initialize();
static Handle<Code> initialize_stub(Isolate* isolate) {
return isolate->builtins()->KeyedStoreIC_Initialize();
}
static Handle<Code> initialize_stub_strict() {
return Isolate::Current()->builtins()->KeyedStoreIC_Initialize_Strict();
static Handle<Code> initialize_stub_strict(Isolate* isolate) {
return isolate->builtins()->KeyedStoreIC_Initialize_Strict();
}
Handle<Code> generic_stub() const {
return isolate()->builtins()->KeyedStoreIC_Generic();
@ -701,7 +701,7 @@ class KeyedStoreIC: public StoreIC {
return isolate()->builtins()->KeyedStoreIC_NonStrictArguments();
}
static void Clear(Address address, Code* target);
static void Clear(Isolate* isolate, Address address, Code* target);
KeyedAccessStoreMode GetStoreMode(Handle<JSObject> receiver,
Handle<Object> key,
@ -807,9 +807,9 @@ class CompareIC: public IC {
bool strict() const { return op_ == Token::EQ_STRICT; }
Condition GetCondition() const { return ComputeCondition(op_); }
static Code* GetRawUninitialized(Token::Value op);
static Code* GetRawUninitialized(Isolate* isolate, Token::Value op);
static void Clear(Address address, Code* target);
static void Clear(Isolate* isolate, Address address, Code* target);
Token::Value op_;

View File

@ -36,7 +36,9 @@ namespace v8 {
namespace internal {
SaveContext::SaveContext(Isolate* isolate) : prev_(isolate->save_context()) {
SaveContext::SaveContext(Isolate* isolate)
: isolate_(isolate),
prev_(isolate->save_context()) {
if (isolate->context() != NULL) {
context_ = Handle<Context>(isolate->context());
}

View File

@ -2187,7 +2187,7 @@ bool Isolate::Init(Deserializer* des) {
string_tracker_ = new StringTracker();
string_tracker_->isolate_ = this;
compilation_cache_ = new CompilationCache(this);
transcendental_cache_ = new TranscendentalCache();
transcendental_cache_ = new TranscendentalCache(this);
keyed_lookup_cache_ = new KeyedLookupCache();
context_slot_cache_ = new ContextSlotCache();
descriptor_lookup_cache_ = new DescriptorLookupCache();

View File

@ -1396,15 +1396,8 @@ class SaveContext BASE_EMBEDDED {
inline explicit SaveContext(Isolate* isolate);
~SaveContext() {
if (context_.is_null()) {
Isolate* isolate = Isolate::Current();
isolate->set_context(NULL);
isolate->set_save_context(prev_);
} else {
Isolate* isolate = context_->GetIsolate();
isolate->set_context(*context_);
isolate->set_save_context(prev_);
}
isolate_->set_context(context_.is_null() ? NULL : *context_);
isolate_->set_save_context(prev_);
}
Handle<Context> context() { return context_; }
@ -1416,6 +1409,7 @@ class SaveContext BASE_EMBEDDED {
}
private:
Isolate* isolate_;
Handle<Context> context_;
SaveContext* prev_;
Address c_entry_fp_;

View File

@ -304,7 +304,7 @@ void StaticMarkingVisitor<StaticVisitor>::VisitCodeTarget(
&& (target->ic_state() == MEGAMORPHIC || target->ic_state() == GENERIC ||
target->ic_state() == POLYMORPHIC || heap->flush_monomorphic_ics() ||
Serializer::enabled() || target->ic_age() != heap->global_ic_age())) {
IC::Clear(rinfo->pc());
IC::Clear(target->GetIsolate(), rinfo->pc());
target = Code::GetCodeFromTargetAddress(rinfo->target_address());
}
heap->mark_compact_collector()->RecordRelocSlot(rinfo, target);

View File

@ -10305,7 +10305,7 @@ void Code::ClearInlineCaches() {
RelocInfo* info = it.rinfo();
Code* target(Code::GetCodeFromTargetAddress(info->target_address()));
if (target->is_inline_cache_stub()) {
IC::Clear(info->pc());
IC::Clear(this->GetIsolate(), info->pc());
}
}
}