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

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

Issue 9693: Remove the platform specific jump target files by making them have the... (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/jump-target-ia32.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 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 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
53 53
54 54
55 void JumpTarget::set_code_generator(CodeGenerator* cgen) { 55 void JumpTarget::set_code_generator(CodeGenerator* cgen) {
56 ASSERT(cgen != NULL); 56 ASSERT(cgen != NULL);
57 ASSERT(code_generator_ == NULL); 57 ASSERT(code_generator_ == NULL);
58 code_generator_ = cgen; 58 code_generator_ = cgen;
59 masm_ = cgen->masm(); 59 masm_ = cgen->masm();
60 } 60 }
61 61
62 62
63 bool JumpTarget::IsActualFunctionReturn() {
64 return (this == &code_generator_->function_return_ &&
65 !code_generator_->function_return_is_shadowed_);
66 }
67
68
69 void JumpTarget::Jump() { 63 void JumpTarget::Jump() {
70 // Precondition: there is a current frame. There may or may not be an 64 // Precondition: there is a current frame. There may or may not be an
71 // expected frame at the label. 65 // expected frame at the label.
72 ASSERT(code_generator_ != NULL); 66 ASSERT(code_generator_ != NULL);
73 ASSERT(masm_ != NULL); 67 ASSERT(masm_ != NULL);
74 68
75 VirtualFrame* current_frame = code_generator_->frame(); 69 VirtualFrame* current_frame = code_generator_->frame();
76 ASSERT(current_frame != NULL); 70 ASSERT(current_frame != NULL);
77 71
78 if (expected_frame_ == NULL) { 72 if (expected_frame_ == NULL) {
79 expected_frame_ = current_frame; 73 expected_frame_ = current_frame;
80 code_generator_->set_frame(NULL); 74 code_generator_->set_frame(NULL);
81 // The frame at the actual function return will always have height 75 // The frame at the actual function return will always have height
82 // zero. 76 // zero.
83 if (IsActualFunctionReturn()) expected_frame_->height_ = 0; 77 if (code_generator_->IsActualFunctionReturn(this)) {
78 expected_frame_->height_ = 0;
79 }
84 } else { 80 } else {
85 // 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
86 // actual function return. 82 // actual function return.
87 if (!IsActualFunctionReturn()) current_frame->MergeTo(expected_frame_); 83 if (!code_generator_->IsActualFunctionReturn(this)) {
84 current_frame->MergeTo(expected_frame_);
85 }
88 code_generator_->delete_frame(); 86 code_generator_->delete_frame();
89 } 87 }
90 88
91 __ jmp(&label_); 89 __ jmp(&label_);
92 // 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
93 // at the label. 91 // at the label.
94 } 92 }
95 93
96 94
97 void JumpTarget::Branch(Condition cc, Hint hint) { 95 void JumpTarget::Branch(Condition cc, Hint hint) {
98 // 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
99 // expected frame at the label. 97 // expected frame at the label.
100 ASSERT(code_generator_ != NULL); 98 ASSERT(code_generator_ != NULL);
101 ASSERT(masm_ != NULL); 99 ASSERT(masm_ != NULL);
102 100
103 VirtualFrame* current_frame = code_generator_->frame(); 101 VirtualFrame* current_frame = code_generator_->frame();
104 ASSERT(current_frame != NULL); 102 ASSERT(current_frame != NULL);
105 103
106 if (expected_frame_ == NULL) { 104 if (expected_frame_ == NULL) {
107 expected_frame_ = new VirtualFrame(current_frame); 105 expected_frame_ = new VirtualFrame(current_frame);
108 // The frame at the actual function return will always have height 106 // The frame at the actual function return will always have height
109 // zero. 107 // zero.
110 if (IsActualFunctionReturn()) expected_frame_->height_ = 0; 108 if (code_generator_->IsActualFunctionReturn(this)) {
109 expected_frame_->height_ = 0;
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 (!IsActualFunctionReturn()) current_frame->MergeTo(expected_frame_); 114 if (!code_generator_->IsActualFunctionReturn(this)) {
115 current_frame->MergeTo(expected_frame_);
116 }
115 } 117 }
116 118
117 __ j(cc, &label_, hint); 119 __ j(cc, &label_, hint);
118 // 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
119 // the label and they match. 121 // the label and they match.
120 } 122 }
121 123
122 124
123 void JumpTarget::Call() { 125 void JumpTarget::Call() {
124 // 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
125 // at the label. 127 // at the label.
126 ASSERT(code_generator_ != NULL); 128 ASSERT(code_generator_ != NULL);
127 ASSERT(masm_ != NULL); 129 ASSERT(masm_ != NULL);
128 ASSERT(!IsActualFunctionReturn()); 130 ASSERT(!code_generator_->IsActualFunctionReturn(this));
129 131
130 VirtualFrame* current_frame = code_generator_->frame(); 132 VirtualFrame* current_frame = code_generator_->frame();
131 ASSERT(current_frame != NULL); 133 ASSERT(current_frame != NULL);
132 ASSERT(expected_frame_ == NULL); 134 ASSERT(expected_frame_ == NULL);
133 135
134 expected_frame_ = new VirtualFrame(current_frame); 136 expected_frame_ = new VirtualFrame(current_frame);
135 // 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
136 // pushed by the call instruction. 138 // pushed by the call instruction.
137 expected_frame_->height_++; 139 expected_frame_->height_++;
138 140
(...skipping 13 matching lines...) Expand all
152 // 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
153 // the label (and possibly both). The label is unbound. 155 // the label (and possibly both). The label is unbound.
154 VirtualFrame* current_frame = code_generator_->frame(); 156 VirtualFrame* current_frame = code_generator_->frame();
155 ASSERT(current_frame != NULL || expected_frame_ != NULL); 157 ASSERT(current_frame != NULL || expected_frame_ != NULL);
156 ASSERT(!label_.is_bound()); 158 ASSERT(!label_.is_bound());
157 159
158 if (expected_frame_ == NULL) { 160 if (expected_frame_ == NULL) {
159 expected_frame_ = new VirtualFrame(current_frame); 161 expected_frame_ = new VirtualFrame(current_frame);
160 // The frame at the actual function return will always have height 162 // The frame at the actual function return will always have height
161 // zero. 163 // zero.
162 if (IsActualFunctionReturn()) expected_frame_->height_ = 0; 164 if (code_generator_->IsActualFunctionReturn(this)) {
165 expected_frame_->height_ = 0;
166 }
163 } else if (current_frame == NULL) { 167 } else if (current_frame == NULL) {
164 code_generator_->set_frame(new VirtualFrame(expected_frame_)); 168 code_generator_->set_frame(new VirtualFrame(expected_frame_));
165 } else { 169 } else {
166 // 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
167 // actual function return. 171 // actual function return.
168 if (!IsActualFunctionReturn()) current_frame->MergeTo(expected_frame_); 172 if (!code_generator_->IsActualFunctionReturn(this)) {
173 current_frame->MergeTo(expected_frame_);
174 }
169 } 175 }
170 176
171 __ bind(&label_); 177 __ bind(&label_);
172 // Postcondition: there is both a current frame and an expected frame at 178 // Postcondition: there is both a current frame and an expected frame at
173 // the label and they match. The label is bound. 179 // the label and they match. The label is bound.
174 } 180 }
175 181
176 182
177 // ------------------------------------------------------------------------- 183 // -------------------------------------------------------------------------
178 // ShadowTarget implementation. 184 // ShadowTarget implementation.
(...skipping 27 matching lines...) Expand all
206 212
207 #ifdef DEBUG 213 #ifdef DEBUG
208 is_shadowing_ = false; 214 is_shadowing_ = false;
209 #endif 215 #endif
210 } 216 }
211 217
212 #undef __ 218 #undef __
213 219
214 220
215 } } // namespace v8::internal 221 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/jump-target-ia32.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698