Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 150 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 161 | 161 |
| 162 cgen_->frame()->Push(arg); | 162 cgen_->frame()->Push(arg); |
| 163 Branch(cc, hint); | 163 Branch(cc, hint); |
| 164 *arg = cgen_->frame()->Pop(); | 164 *arg = cgen_->frame()->Pop(); |
| 165 | 165 |
| 166 ASSERT(arg->type() == arg_type); | 166 ASSERT(arg->type() == arg_type); |
| 167 ASSERT(!arg->is_register() || arg->reg().is(arg_reg)); | 167 ASSERT(!arg->is_register() || arg->reg().is(arg_reg)); |
| 168 } | 168 } |
| 169 | 169 |
| 170 | 170 |
| 171 void JumpTarget::Branch(Condition cc, Result* arg_1, Result* arg_2, Hint hint) { | |
| 172 ASSERT(cgen_ != NULL); | |
| 173 ASSERT(cgen_->frame() != NULL); | |
| 174 | |
| 175 #ifdef DEBUG | |
| 176 // We want register results at the call site to stay in the same registers | |
| 177 // on the fall-through branch. | |
| 178 Result::Type arg_1_type = arg_1->type(); | |
|
Kevin Millikin (Chromium)
2008/12/29 09:05:38
These assertions don't scale so well. We should t
| |
| 179 Register arg_1_reg = arg_1->is_register() ? arg_1->reg() : no_reg; | |
| 180 Result::Type arg_2_type = arg_2->type(); | |
| 181 Register arg_2_reg = arg_2->is_register() ? arg_2->reg() : no_reg; | |
| 182 #endif | |
| 183 | |
| 184 cgen_->frame()->Push(arg_1); | |
| 185 cgen_->frame()->Push(arg_2); | |
| 186 Branch(cc, hint); | |
| 187 *arg_2 = cgen_->frame()->Pop(); | |
| 188 *arg_1 = cgen_->frame()->Pop(); | |
| 189 | |
| 190 ASSERT(arg_1->type() == arg_1_type); | |
| 191 ASSERT(!arg_1->is_register() || arg_1->reg().is(arg_1_reg)); | |
| 192 ASSERT(arg_2->type() == arg_2_type); | |
| 193 ASSERT(!arg_2->is_register() || arg_2->reg().is(arg_2_reg)); | |
| 194 } | |
| 195 | |
| 196 | |
| 171 void JumpTarget::Call() { | 197 void JumpTarget::Call() { |
| 172 // Precondition: there is a current frame, and there is no expected frame | 198 // Precondition: there is a current frame, and there is no expected frame |
| 173 // at the label. | 199 // at the label. |
| 174 ASSERT(cgen_ != NULL); | 200 ASSERT(cgen_ != NULL); |
| 175 ASSERT(masm_ != NULL); | 201 ASSERT(masm_ != NULL); |
| 176 ASSERT(!cgen_->IsActualFunctionReturn(this)); | 202 ASSERT(!cgen_->IsActualFunctionReturn(this)); |
| 177 | 203 |
| 178 VirtualFrame* current_frame = cgen_->frame(); | 204 VirtualFrame* current_frame = cgen_->frame(); |
| 179 ASSERT(current_frame != NULL); | 205 ASSERT(current_frame != NULL); |
| 180 ASSERT(expected_frame_ == NULL); | 206 ASSERT(expected_frame_ == NULL); |
| (...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 254 cgen_->frame()->Push(arg); | 280 cgen_->frame()->Push(arg); |
| 255 } | 281 } |
| 256 Bind(); | 282 Bind(); |
| 257 *arg = cgen_->frame()->Pop(); | 283 *arg = cgen_->frame()->Pop(); |
| 258 | 284 |
| 259 ASSERT(!had_entry_frame || arg->type() == arg_type); | 285 ASSERT(!had_entry_frame || arg->type() == arg_type); |
| 260 ASSERT(!had_entry_frame || !arg->is_register() || arg->reg().is(arg_reg)); | 286 ASSERT(!had_entry_frame || !arg->is_register() || arg->reg().is(arg_reg)); |
| 261 } | 287 } |
| 262 | 288 |
| 263 | 289 |
| 290 void JumpTarget::Bind(Result* arg_1, Result* arg_2) { | |
| 291 ASSERT(cgen_ != NULL); | |
| 292 | |
| 293 #ifdef DEBUG | |
| 294 // We want register results at the call site to stay in the same | |
| 295 // registers. | |
| 296 bool had_entry_frame = false; | |
| 297 Result::Type arg_1_type; | |
| 298 Register arg_1_reg; | |
| 299 Result::Type arg_2_type; | |
| 300 Register arg_2_reg; | |
| 301 #endif | |
| 302 | |
| 303 if (cgen_->frame() != NULL) { | |
| 304 #ifdef DEBUG | |
| 305 had_entry_frame = true; | |
| 306 arg_1_type = arg_1->type(); | |
| 307 arg_1_reg = arg_1->is_register() ? arg_1->reg() : no_reg; | |
| 308 arg_2_type = arg_2->type(); | |
| 309 arg_2_reg = arg_2->is_register() ? arg_2->reg() : no_reg; | |
| 310 #endif | |
| 311 cgen_->frame()->Push(arg_1); | |
| 312 cgen_->frame()->Push(arg_2); | |
| 313 } | |
| 314 Bind(); | |
| 315 *arg_2 = cgen_->frame()->Pop(); | |
| 316 *arg_1 = cgen_->frame()->Pop(); | |
| 317 | |
| 318 ASSERT(!had_entry_frame || arg_1->type() == arg_1_type); | |
| 319 ASSERT(!had_entry_frame || | |
| 320 !arg_1->is_register() || | |
| 321 arg_1->reg().is(arg_1_reg)); | |
| 322 ASSERT(!had_entry_frame || arg_2->type() == arg_2_type); | |
| 323 ASSERT(!had_entry_frame || | |
| 324 !arg_2->is_register() || | |
| 325 arg_2->reg().is(arg_2_reg)); | |
| 326 } | |
| 327 | |
| 328 | |
| 264 // ------------------------------------------------------------------------- | 329 // ------------------------------------------------------------------------- |
| 265 // ShadowTarget implementation. | 330 // ShadowTarget implementation. |
| 266 | 331 |
| 267 ShadowTarget::ShadowTarget(JumpTarget* original) { | 332 ShadowTarget::ShadowTarget(JumpTarget* original) { |
| 268 ASSERT(original != NULL); | 333 ASSERT(original != NULL); |
| 269 original_target_ = original; | 334 original_target_ = original; |
| 270 original_pos_ = original->label()->pos_; | 335 original_pos_ = original->label()->pos_; |
| 271 original_expected_frame_ = original->expected_frame(); | 336 original_expected_frame_ = original->expected_frame(); |
| 272 | 337 |
| 273 // We do not call Unuse() on the orginal jump target, because we do not | 338 // We do not call Unuse() on the orginal jump target, because we do not |
| (...skipping 19 matching lines...) Expand all Loading... | |
| 293 | 358 |
| 294 #ifdef DEBUG | 359 #ifdef DEBUG |
| 295 is_shadowing_ = false; | 360 is_shadowing_ = false; |
| 296 #endif | 361 #endif |
| 297 } | 362 } |
| 298 | 363 |
| 299 #undef __ | 364 #undef __ |
| 300 | 365 |
| 301 | 366 |
| 302 } } // namespace v8::internal | 367 } } // namespace v8::internal |
| OLD | NEW |