| OLD | NEW |
| 1 // Copyright 2009 the V8 project authors. All rights reserved. | 1 // Copyright 2009 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 654 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 665 | 665 |
| 666 Comment cmnt(masm_, "[ Case comparison"); | 666 Comment cmnt(masm_, "[ Case comparison"); |
| 667 __ bind(&next_test); | 667 __ bind(&next_test); |
| 668 next_test.Unuse(); | 668 next_test.Unuse(); |
| 669 | 669 |
| 670 // Compile the label expression. | 670 // Compile the label expression. |
| 671 VisitForValue(clause->label(), kAccumulator); | 671 VisitForValue(clause->label(), kAccumulator); |
| 672 | 672 |
| 673 // Perform the comparison as if via '==='. | 673 // Perform the comparison as if via '==='. |
| 674 __ ldr(r1, MemOperand(sp, 0)); // Switch value. | 674 __ ldr(r1, MemOperand(sp, 0)); // Switch value. |
| 675 if (ShouldInlineSmiCase(Token::EQ_STRICT)) { | 675 bool inline_smi_code = ShouldInlineSmiCase(Token::EQ_STRICT); |
| 676 if (inline_smi_code) { |
| 676 Label slow_case; | 677 Label slow_case; |
| 677 __ orr(r2, r1, r0); | 678 __ orr(r2, r1, r0); |
| 678 __ tst(r2, Operand(kSmiTagMask)); | 679 __ tst(r2, Operand(kSmiTagMask)); |
| 679 __ b(ne, &slow_case); | 680 __ b(ne, &slow_case); |
| 680 __ cmp(r1, r0); | 681 __ cmp(r1, r0); |
| 681 __ b(ne, &next_test); | 682 __ b(ne, &next_test); |
| 682 __ Drop(1); // Switch value is no longer needed. | 683 __ Drop(1); // Switch value is no longer needed. |
| 683 __ b(clause->body_target()->entry_label()); | 684 __ b(clause->body_target()->entry_label()); |
| 684 __ bind(&slow_case); | 685 __ bind(&slow_case); |
| 685 } | 686 } |
| 686 | 687 |
| 687 CompareStub stub(eq, true, kBothCouldBeNaN, true, r1, r0); | 688 CompareFlags flags = inline_smi_code |
| 689 ? NO_SMI_COMPARE_IN_STUB |
| 690 : NO_COMPARE_FLAGS; |
| 691 CompareStub stub(eq, true, flags, r1, r0); |
| 688 __ CallStub(&stub); | 692 __ CallStub(&stub); |
| 689 __ cmp(r0, Operand(0, RelocInfo::NONE)); | 693 __ cmp(r0, Operand(0, RelocInfo::NONE)); |
| 690 __ b(ne, &next_test); | 694 __ b(ne, &next_test); |
| 691 __ Drop(1); // Switch value is no longer needed. | 695 __ Drop(1); // Switch value is no longer needed. |
| 692 __ b(clause->body_target()->entry_label()); | 696 __ b(clause->body_target()->entry_label()); |
| 693 } | 697 } |
| 694 | 698 |
| 695 // Discard the test value and jump to the default if present, otherwise to | 699 // Discard the test value and jump to the default if present, otherwise to |
| 696 // the end of the statement. | 700 // the end of the statement. |
| 697 __ bind(&next_test); | 701 __ bind(&next_test); |
| (...skipping 2183 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2881 __ bind(&no_conversion); | 2885 __ bind(&no_conversion); |
| 2882 Apply(context_, result_register()); | 2886 Apply(context_, result_register()); |
| 2883 break; | 2887 break; |
| 2884 } | 2888 } |
| 2885 | 2889 |
| 2886 case Token::SUB: { | 2890 case Token::SUB: { |
| 2887 Comment cmt(masm_, "[ UnaryOperation (SUB)"); | 2891 Comment cmt(masm_, "[ UnaryOperation (SUB)"); |
| 2888 bool can_overwrite = expr->expression()->ResultOverwriteAllowed(); | 2892 bool can_overwrite = expr->expression()->ResultOverwriteAllowed(); |
| 2889 UnaryOverwriteMode overwrite = | 2893 UnaryOverwriteMode overwrite = |
| 2890 can_overwrite ? UNARY_OVERWRITE : UNARY_NO_OVERWRITE; | 2894 can_overwrite ? UNARY_OVERWRITE : UNARY_NO_OVERWRITE; |
| 2891 GenericUnaryOpStub stub(Token::SUB, overwrite); | 2895 GenericUnaryOpStub stub(Token::SUB, |
| 2896 overwrite, |
| 2897 NO_UNARY_FLAGS); |
| 2892 // GenericUnaryOpStub expects the argument to be in the | 2898 // GenericUnaryOpStub expects the argument to be in the |
| 2893 // accumulator register r0. | 2899 // accumulator register r0. |
| 2894 VisitForValue(expr->expression(), kAccumulator); | 2900 VisitForValue(expr->expression(), kAccumulator); |
| 2895 __ CallStub(&stub); | 2901 __ CallStub(&stub); |
| 2896 Apply(context_, r0); | 2902 Apply(context_, r0); |
| 2897 break; | 2903 break; |
| 2898 } | 2904 } |
| 2899 | 2905 |
| 2900 case Token::BIT_NOT: { | 2906 case Token::BIT_NOT: { |
| 2901 Comment cmt(masm_, "[ UnaryOperation (BIT_NOT)"); | 2907 Comment cmt(masm_, "[ UnaryOperation (BIT_NOT)"); |
| 2902 // The generic unary operation stub expects the argument to be | 2908 // The generic unary operation stub expects the argument to be |
| 2903 // in the accumulator register r0. | 2909 // in the accumulator register r0. |
| 2904 VisitForValue(expr->expression(), kAccumulator); | 2910 VisitForValue(expr->expression(), kAccumulator); |
| 2905 Label done; | 2911 Label done; |
| 2906 if (ShouldInlineSmiCase(expr->op())) { | 2912 bool inline_smi_code = ShouldInlineSmiCase(expr->op()); |
| 2913 if (inline_smi_code) { |
| 2907 Label call_stub; | 2914 Label call_stub; |
| 2908 __ BranchOnNotSmi(r0, &call_stub); | 2915 __ BranchOnNotSmi(r0, &call_stub); |
| 2909 __ mvn(r0, Operand(r0)); | 2916 __ mvn(r0, Operand(r0)); |
| 2910 // Bit-clear inverted smi-tag. | 2917 // Bit-clear inverted smi-tag. |
| 2911 __ bic(r0, r0, Operand(kSmiTagMask)); | 2918 __ bic(r0, r0, Operand(kSmiTagMask)); |
| 2912 __ b(&done); | 2919 __ b(&done); |
| 2913 __ bind(&call_stub); | 2920 __ bind(&call_stub); |
| 2914 } | 2921 } |
| 2915 bool overwrite = expr->expression()->ResultOverwriteAllowed(); | 2922 bool overwrite = expr->expression()->ResultOverwriteAllowed(); |
| 2923 UnaryOpFlags flags = inline_smi_code |
| 2924 ? NO_UNARY_SMI_CODE_IN_STUB |
| 2925 : NO_UNARY_FLAGS; |
| 2916 UnaryOverwriteMode mode = | 2926 UnaryOverwriteMode mode = |
| 2917 overwrite ? UNARY_OVERWRITE : UNARY_NO_OVERWRITE; | 2927 overwrite ? UNARY_OVERWRITE : UNARY_NO_OVERWRITE; |
| 2918 GenericUnaryOpStub stub(Token::BIT_NOT, mode); | 2928 GenericUnaryOpStub stub(Token::BIT_NOT, mode, flags); |
| 2919 __ CallStub(&stub); | 2929 __ CallStub(&stub); |
| 2920 __ bind(&done); | 2930 __ bind(&done); |
| 2921 Apply(context_, r0); | 2931 Apply(context_, r0); |
| 2922 break; | 2932 break; |
| 2923 } | 2933 } |
| 2924 | 2934 |
| 2925 default: | 2935 default: |
| 2926 UNREACHABLE(); | 2936 UNREACHABLE(); |
| 2927 } | 2937 } |
| 2928 } | 2938 } |
| (...skipping 356 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3285 case Token::GTE: | 3295 case Token::GTE: |
| 3286 cc = ge; | 3296 cc = ge; |
| 3287 __ pop(r1); | 3297 __ pop(r1); |
| 3288 break; | 3298 break; |
| 3289 case Token::IN: | 3299 case Token::IN: |
| 3290 case Token::INSTANCEOF: | 3300 case Token::INSTANCEOF: |
| 3291 default: | 3301 default: |
| 3292 UNREACHABLE(); | 3302 UNREACHABLE(); |
| 3293 } | 3303 } |
| 3294 | 3304 |
| 3295 if (ShouldInlineSmiCase(op)) { | 3305 bool inline_smi_code = ShouldInlineSmiCase(op); |
| 3306 if (inline_smi_code) { |
| 3296 Label slow_case; | 3307 Label slow_case; |
| 3297 __ orr(r2, r0, Operand(r1)); | 3308 __ orr(r2, r0, Operand(r1)); |
| 3298 __ BranchOnNotSmi(r2, &slow_case); | 3309 __ BranchOnNotSmi(r2, &slow_case); |
| 3299 __ cmp(r1, r0); | 3310 __ cmp(r1, r0); |
| 3300 Split(cc, if_true, if_false, NULL); | 3311 Split(cc, if_true, if_false, NULL); |
| 3301 __ bind(&slow_case); | 3312 __ bind(&slow_case); |
| 3302 } | 3313 } |
| 3303 | 3314 CompareFlags flags = inline_smi_code |
| 3304 CompareStub stub(cc, strict, kBothCouldBeNaN, true, r1, r0); | 3315 ? NO_SMI_COMPARE_IN_STUB |
| 3316 : NO_COMPARE_FLAGS; |
| 3317 CompareStub stub(cc, strict, flags, r1, r0); |
| 3305 __ CallStub(&stub); | 3318 __ CallStub(&stub); |
| 3306 __ cmp(r0, Operand(0, RelocInfo::NONE)); | 3319 __ cmp(r0, Operand(0, RelocInfo::NONE)); |
| 3307 Split(cc, if_true, if_false, fall_through); | 3320 Split(cc, if_true, if_false, fall_through); |
| 3308 } | 3321 } |
| 3309 } | 3322 } |
| 3310 | 3323 |
| 3311 // Convert the result of the comparison into one expected for this | 3324 // Convert the result of the comparison into one expected for this |
| 3312 // expression's context. | 3325 // expression's context. |
| 3313 Apply(context_, if_true, if_false); | 3326 Apply(context_, if_true, if_false); |
| 3314 } | 3327 } |
| (...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3395 __ mov(r1, Operand(r1, ASR, 1)); // Un-smi-tag value. | 3408 __ mov(r1, Operand(r1, ASR, 1)); // Un-smi-tag value. |
| 3396 __ add(pc, r1, Operand(masm_->CodeObject())); | 3409 __ add(pc, r1, Operand(masm_->CodeObject())); |
| 3397 } | 3410 } |
| 3398 | 3411 |
| 3399 | 3412 |
| 3400 #undef __ | 3413 #undef __ |
| 3401 | 3414 |
| 3402 } } // namespace v8::internal | 3415 } } // namespace v8::internal |
| 3403 | 3416 |
| 3404 #endif // V8_TARGET_ARCH_ARM | 3417 #endif // V8_TARGET_ARCH_ARM |
| OLD | NEW |