Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(333)

Side by Side Diff: src/jump-target.cc

Issue 115345: - Make VirtualFrame and JumpTarget zone allocated.... (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: Created 11 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « src/jump-target.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 23 matching lines...) Expand all
34 34
35 // ------------------------------------------------------------------------- 35 // -------------------------------------------------------------------------
36 // JumpTarget implementation. 36 // JumpTarget implementation.
37 37
38 bool JumpTarget::compiling_deferred_code_ = false; 38 bool JumpTarget::compiling_deferred_code_ = false;
39 39
40 40
41 JumpTarget::JumpTarget(CodeGenerator* cgen, Directionality direction) 41 JumpTarget::JumpTarget(CodeGenerator* cgen, Directionality direction)
42 : cgen_(cgen), 42 : cgen_(cgen),
43 direction_(direction), 43 direction_(direction),
44 is_bound_(false),
45 is_linked_(false),
44 reaching_frames_(0), 46 reaching_frames_(0),
45 merge_labels_(0), 47 merge_labels_(0),
46 entry_frame_(NULL), 48 entry_frame_(NULL) {
47 is_bound_(false),
48 is_linked_(false) {
49 ASSERT(cgen != NULL); 49 ASSERT(cgen != NULL);
50 masm_ = cgen->masm(); 50 masm_ = cgen->masm();
51 } 51 }
52 52
53 53
54 JumpTarget::JumpTarget() 54 JumpTarget::JumpTarget()
55 : cgen_(NULL), 55 : cgen_(NULL),
56 masm_(NULL), 56 masm_(NULL),
57 direction_(FORWARD_ONLY), 57 direction_(FORWARD_ONLY),
58 is_bound_(false),
59 is_linked_(false),
58 reaching_frames_(0), 60 reaching_frames_(0),
59 merge_labels_(0), 61 merge_labels_(0),
60 entry_frame_(NULL), 62 entry_frame_(NULL) {
61 is_bound_(false),
62 is_linked_(false) {
63 } 63 }
64 64
65 65
66 void JumpTarget::Initialize(CodeGenerator* cgen, Directionality direction) { 66 void JumpTarget::Initialize(CodeGenerator* cgen, Directionality direction) {
67 ASSERT(cgen != NULL); 67 ASSERT(cgen != NULL);
68 ASSERT(cgen_ == NULL); 68 ASSERT(cgen_ == NULL);
69 cgen_ = cgen; 69 cgen_ = cgen;
70 masm_ = cgen->masm(); 70 masm_ = cgen->masm();
71 direction_ = direction; 71 direction_ = direction;
72 } 72 }
73 73
74 74
75 void JumpTarget::Unuse() { 75 void JumpTarget::Unuse() {
76 // We should not deallocate jump targets that have unresolved jumps
77 // to them. In the event of a compile-time stack overflow or an
78 // uninitialized jump target, we don't care.
79 ASSERT(!is_linked() || cgen_ == NULL || cgen_->HasStackOverflow());
80 for (int i = 0; i < reaching_frames_.length(); i++) {
81 delete reaching_frames_[i];
82 }
83 delete entry_frame_;
84 Reset();
85 }
86
87
88 void JumpTarget::Reset() {
89 reaching_frames_.Clear(); 76 reaching_frames_.Clear();
90 merge_labels_.Clear(); 77 merge_labels_.Clear();
91 entry_frame_ = NULL; 78 entry_frame_ = NULL;
92 entry_label_.Unuse(); 79 entry_label_.Unuse();
93 is_bound_ = false; 80 is_bound_ = false;
94 is_linked_ = false; 81 is_linked_ = false;
95 } 82 }
96 83
97 84
98 void JumpTarget::ComputeEntryFrame(int mergable_elements) { 85 void JumpTarget::ComputeEntryFrame(int mergable_elements) {
(...skipping 556 matching lines...) Expand 10 before | Expand all | Expand 10 after
655 ShadowTarget::ShadowTarget(BreakTarget* shadowed) { 642 ShadowTarget::ShadowTarget(BreakTarget* shadowed) {
656 ASSERT(shadowed != NULL); 643 ASSERT(shadowed != NULL);
657 other_target_ = shadowed; 644 other_target_ = shadowed;
658 645
659 #ifdef DEBUG 646 #ifdef DEBUG
660 is_shadowing_ = true; 647 is_shadowing_ = true;
661 #endif 648 #endif
662 // While shadowing this shadow target saves the state of the original. 649 // While shadowing this shadow target saves the state of the original.
663 shadowed->CopyTo(this); 650 shadowed->CopyTo(this);
664 651
665 // The original's state is reset. We do not Unuse it because that 652 // The original's state is reset.
666 // would delete the expected frame and assert that the target is not 653 shadowed->Unuse();
667 // linked.
668 shadowed->Reset();
669 ASSERT(cgen_ != NULL); 654 ASSERT(cgen_ != NULL);
670 ASSERT(cgen_->has_valid_frame()); 655 ASSERT(cgen_->has_valid_frame());
671 shadowed->set_expected_height(cgen_->frame()->height()); 656 shadowed->set_expected_height(cgen_->frame()->height());
672 657
673 // Setting the code generator to null prevents the shadow target from 658 // Setting the code generator to null prevents the shadow target from
674 // being used until shadowing stops. 659 // being used until shadowing stops.
675 cgen_ = NULL; 660 cgen_ = NULL;
676 masm_ = NULL; 661 masm_ = NULL;
677 } 662 }
678 663
679 664
680 void ShadowTarget::StopShadowing() { 665 void ShadowTarget::StopShadowing() {
681 ASSERT(is_shadowing_); 666 ASSERT(is_shadowing_);
682 667
683 // This target does not have a valid code generator yet. 668 // This target does not have a valid code generator yet.
684 cgen_ = other_target_->code_generator(); 669 cgen_ = other_target_->code_generator();
685 ASSERT(cgen_ != NULL); 670 ASSERT(cgen_ != NULL);
686 masm_ = cgen_->masm(); 671 masm_ = cgen_->masm();
687 672
688 // The states of this target, which was shadowed, and the original 673 // The states of this target, which was shadowed, and the original
689 // target, which was shadowing, are swapped. 674 // target, which was shadowing, are swapped.
690 BreakTarget temp; 675 BreakTarget temp;
691 other_target_->CopyTo(&temp); 676 other_target_->CopyTo(&temp);
692 CopyTo(other_target_); 677 CopyTo(other_target_);
693 temp.CopyTo(this); 678 temp.CopyTo(this);
694 temp.Reset(); // So the destructor does not deallocate virtual frames. 679 temp.Unuse();
695 680
696 #ifdef DEBUG 681 #ifdef DEBUG
697 is_shadowing_ = false; 682 is_shadowing_ = false;
698 #endif 683 #endif
699 } 684 }
700 685
701 686
702 } } // namespace v8::internal 687 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/jump-target.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698