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

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

Issue 11011: The expected expression stack height at the return label can be... (Closed) Base URL: http://v8.googlecode.com/svn/branches/experimental/toiger/
Patch Set: Created 12 years, 1 month 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/codegen-arm.cc ('k') | src/jump-target-ia32.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2008 the V8 project authors. All rights reserved. 1 // Copyright 2008 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 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
63 // Precondition: there is a current frame. There may or may not be an 63 // Precondition: there is a current frame. There may or may not be an
64 // expected frame at the label. 64 // expected frame at the label.
65 ASSERT(code_generator_ != NULL); 65 ASSERT(code_generator_ != NULL);
66 66
67 VirtualFrame* current_frame = code_generator_->frame(); 67 VirtualFrame* current_frame = code_generator_->frame();
68 ASSERT(current_frame != NULL); 68 ASSERT(current_frame != NULL);
69 69
70 if (expected_frame_ == NULL) { 70 if (expected_frame_ == NULL) {
71 expected_frame_ = current_frame; 71 expected_frame_ = current_frame;
72 code_generator_->set_frame(NULL); 72 code_generator_->set_frame(NULL);
73 // The frame at the actual function return will always have height zero.
74 if (code_generator_->IsActualFunctionReturn(this)) {
75 expected_frame_->Forget(expected_frame_->height());
76 }
73 } else { 77 } else {
74 current_frame->MergeTo(expected_frame_); 78 // No code needs to be emitted to merge to the expected frame at the
79 // actual function return.
80 if (!code_generator_->IsActualFunctionReturn(this)) {
81 current_frame->MergeTo(expected_frame_);
82 }
75 code_generator_->delete_frame(); 83 code_generator_->delete_frame();
76 } 84 }
77 85
78 __ b(&label_); 86 __ b(&label_);
79 // Postcondition: there is no current frame but there is an expected frame 87 // Postcondition: there is no current frame but there is an expected frame
80 // at the label. 88 // at the label.
81 } 89 }
82 90
83 91
84 void JumpTarget::Branch(Condition cc, Hint ignored) { 92 void JumpTarget::Branch(Condition cc, Hint ignored) {
85 // Precondition: there is a current frame. There may or may not be an 93 // Precondition: there is a current frame. There may or may not be an
86 // expected frame at the label. 94 // expected frame at the label.
87 ASSERT(code_generator_ != NULL); 95 ASSERT(code_generator_ != NULL);
88 ASSERT(masm_ != NULL); 96 ASSERT(masm_ != NULL);
89 97
90 VirtualFrame* current_frame = code_generator_->frame(); 98 VirtualFrame* current_frame = code_generator_->frame();
91 ASSERT(current_frame != NULL); 99 ASSERT(current_frame != NULL);
92 100
93 if (expected_frame_ == NULL) { 101 if (expected_frame_ == NULL) {
94 expected_frame_ = new VirtualFrame(current_frame); 102 expected_frame_ = new VirtualFrame(current_frame);
103 // The frame at the actual function return will always have height zero.
104 if (code_generator_->IsActualFunctionReturn(this)) {
105 expected_frame_->Forget(expected_frame_->height());
106 }
95 } else { 107 } else {
96 current_frame->MergeTo(expected_frame_); 108 // No code needs to be emitted to merge to the expected frame at the
109 // actual function return.
110 if (!code_generator_->IsActualFunctionReturn(this)) {
111 current_frame->MergeTo(expected_frame_);
112 }
97 } 113 }
98 114
99 __ b(cc, &label_); 115 __ b(cc, &label_);
100 // Postcondition: there is both a current frame and an expected frame at 116 // Postcondition: there is both a current frame and an expected frame at
101 // the label and they match. 117 // the label and they match.
102 } 118 }
103 119
104 120
105 void JumpTarget::Call() { 121 void JumpTarget::Call() {
106 // Precondition: there is a current frame, and there is no expected frame 122 // Precondition: there is a current frame, and there is no expected frame
107 // at the label. 123 // at the label.
108 ASSERT(code_generator_ != NULL); 124 ASSERT(code_generator_ != NULL);
109 ASSERT(masm_ != NULL); 125 ASSERT(masm_ != NULL);
126 ASSERT(!code_generator_->IsActualFunctionReturn(this));
110 127
111 VirtualFrame* current_frame = code_generator_->frame(); 128 VirtualFrame* current_frame = code_generator_->frame();
112 ASSERT(current_frame != NULL); 129 ASSERT(current_frame != NULL);
113 ASSERT(expected_frame_ == NULL); 130 ASSERT(expected_frame_ == NULL);
114 131
115 expected_frame_ = new VirtualFrame(current_frame); 132 expected_frame_ = new VirtualFrame(current_frame);
116 // Adjust the expected frame's height to account for the return address 133 // Adjust the expected frame's height to account for the return address
117 // pushed by the call instruction. 134 // pushed by the call instruction.
118 expected_frame_->Adjust(1); 135 expected_frame_->Adjust(1);
119 136
120 __ bl(&label_); 137 __ bl(&label_);
121 // Postcondition: there is both a current frame and an expected frame at 138 // Postcondition: there is both a current frame and an expected frame at
122 // the label. The current frame is one shorter than the one at the label 139 // the label. The current frame is one shorter than the one at the label
123 // (which contains the return address in memory). 140 // (which contains the return address in memory).
124 } 141 }
125 142
126 143
127 void JumpTarget::Bind() { 144 void JumpTarget::Bind() {
128 // Precondition: there is either a current frame or an expected frame at 145 // Precondition: there is either a current frame or an expected frame at
129 // the label (and possibly both). The label is unbound. 146 // the label (and possibly both). The label is unbound.
130 ASSERT(code_generator_ != NULL); 147 ASSERT(code_generator_ != NULL);
131 ASSERT(masm_ != NULL); 148 ASSERT(masm_ != NULL);
132 149
133 VirtualFrame* current_frame = code_generator_->frame(); 150 VirtualFrame* current_frame = code_generator_->frame();
134 ASSERT(current_frame != NULL || expected_frame_ != NULL); 151 ASSERT(current_frame != NULL || expected_frame_ != NULL);
135 ASSERT(!label_.is_bound()); 152 ASSERT(!label_.is_bound());
136 153
137 if (expected_frame_ == NULL) { 154 if (expected_frame_ == NULL) {
138 expected_frame_ = new VirtualFrame(current_frame); 155 expected_frame_ = new VirtualFrame(current_frame);
156 // The frame at the actual function return will always have height zero.
157 if (code_generator_->IsActualFunctionReturn(this)) {
158 expected_frame_->Forget(expected_frame_->height());
159 }
139 } else if (current_frame == NULL) { 160 } else if (current_frame == NULL) {
140 code_generator_->set_frame(new VirtualFrame(expected_frame_)); 161 code_generator_->set_frame(new VirtualFrame(expected_frame_));
141 } else { 162 } else {
142 current_frame->MergeTo(expected_frame_); 163 // No code needs to be emitted to merge to the expected frame at the
164 // actual function return.
165 if (!code_generator_->IsActualFunctionReturn(this)) {
166 current_frame->MergeTo(expected_frame_);
167 }
143 } 168 }
144 169
145 __ bind(&label_); 170 __ bind(&label_);
146 // Postcondition: there is both a current frame and an expected frame at 171 // Postcondition: there is both a current frame and an expected frame at
147 // the label and they match. The label is bound. 172 // the label and they match. The label is bound.
148 } 173 }
149 174
150 175
151 // ------------------------------------------------------------------------- 176 // -------------------------------------------------------------------------
152 // ShadowTarget implementation. 177 // ShadowTarget implementation.
(...skipping 27 matching lines...) Expand all
180 205
181 #ifdef DEBUG 206 #ifdef DEBUG
182 is_shadowing_ = false; 207 is_shadowing_ = false;
183 #endif 208 #endif
184 } 209 }
185 210
186 #undef __ 211 #undef __
187 212
188 213
189 } } // namespace v8::internal 214 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/codegen-arm.cc ('k') | src/jump-target-ia32.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698