Commit 0dce18e6 authored by vitalyr@chromium.org's avatar vitalyr@chromium.org

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
parent b30e3388
...@@ -700,7 +700,7 @@ void CompareOperation::RecordTypeFeedback(TypeFeedbackOracle* oracle) { ...@@ -700,7 +700,7 @@ void CompareOperation::RecordTypeFeedback(TypeFeedbackOracle* oracle) {
bool AstVisitor::CheckStackOverflow() { bool AstVisitor::CheckStackOverflow() {
if (stack_overflow_) return true; if (stack_overflow_) return true;
StackLimitCheck check(Isolate::Current()); StackLimitCheck check(isolate_);
if (!check.HasOverflowed()) return false; if (!check.HasOverflowed()) return false;
return (stack_overflow_ = true); return (stack_overflow_ = true);
} }
......
...@@ -2180,7 +2180,7 @@ class RegExpEmpty: public RegExpTree { ...@@ -2180,7 +2180,7 @@ class RegExpEmpty: public RegExpTree {
class AstVisitor BASE_EMBEDDED { class AstVisitor BASE_EMBEDDED {
public: public:
AstVisitor() : stack_overflow_(false) { } AstVisitor() : isolate_(Isolate::Current()), stack_overflow_(false) { }
virtual ~AstVisitor() { } virtual ~AstVisitor() { }
// Stack overflow check and dynamic dispatch. // Stack overflow check and dynamic dispatch.
...@@ -2210,7 +2210,11 @@ class AstVisitor BASE_EMBEDDED { ...@@ -2210,7 +2210,11 @@ class AstVisitor BASE_EMBEDDED {
AST_NODE_LIST(DEF_VISIT) AST_NODE_LIST(DEF_VISIT)
#undef DEF_VISIT #undef DEF_VISIT
protected:
Isolate* isolate() { return isolate_; }
private: private:
Isolate* isolate_;
bool stack_overflow_; bool stack_overflow_;
}; };
......
...@@ -275,7 +275,7 @@ void BreakableStatementChecker::VisitThisFunction(ThisFunction* expr) { ...@@ -275,7 +275,7 @@ void BreakableStatementChecker::VisitThisFunction(ThisFunction* expr) {
#define __ ACCESS_MASM(masm()) #define __ ACCESS_MASM(masm())
bool FullCodeGenerator::MakeCode(CompilationInfo* info) { bool FullCodeGenerator::MakeCode(CompilationInfo* info) {
Isolate* isolate = Isolate::Current(); Isolate* isolate = info->isolate();
Handle<Script> script = info->script(); Handle<Script> script = info->script();
if (!script->IsUndefined() && !script->source()->IsUndefined()) { if (!script->IsUndefined() && !script->source()->IsUndefined()) {
int len = String::cast(script->source())->length(); int len = String::cast(script->source())->length();
......
...@@ -77,8 +77,7 @@ class FullCodeGenerator: public AstVisitor { ...@@ -77,8 +77,7 @@ class FullCodeGenerator: public AstVisitor {
}; };
explicit FullCodeGenerator(MacroAssembler* masm) explicit FullCodeGenerator(MacroAssembler* masm)
: isolate_(Isolate::Current()), : masm_(masm),
masm_(masm),
info_(NULL), info_(NULL),
nesting_stack_(NULL), nesting_stack_(NULL),
loop_depth_(0), loop_depth_(0),
...@@ -494,7 +493,6 @@ class FullCodeGenerator: public AstVisitor { ...@@ -494,7 +493,6 @@ class FullCodeGenerator: public AstVisitor {
loop_depth_--; loop_depth_--;
} }
Isolate* isolate() { return isolate_; }
MacroAssembler* masm() { return masm_; } MacroAssembler* masm() { return masm_; }
class ExpressionContext; class ExpressionContext;
...@@ -733,7 +731,6 @@ class FullCodeGenerator: public AstVisitor { ...@@ -733,7 +731,6 @@ class FullCodeGenerator: public AstVisitor {
virtual bool IsEffect() const { return true; } virtual bool IsEffect() const { return true; }
}; };
Isolate* isolate_;
MacroAssembler* masm_; MacroAssembler* masm_;
CompilationInfo* info_; CompilationInfo* info_;
Label return_label_; Label return_label_;
......
...@@ -512,12 +512,12 @@ HConstant* HGraph::GetConstantMinus1() { ...@@ -512,12 +512,12 @@ HConstant* HGraph::GetConstantMinus1() {
HConstant* HGraph::GetConstantTrue() { HConstant* HGraph::GetConstantTrue() {
return GetConstant(&constant_true_, HEAP->true_value()); return GetConstant(&constant_true_, isolate()->heap()->true_value());
} }
HConstant* HGraph::GetConstantFalse() { 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) { ...@@ -573,7 +573,8 @@ void HBasicBlock::FinishExit(HControlInstruction* instruction) {
HGraph::HGraph(CompilationInfo* info) HGraph::HGraph(CompilationInfo* info)
: next_block_id_(0), : isolate_(info->isolate()),
next_block_id_(0),
entry_block_(NULL), entry_block_(NULL),
blocks_(8), blocks_(8),
values_(16), values_(16),
...@@ -1248,12 +1249,12 @@ class HGlobalValueNumberer BASE_EMBEDDED { ...@@ -1248,12 +1249,12 @@ class HGlobalValueNumberer BASE_EMBEDDED {
info_(info), info_(info),
block_side_effects_(graph_->blocks()->length()), block_side_effects_(graph_->blocks()->length()),
loop_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()); block_side_effects_.AddBlock(0, graph_->blocks()->length());
loop_side_effects_.AddBlock(0, graph_->blocks()->length()); loop_side_effects_.AddBlock(0, graph_->blocks()->length());
} }
~HGlobalValueNumberer() { ~HGlobalValueNumberer() {
ASSERT(!HEAP->allow_allocation(true)); ASSERT(!info_->isolate()->heap()->allow_allocation(true));
} }
void Analyze(); void Analyze();
...@@ -2278,8 +2279,8 @@ void HGraphBuilder::SetupScope(Scope* scope) { ...@@ -2278,8 +2279,8 @@ void HGraphBuilder::SetupScope(Scope* scope) {
// We don't yet handle the function name for named function expressions. // We don't yet handle the function name for named function expressions.
if (scope->function() != NULL) BAILOUT("named function expression"); if (scope->function() != NULL) BAILOUT("named function expression");
HConstant* undefined_constant = HConstant* undefined_constant = new HConstant(
new HConstant(FACTORY->undefined_value(), Representation::Tagged()); isolate()->factory()->undefined_value(), Representation::Tagged());
AddInstruction(undefined_constant); AddInstruction(undefined_constant);
graph_->set_undefined_constant(undefined_constant); graph_->set_undefined_constant(undefined_constant);
...@@ -3625,7 +3626,8 @@ HInstruction* HGraphBuilder::BuildStoreKeyedFastElement(HValue* object, ...@@ -3625,7 +3626,8 @@ HInstruction* HGraphBuilder::BuildStoreKeyedFastElement(HValue* object,
ASSERT(map->has_fast_elements()); ASSERT(map->has_fast_elements());
AddInstruction(new HCheckMap(object, map)); AddInstruction(new HCheckMap(object, map));
HInstruction* elements = AddInstruction(new HLoadElements(object)); 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); bool is_array = (map->instance_type() == JS_ARRAY_TYPE);
HInstruction* length = NULL; HInstruction* length = NULL;
if (is_array) { if (is_array) {
...@@ -4975,7 +4977,7 @@ void HGraphBuilder::VisitCompareOperation(CompareOperation* expr) { ...@@ -4975,7 +4977,7 @@ void HGraphBuilder::VisitCompareOperation(CompareOperation* expr) {
Handle<JSFunction> candidate(JSFunction::cast(lookup.GetValue())); Handle<JSFunction> candidate(JSFunction::cast(lookup.GetValue()));
// If the function is in new space we assume it's more likely to // If the function is in new space we assume it's more likely to
// change and thus prefer the general IC code. // change and thus prefer the general IC code.
if (!Isolate::Current()->heap()->InNewSpace(*candidate)) { if (!isolate()->heap()->InNewSpace(*candidate)) {
target = candidate; target = candidate;
} }
} }
......
...@@ -281,6 +281,9 @@ class HGraph: public ZoneObject { ...@@ -281,6 +281,9 @@ class HGraph: public ZoneObject {
void InitializeInferredTypes(int from_inclusive, int to_inclusive); void InitializeInferredTypes(int from_inclusive, int to_inclusive);
void CheckForBackEdge(HBasicBlock* block, HBasicBlock* successor); void CheckForBackEdge(HBasicBlock* block, HBasicBlock* successor);
Isolate* isolate() { return isolate_; }
Isolate* isolate_;
int next_block_id_; int next_block_id_;
HBasicBlock* entry_block_; HBasicBlock* entry_block_;
HEnvironment* start_environment_; HEnvironment* start_environment_;
......
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