| Index: src/hydrogen.h
|
| diff --git a/src/hydrogen.h b/src/hydrogen.h
|
| index 7d9a7affb8f10f4faac1fb7ba9672e1ab963c558..cb72426a7641ee32f066619d6c6303755cb704e5 100644
|
| --- a/src/hydrogen.h
|
| +++ b/src/hydrogen.h
|
| @@ -109,11 +109,6 @@ class HBasicBlock: public ZoneObject {
|
| int LoopNestingDepth() const;
|
|
|
| void SetInitialEnvironment(HEnvironment* env);
|
| - void ClearEnvironment() {
|
| - ASSERT(IsFinished());
|
| - ASSERT(end()->SuccessorCount() == 0);
|
| - last_environment_ = NULL;
|
| - }
|
| bool HasEnvironment() const { return last_environment_ != NULL; }
|
| void UpdateEnvironment(HEnvironment* env);
|
| HBasicBlock* parent_loop_header() const { return parent_loop_header_; }
|
| @@ -137,17 +132,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 +175,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 +1017,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_++;
|
| }
|
| @@ -1042,6 +1031,8 @@ class HGraphBuilder {
|
| HBasicBlock* CreateBasicBlock(HEnvironment* env);
|
| HBasicBlock* CreateLoopHeaderBlock();
|
|
|
| + void Deoptimize(HBasicBlock* continuation);
|
| +
|
| HValue* BuildCheckHeapObject(HValue* object);
|
| HValue* BuildCheckMap(HValue* obj, Handle<Map> map);
|
|
|
| @@ -1118,13 +1109,6 @@ 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);
|
| -
|
| class IfBuilder {
|
| public:
|
| explicit IfBuilder(HGraphBuilder* builder,
|
| @@ -1228,7 +1212,6 @@ class HGraphBuilder {
|
| void ElseDeopt() {
|
| Else();
|
| Deopt();
|
| - End();
|
| }
|
|
|
| void Return(HValue* value);
|
| @@ -1428,6 +1411,51 @@ class HGraphBuilder {
|
| int no_side_effects_scope_count_;
|
| };
|
|
|
| +
|
| +template<>
|
| +inline HDeoptimize* HGraphBuilder::Add(Deoptimizer::BailoutType type) {
|
| + isolate()->counters()->soft_deopts_requested()->Increment();
|
| + 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 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 +1769,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,
|
|
|