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

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

Issue 9769: Add state to track the individual elements of the virtual frame.... (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
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 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
68 68
69 VirtualFrame* current_frame = code_generator_->frame(); 69 VirtualFrame* current_frame = code_generator_->frame();
70 ASSERT(current_frame != NULL); 70 ASSERT(current_frame != NULL);
71 71
72 if (expected_frame_ == NULL) { 72 if (expected_frame_ == NULL) {
73 expected_frame_ = current_frame; 73 expected_frame_ = current_frame;
74 code_generator_->set_frame(NULL); 74 code_generator_->set_frame(NULL);
75 // The frame at the actual function return will always have height 75 // The frame at the actual function return will always have height
76 // zero. 76 // zero.
77 if (code_generator_->IsActualFunctionReturn(this)) { 77 if (code_generator_->IsActualFunctionReturn(this)) {
78 expected_frame_->height_ = 0; 78 expected_frame_->Forget(expected_frame_->height());
79 } 79 }
80 } else { 80 } else {
81 // No code needs to be emitted to merge to the expected frame at the 81 // No code needs to be emitted to merge to the expected frame at the
82 // actual function return. 82 // actual function return.
83 if (!code_generator_->IsActualFunctionReturn(this)) { 83 if (!code_generator_->IsActualFunctionReturn(this)) {
84 current_frame->MergeTo(expected_frame_); 84 current_frame->MergeTo(expected_frame_);
85 } 85 }
86 code_generator_->delete_frame(); 86 code_generator_->delete_frame();
87 } 87 }
88 88
(...skipping 10 matching lines...) Expand all
99 ASSERT(masm_ != NULL); 99 ASSERT(masm_ != NULL);
100 100
101 VirtualFrame* current_frame = code_generator_->frame(); 101 VirtualFrame* current_frame = code_generator_->frame();
102 ASSERT(current_frame != NULL); 102 ASSERT(current_frame != NULL);
103 103
104 if (expected_frame_ == NULL) { 104 if (expected_frame_ == NULL) {
105 expected_frame_ = new VirtualFrame(current_frame); 105 expected_frame_ = new VirtualFrame(current_frame);
106 // The frame at the actual function return will always have height 106 // The frame at the actual function return will always have height
107 // zero. 107 // zero.
108 if (code_generator_->IsActualFunctionReturn(this)) { 108 if (code_generator_->IsActualFunctionReturn(this)) {
109 expected_frame_->height_ = 0; 109 expected_frame_->Forget(expected_frame_->height());
110 } 110 }
111 } else { 111 } else {
112 // No code needs to be emitted to merge to the expected frame at the 112 // No code needs to be emitted to merge to the expected frame at the
113 // actual function return. 113 // actual function return.
114 if (!code_generator_->IsActualFunctionReturn(this)) { 114 if (!code_generator_->IsActualFunctionReturn(this)) {
115 current_frame->MergeTo(expected_frame_); 115 current_frame->MergeTo(expected_frame_);
116 } 116 }
117 } 117 }
118 118
119 __ j(cc, &label_, hint); 119 __ j(cc, &label_, hint);
120 // Postcondition: there is both a current frame and an expected frame at 120 // Postcondition: there is both a current frame and an expected frame at
121 // the label and they match. 121 // the label and they match.
122 } 122 }
123 123
124 124
125 void JumpTarget::Call() { 125 void JumpTarget::Call() {
126 // Precondition: there is a current frame, and there is no expected frame 126 // Precondition: there is a current frame, and there is no expected frame
127 // at the label. 127 // at the label.
128 ASSERT(code_generator_ != NULL); 128 ASSERT(code_generator_ != NULL);
129 ASSERT(masm_ != NULL); 129 ASSERT(masm_ != NULL);
130 ASSERT(!code_generator_->IsActualFunctionReturn(this)); 130 ASSERT(!code_generator_->IsActualFunctionReturn(this));
131 131
132 VirtualFrame* current_frame = code_generator_->frame(); 132 VirtualFrame* current_frame = code_generator_->frame();
133 ASSERT(current_frame != NULL); 133 ASSERT(current_frame != NULL);
134 ASSERT(expected_frame_ == NULL); 134 ASSERT(expected_frame_ == NULL);
135 135
136 expected_frame_ = new VirtualFrame(current_frame); 136 expected_frame_ = new VirtualFrame(current_frame);
137 // Adjust the expected frame's height to account for the return address 137 // Adjust the expected frame's height to account for the return address
138 // pushed by the call instruction. 138 // pushed by the call instruction.
139 expected_frame_->height_++; 139 expected_frame_->Adjust(1);
140 140
141 __ call(&label_); 141 __ call(&label_);
142 142
143 // Postcondition: there is both a current frame and an expected frame at 143 // Postcondition: there is both a current frame and an expected frame at
144 // the label. The current frame is one shorter than the one at the label 144 // the label. The current frame is one shorter than the one at the label
145 // (which contains the 'return address', ie, the eip register and possibly 145 // (which contains the 'return address', ie, the eip register and possibly
146 // cs register). 146 // cs register).
147 } 147 }
148 148
149 149
150 void JumpTarget::Bind() { 150 void JumpTarget::Bind() {
151 ASSERT(code_generator_ != NULL); 151 ASSERT(code_generator_ != NULL);
152 ASSERT(masm_ != NULL); 152 ASSERT(masm_ != NULL);
153 153
154 // Precondition: there is either a current frame or an expected frame at 154 // Precondition: there is either a current frame or an expected frame at
155 // the label (and possibly both). The label is unbound. 155 // the label (and possibly both). The label is unbound.
156 VirtualFrame* current_frame = code_generator_->frame(); 156 VirtualFrame* current_frame = code_generator_->frame();
157 ASSERT(current_frame != NULL || expected_frame_ != NULL); 157 ASSERT(current_frame != NULL || expected_frame_ != NULL);
158 ASSERT(!label_.is_bound()); 158 ASSERT(!label_.is_bound());
159 159
160 if (expected_frame_ == NULL) { 160 if (expected_frame_ == NULL) {
161 expected_frame_ = new VirtualFrame(current_frame); 161 expected_frame_ = new VirtualFrame(current_frame);
162 // The frame at the actual function return will always have height 162 // The frame at the actual function return will always have height
163 // zero. 163 // zero.
164 if (code_generator_->IsActualFunctionReturn(this)) { 164 if (code_generator_->IsActualFunctionReturn(this)) {
165 expected_frame_->height_ = 0; 165 expected_frame_->Forget(expected_frame_->height());
166 } 166 }
167 } else if (current_frame == NULL) { 167 } else if (current_frame == NULL) {
168 code_generator_->set_frame(new VirtualFrame(expected_frame_)); 168 code_generator_->set_frame(new VirtualFrame(expected_frame_));
169 } else { 169 } else {
170 // No code needs to be emitted to merge to the expected frame at the 170 // No code needs to be emitted to merge to the expected frame at the
171 // actual function return. 171 // actual function return.
172 if (!code_generator_->IsActualFunctionReturn(this)) { 172 if (!code_generator_->IsActualFunctionReturn(this)) {
173 current_frame->MergeTo(expected_frame_); 173 current_frame->MergeTo(expected_frame_);
174 } 174 }
175 } 175 }
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
212 212
213 #ifdef DEBUG 213 #ifdef DEBUG
214 is_shadowing_ = false; 214 is_shadowing_ = false;
215 #endif 215 #endif
216 } 216 }
217 217
218 #undef __ 218 #undef __
219 219
220 220
221 } } // namespace v8::internal 221 } } // namespace v8::internal
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698