Reviewers: Mads Ager,
Description:
Clean up Isolate usages in ast visitor and hydrogen.
Please review this at http://codereview.chromium.org/6688066/
Affected files:
M src/ast.h
M src/ast.cc
M src/full-codegen.h
M src/hydrogen.h
M src/hydrogen.cc
Index: src/ast.cc
diff --git a/src/ast.cc b/src/ast.cc
index
a61632243b7193232efd83b883e1d9b60e28fcd1..3912773580513fdaaf06ec475da7b9d4881802dd
100644
--- a/src/ast.cc
+++ b/src/ast.cc
@@ -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);
}
Index: src/ast.h
diff --git a/src/ast.h b/src/ast.h
index
19d3580c4bf48dca3779864922ae2702ab843a87..ea365073823846d3dfa4ff19dd819a320a93bfd9
100644
--- a/src/ast.h
+++ b/src/ast.h
@@ -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_;
};
Index: src/full-codegen.h
diff --git a/src/full-codegen.h b/src/full-codegen.h
index
e76d679d86861caf047a214106f821bd2b653eab..d6ed1b9ff0385917e36f6dc6f187b9e09091e1cc
100644
--- a/src/full-codegen.h
+++ b/src/full-codegen.h
@@ -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_;
Index: src/hydrogen.cc
diff --git a/src/hydrogen.cc b/src/hydrogen.cc
index
3fffd84c0e814438707ae0401ac2894083e93345..ded4fbf2946189ff17e6bc9c4a9a8aeac77efc80
100644
--- a/src/hydrogen.cc
+++ b/src/hydrogen.cc
@@ -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());
}
@@ -1248,12 +1248,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 +2278,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 +3625,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 +4976,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;
}
}
Index: src/hydrogen.h
diff --git a/src/hydrogen.h b/src/hydrogen.h
index
5aa3ec99278528df4800f2e2b1d12a68c7f8ac34..dee78666cb208c0efa645f38ca94a847f407ff5c
100644
--- a/src/hydrogen.h
+++ b/src/hydrogen.h
@@ -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_;
--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev