Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(690)

Unified Diff: src/hydrogen.h

Issue 20767002: Merge 15827, 15842, and 15912 into 3.19 (Closed) Base URL: https://v8.googlecode.com/svn/branches/3.19
Patch Set: Final version Created 7 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/code-stubs-hydrogen.cc ('k') | src/hydrogen.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/hydrogen.h
diff --git a/src/hydrogen.h b/src/hydrogen.h
index 82c134269be688049a649261539deaf683a63273..bc5fa7f36ae0ab8d5616b697729ba70e63ab8b65 100644
--- a/src/hydrogen.h
+++ b/src/hydrogen.h
@@ -136,17 +136,15 @@ class HBasicBlock: public ZoneObject {
}
int PredecessorIndexOf(HBasicBlock* predecessor) const;
- void AddSimulate(BailoutId ast_id,
- RemovableSimulate removable = FIXED_SIMULATE) {
- AddInstruction(CreateSimulate(ast_id, removable));
+ HSimulate* AddSimulate(BailoutId ast_id,
+ RemovableSimulate removable = FIXED_SIMULATE) {
+ HSimulate* instr = CreateSimulate(ast_id, removable);
+ AddInstruction(instr);
+ return instr;
}
void AssignCommonDominator(HBasicBlock* other);
void AssignLoopSuccessorDominators();
- void FinishExitWithDeoptimization(HDeoptimize::UseEnvironment has_uses) {
- FinishExit(CreateDeoptimize(has_uses));
- }
-
// Add the inlined function exit sequence, adding an HLeaveInlined
// instruction and updating the bailout environment.
void AddLeaveInlined(HValue* return_value, FunctionState* state);
@@ -181,11 +179,12 @@ class HBasicBlock: public ZoneObject {
#endif
private:
+ friend class HGraphBuilder;
+
void RegisterPredecessor(HBasicBlock* pred);
void AddDominatedBlock(HBasicBlock* block);
HSimulate* CreateSimulate(BailoutId ast_id, RemovableSimulate removable);
- HDeoptimize* CreateDeoptimize(HDeoptimize::UseEnvironment has_uses);
int block_id_;
HGraph* graph_;
@@ -991,8 +990,6 @@ class HGraphBuilder {
// Adding instructions.
HInstruction* AddInstruction(HInstruction* instr);
- void AddSimulate(BailoutId id,
- RemovableSimulate removable = FIXED_SIMULATE);
HBoundsCheck* AddBoundsCheck(HValue* index, HValue* length);
HReturn* AddReturn(HValue* value);
@@ -1005,6 +1002,18 @@ class HGraphBuilder {
no_side_effects_scope_count_--;
}
+ void FinishExitWithHardDeoptimization(HBasicBlock* continuation);
+
+ template<class I, class P1>
+ I* Add(P1 p1) {
+ return I::cast(AddInstruction(new (zone()) I(p1)));
+ }
+
+ template<class I, class P1, class P2>
+ I* Add(P1 p1, P2 p2) {
+ return I::cast(AddInstruction(new (zone()) I(p1, p2)));
+ }
+
protected:
virtual bool BuildGraph() = 0;
@@ -1183,7 +1192,6 @@ class HGraphBuilder {
void ElseDeopt() {
Else();
Deopt();
- End();
}
void Return(HValue* value);
@@ -1196,6 +1204,8 @@ class HGraphBuilder {
HGraphBuilder* builder_;
int position_;
bool finished_ : 1;
+ bool deopt_then_ : 1;
+ bool deopt_else_ : 1;
bool did_then_ : 1;
bool did_else_ : 1;
bool did_and_ : 1;
@@ -1374,6 +1384,10 @@ class HGraphBuilder {
private:
HGraphBuilder();
+
+ void PadEnvironmentForContinuation(HBasicBlock* from,
+ HBasicBlock* continuation);
+
CompilationInfo* info_;
HGraph* graph_;
HBasicBlock* current_block_;
@@ -1381,6 +1395,55 @@ class HGraphBuilder {
};
+template<>
+inline HDeoptimize* HGraphBuilder::Add(Deoptimizer::BailoutType type) {
+ if (type == Deoptimizer::SOFT) {
+ if (FLAG_always_opt) return NULL;
+ }
+ if (current_block()->IsDeoptimizing()) return NULL;
+ HDeoptimize* instr = new(zone()) HDeoptimize(type);
+ AddInstruction(instr);
+ if (type == Deoptimizer::SOFT) {
+ graph()->set_has_soft_deoptimize(true);
+ }
+ current_block()->MarkAsDeoptimizing();
+ return instr;
+}
+
+
+template<>
+inline HSimulate* HGraphBuilder::Add(BailoutId id,
+ RemovableSimulate removable) {
+ HSimulate* instr = current_block()->CreateSimulate(id, removable);
+ AddInstruction(instr);
+ return instr;
+}
+
+
+template<>
+inline HSimulate* HGraphBuilder::Add(BailoutId id) {
+ return Add<HSimulate>(id, FIXED_SIMULATE);
+}
+
+
+template<>
+inline HReturn* HGraphBuilder::Add(HValue* value) {
+ HValue* context = environment()->LookupContext();
+ int num_parameters = graph()->info()->num_parameters();
+ HValue* params = Add<HConstant>(num_parameters);
+ HReturn* return_instruction = new(graph()->zone())
+ HReturn(value, context, params);
+ current_block()->FinishExit(return_instruction);
+ return return_instruction;
+}
+
+
+template<>
+inline HReturn* HGraphBuilder::Add(HConstant* p1) {
+ return Add<HReturn>(static_cast<HValue*>(p1));
+}
+
+
class HOptimizedGraphBuilder: public HGraphBuilder, public AstVisitor {
public:
// A class encapsulating (lazily-allocated) break and continue blocks for
@@ -1446,8 +1509,6 @@ class HOptimizedGraphBuilder: public HGraphBuilder, public AstVisitor {
bool inline_bailout() { return inline_bailout_; }
- void AddSoftDeoptimize();
-
void Bailout(const char* reason);
HBasicBlock* CreateJoin(HBasicBlock* first,
« no previous file with comments | « src/code-stubs-hydrogen.cc ('k') | src/hydrogen.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698