OLD | NEW |
1 // Copyright 2009 the V8 project authors. All rights reserved. | 1 // Copyright 2009 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 24 matching lines...) Expand all Loading... |
35 | 35 |
36 // ------------------------------------------------------------------------- | 36 // ------------------------------------------------------------------------- |
37 // JumpTarget implementation. | 37 // JumpTarget implementation. |
38 | 38 |
39 bool JumpTarget::compiling_deferred_code_ = false; | 39 bool JumpTarget::compiling_deferred_code_ = false; |
40 | 40 |
41 | 41 |
42 JumpTarget::JumpTarget(CodeGenerator* cgen, Directionality direction) | 42 JumpTarget::JumpTarget(CodeGenerator* cgen, Directionality direction) |
43 : cgen_(cgen), | 43 : cgen_(cgen), |
44 direction_(direction), | 44 direction_(direction), |
45 is_bound_(false), | |
46 is_linked_(false), | |
47 reaching_frames_(0), | 45 reaching_frames_(0), |
48 merge_labels_(0), | 46 merge_labels_(0), |
49 entry_frame_(NULL) { | 47 entry_frame_(NULL) { |
50 ASSERT(cgen != NULL); | 48 ASSERT(cgen != NULL); |
51 masm_ = cgen->masm(); | 49 masm_ = cgen->masm(); |
52 } | 50 } |
53 | 51 |
54 | 52 |
55 JumpTarget::JumpTarget() | 53 JumpTarget::JumpTarget() |
56 : cgen_(NULL), | 54 : cgen_(NULL), |
57 masm_(NULL), | 55 masm_(NULL), |
58 direction_(FORWARD_ONLY), | 56 direction_(FORWARD_ONLY), |
59 is_bound_(false), | |
60 is_linked_(false), | |
61 reaching_frames_(0), | 57 reaching_frames_(0), |
62 merge_labels_(0), | 58 merge_labels_(0), |
63 entry_frame_(NULL) { | 59 entry_frame_(NULL) { |
64 } | 60 } |
65 | 61 |
66 | 62 |
67 void JumpTarget::Initialize(CodeGenerator* cgen, Directionality direction) { | 63 void JumpTarget::Initialize(CodeGenerator* cgen, Directionality direction) { |
68 ASSERT(cgen != NULL); | 64 ASSERT(cgen != NULL); |
69 ASSERT(cgen_ == NULL); | 65 ASSERT(cgen_ == NULL); |
70 cgen_ = cgen; | 66 cgen_ = cgen; |
71 masm_ = cgen->masm(); | 67 masm_ = cgen->masm(); |
72 direction_ = direction; | 68 direction_ = direction; |
73 } | 69 } |
74 | 70 |
75 | 71 |
76 void JumpTarget::Unuse() { | 72 void JumpTarget::Unuse() { |
77 reaching_frames_.Clear(); | 73 reaching_frames_.Clear(); |
78 merge_labels_.Clear(); | 74 merge_labels_.Clear(); |
79 entry_frame_ = NULL; | 75 entry_frame_ = NULL; |
80 entry_label_.Unuse(); | 76 entry_label_.Unuse(); |
81 is_bound_ = false; | |
82 is_linked_ = false; | |
83 } | 77 } |
84 | 78 |
85 | 79 |
86 void JumpTarget::ComputeEntryFrame(int mergable_elements) { | 80 void JumpTarget::ComputeEntryFrame(int mergable_elements) { |
87 // Given: a collection of frames reaching by forward CFG edges and | 81 // Given: a collection of frames reaching by forward CFG edges and |
88 // the directionality of the block. Compute: an entry frame for the | 82 // the directionality of the block. Compute: an entry frame for the |
89 // block. | 83 // block. |
90 | 84 |
91 Counters::compute_entry_frame.Increment(); | 85 Counters::compute_entry_frame.Increment(); |
92 #ifdef DEBUG | 86 #ifdef DEBUG |
(...skipping 447 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
540 destination->direction_ = direction_; | 534 destination->direction_ = direction_; |
541 destination->reaching_frames_.Clear(); | 535 destination->reaching_frames_.Clear(); |
542 destination->merge_labels_.Clear(); | 536 destination->merge_labels_.Clear(); |
543 ASSERT(reaching_frames_.length() == merge_labels_.length()); | 537 ASSERT(reaching_frames_.length() == merge_labels_.length()); |
544 for (int i = 0; i < reaching_frames_.length(); i++) { | 538 for (int i = 0; i < reaching_frames_.length(); i++) { |
545 destination->reaching_frames_.Add(reaching_frames_[i]); | 539 destination->reaching_frames_.Add(reaching_frames_[i]); |
546 destination->merge_labels_.Add(merge_labels_[i]); | 540 destination->merge_labels_.Add(merge_labels_[i]); |
547 } | 541 } |
548 destination->entry_frame_ = entry_frame_; | 542 destination->entry_frame_ = entry_frame_; |
549 destination->entry_label_ = entry_label_; | 543 destination->entry_label_ = entry_label_; |
550 destination->is_bound_ = is_bound_; | |
551 destination->is_linked_ = is_linked_; | |
552 destination->expected_height_ = expected_height_; | 544 destination->expected_height_ = expected_height_; |
553 } | 545 } |
554 | 546 |
555 | 547 |
556 void BreakTarget::Jump() { | 548 void BreakTarget::Jump() { |
557 ASSERT(cgen_ != NULL); | 549 ASSERT(cgen_ != NULL); |
558 ASSERT(cgen_->has_valid_frame()); | 550 ASSERT(cgen_->has_valid_frame()); |
559 | 551 |
560 // Drop leftover statement state from the frame before merging. | 552 // Drop leftover statement state from the frame before merging. |
561 cgen_->frame()->ForgetElements(cgen_->frame()->height() - expected_height_); | 553 cgen_->frame()->ForgetElements(cgen_->frame()->height() - expected_height_); |
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
679 temp.CopyTo(this); | 671 temp.CopyTo(this); |
680 temp.Unuse(); | 672 temp.Unuse(); |
681 | 673 |
682 #ifdef DEBUG | 674 #ifdef DEBUG |
683 is_shadowing_ = false; | 675 is_shadowing_ = false; |
684 #endif | 676 #endif |
685 } | 677 } |
686 | 678 |
687 | 679 |
688 } } // namespace v8::internal | 680 } } // namespace v8::internal |
OLD | NEW |