Chromium Code Reviews| Index: src/hydrogen.h |
| diff --git a/src/hydrogen.h b/src/hydrogen.h |
| index 7d9a7affb8f10f4faac1fb7ba9672e1ab963c558..3e19fc1b8346d34f0cee55463c72fc7b18e9b858 100644 |
| --- a/src/hydrogen.h |
| +++ b/src/hydrogen.h |
| @@ -137,17 +137,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); |
| @@ -182,11 +180,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_; |
| @@ -1023,11 +1022,6 @@ class HGraphBuilder { |
| new(zone()) I(p1, p2, p3, p4, p5, p6, p7, p8))); |
| } |
| - void AddSimulate(BailoutId id, |
| - RemovableSimulate removable = FIXED_SIMULATE); |
| - |
| - HReturn* AddReturn(HValue* value); |
| - |
| void IncrementInNoSideEffectsScope() { |
| no_side_effects_scope_count_++; |
| } |
| @@ -1118,12 +1112,7 @@ class HGraphBuilder { |
| HValue* AddLoadJSBuiltin(Builtins::JavaScript builtin, HValue* context); |
| - enum SoftDeoptimizeMode { |
| - MUST_EMIT_SOFT_DEOPT, |
| - CAN_OMIT_SOFT_DEOPT |
| - }; |
| - |
| - void AddSoftDeoptimize(SoftDeoptimizeMode mode = CAN_OMIT_SOFT_DEOPT); |
| + void FinishExitWithHardDeoptimization(HBasicBlock* continuation); |
| class IfBuilder { |
| public: |
| @@ -1228,7 +1217,6 @@ class HGraphBuilder { |
| void ElseDeopt() { |
| Else(); |
| Deopt(); |
| - End(); |
| } |
| void Return(HValue* value); |
| @@ -1241,6 +1229,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; |
| @@ -1422,12 +1412,70 @@ class HGraphBuilder { |
| private: |
| HGraphBuilder(); |
| + |
| + void PadEnvironmentForContinuation(HBasicBlock* from, |
| + HBasicBlock* continuation); |
| + |
| CompilationInfo* info_; |
| HGraph* graph_; |
| HBasicBlock* current_block_; |
| int no_side_effects_scope_count_; |
| }; |
| + |
| +template<> |
| +inline HDeoptimize* HGraphBuilder::Add(Deoptimizer::BailoutType type) { |
| + isolate()->counters()->soft_deopts_requested()->Increment(); |
|
Jakob Kummerow
2013/07/22 16:53:12
This sounds pretty SOFT-deopt specific. I think th
danno
2013/07/23 12:18:14
Good catch. Done.
On 2013/07/22 16:53:12, Jakob wr
|
| + if (FLAG_always_opt && type == Deoptimizer::SOFT) return NULL; |
| + if (current_block()->IsDeoptimizing()) return NULL; |
| + HDeoptimize* instr = new(zone()) HDeoptimize(type); |
| + AddInstruction(instr); |
| + isolate()->counters()->soft_deopts_inserted()->Increment(); |
| + current_block()->MarkAsDeoptimizing(); |
| + graph()->set_has_soft_deoptimize(true); |
| + return instr; |
| +} |
| + |
| + |
| +template<> |
| +inline HDeoptimize* HGraphBuilder::Add() { |
| + return Add<HDeoptimize>(Deoptimizer::SOFT); |
| +} |
| + |
| + |
| +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 |
| @@ -1741,6 +1789,15 @@ class HOptimizedGraphBuilder: public HGraphBuilder, public AstVisitor { |
| HValue* object, |
| SmallMapList* types, |
| Handle<String> name); |
| + |
| + void HandlePolymorphicStoreNamedFieldHelper(HValue* object, |
| + Handle<String> name, |
| + HValue* value, |
| + SmallMapList* types, |
| + int current_type, |
| + int stored_count, |
| + int position); |
| + |
| void HandlePolymorphicStoreNamedField(BailoutId id, |
| int position, |
| BailoutId assignment_id, |