OLD | NEW |
1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 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 368 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
379 void FullCodeGenerator::StackValueContext::Plug(Slot* slot) const { | 379 void FullCodeGenerator::StackValueContext::Plug(Slot* slot) const { |
380 codegen()->Move(result_register(), slot); | 380 codegen()->Move(result_register(), slot); |
381 __ push(result_register()); | 381 __ push(result_register()); |
382 } | 382 } |
383 | 383 |
384 | 384 |
385 void FullCodeGenerator::TestContext::Plug(Slot* slot) const { | 385 void FullCodeGenerator::TestContext::Plug(Slot* slot) const { |
386 // For simplicity we always test the accumulator register. | 386 // For simplicity we always test the accumulator register. |
387 codegen()->Move(result_register(), slot); | 387 codegen()->Move(result_register(), slot); |
388 codegen()->PrepareForBailoutBeforeSplit(TOS_REG, false, NULL, NULL); | 388 codegen()->PrepareForBailoutBeforeSplit(TOS_REG, false, NULL, NULL); |
389 codegen()->DoTest(true_label_, false_label_, fall_through_); | 389 codegen()->DoTest(this); |
390 } | 390 } |
391 | 391 |
392 | 392 |
393 void FullCodeGenerator::EffectContext::Plug(Heap::RootListIndex index) const { | 393 void FullCodeGenerator::EffectContext::Plug(Heap::RootListIndex index) const { |
394 } | 394 } |
395 | 395 |
396 | 396 |
397 void FullCodeGenerator::AccumulatorValueContext::Plug( | 397 void FullCodeGenerator::AccumulatorValueContext::Plug( |
398 Heap::RootListIndex index) const { | 398 Heap::RootListIndex index) const { |
399 __ LoadRoot(result_register(), index); | 399 __ LoadRoot(result_register(), index); |
(...skipping 13 matching lines...) Expand all Loading... |
413 true_label_, | 413 true_label_, |
414 false_label_); | 414 false_label_); |
415 if (index == Heap::kUndefinedValueRootIndex || | 415 if (index == Heap::kUndefinedValueRootIndex || |
416 index == Heap::kNullValueRootIndex || | 416 index == Heap::kNullValueRootIndex || |
417 index == Heap::kFalseValueRootIndex) { | 417 index == Heap::kFalseValueRootIndex) { |
418 if (false_label_ != fall_through_) __ Branch(false_label_); | 418 if (false_label_ != fall_through_) __ Branch(false_label_); |
419 } else if (index == Heap::kTrueValueRootIndex) { | 419 } else if (index == Heap::kTrueValueRootIndex) { |
420 if (true_label_ != fall_through_) __ Branch(true_label_); | 420 if (true_label_ != fall_through_) __ Branch(true_label_); |
421 } else { | 421 } else { |
422 __ LoadRoot(result_register(), index); | 422 __ LoadRoot(result_register(), index); |
423 codegen()->DoTest(true_label_, false_label_, fall_through_); | 423 codegen()->DoTest(this); |
424 } | 424 } |
425 } | 425 } |
426 | 426 |
427 | 427 |
428 void FullCodeGenerator::EffectContext::Plug(Handle<Object> lit) const { | 428 void FullCodeGenerator::EffectContext::Plug(Handle<Object> lit) const { |
429 } | 429 } |
430 | 430 |
431 | 431 |
432 void FullCodeGenerator::AccumulatorValueContext::Plug( | 432 void FullCodeGenerator::AccumulatorValueContext::Plug( |
433 Handle<Object> lit) const { | 433 Handle<Object> lit) const { |
(...skipping 26 matching lines...) Expand all Loading... |
460 } | 460 } |
461 } else if (lit->IsSmi()) { | 461 } else if (lit->IsSmi()) { |
462 if (Smi::cast(*lit)->value() == 0) { | 462 if (Smi::cast(*lit)->value() == 0) { |
463 if (false_label_ != fall_through_) __ Branch(false_label_); | 463 if (false_label_ != fall_through_) __ Branch(false_label_); |
464 } else { | 464 } else { |
465 if (true_label_ != fall_through_) __ Branch(true_label_); | 465 if (true_label_ != fall_through_) __ Branch(true_label_); |
466 } | 466 } |
467 } else { | 467 } else { |
468 // For simplicity we always test the accumulator register. | 468 // For simplicity we always test the accumulator register. |
469 __ li(result_register(), Operand(lit)); | 469 __ li(result_register(), Operand(lit)); |
470 codegen()->DoTest(true_label_, false_label_, fall_through_); | 470 codegen()->DoTest(this); |
471 } | 471 } |
472 } | 472 } |
473 | 473 |
474 | 474 |
475 void FullCodeGenerator::EffectContext::DropAndPlug(int count, | 475 void FullCodeGenerator::EffectContext::DropAndPlug(int count, |
476 Register reg) const { | 476 Register reg) const { |
477 ASSERT(count > 0); | 477 ASSERT(count > 0); |
478 __ Drop(count); | 478 __ Drop(count); |
479 } | 479 } |
480 | 480 |
(...skipping 15 matching lines...) Expand all Loading... |
496 } | 496 } |
497 | 497 |
498 | 498 |
499 void FullCodeGenerator::TestContext::DropAndPlug(int count, | 499 void FullCodeGenerator::TestContext::DropAndPlug(int count, |
500 Register reg) const { | 500 Register reg) const { |
501 ASSERT(count > 0); | 501 ASSERT(count > 0); |
502 // For simplicity we always test the accumulator register. | 502 // For simplicity we always test the accumulator register. |
503 __ Drop(count); | 503 __ Drop(count); |
504 __ Move(result_register(), reg); | 504 __ Move(result_register(), reg); |
505 codegen()->PrepareForBailoutBeforeSplit(TOS_REG, false, NULL, NULL); | 505 codegen()->PrepareForBailoutBeforeSplit(TOS_REG, false, NULL, NULL); |
506 codegen()->DoTest(true_label_, false_label_, fall_through_); | 506 codegen()->DoTest(this); |
507 } | 507 } |
508 | 508 |
509 | 509 |
510 void FullCodeGenerator::EffectContext::Plug(Label* materialize_true, | 510 void FullCodeGenerator::EffectContext::Plug(Label* materialize_true, |
511 Label* materialize_false) const { | 511 Label* materialize_false) const { |
512 ASSERT(materialize_true == materialize_false); | 512 ASSERT(materialize_true == materialize_false); |
513 __ bind(materialize_true); | 513 __ bind(materialize_true); |
514 } | 514 } |
515 | 515 |
516 | 516 |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
574 true_label_, | 574 true_label_, |
575 false_label_); | 575 false_label_); |
576 if (flag) { | 576 if (flag) { |
577 if (true_label_ != fall_through_) __ Branch(true_label_); | 577 if (true_label_ != fall_through_) __ Branch(true_label_); |
578 } else { | 578 } else { |
579 if (false_label_ != fall_through_) __ Branch(false_label_); | 579 if (false_label_ != fall_through_) __ Branch(false_label_); |
580 } | 580 } |
581 } | 581 } |
582 | 582 |
583 | 583 |
584 void FullCodeGenerator::DoTest(Label* if_true, | 584 void FullCodeGenerator::DoTest(Expression* condition, |
| 585 Label* if_true, |
585 Label* if_false, | 586 Label* if_false, |
586 Label* fall_through) { | 587 Label* fall_through) { |
587 if (CpuFeatures::IsSupported(FPU)) { | 588 if (CpuFeatures::IsSupported(FPU)) { |
588 ToBooleanStub stub(result_register()); | 589 ToBooleanStub stub(result_register()); |
589 __ CallStub(&stub); | 590 __ CallStub(&stub); |
590 __ mov(at, zero_reg); | 591 __ mov(at, zero_reg); |
591 } else { | 592 } else { |
592 // Call the runtime to find the boolean value of the source and then | 593 // Call the runtime to find the boolean value of the source and then |
593 // translate it into control flow to the pair of labels. | 594 // translate it into control flow to the pair of labels. |
594 __ push(result_register()); | 595 __ push(result_register()); |
(...skipping 3782 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4377 __ Addu(at, a1, Operand(masm_->CodeObject())); | 4378 __ Addu(at, a1, Operand(masm_->CodeObject())); |
4378 __ Jump(at); | 4379 __ Jump(at); |
4379 } | 4380 } |
4380 | 4381 |
4381 | 4382 |
4382 #undef __ | 4383 #undef __ |
4383 | 4384 |
4384 } } // namespace v8::internal | 4385 } } // namespace v8::internal |
4385 | 4386 |
4386 #endif // V8_TARGET_ARCH_MIPS | 4387 #endif // V8_TARGET_ARCH_MIPS |
OLD | NEW |