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

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

Issue 13127: Initial real implementation of simple merge for frames. Does not yet... (Closed) Base URL: http://v8.googlecode.com/svn/branches/experimental/toiger/
Patch Set: '' Created 12 years 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/flag-definitions.h ('k') | src/register-allocator-ia32.h » ('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 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
62 void JumpTarget::Jump() { 62 void JumpTarget::Jump() {
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 expected_frame_->EnsureMergable();
73 // The frame at the actual function return will always have height zero. 72 // The frame at the actual function return will always have height zero.
74 if (code_generator_->IsActualFunctionReturn(this)) { 73 if (code_generator_->IsActualFunctionReturn(this)) {
75 expected_frame_->Forget(expected_frame_->height()); 74 expected_frame_->Forget(expected_frame_->height());
76 } 75 }
76 if (!expected_frame_->IsMergable()) {
77 expected_frame_->MakeMergable();
78 }
77 code_generator_->set_frame(NULL); 79 code_generator_->set_frame(NULL);
78 } else { 80 } else {
79 // 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
80 // actual function return. 82 // actual function return.
81 if (!code_generator_->IsActualFunctionReturn(this)) { 83 if (!code_generator_->IsActualFunctionReturn(this)) {
82 current_frame->MergeTo(expected_frame_); 84 current_frame->MergeTo(expected_frame_);
83 } 85 }
84 code_generator_->delete_frame(); 86 code_generator_->delete_frame();
85 } 87 }
86 88
87 __ jmp(&label_); 89 __ jmp(&label_);
88 // Postcondition: there is no current frame but there is an expected frame 90 // Postcondition: there is no current frame but there is an expected frame
89 // at the label. 91 // at the label.
90 } 92 }
91 93
92 94
93 void JumpTarget::Branch(Condition cc, Hint hint) { 95 void JumpTarget::Branch(Condition cc, Hint hint) {
94 // Precondition: there is a current frame. There may or may not be an 96 // Precondition: there is a current frame. There may or may not be an
95 // expected frame at the label. 97 // expected frame at the label.
96 ASSERT(code_generator_ != NULL); 98 ASSERT(code_generator_ != NULL);
97 ASSERT(masm_ != NULL); 99 ASSERT(masm_ != NULL);
98 100
99 VirtualFrame* current_frame = code_generator_->frame(); 101 VirtualFrame* current_frame = code_generator_->frame();
100 ASSERT(current_frame != NULL); 102 ASSERT(current_frame != NULL);
101 103
102 if (expected_frame_ == NULL) { 104 if (expected_frame_ == NULL) {
103 expected_frame_ = new VirtualFrame(current_frame); 105 expected_frame_ = new VirtualFrame(current_frame);
104 expected_frame_->EnsureMergable();
105 // The frame at the actual function return will always have height zero. 106 // The frame at the actual function return will always have height zero.
106 if (code_generator_->IsActualFunctionReturn(this)) { 107 if (code_generator_->IsActualFunctionReturn(this)) {
107 expected_frame_->Forget(expected_frame_->height()); 108 expected_frame_->Forget(expected_frame_->height());
108 } 109 }
110 if (!expected_frame_->IsMergable()) {
111 expected_frame_->MakeMergable();
112 }
109 } else { 113 } else {
110 // No code needs to be emitted to merge to the expected frame at the 114 // No code needs to be emitted to merge to the expected frame at the
111 // actual function return. 115 // actual function return.
112 if (!code_generator_->IsActualFunctionReturn(this)) { 116 if (!code_generator_->IsActualFunctionReturn(this)) {
113 current_frame->MergeTo(expected_frame_); 117 current_frame->MergeTo(expected_frame_);
114 } 118 }
115 } 119 }
116 120
117 __ j(cc, &label_, hint); 121 __ j(cc, &label_, hint);
118 // Postcondition: there is both a current frame and an expected frame at 122 // Postcondition: there is both a current frame and an expected frame at
119 // the label and they match. 123 // the label and they match.
120 } 124 }
121 125
122 126
123 void JumpTarget::Call() { 127 void JumpTarget::Call() {
124 // Precondition: there is a current frame, and there is no expected frame 128 // Precondition: there is a current frame, and there is no expected frame
125 // at the label. 129 // at the label.
126 ASSERT(code_generator_ != NULL); 130 ASSERT(code_generator_ != NULL);
127 ASSERT(masm_ != NULL); 131 ASSERT(masm_ != NULL);
128 ASSERT(!code_generator_->IsActualFunctionReturn(this)); 132 ASSERT(!code_generator_->IsActualFunctionReturn(this));
129 133
130 VirtualFrame* current_frame = code_generator_->frame(); 134 VirtualFrame* current_frame = code_generator_->frame();
131 ASSERT(current_frame != NULL); 135 ASSERT(current_frame != NULL);
132 ASSERT(expected_frame_ == NULL); 136 ASSERT(expected_frame_ == NULL);
133 137
134 expected_frame_ = new VirtualFrame(current_frame); 138 expected_frame_ = new VirtualFrame(current_frame);
135 expected_frame_->EnsureMergable(); 139 if (!expected_frame_->IsMergable()) {
140 expected_frame_->MakeMergable();
141 }
136 // Adjust the expected frame's height to account for the return address 142 // Adjust the expected frame's height to account for the return address
137 // pushed by the call instruction. 143 // pushed by the call instruction.
138 expected_frame_->Adjust(1); 144 expected_frame_->Adjust(1);
139 145
140 __ call(&label_); 146 __ call(&label_);
141 // Postcondition: there is both a current frame and an expected frame at 147 // Postcondition: there is both a current frame and an expected frame at
142 // the label. The current frame is one shorter than the one at the label 148 // the label. The current frame is one shorter than the one at the label
143 // (which contains the return address in memory). 149 // (which contains the return address in memory).
144 } 150 }
145 151
146 152
147 void JumpTarget::Bind() { 153 void JumpTarget::Bind() {
148 // 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
149 // the label (and possibly both). The label is unbound. 155 // the label (and possibly both). The label is unbound.
150 ASSERT(code_generator_ != NULL); 156 ASSERT(code_generator_ != NULL);
151 ASSERT(masm_ != NULL); 157 ASSERT(masm_ != NULL);
152 158
153 VirtualFrame* current_frame = code_generator_->frame(); 159 VirtualFrame* current_frame = code_generator_->frame();
154 ASSERT(current_frame != NULL || expected_frame_ != NULL); 160 ASSERT(current_frame != NULL || expected_frame_ != NULL);
155 ASSERT(!label_.is_bound()); 161 ASSERT(!label_.is_bound());
156 162
157 if (expected_frame_ == NULL) { 163 if (expected_frame_ == NULL) {
158 expected_frame_ = new VirtualFrame(current_frame); 164 expected_frame_ = new VirtualFrame(current_frame);
159 expected_frame_->EnsureMergable();
160 // The frame at the actual function return will always have height zero. 165 // The frame at the actual function return will always have height zero.
161 if (code_generator_->IsActualFunctionReturn(this)) { 166 if (code_generator_->IsActualFunctionReturn(this)) {
162 expected_frame_->Forget(expected_frame_->height()); 167 expected_frame_->Forget(expected_frame_->height());
163 } 168 }
169 if (!expected_frame_->IsMergable()) {
170 expected_frame_->MakeMergable();
171 }
164 } else if (current_frame == NULL) { 172 } else if (current_frame == NULL) {
165 code_generator_->set_frame(new VirtualFrame(expected_frame_)); 173 code_generator_->set_frame(new VirtualFrame(expected_frame_));
166 } else { 174 } else {
167 // No code needs to be emitted to merge to the expected frame at the 175 // No code needs to be emitted to merge to the expected frame at the
168 // actual function return. 176 // actual function return.
169 if (!code_generator_->IsActualFunctionReturn(this)) { 177 if (!code_generator_->IsActualFunctionReturn(this)) {
170 current_frame->MergeTo(expected_frame_); 178 current_frame->MergeTo(expected_frame_);
171 } 179 }
172 } 180 }
173 181
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
209 217
210 #ifdef DEBUG 218 #ifdef DEBUG
211 is_shadowing_ = false; 219 is_shadowing_ = false;
212 #endif 220 #endif
213 } 221 }
214 222
215 #undef __ 223 #undef __
216 224
217 225
218 } } // namespace v8::internal 226 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/flag-definitions.h ('k') | src/register-allocator-ia32.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698