Revision: 7282 Author: [email protected] Date: Mon Mar 21 04:57:59 2011 Log: Clean up Isolate usages in ast visitor and hydrogen.
Review URL: http://codereview.chromium.org/6688066 http://code.google.com/p/v8/source/detail?r=7282 Modified: /branches/bleeding_edge/src/ast.cc /branches/bleeding_edge/src/ast.h /branches/bleeding_edge/src/full-codegen.cc /branches/bleeding_edge/src/full-codegen.h /branches/bleeding_edge/src/hydrogen.cc /branches/bleeding_edge/src/hydrogen.h ======================================= --- /branches/bleeding_edge/src/ast.cc Fri Mar 18 13:35:07 2011 +++ /branches/bleeding_edge/src/ast.cc Mon Mar 21 04:57:59 2011 @@ -700,7 +700,7 @@ bool AstVisitor::CheckStackOverflow() { if (stack_overflow_) return true; - StackLimitCheck check(Isolate::Current()); + StackLimitCheck check(isolate_); if (!check.HasOverflowed()) return false; return (stack_overflow_ = true); } ======================================= --- /branches/bleeding_edge/src/ast.h Fri Mar 18 13:35:07 2011 +++ /branches/bleeding_edge/src/ast.h Mon Mar 21 04:57:59 2011 @@ -2180,7 +2180,7 @@ class AstVisitor BASE_EMBEDDED { public: - AstVisitor() : stack_overflow_(false) { } + AstVisitor() : isolate_(Isolate::Current()), stack_overflow_(false) { } virtual ~AstVisitor() { } // Stack overflow check and dynamic dispatch. @@ -2209,8 +2209,12 @@ virtual void Visit##type(type* node) = 0; AST_NODE_LIST(DEF_VISIT) #undef DEF_VISIT + + protected: + Isolate* isolate() { return isolate_; } private: + Isolate* isolate_; bool stack_overflow_; }; ======================================= --- /branches/bleeding_edge/src/full-codegen.cc Fri Mar 18 13:35:07 2011 +++ /branches/bleeding_edge/src/full-codegen.cc Mon Mar 21 04:57:59 2011 @@ -275,7 +275,7 @@ #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(); ======================================= --- /branches/bleeding_edge/src/full-codegen.h Fri Mar 18 13:35:07 2011 +++ /branches/bleeding_edge/src/full-codegen.h Mon Mar 21 04:57:59 2011 @@ -77,8 +77,7 @@ }; explicit FullCodeGenerator(MacroAssembler* masm) - : isolate_(Isolate::Current()), - masm_(masm), + : masm_(masm), info_(NULL), nesting_stack_(NULL), loop_depth_(0), @@ -494,7 +493,6 @@ loop_depth_--; } - Isolate* isolate() { return isolate_; } MacroAssembler* masm() { return masm_; } class ExpressionContext; @@ -733,7 +731,6 @@ virtual bool IsEffect() const { return true; } }; - Isolate* isolate_; MacroAssembler* masm_; CompilationInfo* info_; Label return_label_; ======================================= --- /branches/bleeding_edge/src/hydrogen.cc Fri Mar 18 13:35:07 2011 +++ /branches/bleeding_edge/src/hydrogen.cc Mon Mar 21 04:57:59 2011 @@ -512,12 +512,12 @@ 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 @@ 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 @@ 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 @@ // 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 @@ 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 @@ 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; } } ======================================= --- /branches/bleeding_edge/src/hydrogen.h Fri Mar 18 12:41:05 2011 +++ /branches/bleeding_edge/src/hydrogen.h Mon Mar 21 04:57:59 2011 @@ -281,6 +281,9 @@ 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_; -- v8-dev mailing list [email protected] http://groups.google.com/group/v8-dev
