Clean up Isolate usages in ast visitor and hydrogen.

Review URL: http://codereview.chromium.org/6688066

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@7282 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
This commit is contained in:
vitalyr@chromium.org 2011-03-21 11:57:59 +00:00
parent b30e3388a9
commit 0dce18e6c2
6 changed files with 22 additions and 16 deletions

View File

@ -700,7 +700,7 @@ void CompareOperation::RecordTypeFeedback(TypeFeedbackOracle* oracle) {
bool AstVisitor::CheckStackOverflow() {
if (stack_overflow_) return true;
StackLimitCheck check(Isolate::Current());
StackLimitCheck check(isolate_);
if (!check.HasOverflowed()) return false;
return (stack_overflow_ = true);
}

View File

@ -2180,7 +2180,7 @@ class RegExpEmpty: public RegExpTree {
class AstVisitor BASE_EMBEDDED {
public:
AstVisitor() : stack_overflow_(false) { }
AstVisitor() : isolate_(Isolate::Current()), stack_overflow_(false) { }
virtual ~AstVisitor() { }
// Stack overflow check and dynamic dispatch.
@ -2210,7 +2210,11 @@ class AstVisitor BASE_EMBEDDED {
AST_NODE_LIST(DEF_VISIT)
#undef DEF_VISIT
protected:
Isolate* isolate() { return isolate_; }
private:
Isolate* isolate_;
bool stack_overflow_;
};

View File

@ -275,7 +275,7 @@ void BreakableStatementChecker::VisitThisFunction(ThisFunction* expr) {
#define __ ACCESS_MASM(masm())
bool FullCodeGenerator::MakeCode(CompilationInfo* info) {
Isolate* isolate = Isolate::Current();
Isolate* isolate = info->isolate();
Handle<Script> script = info->script();
if (!script->IsUndefined() && !script->source()->IsUndefined()) {
int len = String::cast(script->source())->length();

View File

@ -77,8 +77,7 @@ class FullCodeGenerator: public AstVisitor {
};
explicit FullCodeGenerator(MacroAssembler* masm)
: isolate_(Isolate::Current()),
masm_(masm),
: masm_(masm),
info_(NULL),
nesting_stack_(NULL),
loop_depth_(0),
@ -494,7 +493,6 @@ class FullCodeGenerator: public AstVisitor {
loop_depth_--;
}
Isolate* isolate() { return isolate_; }
MacroAssembler* masm() { return masm_; }
class ExpressionContext;
@ -733,7 +731,6 @@ class FullCodeGenerator: public AstVisitor {
virtual bool IsEffect() const { return true; }
};
Isolate* isolate_;
MacroAssembler* masm_;
CompilationInfo* info_;
Label return_label_;

View File

@ -512,12 +512,12 @@ HConstant* HGraph::GetConstantMinus1() {
HConstant* HGraph::GetConstantTrue() {
return GetConstant(&constant_true_, HEAP->true_value());
return GetConstant(&constant_true_, isolate()->heap()->true_value());
}
HConstant* HGraph::GetConstantFalse() {
return GetConstant(&constant_false_, HEAP->false_value());
return GetConstant(&constant_false_, isolate()->heap()->false_value());
}
@ -573,7 +573,8 @@ void HBasicBlock::FinishExit(HControlInstruction* instruction) {
HGraph::HGraph(CompilationInfo* info)
: next_block_id_(0),
: isolate_(info->isolate()),
next_block_id_(0),
entry_block_(NULL),
blocks_(8),
values_(16),
@ -1248,12 +1249,12 @@ class HGlobalValueNumberer BASE_EMBEDDED {
info_(info),
block_side_effects_(graph_->blocks()->length()),
loop_side_effects_(graph_->blocks()->length()) {
ASSERT(HEAP->allow_allocation(false));
ASSERT(info->isolate()->heap()->allow_allocation(false));
block_side_effects_.AddBlock(0, graph_->blocks()->length());
loop_side_effects_.AddBlock(0, graph_->blocks()->length());
}
~HGlobalValueNumberer() {
ASSERT(!HEAP->allow_allocation(true));
ASSERT(!info_->isolate()->heap()->allow_allocation(true));
}
void Analyze();
@ -2278,8 +2279,8 @@ void HGraphBuilder::SetupScope(Scope* scope) {
// We don't yet handle the function name for named function expressions.
if (scope->function() != NULL) BAILOUT("named function expression");
HConstant* undefined_constant =
new HConstant(FACTORY->undefined_value(), Representation::Tagged());
HConstant* undefined_constant = new HConstant(
isolate()->factory()->undefined_value(), Representation::Tagged());
AddInstruction(undefined_constant);
graph_->set_undefined_constant(undefined_constant);
@ -3625,7 +3626,8 @@ HInstruction* HGraphBuilder::BuildStoreKeyedFastElement(HValue* object,
ASSERT(map->has_fast_elements());
AddInstruction(new HCheckMap(object, map));
HInstruction* elements = AddInstruction(new HLoadElements(object));
AddInstruction(new HCheckMap(elements, FACTORY->fixed_array_map()));
AddInstruction(new HCheckMap(elements,
isolate()->factory()->fixed_array_map()));
bool is_array = (map->instance_type() == JS_ARRAY_TYPE);
HInstruction* length = NULL;
if (is_array) {
@ -4975,7 +4977,7 @@ void HGraphBuilder::VisitCompareOperation(CompareOperation* expr) {
Handle<JSFunction> candidate(JSFunction::cast(lookup.GetValue()));
// If the function is in new space we assume it's more likely to
// change and thus prefer the general IC code.
if (!Isolate::Current()->heap()->InNewSpace(*candidate)) {
if (!isolate()->heap()->InNewSpace(*candidate)) {
target = candidate;
}
}

View File

@ -281,6 +281,9 @@ class HGraph: public ZoneObject {
void InitializeInferredTypes(int from_inclusive, int to_inclusive);
void CheckForBackEdge(HBasicBlock* block, HBasicBlock* successor);
Isolate* isolate() { return isolate_; }
Isolate* isolate_;
int next_block_id_;
HBasicBlock* entry_block_;
HEnvironment* start_environment_;