OLD | NEW |
1 // Copyright 2013 the V8 project authors. All rights reserved. | 1 // Copyright 2013 the V8 project authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "src/hydrogen.h" | 5 #include "src/hydrogen.h" |
6 | 6 |
7 #include <sstream> | 7 #include <sstream> |
8 | 8 |
9 #include "src/v8.h" | 9 #include "src/v8.h" |
10 | 10 |
(...skipping 10294 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
10305 } | 10305 } |
10306 Push(number_input); | 10306 Push(number_input); |
10307 } | 10307 } |
10308 | 10308 |
10309 // The addition has no side effects, so we do not need | 10309 // The addition has no side effects, so we do not need |
10310 // to simulate the expression stack after this instruction. | 10310 // to simulate the expression stack after this instruction. |
10311 // Any later failures deopt to the load of the input or earlier. | 10311 // Any later failures deopt to the load of the input or earlier. |
10312 HConstant* delta = (expr->op() == Token::INC) | 10312 HConstant* delta = (expr->op() == Token::INC) |
10313 ? graph()->GetConstant1() | 10313 ? graph()->GetConstant1() |
10314 : graph()->GetConstantMinus1(); | 10314 : graph()->GetConstantMinus1(); |
10315 HInstruction* instr = AddUncasted<HAdd>(Top(), delta, | 10315 HInstruction* instr = |
10316 function_language_mode()); | 10316 AddUncasted<HAdd>(Top(), delta, strength(function_language_mode())); |
10317 if (instr->IsAdd()) { | 10317 if (instr->IsAdd()) { |
10318 HAdd* add = HAdd::cast(instr); | 10318 HAdd* add = HAdd::cast(instr); |
10319 add->set_observed_input_representation(1, rep); | 10319 add->set_observed_input_representation(1, rep); |
10320 add->set_observed_input_representation(2, Representation::Smi()); | 10320 add->set_observed_input_representation(2, Representation::Smi()); |
10321 } | 10321 } |
10322 instr->SetFlag(HInstruction::kCannotBeTagged); | 10322 instr->SetFlag(HInstruction::kCannotBeTagged); |
10323 instr->ClearAllSideEffects(); | 10323 instr->ClearAllSideEffects(); |
10324 return instr; | 10324 return instr; |
10325 } | 10325 } |
10326 | 10326 |
(...skipping 273 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
10600 Maybe<int> fixed_right_arg = expr->fixed_right_arg(); | 10600 Maybe<int> fixed_right_arg = expr->fixed_right_arg(); |
10601 Handle<AllocationSite> allocation_site = expr->allocation_site(); | 10601 Handle<AllocationSite> allocation_site = expr->allocation_site(); |
10602 | 10602 |
10603 HAllocationMode allocation_mode; | 10603 HAllocationMode allocation_mode; |
10604 if (FLAG_allocation_site_pretenuring && !allocation_site.is_null()) { | 10604 if (FLAG_allocation_site_pretenuring && !allocation_site.is_null()) { |
10605 allocation_mode = HAllocationMode(allocation_site); | 10605 allocation_mode = HAllocationMode(allocation_site); |
10606 } | 10606 } |
10607 | 10607 |
10608 HValue* result = HGraphBuilder::BuildBinaryOperation( | 10608 HValue* result = HGraphBuilder::BuildBinaryOperation( |
10609 expr->op(), left, right, left_type, right_type, result_type, | 10609 expr->op(), left, right, left_type, right_type, result_type, |
10610 fixed_right_arg, allocation_mode, function_language_mode()); | 10610 fixed_right_arg, allocation_mode, strength(function_language_mode())); |
10611 // Add a simulate after instructions with observable side effects, and | 10611 // Add a simulate after instructions with observable side effects, and |
10612 // after phis, which are the result of BuildBinaryOperation when we | 10612 // after phis, which are the result of BuildBinaryOperation when we |
10613 // inlined some complex subgraph. | 10613 // inlined some complex subgraph. |
10614 if (result->HasObservableSideEffects() || result->IsPhi()) { | 10614 if (result->HasObservableSideEffects() || result->IsPhi()) { |
10615 if (push_sim_result == PUSH_BEFORE_SIMULATE) { | 10615 if (push_sim_result == PUSH_BEFORE_SIMULATE) { |
10616 Push(result); | 10616 Push(result); |
10617 Add<HSimulate>(expr->id(), REMOVABLE_SIMULATE); | 10617 Add<HSimulate>(expr->id(), REMOVABLE_SIMULATE); |
10618 Drop(1); | 10618 Drop(1); |
10619 } else { | 10619 } else { |
10620 Add<HSimulate>(expr->id(), REMOVABLE_SIMULATE); | 10620 Add<HSimulate>(expr->id(), REMOVABLE_SIMULATE); |
10621 } | 10621 } |
10622 } | 10622 } |
10623 return result; | 10623 return result; |
10624 } | 10624 } |
10625 | 10625 |
10626 | 10626 |
10627 HValue* HGraphBuilder::BuildBinaryOperation( | 10627 HValue* HGraphBuilder::BuildBinaryOperation(Token::Value op, HValue* left, |
10628 Token::Value op, | 10628 HValue* right, Type* left_type, |
10629 HValue* left, | 10629 Type* right_type, Type* result_type, |
10630 HValue* right, | 10630 Maybe<int> fixed_right_arg, |
10631 Type* left_type, | 10631 HAllocationMode allocation_mode, |
10632 Type* right_type, | 10632 Strength strength) { |
10633 Type* result_type, | |
10634 Maybe<int> fixed_right_arg, | |
10635 HAllocationMode allocation_mode, | |
10636 LanguageMode language_mode) { | |
10637 bool maybe_string_add = false; | 10633 bool maybe_string_add = false; |
10638 if (op == Token::ADD) { | 10634 if (op == Token::ADD) { |
10639 // If we are adding constant string with something for which we don't have | 10635 // If we are adding constant string with something for which we don't have |
10640 // a feedback yet, assume that it's also going to be a string and don't | 10636 // a feedback yet, assume that it's also going to be a string and don't |
10641 // generate deopt instructions. | 10637 // generate deopt instructions. |
10642 if (!left_type->IsInhabited() && right->IsConstant() && | 10638 if (!left_type->IsInhabited() && right->IsConstant() && |
10643 HConstant::cast(right)->HasStringValue()) { | 10639 HConstant::cast(right)->HasStringValue()) { |
10644 left_type = Type::String(); | 10640 left_type = Type::String(); |
10645 } | 10641 } |
10646 | 10642 |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
10688 if (left_type->Is(Type::String())) { | 10684 if (left_type->Is(Type::String())) { |
10689 left = BuildCheckString(left); | 10685 left = BuildCheckString(left); |
10690 } | 10686 } |
10691 | 10687 |
10692 // Validate type feedback for right argument. | 10688 // Validate type feedback for right argument. |
10693 if (right_type->Is(Type::String())) { | 10689 if (right_type->Is(Type::String())) { |
10694 right = BuildCheckString(right); | 10690 right = BuildCheckString(right); |
10695 } | 10691 } |
10696 | 10692 |
10697 // Convert left argument as necessary. | 10693 // Convert left argument as necessary. |
10698 if (left_type->Is(Type::Number()) && !is_strong(language_mode)) { | 10694 if (left_type->Is(Type::Number()) && !is_strong(strength)) { |
10699 DCHECK(right_type->Is(Type::String())); | 10695 DCHECK(right_type->Is(Type::String())); |
10700 left = BuildNumberToString(left, left_type); | 10696 left = BuildNumberToString(left, left_type); |
10701 } else if (!left_type->Is(Type::String())) { | 10697 } else if (!left_type->Is(Type::String())) { |
10702 DCHECK(right_type->Is(Type::String())); | 10698 DCHECK(right_type->Is(Type::String())); |
10703 HValue* function = AddLoadJSBuiltin(is_strong(language_mode) ? | 10699 HValue* function = AddLoadJSBuiltin( |
10704 Builtins::STRING_ADD_RIGHT_STRONG : | 10700 is_strong(strength) ? Builtins::STRING_ADD_RIGHT_STRONG |
10705 Builtins::STRING_ADD_RIGHT); | 10701 : Builtins::STRING_ADD_RIGHT); |
10706 Add<HPushArguments>(left, right); | 10702 Add<HPushArguments>(left, right); |
10707 return AddUncasted<HInvokeFunction>(function, 2); | 10703 return AddUncasted<HInvokeFunction>(function, 2); |
10708 } | 10704 } |
10709 | 10705 |
10710 // Convert right argument as necessary. | 10706 // Convert right argument as necessary. |
10711 if (right_type->Is(Type::Number()) && !is_strong(language_mode)) { | 10707 if (right_type->Is(Type::Number()) && !is_strong(strength)) { |
10712 DCHECK(left_type->Is(Type::String())); | 10708 DCHECK(left_type->Is(Type::String())); |
10713 right = BuildNumberToString(right, right_type); | 10709 right = BuildNumberToString(right, right_type); |
10714 } else if (!right_type->Is(Type::String())) { | 10710 } else if (!right_type->Is(Type::String())) { |
10715 DCHECK(left_type->Is(Type::String())); | 10711 DCHECK(left_type->Is(Type::String())); |
10716 HValue* function = AddLoadJSBuiltin(is_strong(language_mode) ? | 10712 HValue* function = AddLoadJSBuiltin(is_strong(strength) |
10717 Builtins::STRING_ADD_LEFT_STRONG : | 10713 ? Builtins::STRING_ADD_LEFT_STRONG |
10718 Builtins::STRING_ADD_LEFT); | 10714 : Builtins::STRING_ADD_LEFT); |
10719 Add<HPushArguments>(left, right); | 10715 Add<HPushArguments>(left, right); |
10720 return AddUncasted<HInvokeFunction>(function, 2); | 10716 return AddUncasted<HInvokeFunction>(function, 2); |
10721 } | 10717 } |
10722 | 10718 |
10723 // Fast paths for empty constant strings. | 10719 // Fast paths for empty constant strings. |
10724 Handle<String> left_string = | 10720 Handle<String> left_string = |
10725 left->IsConstant() && HConstant::cast(left)->HasStringValue() | 10721 left->IsConstant() && HConstant::cast(left)->HasStringValue() |
10726 ? HConstant::cast(left)->StringValue() | 10722 ? HConstant::cast(left)->StringValue() |
10727 : Handle<String>(); | 10723 : Handle<String>(); |
10728 Handle<String> right_string = | 10724 Handle<String> right_string = |
10729 right->IsConstant() && HConstant::cast(right)->HasStringValue() | 10725 right->IsConstant() && HConstant::cast(right)->HasStringValue() |
10730 ? HConstant::cast(right)->StringValue() | 10726 ? HConstant::cast(right)->StringValue() |
10731 : Handle<String>(); | 10727 : Handle<String>(); |
10732 if (!left_string.is_null() && left_string->length() == 0) return right; | 10728 if (!left_string.is_null() && left_string->length() == 0) return right; |
10733 if (!right_string.is_null() && right_string->length() == 0) return left; | 10729 if (!right_string.is_null() && right_string->length() == 0) return left; |
10734 if (!left_string.is_null() && !right_string.is_null()) { | 10730 if (!left_string.is_null() && !right_string.is_null()) { |
10735 return AddUncasted<HStringAdd>( | 10731 return AddUncasted<HStringAdd>( |
10736 left, right, language_mode, allocation_mode.GetPretenureMode(), | 10732 left, right, strength, allocation_mode.GetPretenureMode(), |
10737 STRING_ADD_CHECK_NONE, allocation_mode.feedback_site()); | 10733 STRING_ADD_CHECK_NONE, allocation_mode.feedback_site()); |
10738 } | 10734 } |
10739 | 10735 |
10740 // Register the dependent code with the allocation site. | 10736 // Register the dependent code with the allocation site. |
10741 if (!allocation_mode.feedback_site().is_null()) { | 10737 if (!allocation_mode.feedback_site().is_null()) { |
10742 DCHECK(!graph()->info()->IsStub()); | 10738 DCHECK(!graph()->info()->IsStub()); |
10743 Handle<AllocationSite> site(allocation_mode.feedback_site()); | 10739 Handle<AllocationSite> site(allocation_mode.feedback_site()); |
10744 top_info()->dependencies()->AssumeTenuringDecision(site); | 10740 top_info()->dependencies()->AssumeTenuringDecision(site); |
10745 } | 10741 } |
10746 | 10742 |
10747 // Inline the string addition into the stub when creating allocation | 10743 // Inline the string addition into the stub when creating allocation |
10748 // mementos to gather allocation site feedback, or if we can statically | 10744 // mementos to gather allocation site feedback, or if we can statically |
10749 // infer that we're going to create a cons string. | 10745 // infer that we're going to create a cons string. |
10750 if ((graph()->info()->IsStub() && | 10746 if ((graph()->info()->IsStub() && |
10751 allocation_mode.CreateAllocationMementos()) || | 10747 allocation_mode.CreateAllocationMementos()) || |
10752 (left->IsConstant() && | 10748 (left->IsConstant() && |
10753 HConstant::cast(left)->HasStringValue() && | 10749 HConstant::cast(left)->HasStringValue() && |
10754 HConstant::cast(left)->StringValue()->length() + 1 >= | 10750 HConstant::cast(left)->StringValue()->length() + 1 >= |
10755 ConsString::kMinLength) || | 10751 ConsString::kMinLength) || |
10756 (right->IsConstant() && | 10752 (right->IsConstant() && |
10757 HConstant::cast(right)->HasStringValue() && | 10753 HConstant::cast(right)->HasStringValue() && |
10758 HConstant::cast(right)->StringValue()->length() + 1 >= | 10754 HConstant::cast(right)->StringValue()->length() + 1 >= |
10759 ConsString::kMinLength)) { | 10755 ConsString::kMinLength)) { |
10760 return BuildStringAdd(left, right, allocation_mode); | 10756 return BuildStringAdd(left, right, allocation_mode); |
10761 } | 10757 } |
10762 | 10758 |
10763 // Fallback to using the string add stub. | 10759 // Fallback to using the string add stub. |
10764 return AddUncasted<HStringAdd>( | 10760 return AddUncasted<HStringAdd>( |
10765 left, right, language_mode, allocation_mode.GetPretenureMode(), | 10761 left, right, strength, allocation_mode.GetPretenureMode(), |
10766 STRING_ADD_CHECK_NONE, allocation_mode.feedback_site()); | 10762 STRING_ADD_CHECK_NONE, allocation_mode.feedback_site()); |
10767 } | 10763 } |
10768 | 10764 |
10769 if (graph()->info()->IsStub()) { | 10765 if (graph()->info()->IsStub()) { |
10770 left = EnforceNumberType(left, left_type); | 10766 left = EnforceNumberType(left, left_type); |
10771 right = EnforceNumberType(right, right_type); | 10767 right = EnforceNumberType(right, right_type); |
10772 } | 10768 } |
10773 | 10769 |
10774 Representation result_rep = RepresentationFor(result_type); | 10770 Representation result_rep = RepresentationFor(result_type); |
10775 | 10771 |
10776 bool is_non_primitive = (left_rep.IsTagged() && !left_rep.IsSmi()) || | 10772 bool is_non_primitive = (left_rep.IsTagged() && !left_rep.IsSmi()) || |
10777 (right_rep.IsTagged() && !right_rep.IsSmi()); | 10773 (right_rep.IsTagged() && !right_rep.IsSmi()); |
10778 | 10774 |
10779 HInstruction* instr = NULL; | 10775 HInstruction* instr = NULL; |
10780 // Only the stub is allowed to call into the runtime, since otherwise we would | 10776 // Only the stub is allowed to call into the runtime, since otherwise we would |
10781 // inline several instructions (including the two pushes) for every tagged | 10777 // inline several instructions (including the two pushes) for every tagged |
10782 // operation in optimized code, which is more expensive, than a stub call. | 10778 // operation in optimized code, which is more expensive, than a stub call. |
10783 if (graph()->info()->IsStub() && is_non_primitive) { | 10779 if (graph()->info()->IsStub() && is_non_primitive) { |
10784 HValue* function = AddLoadJSBuiltin( | 10780 HValue* function = |
10785 BinaryOpIC::TokenToJSBuiltin(op, language_mode)); | 10781 AddLoadJSBuiltin(BinaryOpIC::TokenToJSBuiltin(op, strength)); |
10786 Add<HPushArguments>(left, right); | 10782 Add<HPushArguments>(left, right); |
10787 instr = AddUncasted<HInvokeFunction>(function, 2); | 10783 instr = AddUncasted<HInvokeFunction>(function, 2); |
10788 } else { | 10784 } else { |
10789 switch (op) { | 10785 switch (op) { |
10790 case Token::ADD: | 10786 case Token::ADD: |
10791 instr = AddUncasted<HAdd>(left, right, language_mode); | 10787 instr = AddUncasted<HAdd>(left, right, strength); |
10792 break; | 10788 break; |
10793 case Token::SUB: | 10789 case Token::SUB: |
10794 instr = AddUncasted<HSub>(left, right, language_mode); | 10790 instr = AddUncasted<HSub>(left, right, strength); |
10795 break; | 10791 break; |
10796 case Token::MUL: | 10792 case Token::MUL: |
10797 instr = AddUncasted<HMul>(left, right, language_mode); | 10793 instr = AddUncasted<HMul>(left, right, strength); |
10798 break; | 10794 break; |
10799 case Token::MOD: { | 10795 case Token::MOD: { |
10800 if (fixed_right_arg.IsJust() && | 10796 if (fixed_right_arg.IsJust() && |
10801 !right->EqualsInteger32Constant(fixed_right_arg.FromJust())) { | 10797 !right->EqualsInteger32Constant(fixed_right_arg.FromJust())) { |
10802 HConstant* fixed_right = | 10798 HConstant* fixed_right = |
10803 Add<HConstant>(static_cast<int>(fixed_right_arg.FromJust())); | 10799 Add<HConstant>(static_cast<int>(fixed_right_arg.FromJust())); |
10804 IfBuilder if_same(this); | 10800 IfBuilder if_same(this); |
10805 if_same.If<HCompareNumericAndBranch>(right, fixed_right, Token::EQ); | 10801 if_same.If<HCompareNumericAndBranch>(right, fixed_right, Token::EQ); |
10806 if_same.Then(); | 10802 if_same.Then(); |
10807 if_same.ElseDeopt(Deoptimizer::kUnexpectedRHSOfBinaryOperation); | 10803 if_same.ElseDeopt(Deoptimizer::kUnexpectedRHSOfBinaryOperation); |
10808 right = fixed_right; | 10804 right = fixed_right; |
10809 } | 10805 } |
10810 instr = AddUncasted<HMod>(left, right, language_mode); | 10806 instr = AddUncasted<HMod>(left, right, strength); |
10811 break; | 10807 break; |
10812 } | 10808 } |
10813 case Token::DIV: | 10809 case Token::DIV: |
10814 instr = AddUncasted<HDiv>(left, right, language_mode); | 10810 instr = AddUncasted<HDiv>(left, right, strength); |
10815 break; | 10811 break; |
10816 case Token::BIT_XOR: | 10812 case Token::BIT_XOR: |
10817 case Token::BIT_AND: | 10813 case Token::BIT_AND: |
10818 instr = AddUncasted<HBitwise>(op, left, right, language_mode); | 10814 instr = AddUncasted<HBitwise>(op, left, right, strength); |
10819 break; | 10815 break; |
10820 case Token::BIT_OR: { | 10816 case Token::BIT_OR: { |
10821 HValue* operand, *shift_amount; | 10817 HValue* operand, *shift_amount; |
10822 if (left_type->Is(Type::Signed32()) && | 10818 if (left_type->Is(Type::Signed32()) && |
10823 right_type->Is(Type::Signed32()) && | 10819 right_type->Is(Type::Signed32()) && |
10824 MatchRotateRight(left, right, &operand, &shift_amount)) { | 10820 MatchRotateRight(left, right, &operand, &shift_amount)) { |
10825 instr = AddUncasted<HRor>(operand, shift_amount, language_mode); | 10821 instr = AddUncasted<HRor>(operand, shift_amount, strength); |
10826 } else { | 10822 } else { |
10827 instr = AddUncasted<HBitwise>(op, left, right, language_mode); | 10823 instr = AddUncasted<HBitwise>(op, left, right, strength); |
10828 } | 10824 } |
10829 break; | 10825 break; |
10830 } | 10826 } |
10831 case Token::SAR: | 10827 case Token::SAR: |
10832 instr = AddUncasted<HSar>(left, right, language_mode); | 10828 instr = AddUncasted<HSar>(left, right, strength); |
10833 break; | 10829 break; |
10834 case Token::SHR: | 10830 case Token::SHR: |
10835 instr = AddUncasted<HShr>(left, right, language_mode); | 10831 instr = AddUncasted<HShr>(left, right, strength); |
10836 if (instr->IsShr() && CanBeZero(right)) { | 10832 if (instr->IsShr() && CanBeZero(right)) { |
10837 graph()->RecordUint32Instruction(instr); | 10833 graph()->RecordUint32Instruction(instr); |
10838 } | 10834 } |
10839 break; | 10835 break; |
10840 case Token::SHL: | 10836 case Token::SHL: |
10841 instr = AddUncasted<HShl>(left, right, language_mode); | 10837 instr = AddUncasted<HShl>(left, right, strength); |
10842 break; | 10838 break; |
10843 default: | 10839 default: |
10844 UNREACHABLE(); | 10840 UNREACHABLE(); |
10845 } | 10841 } |
10846 } | 10842 } |
10847 | 10843 |
10848 if (instr->IsBinaryOperation()) { | 10844 if (instr->IsBinaryOperation()) { |
10849 HBinaryOperation* binop = HBinaryOperation::cast(instr); | 10845 HBinaryOperation* binop = HBinaryOperation::cast(instr); |
10850 binop->set_observed_input_representation(1, left_rep); | 10846 binop->set_observed_input_representation(1, left_rep); |
10851 binop->set_observed_input_representation(2, right_rep); | 10847 binop->set_observed_input_representation(2, right_rep); |
(...skipping 367 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
11219 } else if (combined_type->Is(Type::String())) { | 11215 } else if (combined_type->Is(Type::String())) { |
11220 BuildCheckHeapObject(left); | 11216 BuildCheckHeapObject(left); |
11221 Add<HCheckInstanceType>(left, HCheckInstanceType::IS_STRING); | 11217 Add<HCheckInstanceType>(left, HCheckInstanceType::IS_STRING); |
11222 BuildCheckHeapObject(right); | 11218 BuildCheckHeapObject(right); |
11223 Add<HCheckInstanceType>(right, HCheckInstanceType::IS_STRING); | 11219 Add<HCheckInstanceType>(right, HCheckInstanceType::IS_STRING); |
11224 HStringCompareAndBranch* result = | 11220 HStringCompareAndBranch* result = |
11225 New<HStringCompareAndBranch>(left, right, op); | 11221 New<HStringCompareAndBranch>(left, right, op); |
11226 return result; | 11222 return result; |
11227 } else { | 11223 } else { |
11228 if (combined_rep.IsTagged() || combined_rep.IsNone()) { | 11224 if (combined_rep.IsTagged() || combined_rep.IsNone()) { |
11229 HCompareGeneric* result = | 11225 HCompareGeneric* result = Add<HCompareGeneric>( |
11230 Add<HCompareGeneric>(left, right, op, function_language_mode()); | 11226 left, right, op, strength(function_language_mode())); |
11231 result->set_observed_input_representation(1, left_rep); | 11227 result->set_observed_input_representation(1, left_rep); |
11232 result->set_observed_input_representation(2, right_rep); | 11228 result->set_observed_input_representation(2, right_rep); |
11233 if (result->HasObservableSideEffects()) { | 11229 if (result->HasObservableSideEffects()) { |
11234 if (push_sim_result == PUSH_BEFORE_SIMULATE) { | 11230 if (push_sim_result == PUSH_BEFORE_SIMULATE) { |
11235 Push(result); | 11231 Push(result); |
11236 AddSimulate(bailout_id, REMOVABLE_SIMULATE); | 11232 AddSimulate(bailout_id, REMOVABLE_SIMULATE); |
11237 Drop(1); | 11233 Drop(1); |
11238 } else { | 11234 } else { |
11239 AddSimulate(bailout_id, REMOVABLE_SIMULATE); | 11235 AddSimulate(bailout_id, REMOVABLE_SIMULATE); |
11240 } | 11236 } |
(...skipping 839 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
12080 } | 12076 } |
12081 | 12077 |
12082 | 12078 |
12083 // Fast support for StringAdd. | 12079 // Fast support for StringAdd. |
12084 void HOptimizedGraphBuilder::GenerateStringAdd(CallRuntime* call) { | 12080 void HOptimizedGraphBuilder::GenerateStringAdd(CallRuntime* call) { |
12085 DCHECK_EQ(2, call->arguments()->length()); | 12081 DCHECK_EQ(2, call->arguments()->length()); |
12086 CHECK_ALIVE(VisitForValue(call->arguments()->at(0))); | 12082 CHECK_ALIVE(VisitForValue(call->arguments()->at(0))); |
12087 CHECK_ALIVE(VisitForValue(call->arguments()->at(1))); | 12083 CHECK_ALIVE(VisitForValue(call->arguments()->at(1))); |
12088 HValue* right = Pop(); | 12084 HValue* right = Pop(); |
12089 HValue* left = Pop(); | 12085 HValue* left = Pop(); |
12090 HInstruction* result = NewUncasted<HStringAdd>(left, right, | 12086 HInstruction* result = |
12091 function_language_mode()); | 12087 NewUncasted<HStringAdd>(left, right, strength(function_language_mode())); |
12092 return ast_context()->ReturnInstruction(result, call->id()); | 12088 return ast_context()->ReturnInstruction(result, call->id()); |
12093 } | 12089 } |
12094 | 12090 |
12095 | 12091 |
12096 // Fast support for SubString. | 12092 // Fast support for SubString. |
12097 void HOptimizedGraphBuilder::GenerateSubString(CallRuntime* call) { | 12093 void HOptimizedGraphBuilder::GenerateSubString(CallRuntime* call) { |
12098 DCHECK_EQ(3, call->arguments()->length()); | 12094 DCHECK_EQ(3, call->arguments()->length()); |
12099 CHECK_ALIVE(VisitExpressions(call->arguments())); | 12095 CHECK_ALIVE(VisitExpressions(call->arguments())); |
12100 PushArgumentsFromEnvironment(call->arguments()->length()); | 12096 PushArgumentsFromEnvironment(call->arguments()->length()); |
12101 HCallStub* result = New<HCallStub>(CodeStub::SubString, 3); | 12097 HCallStub* result = New<HCallStub>(CodeStub::SubString, 3); |
(...skipping 1077 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
13179 isolate()->GetHTracer()->TraceHydrogen(name(), graph_); | 13175 isolate()->GetHTracer()->TraceHydrogen(name(), graph_); |
13180 } | 13176 } |
13181 | 13177 |
13182 #ifdef DEBUG | 13178 #ifdef DEBUG |
13183 graph_->Verify(false); // No full verify. | 13179 graph_->Verify(false); // No full verify. |
13184 #endif | 13180 #endif |
13185 } | 13181 } |
13186 | 13182 |
13187 } // namespace internal | 13183 } // namespace internal |
13188 } // namespace v8 | 13184 } // namespace v8 |
OLD | NEW |