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 647 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
658 } | 658 } |
659 | 659 |
660 ASSERT(FLAG_deopt_every_n_times < 2); // Other values not supported on ARM. | 660 ASSERT(FLAG_deopt_every_n_times < 2); // Other values not supported on ARM. |
661 | 661 |
662 if (FLAG_deopt_every_n_times == 1 && | 662 if (FLAG_deopt_every_n_times == 1 && |
663 info_->shared_info()->opt_count() == id) { | 663 info_->shared_info()->opt_count() == id) { |
664 __ Jump(entry, RelocInfo::RUNTIME_ENTRY); | 664 __ Jump(entry, RelocInfo::RUNTIME_ENTRY); |
665 return; | 665 return; |
666 } | 666 } |
667 | 667 |
668 if (cc == no_condition) { | 668 if (cc == kNoCondition) { |
669 if (FLAG_trap_on_deopt) __ stop("trap_on_deopt"); | 669 if (FLAG_trap_on_deopt) __ stop("trap_on_deopt"); |
670 __ Jump(entry, RelocInfo::RUNTIME_ENTRY); | 670 __ Jump(entry, RelocInfo::RUNTIME_ENTRY); |
671 } else { | 671 } else { |
672 if (FLAG_trap_on_deopt) { | 672 if (FLAG_trap_on_deopt) { |
673 Label done; | 673 Label done; |
674 __ b(&done, NegateCondition(cc)); | 674 __ b(&done, NegateCondition(cc)); |
675 __ stop("trap_on_deopt"); | 675 __ stop("trap_on_deopt"); |
676 __ Jump(entry, RelocInfo::RUNTIME_ENTRY); | 676 __ Jump(entry, RelocInfo::RUNTIME_ENTRY); |
677 __ bind(&done); | 677 __ bind(&done); |
678 } else { | 678 } else { |
(...skipping 534 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1213 __ mul(left, left, right); | 1213 __ mul(left, left, right); |
1214 } | 1214 } |
1215 | 1215 |
1216 if (instr->hydrogen()->CheckFlag(HValue::kBailoutOnMinusZero)) { | 1216 if (instr->hydrogen()->CheckFlag(HValue::kBailoutOnMinusZero)) { |
1217 // Bail out if the result is supposed to be negative zero. | 1217 // Bail out if the result is supposed to be negative zero. |
1218 Label done; | 1218 Label done; |
1219 __ tst(left, Operand(left)); | 1219 __ tst(left, Operand(left)); |
1220 __ b(ne, &done); | 1220 __ b(ne, &done); |
1221 if (instr->InputAt(1)->IsConstantOperand()) { | 1221 if (instr->InputAt(1)->IsConstantOperand()) { |
1222 if (ToInteger32(LConstantOperand::cast(instr->InputAt(1))) < 0) { | 1222 if (ToInteger32(LConstantOperand::cast(instr->InputAt(1))) < 0) { |
1223 DeoptimizeIf(no_condition, instr->environment()); | 1223 DeoptimizeIf(kNoCondition, instr->environment()); |
1224 } | 1224 } |
1225 } else { | 1225 } else { |
1226 // Test the non-zero operand for negative sign. | 1226 // Test the non-zero operand for negative sign. |
1227 __ cmp(ToRegister(instr->TempAt(0)), Operand(0)); | 1227 __ cmp(ToRegister(instr->TempAt(0)), Operand(0)); |
1228 DeoptimizeIf(mi, instr->environment()); | 1228 DeoptimizeIf(mi, instr->environment()); |
1229 } | 1229 } |
1230 __ bind(&done); | 1230 __ bind(&done); |
1231 } | 1231 } |
1232 } | 1232 } |
1233 | 1233 |
(...skipping 246 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1480 | 1480 |
1481 | 1481 |
1482 void LCodeGen::DoBranch(LBranch* instr) { | 1482 void LCodeGen::DoBranch(LBranch* instr) { |
1483 int true_block = chunk_->LookupDestination(instr->true_block_id()); | 1483 int true_block = chunk_->LookupDestination(instr->true_block_id()); |
1484 int false_block = chunk_->LookupDestination(instr->false_block_id()); | 1484 int false_block = chunk_->LookupDestination(instr->false_block_id()); |
1485 | 1485 |
1486 Representation r = instr->hydrogen()->representation(); | 1486 Representation r = instr->hydrogen()->representation(); |
1487 if (r.IsInteger32()) { | 1487 if (r.IsInteger32()) { |
1488 Register reg = ToRegister(instr->InputAt(0)); | 1488 Register reg = ToRegister(instr->InputAt(0)); |
1489 __ cmp(reg, Operand(0)); | 1489 __ cmp(reg, Operand(0)); |
1490 EmitBranch(true_block, false_block, nz); | 1490 EmitBranch(true_block, false_block, ne); |
1491 } else if (r.IsDouble()) { | 1491 } else if (r.IsDouble()) { |
1492 DoubleRegister reg = ToDoubleRegister(instr->InputAt(0)); | 1492 DoubleRegister reg = ToDoubleRegister(instr->InputAt(0)); |
1493 Register scratch = scratch0(); | 1493 Register scratch = scratch0(); |
1494 | 1494 |
1495 // Test the double value. Zero and NaN are false. | 1495 // Test the double value. Zero and NaN are false. |
1496 __ VFPCompareAndLoadFlags(reg, 0.0, scratch); | 1496 __ VFPCompareAndLoadFlags(reg, 0.0, scratch); |
1497 __ tst(scratch, Operand(kVFPZConditionFlagBit | kVFPVConditionFlagBit)); | 1497 __ tst(scratch, Operand(kVFPZConditionFlagBit | kVFPVConditionFlagBit)); |
1498 EmitBranch(true_block, false_block, ne); | 1498 EmitBranch(true_block, false_block, ne); |
1499 } else { | 1499 } else { |
1500 ASSERT(r.IsTagged()); | 1500 ASSERT(r.IsTagged()); |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1538 | 1538 |
1539 // The conversion stub doesn't cause garbage collections so it's | 1539 // The conversion stub doesn't cause garbage collections so it's |
1540 // safe to not record a safepoint after the call. | 1540 // safe to not record a safepoint after the call. |
1541 __ bind(&call_stub); | 1541 __ bind(&call_stub); |
1542 ToBooleanStub stub(reg); | 1542 ToBooleanStub stub(reg); |
1543 RegList saved_regs = kJSCallerSaved | kCalleeSaved; | 1543 RegList saved_regs = kJSCallerSaved | kCalleeSaved; |
1544 __ stm(db_w, sp, saved_regs); | 1544 __ stm(db_w, sp, saved_regs); |
1545 __ CallStub(&stub); | 1545 __ CallStub(&stub); |
1546 __ cmp(reg, Operand(0)); | 1546 __ cmp(reg, Operand(0)); |
1547 __ ldm(ia_w, sp, saved_regs); | 1547 __ ldm(ia_w, sp, saved_regs); |
1548 EmitBranch(true_block, false_block, nz); | 1548 EmitBranch(true_block, false_block, ne); |
1549 } | 1549 } |
1550 } | 1550 } |
1551 } | 1551 } |
1552 | 1552 |
1553 | 1553 |
1554 void LCodeGen::EmitGoto(int block, LDeferredCode* deferred_stack_check) { | 1554 void LCodeGen::EmitGoto(int block, LDeferredCode* deferred_stack_check) { |
1555 block = chunk_->LookupDestination(block); | 1555 block = chunk_->LookupDestination(block); |
1556 int next_block = GetNextEmittedBlock(current_block_); | 1556 int next_block = GetNextEmittedBlock(current_block_); |
1557 if (block != next_block) { | 1557 if (block != next_block) { |
1558 // Perform stack overflow check if this goto needs it before jumping. | 1558 // Perform stack overflow check if this goto needs it before jumping. |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1590 | 1590 |
1591 DeferredStackCheck* deferred = NULL; | 1591 DeferredStackCheck* deferred = NULL; |
1592 if (instr->include_stack_check()) { | 1592 if (instr->include_stack_check()) { |
1593 deferred = new DeferredStackCheck(this, instr); | 1593 deferred = new DeferredStackCheck(this, instr); |
1594 } | 1594 } |
1595 EmitGoto(instr->block_id(), deferred); | 1595 EmitGoto(instr->block_id(), deferred); |
1596 } | 1596 } |
1597 | 1597 |
1598 | 1598 |
1599 Condition LCodeGen::TokenToCondition(Token::Value op, bool is_unsigned) { | 1599 Condition LCodeGen::TokenToCondition(Token::Value op, bool is_unsigned) { |
1600 Condition cond = no_condition; | 1600 Condition cond = kNoCondition; |
1601 switch (op) { | 1601 switch (op) { |
1602 case Token::EQ: | 1602 case Token::EQ: |
1603 case Token::EQ_STRICT: | 1603 case Token::EQ_STRICT: |
1604 cond = eq; | 1604 cond = eq; |
1605 break; | 1605 break; |
1606 case Token::LT: | 1606 case Token::LT: |
1607 cond = is_unsigned ? lo : lt; | 1607 cond = is_unsigned ? lo : lt; |
1608 break; | 1608 break; |
1609 case Token::GT: | 1609 case Token::GT: |
1610 cond = is_unsigned ? hi : gt; | 1610 cond = is_unsigned ? hi : gt; |
(...skipping 522 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2133 case Token::LT: | 2133 case Token::LT: |
2134 return lt; | 2134 return lt; |
2135 case Token::GT: | 2135 case Token::GT: |
2136 return gt; | 2136 return gt; |
2137 case Token::LTE: | 2137 case Token::LTE: |
2138 return le; | 2138 return le; |
2139 case Token::GTE: | 2139 case Token::GTE: |
2140 return ge; | 2140 return ge; |
2141 default: | 2141 default: |
2142 UNREACHABLE(); | 2142 UNREACHABLE(); |
2143 return no_condition; | 2143 return kNoCondition; |
2144 } | 2144 } |
2145 } | 2145 } |
2146 | 2146 |
2147 | 2147 |
2148 void LCodeGen::DoCmpT(LCmpT* instr) { | 2148 void LCodeGen::DoCmpT(LCmpT* instr) { |
2149 Token::Value op = instr->op(); | 2149 Token::Value op = instr->op(); |
2150 | 2150 |
2151 Handle<Code> ic = CompareIC::GetUninitialized(op); | 2151 Handle<Code> ic = CompareIC::GetUninitialized(op); |
2152 CallCode(ic, RelocInfo::CODE_TARGET, instr); | 2152 CallCode(ic, RelocInfo::CODE_TARGET, instr); |
2153 | 2153 |
(...skipping 1399 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3553 instr->type_literal()); | 3553 instr->type_literal()); |
3554 | 3554 |
3555 EmitBranch(true_block, false_block, final_branch_condition); | 3555 EmitBranch(true_block, false_block, final_branch_condition); |
3556 } | 3556 } |
3557 | 3557 |
3558 | 3558 |
3559 Condition LCodeGen::EmitTypeofIs(Label* true_label, | 3559 Condition LCodeGen::EmitTypeofIs(Label* true_label, |
3560 Label* false_label, | 3560 Label* false_label, |
3561 Register input, | 3561 Register input, |
3562 Handle<String> type_name) { | 3562 Handle<String> type_name) { |
3563 Condition final_branch_condition = no_condition; | 3563 Condition final_branch_condition = kNoCondition; |
3564 Register scratch = scratch0(); | 3564 Register scratch = scratch0(); |
3565 if (type_name->Equals(Heap::number_symbol())) { | 3565 if (type_name->Equals(Heap::number_symbol())) { |
3566 __ tst(input, Operand(kSmiTagMask)); | 3566 __ tst(input, Operand(kSmiTagMask)); |
3567 __ b(eq, true_label); | 3567 __ b(eq, true_label); |
3568 __ ldr(input, FieldMemOperand(input, HeapObject::kMapOffset)); | 3568 __ ldr(input, FieldMemOperand(input, HeapObject::kMapOffset)); |
3569 __ LoadRoot(ip, Heap::kHeapNumberMapRootIndex); | 3569 __ LoadRoot(ip, Heap::kHeapNumberMapRootIndex); |
3570 __ cmp(input, Operand(ip)); | 3570 __ cmp(input, Operand(ip)); |
3571 final_branch_condition = eq; | 3571 final_branch_condition = eq; |
3572 | 3572 |
3573 } else if (type_name->Equals(Heap::string_symbol())) { | 3573 } else if (type_name->Equals(Heap::string_symbol())) { |
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3638 } | 3638 } |
3639 | 3639 |
3640 | 3640 |
3641 void LCodeGen::DoLazyBailout(LLazyBailout* instr) { | 3641 void LCodeGen::DoLazyBailout(LLazyBailout* instr) { |
3642 // No code for lazy bailout instruction. Used to capture environment after a | 3642 // No code for lazy bailout instruction. Used to capture environment after a |
3643 // call for populating the safepoint data with deoptimization data. | 3643 // call for populating the safepoint data with deoptimization data. |
3644 } | 3644 } |
3645 | 3645 |
3646 | 3646 |
3647 void LCodeGen::DoDeoptimize(LDeoptimize* instr) { | 3647 void LCodeGen::DoDeoptimize(LDeoptimize* instr) { |
3648 DeoptimizeIf(no_condition, instr->environment()); | 3648 DeoptimizeIf(kNoCondition, instr->environment()); |
3649 } | 3649 } |
3650 | 3650 |
3651 | 3651 |
3652 void LCodeGen::DoDeleteProperty(LDeleteProperty* instr) { | 3652 void LCodeGen::DoDeleteProperty(LDeleteProperty* instr) { |
3653 Register object = ToRegister(instr->object()); | 3653 Register object = ToRegister(instr->object()); |
3654 Register key = ToRegister(instr->key()); | 3654 Register key = ToRegister(instr->key()); |
3655 __ Push(object, key); | 3655 __ Push(object, key); |
3656 RecordPosition(instr->pointer_map()->position()); | 3656 RecordPosition(instr->pointer_map()->position()); |
3657 SafepointGenerator safepoint_generator(this, | 3657 SafepointGenerator safepoint_generator(this, |
3658 instr->pointer_map(), | 3658 instr->pointer_map(), |
(...skipping 15 matching lines...) Expand all Loading... |
3674 | 3674 |
3675 | 3675 |
3676 void LCodeGen::DoOsrEntry(LOsrEntry* instr) { | 3676 void LCodeGen::DoOsrEntry(LOsrEntry* instr) { |
3677 Abort("DoOsrEntry unimplemented."); | 3677 Abort("DoOsrEntry unimplemented."); |
3678 } | 3678 } |
3679 | 3679 |
3680 | 3680 |
3681 #undef __ | 3681 #undef __ |
3682 | 3682 |
3683 } } // namespace v8::internal | 3683 } } // namespace v8::internal |
OLD | NEW |