| OLD | NEW |
| 1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 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 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 48 #else | 48 #else |
| 49 #error Unsupported target architecture. | 49 #error Unsupported target architecture. |
| 50 #endif | 50 #endif |
| 51 | 51 |
| 52 namespace v8 { | 52 namespace v8 { |
| 53 namespace internal { | 53 namespace internal { |
| 54 | 54 |
| 55 HBasicBlock::HBasicBlock(HGraph* graph) | 55 HBasicBlock::HBasicBlock(HGraph* graph) |
| 56 : block_id_(graph->GetNextBlockID()), | 56 : block_id_(graph->GetNextBlockID()), |
| 57 graph_(graph), | 57 graph_(graph), |
| 58 phis_(4), | 58 phis_(zone(), 4), |
| 59 first_(NULL), | 59 first_(NULL), |
| 60 last_(NULL), | 60 last_(NULL), |
| 61 end_(NULL), | 61 end_(NULL), |
| 62 loop_information_(NULL), | 62 loop_information_(NULL), |
| 63 predecessors_(2), | 63 predecessors_(zone(), 2), |
| 64 dominator_(NULL), | 64 dominator_(NULL), |
| 65 dominated_blocks_(4), | 65 dominated_blocks_(zone(), 4), |
| 66 last_environment_(NULL), | 66 last_environment_(NULL), |
| 67 argument_count_(-1), | 67 argument_count_(-1), |
| 68 first_instruction_index_(-1), | 68 first_instruction_index_(-1), |
| 69 last_instruction_index_(-1), | 69 last_instruction_index_(-1), |
| 70 deleted_phis_(4), | 70 deleted_phis_(zone(), 4), |
| 71 parent_loop_header_(NULL), | 71 parent_loop_header_(NULL), |
| 72 is_inline_return_target_(false), | 72 is_inline_return_target_(false), |
| 73 is_deoptimizing_(false) { } | 73 is_deoptimizing_(false) { } |
| 74 | 74 |
| 75 | 75 |
| 76 void HBasicBlock::AttachLoopInformation() { | 76 void HBasicBlock::AttachLoopInformation() { |
| 77 ASSERT(!IsLoopHeader()); | 77 ASSERT(!IsLoopHeader()); |
| 78 loop_information_ = new(zone()) HLoopInformation(this); | 78 loop_information_ = new(zone()) HLoopInformation(this); |
| 79 } | 79 } |
| 80 | 80 |
| (...skipping 287 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 368 // the BitVector "reachable()" for every block that can be reached | 368 // the BitVector "reachable()" for every block that can be reached |
| 369 // from the start block of the graph. If "dont_visit" is non-null, the given | 369 // from the start block of the graph. If "dont_visit" is non-null, the given |
| 370 // block is treated as if it would not be part of the graph. "visited_count()" | 370 // block is treated as if it would not be part of the graph. "visited_count()" |
| 371 // returns the number of reachable blocks. | 371 // returns the number of reachable blocks. |
| 372 class ReachabilityAnalyzer BASE_EMBEDDED { | 372 class ReachabilityAnalyzer BASE_EMBEDDED { |
| 373 public: | 373 public: |
| 374 ReachabilityAnalyzer(HBasicBlock* entry_block, | 374 ReachabilityAnalyzer(HBasicBlock* entry_block, |
| 375 int block_count, | 375 int block_count, |
| 376 HBasicBlock* dont_visit) | 376 HBasicBlock* dont_visit) |
| 377 : visited_count_(0), | 377 : visited_count_(0), |
| 378 stack_(16), | 378 stack_(ZONE, 16), |
| 379 reachable_(block_count), | 379 reachable_(block_count), |
| 380 dont_visit_(dont_visit) { | 380 dont_visit_(dont_visit) { |
| 381 PushBlock(entry_block); | 381 PushBlock(entry_block); |
| 382 Analyze(); | 382 Analyze(); |
| 383 } | 383 } |
| 384 | 384 |
| 385 int visited_count() const { return visited_count_; } | 385 int visited_count() const { return visited_count_; } |
| 386 const BitVector* reachable() const { return &reachable_; } | 386 const BitVector* reachable() const { return &reachable_; } |
| 387 | 387 |
| 388 private: | 388 private: |
| (...skipping 201 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 590 void HBasicBlock::FinishExit(HControlInstruction* instruction) { | 590 void HBasicBlock::FinishExit(HControlInstruction* instruction) { |
| 591 Finish(instruction); | 591 Finish(instruction); |
| 592 ClearEnvironment(); | 592 ClearEnvironment(); |
| 593 } | 593 } |
| 594 | 594 |
| 595 | 595 |
| 596 HGraph::HGraph(CompilationInfo* info) | 596 HGraph::HGraph(CompilationInfo* info) |
| 597 : isolate_(info->isolate()), | 597 : isolate_(info->isolate()), |
| 598 next_block_id_(0), | 598 next_block_id_(0), |
| 599 entry_block_(NULL), | 599 entry_block_(NULL), |
| 600 blocks_(8), | 600 blocks_(info->zone(), 8), |
| 601 values_(16), | 601 values_(info->zone(), 16), |
| 602 phi_list_(NULL) { | 602 phi_list_(NULL) { |
| 603 start_environment_ = | 603 start_environment_ = |
| 604 new(zone()) HEnvironment(NULL, info->scope(), info->closure()); | 604 new(zone()) HEnvironment(NULL, info->scope(), info->closure()); |
| 605 start_environment_->set_ast_id(AstNode::kFunctionEntryId); | 605 start_environment_->set_ast_id(AstNode::kFunctionEntryId); |
| 606 entry_block_ = CreateBasicBlock(); | 606 entry_block_ = CreateBasicBlock(); |
| 607 entry_block_->SetInitialEnvironment(start_environment_); | 607 entry_block_->SetInitialEnvironment(start_environment_); |
| 608 } | 608 } |
| 609 | 609 |
| 610 | 610 |
| 611 Handle<Code> HGraph::Compile(CompilationInfo* info) { | 611 Handle<Code> HGraph::Compile(CompilationInfo* info) { |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 668 instr = instr->next(); | 668 instr = instr->next(); |
| 669 } | 669 } |
| 670 } | 670 } |
| 671 } | 671 } |
| 672 | 672 |
| 673 | 673 |
| 674 void HGraph::OrderBlocks() { | 674 void HGraph::OrderBlocks() { |
| 675 HPhase phase("Block ordering"); | 675 HPhase phase("Block ordering"); |
| 676 BitVector visited(blocks_.length()); | 676 BitVector visited(blocks_.length()); |
| 677 | 677 |
| 678 ZoneList<HBasicBlock*> reverse_result(8); | 678 ZoneList<HBasicBlock*> reverse_result(zone(), 8); |
| 679 HBasicBlock* start = blocks_[0]; | 679 HBasicBlock* start = blocks_[0]; |
| 680 Postorder(start, &visited, &reverse_result, NULL); | 680 Postorder(start, &visited, &reverse_result, NULL); |
| 681 | 681 |
| 682 blocks_.Rewind(0); | 682 blocks_.Rewind(0); |
| 683 int index = 0; | 683 int index = 0; |
| 684 for (int i = reverse_result.length() - 1; i >= 0; --i) { | 684 for (int i = reverse_result.length() - 1; i >= 0; --i) { |
| 685 HBasicBlock* b = reverse_result[i]; | 685 HBasicBlock* b = reverse_result[i]; |
| 686 blocks_.Add(b); | 686 blocks_.Add(b); |
| 687 b->set_block_id(index++); | 687 b->set_block_id(index++); |
| 688 } | 688 } |
| (...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 757 MarkAsDeoptimizingRecursively(dominated); | 757 MarkAsDeoptimizingRecursively(dominated); |
| 758 } | 758 } |
| 759 } | 759 } |
| 760 | 760 |
| 761 void HGraph::EliminateRedundantPhis() { | 761 void HGraph::EliminateRedundantPhis() { |
| 762 HPhase phase("Redundant phi elimination", this); | 762 HPhase phase("Redundant phi elimination", this); |
| 763 | 763 |
| 764 // Worklist of phis that can potentially be eliminated. Initialized with | 764 // Worklist of phis that can potentially be eliminated. Initialized with |
| 765 // all phi nodes. When elimination of a phi node modifies another phi node | 765 // all phi nodes. When elimination of a phi node modifies another phi node |
| 766 // the modified phi node is added to the worklist. | 766 // the modified phi node is added to the worklist. |
| 767 ZoneList<HPhi*> worklist(blocks_.length()); | 767 ZoneList<HPhi*> worklist(zone(), blocks_.length()); |
| 768 for (int i = 0; i < blocks_.length(); ++i) { | 768 for (int i = 0; i < blocks_.length(); ++i) { |
| 769 worklist.AddAll(*blocks_[i]->phis()); | 769 worklist.AddAll(*blocks_[i]->phis()); |
| 770 } | 770 } |
| 771 | 771 |
| 772 while (!worklist.is_empty()) { | 772 while (!worklist.is_empty()) { |
| 773 HPhi* phi = worklist.RemoveLast(); | 773 HPhi* phi = worklist.RemoveLast(); |
| 774 HBasicBlock* block = phi->block(); | 774 HBasicBlock* block = phi->block(); |
| 775 | 775 |
| 776 // Skip phi node if it was already replaced. | 776 // Skip phi node if it was already replaced. |
| 777 if (block == NULL) continue; | 777 if (block == NULL) continue; |
| (...skipping 11 matching lines...) Expand all Loading... |
| 789 block->RemovePhi(phi); | 789 block->RemovePhi(phi); |
| 790 } | 790 } |
| 791 } | 791 } |
| 792 } | 792 } |
| 793 | 793 |
| 794 | 794 |
| 795 void HGraph::EliminateUnreachablePhis() { | 795 void HGraph::EliminateUnreachablePhis() { |
| 796 HPhase phase("Unreachable phi elimination", this); | 796 HPhase phase("Unreachable phi elimination", this); |
| 797 | 797 |
| 798 // Initialize worklist. | 798 // Initialize worklist. |
| 799 ZoneList<HPhi*> phi_list(blocks_.length()); | 799 ZoneList<HPhi*> phi_list(zone(), blocks_.length()); |
| 800 ZoneList<HPhi*> worklist(blocks_.length()); | 800 ZoneList<HPhi*> worklist(zone(), blocks_.length()); |
| 801 for (int i = 0; i < blocks_.length(); ++i) { | 801 for (int i = 0; i < blocks_.length(); ++i) { |
| 802 for (int j = 0; j < blocks_[i]->phis()->length(); j++) { | 802 for (int j = 0; j < blocks_[i]->phis()->length(); j++) { |
| 803 HPhi* phi = blocks_[i]->phis()->at(j); | 803 HPhi* phi = blocks_[i]->phis()->at(j); |
| 804 phi_list.Add(phi); | 804 phi_list.Add(phi); |
| 805 // We can't eliminate phis in the receiver position in the environment | 805 // We can't eliminate phis in the receiver position in the environment |
| 806 // because in case of throwing an error we need this value to | 806 // because in case of throwing an error we need this value to |
| 807 // construct a stack trace. | 807 // construct a stack trace. |
| 808 if (phi->HasRealUses() || phi->IsReceiver()) { | 808 if (phi->HasRealUses() || phi->IsReceiver()) { |
| 809 phi->set_is_live(true); | 809 phi->set_is_live(true); |
| 810 worklist.Add(phi); | 810 worklist.Add(phi); |
| (...skipping 20 matching lines...) Expand all Loading... |
| 831 HBasicBlock* block = phi->block(); | 831 HBasicBlock* block = phi->block(); |
| 832 block->RemovePhi(phi); | 832 block->RemovePhi(phi); |
| 833 block->RecordDeletedPhi(phi->merged_index()); | 833 block->RecordDeletedPhi(phi->merged_index()); |
| 834 } | 834 } |
| 835 } | 835 } |
| 836 } | 836 } |
| 837 | 837 |
| 838 | 838 |
| 839 bool HGraph::CollectPhis() { | 839 bool HGraph::CollectPhis() { |
| 840 int block_count = blocks_.length(); | 840 int block_count = blocks_.length(); |
| 841 phi_list_ = new ZoneList<HPhi*>(block_count); | 841 phi_list_ = ZoneList<HPhi*>::New(zone(), block_count); |
| 842 for (int i = 0; i < block_count; ++i) { | 842 for (int i = 0; i < block_count; ++i) { |
| 843 for (int j = 0; j < blocks_[i]->phis()->length(); ++j) { | 843 for (int j = 0; j < blocks_[i]->phis()->length(); ++j) { |
| 844 HPhi* phi = blocks_[i]->phis()->at(j); | 844 HPhi* phi = blocks_[i]->phis()->at(j); |
| 845 phi_list_->Add(phi); | 845 phi_list_->Add(phi); |
| 846 // We don't support phi uses of arguments for now. | 846 // We don't support phi uses of arguments for now. |
| 847 if (phi->CheckFlag(HValue::kIsArguments)) return false; | 847 if (phi->CheckFlag(HValue::kIsArguments)) return false; |
| 848 // Check for the hole value (from an uninitialized const). | 848 // Check for the hole value (from an uninitialized const). |
| 849 for (int k = 0; k < phi->OperandCount(); k++) { | 849 for (int k = 0; k < phi->OperandCount(); k++) { |
| 850 if (phi->OperandAt(k) == GetConstantHole()) return false; | 850 if (phi->OperandAt(k) == GetConstantHole()) return false; |
| 851 } | 851 } |
| (...skipping 21 matching lines...) Expand all Loading... |
| 873 worklist->Add(use); | 873 worklist->Add(use); |
| 874 } | 874 } |
| 875 } | 875 } |
| 876 } | 876 } |
| 877 } | 877 } |
| 878 } | 878 } |
| 879 | 879 |
| 880 | 880 |
| 881 class HRangeAnalysis BASE_EMBEDDED { | 881 class HRangeAnalysis BASE_EMBEDDED { |
| 882 public: | 882 public: |
| 883 explicit HRangeAnalysis(HGraph* graph) : graph_(graph), changed_ranges_(16) {} | 883 explicit HRangeAnalysis(HGraph* graph) |
| 884 : graph_(graph), |
| 885 changed_ranges_(graph->zone(), 16) {} |
| 884 | 886 |
| 885 void Analyze(); | 887 void Analyze(); |
| 886 | 888 |
| 887 private: | 889 private: |
| 888 void TraceRange(const char* msg, ...); | 890 void TraceRange(const char* msg, ...); |
| 889 void Analyze(HBasicBlock* block); | 891 void Analyze(HBasicBlock* block); |
| 890 void InferControlFlowRange(HCompareIDAndBranch* test, HBasicBlock* dest); | 892 void InferControlFlowRange(HCompareIDAndBranch* test, HBasicBlock* dest); |
| 891 void UpdateControlFlowRange(Token::Value op, HValue* value, HValue* other); | 893 void UpdateControlFlowRange(Token::Value op, HValue* value, HValue* other); |
| 892 void InferRange(HValue* value); | 894 void InferRange(HValue* value); |
| 893 void RollBackTo(int index); | 895 void RollBackTo(int index); |
| (...skipping 404 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1298 | 1300 |
| 1299 DISALLOW_COPY_AND_ASSIGN(SparseSet); | 1301 DISALLOW_COPY_AND_ASSIGN(SparseSet); |
| 1300 }; | 1302 }; |
| 1301 | 1303 |
| 1302 | 1304 |
| 1303 class HGlobalValueNumberer BASE_EMBEDDED { | 1305 class HGlobalValueNumberer BASE_EMBEDDED { |
| 1304 public: | 1306 public: |
| 1305 explicit HGlobalValueNumberer(HGraph* graph, CompilationInfo* info) | 1307 explicit HGlobalValueNumberer(HGraph* graph, CompilationInfo* info) |
| 1306 : graph_(graph), | 1308 : graph_(graph), |
| 1307 info_(info), | 1309 info_(info), |
| 1308 block_side_effects_(graph->blocks()->length()), | 1310 block_side_effects_(info->zone(), graph->blocks()->length()), |
| 1309 loop_side_effects_(graph->blocks()->length()), | 1311 loop_side_effects_(info->zone(), graph->blocks()->length()), |
| 1310 visited_on_paths_(graph->zone(), graph->blocks()->length()) { | 1312 visited_on_paths_(info->zone(), graph->blocks()->length()) { |
| 1311 ASSERT(info->isolate()->heap()->allow_allocation(false)); | 1313 ASSERT(info->isolate()->heap()->allow_allocation(false)); |
| 1312 block_side_effects_.AddBlock(0, graph_->blocks()->length()); | 1314 block_side_effects_.AddBlock(0, graph_->blocks()->length()); |
| 1313 loop_side_effects_.AddBlock(0, graph_->blocks()->length()); | 1315 loop_side_effects_.AddBlock(0, graph_->blocks()->length()); |
| 1314 } | 1316 } |
| 1315 ~HGlobalValueNumberer() { | 1317 ~HGlobalValueNumberer() { |
| 1316 ASSERT(!info_->isolate()->heap()->allow_allocation(true)); | 1318 ASSERT(!info_->isolate()->heap()->allow_allocation(true)); |
| 1317 } | 1319 } |
| 1318 | 1320 |
| 1319 void Analyze(); | 1321 void Analyze(); |
| 1320 | 1322 |
| (...skipping 206 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1527 dominated)); | 1529 dominated)); |
| 1528 } | 1530 } |
| 1529 AnalyzeBlock(dominated, successor_map); | 1531 AnalyzeBlock(dominated, successor_map); |
| 1530 } | 1532 } |
| 1531 } | 1533 } |
| 1532 | 1534 |
| 1533 | 1535 |
| 1534 class HInferRepresentation BASE_EMBEDDED { | 1536 class HInferRepresentation BASE_EMBEDDED { |
| 1535 public: | 1537 public: |
| 1536 explicit HInferRepresentation(HGraph* graph) | 1538 explicit HInferRepresentation(HGraph* graph) |
| 1537 : graph_(graph), worklist_(8), in_worklist_(graph->GetMaximumValueID()) {} | 1539 : graph_(graph), |
| 1540 worklist_(graph->zone(), 8), |
| 1541 in_worklist_(graph->GetMaximumValueID()) {} |
| 1538 | 1542 |
| 1539 void Analyze(); | 1543 void Analyze(); |
| 1540 | 1544 |
| 1541 private: | 1545 private: |
| 1542 Representation TryChange(HValue* current); | 1546 Representation TryChange(HValue* current); |
| 1543 void AddToWorklist(HValue* current); | 1547 void AddToWorklist(HValue* current); |
| 1544 void InferBasedOnInputs(HValue* current); | 1548 void InferBasedOnInputs(HValue* current); |
| 1545 void AddDependantsToWorklist(HValue* current); | 1549 void AddDependantsToWorklist(HValue* current); |
| 1546 void InferBasedOnUses(HValue* current); | 1550 void InferBasedOnUses(HValue* current); |
| 1547 | 1551 |
| (...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1639 } | 1643 } |
| 1640 | 1644 |
| 1641 | 1645 |
| 1642 void HInferRepresentation::Analyze() { | 1646 void HInferRepresentation::Analyze() { |
| 1643 HPhase phase("Infer representations", graph_); | 1647 HPhase phase("Infer representations", graph_); |
| 1644 | 1648 |
| 1645 // (1) Initialize bit vectors and count real uses. Each phi gets a | 1649 // (1) Initialize bit vectors and count real uses. Each phi gets a |
| 1646 // bit-vector of length <number of phis>. | 1650 // bit-vector of length <number of phis>. |
| 1647 const ZoneList<HPhi*>* phi_list = graph_->phi_list(); | 1651 const ZoneList<HPhi*>* phi_list = graph_->phi_list(); |
| 1648 int phi_count = phi_list->length(); | 1652 int phi_count = phi_list->length(); |
| 1649 ZoneList<BitVector*> connected_phis(phi_count); | 1653 ZoneList<BitVector*> connected_phis(graph_->zone(), phi_count); |
| 1650 for (int i = 0; i < phi_count; ++i) { | 1654 for (int i = 0; i < phi_count; ++i) { |
| 1651 phi_list->at(i)->InitRealUses(i); | 1655 phi_list->at(i)->InitRealUses(i); |
| 1652 BitVector* connected_set = new(zone()) BitVector(phi_count); | 1656 BitVector* connected_set = new(zone()) BitVector(phi_count); |
| 1653 connected_set->Add(i); | 1657 connected_set->Add(i); |
| 1654 connected_phis.Add(connected_set); | 1658 connected_phis.Add(connected_set); |
| 1655 } | 1659 } |
| 1656 | 1660 |
| 1657 // (2) Do a fixed point iteration to find the set of connected phis. A | 1661 // (2) Do a fixed point iteration to find the set of connected phis. A |
| 1658 // phi is connected to another phi if its value is used either directly or | 1662 // phi is connected to another phi if its value is used either directly or |
| 1659 // indirectly through a transitive closure of the def-use relation. | 1663 // indirectly through a transitive closure of the def-use relation. |
| (...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1752 } | 1756 } |
| 1753 | 1757 |
| 1754 if (block->IsLoopHeader()) { | 1758 if (block->IsLoopHeader()) { |
| 1755 HBasicBlock* last_back_edge = | 1759 HBasicBlock* last_back_edge = |
| 1756 block->loop_information()->GetLastBackEdge(); | 1760 block->loop_information()->GetLastBackEdge(); |
| 1757 InitializeInferredTypes(i + 1, last_back_edge->block_id()); | 1761 InitializeInferredTypes(i + 1, last_back_edge->block_id()); |
| 1758 // Skip all blocks already processed by the recursive call. | 1762 // Skip all blocks already processed by the recursive call. |
| 1759 i = last_back_edge->block_id(); | 1763 i = last_back_edge->block_id(); |
| 1760 // Update phis of the loop header now after the whole loop body is | 1764 // Update phis of the loop header now after the whole loop body is |
| 1761 // guaranteed to be processed. | 1765 // guaranteed to be processed. |
| 1762 ZoneList<HValue*> worklist(block->phis()->length()); | 1766 ZoneList<HValue*> worklist(zone(), block->phis()->length()); |
| 1763 for (int j = 0; j < block->phis()->length(); ++j) { | 1767 for (int j = 0; j < block->phis()->length(); ++j) { |
| 1764 worklist.Add(block->phis()->at(j)); | 1768 worklist.Add(block->phis()->at(j)); |
| 1765 } | 1769 } |
| 1766 InferTypes(&worklist); | 1770 InferTypes(&worklist); |
| 1767 } | 1771 } |
| 1768 } | 1772 } |
| 1769 } | 1773 } |
| 1770 | 1774 |
| 1771 | 1775 |
| 1772 void HGraph::PropagateMinusZeroChecks(HValue* value, BitVector* visited) { | 1776 void HGraph::PropagateMinusZeroChecks(HValue* value, BitVector* visited) { |
| (...skipping 599 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2372 | 2376 |
| 2373 void HGraphBuilder::PushAndAdd(HInstruction* instr) { | 2377 void HGraphBuilder::PushAndAdd(HInstruction* instr) { |
| 2374 Push(instr); | 2378 Push(instr); |
| 2375 AddInstruction(instr); | 2379 AddInstruction(instr); |
| 2376 } | 2380 } |
| 2377 | 2381 |
| 2378 | 2382 |
| 2379 template <int V> | 2383 template <int V> |
| 2380 HInstruction* HGraphBuilder::PreProcessCall(HCall<V>* call) { | 2384 HInstruction* HGraphBuilder::PreProcessCall(HCall<V>* call) { |
| 2381 int count = call->argument_count(); | 2385 int count = call->argument_count(); |
| 2382 ZoneList<HValue*> arguments(count); | 2386 ZoneList<HValue*> arguments(zone(), count); |
| 2383 for (int i = 0; i < count; ++i) { | 2387 for (int i = 0; i < count; ++i) { |
| 2384 arguments.Add(Pop()); | 2388 arguments.Add(Pop()); |
| 2385 } | 2389 } |
| 2386 | 2390 |
| 2387 while (!arguments.is_empty()) { | 2391 while (!arguments.is_empty()) { |
| 2388 AddInstruction(new(zone()) HPushArgument(arguments.RemoveLast())); | 2392 AddInstruction(new(zone()) HPushArgument(arguments.RemoveLast())); |
| 2389 } | 2393 } |
| 2390 return call; | 2394 return call; |
| 2391 } | 2395 } |
| 2392 | 2396 |
| (...skipping 3790 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6183 | 6187 |
| 6184 | 6188 |
| 6185 #undef CHECK_BAILOUT | 6189 #undef CHECK_BAILOUT |
| 6186 #undef CHECK_ALIVE | 6190 #undef CHECK_ALIVE |
| 6187 | 6191 |
| 6188 | 6192 |
| 6189 HEnvironment::HEnvironment(HEnvironment* outer, | 6193 HEnvironment::HEnvironment(HEnvironment* outer, |
| 6190 Scope* scope, | 6194 Scope* scope, |
| 6191 Handle<JSFunction> closure) | 6195 Handle<JSFunction> closure) |
| 6192 : closure_(closure), | 6196 : closure_(closure), |
| 6193 values_(0), | 6197 values_(ZONE, 0), |
| 6194 assigned_variables_(4), | 6198 assigned_variables_(ZONE, 4), |
| 6195 parameter_count_(0), | 6199 parameter_count_(0), |
| 6196 specials_count_(1), | 6200 specials_count_(1), |
| 6197 local_count_(0), | 6201 local_count_(0), |
| 6198 outer_(outer), | 6202 outer_(outer), |
| 6199 pop_count_(0), | 6203 pop_count_(0), |
| 6200 push_count_(0), | 6204 push_count_(0), |
| 6201 ast_id_(AstNode::kNoNumber) { | 6205 ast_id_(AstNode::kNoNumber) { |
| 6202 Initialize(scope->num_parameters() + 1, scope->num_stack_slots(), 0); | 6206 Initialize(scope->num_parameters() + 1, scope->num_stack_slots(), 0); |
| 6203 } | 6207 } |
| 6204 | 6208 |
| 6205 | 6209 |
| 6206 HEnvironment::HEnvironment(const HEnvironment* other) | 6210 HEnvironment::HEnvironment(const HEnvironment* other) |
| 6207 : values_(0), | 6211 : values_(ZONE, 0), |
| 6208 assigned_variables_(0), | 6212 assigned_variables_(ZONE, 0), |
| 6209 parameter_count_(0), | 6213 parameter_count_(0), |
| 6210 specials_count_(1), | 6214 specials_count_(1), |
| 6211 local_count_(0), | 6215 local_count_(0), |
| 6212 outer_(NULL), | 6216 outer_(NULL), |
| 6213 pop_count_(0), | 6217 pop_count_(0), |
| 6214 push_count_(0), | 6218 push_count_(0), |
| 6215 ast_id_(other->ast_id()) { | 6219 ast_id_(other->ast_id()) { |
| 6216 Initialize(other); | 6220 Initialize(other); |
| 6217 } | 6221 } |
| 6218 | 6222 |
| (...skipping 487 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6706 } | 6710 } |
| 6707 } | 6711 } |
| 6708 | 6712 |
| 6709 #ifdef DEBUG | 6713 #ifdef DEBUG |
| 6710 if (graph_ != NULL) graph_->Verify(); | 6714 if (graph_ != NULL) graph_->Verify(); |
| 6711 if (allocator_ != NULL) allocator_->Verify(); | 6715 if (allocator_ != NULL) allocator_->Verify(); |
| 6712 #endif | 6716 #endif |
| 6713 } | 6717 } |
| 6714 | 6718 |
| 6715 } } // namespace v8::internal | 6719 } } // namespace v8::internal |
| OLD | NEW |