Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
| 2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
| 3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
| 4 // met: | 4 // met: |
| 5 // | 5 // |
| 6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
| 7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
| 8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
| 9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
| 10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 60 | 60 |
| 61 // Simple accessors. | 61 // Simple accessors. |
| 62 int block_id() const { return block_id_; } | 62 int block_id() const { return block_id_; } |
| 63 void set_block_id(int id) { block_id_ = id; } | 63 void set_block_id(int id) { block_id_ = id; } |
| 64 HGraph* graph() const { return graph_; } | 64 HGraph* graph() const { return graph_; } |
| 65 Isolate* isolate() const; | 65 Isolate* isolate() const; |
| 66 const ZoneList<HPhi*>* phis() const { return &phis_; } | 66 const ZoneList<HPhi*>* phis() const { return &phis_; } |
| 67 HInstruction* first() const { return first_; } | 67 HInstruction* first() const { return first_; } |
| 68 HInstruction* last() const { return last_; } | 68 HInstruction* last() const { return last_; } |
| 69 void set_last(HInstruction* instr) { last_ = instr; } | 69 void set_last(HInstruction* instr) { last_ = instr; } |
| 70 HInstruction* GetLastInstruction(); | |
| 71 HControlInstruction* end() const { return end_; } | 70 HControlInstruction* end() const { return end_; } |
| 72 HLoopInformation* loop_information() const { return loop_information_; } | 71 HLoopInformation* loop_information() const { return loop_information_; } |
| 73 const ZoneList<HBasicBlock*>* predecessors() const { return &predecessors_; } | 72 const ZoneList<HBasicBlock*>* predecessors() const { return &predecessors_; } |
| 74 bool HasPredecessor() const { return predecessors_.length() > 0; } | 73 bool HasPredecessor() const { return predecessors_.length() > 0; } |
| 75 const ZoneList<HBasicBlock*>* dominated_blocks() const { | 74 const ZoneList<HBasicBlock*>* dominated_blocks() const { |
| 76 return &dominated_blocks_; | 75 return &dominated_blocks_; |
| 77 } | 76 } |
| 78 const ZoneList<int>* deleted_phis() const { | 77 const ZoneList<int>* deleted_phis() const { |
| 79 return &deleted_phis_; | 78 return &deleted_phis_; |
| 80 } | 79 } |
| (...skipping 24 matching lines...) Expand all Loading... | |
| 105 bool IsFinished() const { return end_ != NULL; } | 104 bool IsFinished() const { return end_ != NULL; } |
| 106 void AddPhi(HPhi* phi); | 105 void AddPhi(HPhi* phi); |
| 107 void RemovePhi(HPhi* phi); | 106 void RemovePhi(HPhi* phi); |
| 108 void AddInstruction(HInstruction* instr); | 107 void AddInstruction(HInstruction* instr); |
| 109 bool Dominates(HBasicBlock* other) const; | 108 bool Dominates(HBasicBlock* other) const; |
| 110 int LoopNestingDepth() const; | 109 int LoopNestingDepth() const; |
| 111 | 110 |
| 112 void SetInitialEnvironment(HEnvironment* env); | 111 void SetInitialEnvironment(HEnvironment* env); |
| 113 void ClearEnvironment() { last_environment_ = NULL; } | 112 void ClearEnvironment() { last_environment_ = NULL; } |
| 114 bool HasEnvironment() const { return last_environment_ != NULL; } | 113 bool HasEnvironment() const { return last_environment_ != NULL; } |
| 115 void UpdateEnvironment(HEnvironment* env) { last_environment_ = env; } | 114 void UpdateEnvironment(HEnvironment* env); |
| 116 HBasicBlock* parent_loop_header() const { return parent_loop_header_; } | 115 HBasicBlock* parent_loop_header() const { return parent_loop_header_; } |
| 117 | 116 |
| 118 void set_parent_loop_header(HBasicBlock* block) { | 117 void set_parent_loop_header(HBasicBlock* block) { |
| 119 ASSERT(parent_loop_header_ == NULL); | 118 ASSERT(parent_loop_header_ == NULL); |
| 120 parent_loop_header_ = block; | 119 parent_loop_header_ = block; |
| 121 } | 120 } |
| 122 | 121 |
| 123 bool HasParentLoopHeader() const { return parent_loop_header_ != NULL; } | 122 bool HasParentLoopHeader() const { return parent_loop_header_ != NULL; } |
| 124 | 123 |
| 125 void SetJoinId(BailoutId ast_id); | 124 void SetJoinId(BailoutId ast_id); |
| (...skipping 23 matching lines...) Expand all Loading... | |
| 149 // instruction and updating the bailout environment. | 148 // instruction and updating the bailout environment. |
| 150 void AddLeaveInlined(HValue* return_value, FunctionState* state); | 149 void AddLeaveInlined(HValue* return_value, FunctionState* state); |
| 151 | 150 |
| 152 // If a target block is tagged as an inline function return, all | 151 // If a target block is tagged as an inline function return, all |
| 153 // predecessors should contain the inlined exit sequence: | 152 // predecessors should contain the inlined exit sequence: |
| 154 // | 153 // |
| 155 // LeaveInlined | 154 // LeaveInlined |
| 156 // Simulate (caller's environment) | 155 // Simulate (caller's environment) |
| 157 // Goto (target block) | 156 // Goto (target block) |
| 158 bool IsInlineReturnTarget() const { return is_inline_return_target_; } | 157 bool IsInlineReturnTarget() const { return is_inline_return_target_; } |
| 159 void MarkAsInlineReturnTarget() { is_inline_return_target_ = true; } | 158 void MarkAsInlineReturnTarget(HBasicBlock* enter_inlined_block) { |
|
titzer
2013/05/23 12:34:55
This name is somewhat difficult to parse. Is this
Jakob Kummerow
2013/05/24 09:49:35
Done. (It's the block containing the HEnterInlined
| |
| 159 is_inline_return_target_ = true; | |
| 160 enter_inlined_block_ = enter_inlined_block; | |
| 161 } | |
| 162 HBasicBlock* enter_inlined_block() { return enter_inlined_block_; } | |
| 160 | 163 |
| 161 bool IsDeoptimizing() const { return is_deoptimizing_; } | 164 bool IsDeoptimizing() const { return is_deoptimizing_; } |
| 162 void MarkAsDeoptimizing() { is_deoptimizing_ = true; } | 165 void MarkAsDeoptimizing() { is_deoptimizing_ = true; } |
| 163 | 166 |
| 164 bool IsLoopSuccessorDominator() const { | 167 bool IsLoopSuccessorDominator() const { |
| 165 return dominates_loop_successors_; | 168 return dominates_loop_successors_; |
| 166 } | 169 } |
| 167 void MarkAsLoopSuccessorDominator() { | 170 void MarkAsLoopSuccessorDominator() { |
| 168 dominates_loop_successors_ = true; | 171 dominates_loop_successors_ = true; |
| 169 } | 172 } |
| (...skipping 22 matching lines...) Expand all Loading... | |
| 192 HBasicBlock* dominator_; | 195 HBasicBlock* dominator_; |
| 193 ZoneList<HBasicBlock*> dominated_blocks_; | 196 ZoneList<HBasicBlock*> dominated_blocks_; |
| 194 HEnvironment* last_environment_; | 197 HEnvironment* last_environment_; |
| 195 // Outgoing parameter count at block exit, set during lithium translation. | 198 // Outgoing parameter count at block exit, set during lithium translation. |
| 196 int argument_count_; | 199 int argument_count_; |
| 197 // Instruction indices into the lithium code stream. | 200 // Instruction indices into the lithium code stream. |
| 198 int first_instruction_index_; | 201 int first_instruction_index_; |
| 199 int last_instruction_index_; | 202 int last_instruction_index_; |
| 200 ZoneList<int> deleted_phis_; | 203 ZoneList<int> deleted_phis_; |
| 201 HBasicBlock* parent_loop_header_; | 204 HBasicBlock* parent_loop_header_; |
| 202 bool is_inline_return_target_; | 205 // For blocks marked as inline return target: the block with HEnterInlined. |
| 203 bool is_deoptimizing_; | 206 HBasicBlock* enter_inlined_block_; |
| 204 bool dominates_loop_successors_; | 207 bool is_inline_return_target_ : 1; |
| 205 bool is_osr_entry_; | 208 bool is_deoptimizing_ : 1; |
| 209 bool dominates_loop_successors_ : 1; | |
| 210 bool is_osr_entry_ : 1; | |
| 206 }; | 211 }; |
| 207 | 212 |
| 208 | 213 |
| 209 class HPredecessorIterator BASE_EMBEDDED { | 214 class HPredecessorIterator BASE_EMBEDDED { |
| 210 public: | 215 public: |
| 211 explicit HPredecessorIterator(HBasicBlock* block) | 216 explicit HPredecessorIterator(HBasicBlock* block) |
| 212 : predecessor_list_(block->predecessors()), current_(0) { } | 217 : predecessor_list_(block->predecessors()), current_(0) { } |
| 213 | 218 |
| 214 bool Done() { return current_ >= predecessor_list_->length(); } | 219 bool Done() { return current_ >= predecessor_list_->length(); } |
| 215 HBasicBlock* Current() { return predecessor_list_->at(current_); } | 220 HBasicBlock* Current() { return predecessor_list_->at(current_); } |
| (...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 279 void EliminateRedundantPhis(); | 284 void EliminateRedundantPhis(); |
| 280 void Canonicalize(); | 285 void Canonicalize(); |
| 281 void OrderBlocks(); | 286 void OrderBlocks(); |
| 282 void AssignDominators(); | 287 void AssignDominators(); |
| 283 void SetupInformativeDefinitions(); | 288 void SetupInformativeDefinitions(); |
| 284 void EliminateRedundantBoundsChecks(); | 289 void EliminateRedundantBoundsChecks(); |
| 285 void DehoistSimpleArrayIndexComputations(); | 290 void DehoistSimpleArrayIndexComputations(); |
| 286 void RestoreActualValues(); | 291 void RestoreActualValues(); |
| 287 void DeadCodeElimination(const char *phase_name); | 292 void DeadCodeElimination(const char *phase_name); |
| 288 void PropagateDeoptimizingMark(); | 293 void PropagateDeoptimizingMark(); |
| 294 void EnvironmentLivenessAnalysis(); | |
| 289 | 295 |
| 290 // Returns false if there are phi-uses of the arguments-object | 296 // Returns false if there are phi-uses of the arguments-object |
| 291 // which are not supported by the optimizing compiler. | 297 // which are not supported by the optimizing compiler. |
| 292 bool CheckArgumentsPhiUses(); | 298 bool CheckArgumentsPhiUses(); |
| 293 | 299 |
| 294 // Returns false if there are phi-uses of an uninitialized const | 300 // Returns false if there are phi-uses of an uninitialized const |
| 295 // which are not supported by the optimizing compiler. | 301 // which are not supported by the optimizing compiler. |
| 296 bool CheckConstPhiUses(); | 302 bool CheckConstPhiUses(); |
| 297 | 303 |
| 298 void CollectPhis(); | 304 void CollectPhis(); |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 356 | 362 |
| 357 void set_osr_values(ZoneList<HUnknownOSRValue*>* values) { | 363 void set_osr_values(ZoneList<HUnknownOSRValue*>* values) { |
| 358 osr_values_.set(values); | 364 osr_values_.set(values); |
| 359 } | 365 } |
| 360 | 366 |
| 361 int update_type_change_checksum(int delta) { | 367 int update_type_change_checksum(int delta) { |
| 362 type_change_checksum_ += delta; | 368 type_change_checksum_ += delta; |
| 363 return type_change_checksum_; | 369 return type_change_checksum_; |
| 364 } | 370 } |
| 365 | 371 |
| 372 void update_biggest_environment_ever(int environment_size) { | |
|
titzer
2013/05/23 12:34:55
Cute name, but "maximum_environment_size" would al
Jakob Kummerow
2013/05/24 09:49:35
Done.
| |
| 373 if (environment_size > biggest_environment_ever_) { | |
| 374 biggest_environment_ever_ = environment_size; | |
| 375 } | |
| 376 } | |
| 377 | |
| 366 bool use_optimistic_licm() { | 378 bool use_optimistic_licm() { |
| 367 return use_optimistic_licm_; | 379 return use_optimistic_licm_; |
| 368 } | 380 } |
| 369 | 381 |
| 370 void set_use_optimistic_licm(bool value) { | 382 void set_use_optimistic_licm(bool value) { |
| 371 use_optimistic_licm_ = value; | 383 use_optimistic_licm_ = value; |
| 372 } | 384 } |
| 373 | 385 |
| 374 bool has_soft_deoptimize() { | 386 bool has_soft_deoptimize() { |
| 375 return has_soft_deoptimize_; | 387 return has_soft_deoptimize_; |
| (...skipping 28 matching lines...) Expand all Loading... | |
| 404 | 416 |
| 405 private: | 417 private: |
| 406 HConstant* GetConstantInt32(SetOncePointer<HConstant>* pointer, | 418 HConstant* GetConstantInt32(SetOncePointer<HConstant>* pointer, |
| 407 int32_t integer_value); | 419 int32_t integer_value); |
| 408 HConstant* GetConstantSmi(SetOncePointer<HConstant>* pointer, | 420 HConstant* GetConstantSmi(SetOncePointer<HConstant>* pointer, |
| 409 int32_t integer_value); | 421 int32_t integer_value); |
| 410 | 422 |
| 411 void MarkLive(HValue* ref, HValue* instr, ZoneList<HValue*>* worklist); | 423 void MarkLive(HValue* ref, HValue* instr, ZoneList<HValue*>* worklist); |
| 412 void MarkLiveInstructions(); | 424 void MarkLiveInstructions(); |
| 413 void RemoveDeadInstructions(); | 425 void RemoveDeadInstructions(); |
| 426 void ZapEnvironmentSlot(int index, HSimulate* simulate); | |
|
titzer
2013/05/23 12:34:55
Maybe "Kill" or "Null" or "Remove"?
Jakob Kummerow
2013/05/24 09:49:35
We use "zap" in other places, so I'd like to keep
| |
| 414 void MarkAsDeoptimizingRecursively(HBasicBlock* block); | 427 void MarkAsDeoptimizingRecursively(HBasicBlock* block); |
| 415 void NullifyUnreachableInstructions(); | 428 void NullifyUnreachableInstructions(); |
| 416 void InsertTypeConversions(HInstruction* instr); | 429 void InsertTypeConversions(HInstruction* instr); |
| 417 void PropagateMinusZeroChecks(HValue* value, BitVector* visited); | 430 void PropagateMinusZeroChecks(HValue* value, BitVector* visited); |
| 418 void RecursivelyMarkPhiDeoptimizeOnUndefined(HPhi* phi); | 431 void RecursivelyMarkPhiDeoptimizeOnUndefined(HPhi* phi); |
| 419 void InsertRepresentationChangeForUse(HValue* value, | 432 void InsertRepresentationChangeForUse(HValue* value, |
| 420 HValue* use_value, | 433 HValue* use_value, |
| 421 int use_index, | 434 int use_index, |
| 422 Representation to); | 435 Representation to); |
| 423 void InsertRepresentationChangesForValue(HValue* value); | 436 void InsertRepresentationChangesForValue(HValue* value); |
| (...skipping 29 matching lines...) Expand all Loading... | |
| 453 SetOncePointer<ZoneList<HUnknownOSRValue*> > osr_values_; | 466 SetOncePointer<ZoneList<HUnknownOSRValue*> > osr_values_; |
| 454 | 467 |
| 455 CompilationInfo* info_; | 468 CompilationInfo* info_; |
| 456 Zone* zone_; | 469 Zone* zone_; |
| 457 | 470 |
| 458 bool is_recursive_; | 471 bool is_recursive_; |
| 459 bool use_optimistic_licm_; | 472 bool use_optimistic_licm_; |
| 460 bool has_soft_deoptimize_; | 473 bool has_soft_deoptimize_; |
| 461 bool depends_on_empty_array_proto_elements_; | 474 bool depends_on_empty_array_proto_elements_; |
| 462 int type_change_checksum_; | 475 int type_change_checksum_; |
| 476 int biggest_environment_ever_; | |
| 463 | 477 |
| 464 DISALLOW_COPY_AND_ASSIGN(HGraph); | 478 DISALLOW_COPY_AND_ASSIGN(HGraph); |
| 465 }; | 479 }; |
| 466 | 480 |
| 467 | 481 |
| 468 Zone* HBasicBlock::zone() const { return graph_->zone(); } | 482 Zone* HBasicBlock::zone() const { return graph_->zone(); } |
| 469 | 483 |
| 470 | 484 |
| 471 // Type of stack frame an environment might refer to. | 485 // Type of stack frame an environment might refer to. |
| 472 enum FrameType { | 486 enum FrameType { |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 514 | 528 |
| 515 int length() const { return values_.length(); } | 529 int length() const { return values_.length(); } |
| 516 bool is_special_index(int i) const { | 530 bool is_special_index(int i) const { |
| 517 return i >= parameter_count() && i < parameter_count() + specials_count(); | 531 return i >= parameter_count() && i < parameter_count() + specials_count(); |
| 518 } | 532 } |
| 519 | 533 |
| 520 int first_expression_index() const { | 534 int first_expression_index() const { |
| 521 return parameter_count() + specials_count() + local_count(); | 535 return parameter_count() + specials_count() + local_count(); |
| 522 } | 536 } |
| 523 | 537 |
| 538 int first_local_index() const { | |
| 539 return parameter_count() + specials_count(); | |
| 540 } | |
| 541 | |
| 524 void Bind(Variable* variable, HValue* value) { | 542 void Bind(Variable* variable, HValue* value) { |
| 525 Bind(IndexFor(variable), value); | 543 Bind(IndexFor(variable), value); |
| 526 } | 544 } |
| 527 | 545 |
| 528 void Bind(int index, HValue* value); | 546 void Bind(int index, HValue* value); |
| 529 | 547 |
| 530 void BindContext(HValue* value) { | 548 void BindContext(HValue* value) { |
| 531 Bind(parameter_count(), value); | 549 Bind(parameter_count(), value); |
| 532 } | 550 } |
| 533 | 551 |
| (...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 611 pop_count_ = 0; | 629 pop_count_ = 0; |
| 612 push_count_ = 0; | 630 push_count_ = 0; |
| 613 assigned_variables_.Clear(); | 631 assigned_variables_.Clear(); |
| 614 } | 632 } |
| 615 | 633 |
| 616 void SetValueAt(int index, HValue* value) { | 634 void SetValueAt(int index, HValue* value) { |
| 617 ASSERT(index < length()); | 635 ASSERT(index < length()); |
| 618 values_[index] = value; | 636 values_[index] = value; |
| 619 } | 637 } |
| 620 | 638 |
| 639 // Map a variable to an environment index. Parameter indices are shifted | |
| 640 // by 1 (receiver is parameter index -1 but environment index 0). | |
| 641 // Stack-allocated local indices are shifted by the number of parameters. | |
| 642 int IndexFor(Variable* variable) const { | |
| 643 ASSERT(variable->IsStackAllocated()); | |
| 644 int shift = variable->IsParameter() | |
| 645 ? 1 | |
| 646 : parameter_count_ + specials_count_; | |
| 647 return variable->index() + shift; | |
| 648 } | |
| 649 | |
| 650 bool is_local_index(int i) const { | |
| 651 return i >= first_local_index() && | |
| 652 i < first_expression_index(); | |
| 653 } | |
| 654 | |
| 621 void PrintTo(StringStream* stream); | 655 void PrintTo(StringStream* stream); |
| 622 void PrintToStd(); | 656 void PrintToStd(); |
| 623 | 657 |
| 624 Zone* zone() const { return zone_; } | 658 Zone* zone() const { return zone_; } |
| 625 | 659 |
| 626 private: | 660 private: |
| 627 HEnvironment(const HEnvironment* other, Zone* zone); | 661 HEnvironment(const HEnvironment* other, Zone* zone); |
| 628 | 662 |
| 629 HEnvironment(HEnvironment* outer, | 663 HEnvironment(HEnvironment* outer, |
| 630 Handle<JSFunction> closure, | 664 Handle<JSFunction> closure, |
| 631 FrameType frame_type, | 665 FrameType frame_type, |
| 632 int arguments, | 666 int arguments, |
| 633 Zone* zone); | 667 Zone* zone); |
| 634 | 668 |
| 635 // Create an artificial stub environment (e.g. for argument adaptor or | 669 // Create an artificial stub environment (e.g. for argument adaptor or |
| 636 // constructor stub). | 670 // constructor stub). |
| 637 HEnvironment* CreateStubEnvironment(HEnvironment* outer, | 671 HEnvironment* CreateStubEnvironment(HEnvironment* outer, |
| 638 Handle<JSFunction> target, | 672 Handle<JSFunction> target, |
| 639 FrameType frame_type, | 673 FrameType frame_type, |
| 640 int arguments) const; | 674 int arguments) const; |
| 641 | 675 |
| 642 // True if index is included in the expression stack part of the environment. | 676 // True if index is included in the expression stack part of the environment. |
| 643 bool HasExpressionAt(int index) const; | 677 bool HasExpressionAt(int index) const; |
| 644 | 678 |
| 645 void Initialize(int parameter_count, int local_count, int stack_height); | 679 void Initialize(int parameter_count, int local_count, int stack_height); |
| 646 void Initialize(const HEnvironment* other); | 680 void Initialize(const HEnvironment* other); |
| 647 | 681 |
| 648 // Map a variable to an environment index. Parameter indices are shifted | |
| 649 // by 1 (receiver is parameter index -1 but environment index 0). | |
| 650 // Stack-allocated local indices are shifted by the number of parameters. | |
| 651 int IndexFor(Variable* variable) const { | |
| 652 ASSERT(variable->IsStackAllocated()); | |
| 653 int shift = variable->IsParameter() | |
| 654 ? 1 | |
| 655 : parameter_count_ + specials_count_; | |
| 656 return variable->index() + shift; | |
| 657 } | |
| 658 | |
| 659 Handle<JSFunction> closure_; | 682 Handle<JSFunction> closure_; |
| 660 // Value array [parameters] [specials] [locals] [temporaries]. | 683 // Value array [parameters] [specials] [locals] [temporaries]. |
| 661 ZoneList<HValue*> values_; | 684 ZoneList<HValue*> values_; |
| 662 GrowableBitVector assigned_variables_; | 685 GrowableBitVector assigned_variables_; |
| 663 FrameType frame_type_; | 686 FrameType frame_type_; |
| 664 int parameter_count_; | 687 int parameter_count_; |
| 665 int specials_count_; | 688 int specials_count_; |
| 666 int local_count_; | 689 int local_count_; |
| 667 HEnvironment* outer_; | 690 HEnvironment* outer_; |
| 668 HEnterInlined* entry_; | 691 HEnterInlined* entry_; |
| (...skipping 859 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1528 HBasicBlock* loop_successor, | 1551 HBasicBlock* loop_successor, |
| 1529 HBasicBlock* break_block); | 1552 HBasicBlock* break_block); |
| 1530 | 1553 |
| 1531 HBasicBlock* JoinContinue(IterationStatement* statement, | 1554 HBasicBlock* JoinContinue(IterationStatement* statement, |
| 1532 HBasicBlock* exit_block, | 1555 HBasicBlock* exit_block, |
| 1533 HBasicBlock* continue_block); | 1556 HBasicBlock* continue_block); |
| 1534 | 1557 |
| 1535 HValue* Top() const { return environment()->Top(); } | 1558 HValue* Top() const { return environment()->Top(); } |
| 1536 void Drop(int n) { environment()->Drop(n); } | 1559 void Drop(int n) { environment()->Drop(n); } |
| 1537 void Bind(Variable* var, HValue* value) { environment()->Bind(var, value); } | 1560 void Bind(Variable* var, HValue* value) { environment()->Bind(var, value); } |
| 1561 bool IsEligibleForEnvironmentLivenessAnalysis(Variable* var, | |
| 1562 int index, | |
| 1563 HEnvironment* env) { | |
| 1564 // |this| and |arguments| are always live; zapping parameters isn't | |
| 1565 // safe because function.arguments can inspect them at any time. | |
| 1566 return !var->is_this() && | |
| 1567 !var->is_arguments() && | |
| 1568 env->is_local_index(index); | |
| 1569 } | |
| 1570 void BindIfLive(Variable* var, HValue* value) { | |
| 1571 HEnvironment* env = environment(); | |
| 1572 int index = env->IndexFor(var); | |
| 1573 env->Bind(index, value); | |
| 1574 if (IsEligibleForEnvironmentLivenessAnalysis(var, index, env)) { | |
| 1575 AddInstruction(new(zone()) HEnvironmentBind(index)); | |
| 1576 } | |
| 1577 } | |
| 1578 HValue* LookupAndMakeLive(Variable* var) { | |
| 1579 HEnvironment* env = environment(); | |
| 1580 int index = env->IndexFor(var); | |
| 1581 HValue* value = env->Lookup(index); | |
| 1582 if (IsEligibleForEnvironmentLivenessAnalysis(var, index, env)) { | |
| 1583 AddInstruction(new(zone()) HEnvironmentLookup(index)); | |
| 1584 } | |
| 1585 return value; | |
| 1586 } | |
| 1538 | 1587 |
| 1539 // The value of the arguments object is allowed in some but not most value | 1588 // The value of the arguments object is allowed in some but not most value |
| 1540 // contexts. (It's allowed in all effect contexts and disallowed in all | 1589 // contexts. (It's allowed in all effect contexts and disallowed in all |
| 1541 // test contexts.) | 1590 // test contexts.) |
| 1542 void VisitForValue(Expression* expr, | 1591 void VisitForValue(Expression* expr, |
| 1543 ArgumentsAllowedFlag flag = ARGUMENTS_NOT_ALLOWED); | 1592 ArgumentsAllowedFlag flag = ARGUMENTS_NOT_ALLOWED); |
| 1544 void VisitForTypeOf(Expression* expr); | 1593 void VisitForTypeOf(Expression* expr); |
| 1545 void VisitForEffect(Expression* expr); | 1594 void VisitForEffect(Expression* expr); |
| 1546 void VisitForControl(Expression* expr, | 1595 void VisitForControl(Expression* expr, |
| 1547 HBasicBlock* true_block, | 1596 HBasicBlock* true_block, |
| (...skipping 477 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2025 EmbeddedVector<char, 64> filename_; | 2074 EmbeddedVector<char, 64> filename_; |
| 2026 HeapStringAllocator string_allocator_; | 2075 HeapStringAllocator string_allocator_; |
| 2027 StringStream trace_; | 2076 StringStream trace_; |
| 2028 int indent_; | 2077 int indent_; |
| 2029 }; | 2078 }; |
| 2030 | 2079 |
| 2031 | 2080 |
| 2032 } } // namespace v8::internal | 2081 } } // namespace v8::internal |
| 2033 | 2082 |
| 2034 #endif // V8_HYDROGEN_H_ | 2083 #endif // V8_HYDROGEN_H_ |
| OLD | NEW |