OLD | NEW |
1 // Copyright 2010 the V8 project authors. All rights reserved. | 1 // Copyright 2010 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 659 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
670 } | 670 } |
671 | 671 |
672 Comment cmnt(masm_, "[ Case comparison"); | 672 Comment cmnt(masm_, "[ Case comparison"); |
673 __ bind(&next_test); | 673 __ bind(&next_test); |
674 next_test.Unuse(); | 674 next_test.Unuse(); |
675 | 675 |
676 // Compile the label expression. | 676 // Compile the label expression. |
677 VisitForValue(clause->label(), kAccumulator); | 677 VisitForValue(clause->label(), kAccumulator); |
678 | 678 |
679 // Perform the comparison as if via '==='. | 679 // Perform the comparison as if via '==='. |
680 if (ShouldInlineSmiCase(Token::EQ_STRICT)) { | 680 __ movq(rdx, Operand(rsp, 0)); // Switch value. |
| 681 bool inline_smi_code = ShouldInlineSmiCase(Token::EQ_STRICT); |
| 682 if (inline_smi_code) { |
681 Label slow_case; | 683 Label slow_case; |
682 __ movq(rdx, Operand(rsp, 0)); // Switch value. | |
683 __ JumpIfNotBothSmi(rdx, rax, &slow_case); | 684 __ JumpIfNotBothSmi(rdx, rax, &slow_case); |
684 __ SmiCompare(rdx, rax); | 685 __ SmiCompare(rdx, rax); |
685 __ j(not_equal, &next_test); | 686 __ j(not_equal, &next_test); |
686 __ Drop(1); // Switch value is no longer needed. | 687 __ Drop(1); // Switch value is no longer needed. |
687 __ jmp(clause->body_target()->entry_label()); | 688 __ jmp(clause->body_target()->entry_label()); |
688 __ bind(&slow_case); | 689 __ bind(&slow_case); |
689 } | 690 } |
690 | 691 |
691 CompareStub stub(equal, true); | 692 CompareFlags flags = inline_smi_code |
| 693 ? NO_SMI_COMPARE_IN_STUB |
| 694 : NO_COMPARE_FLAGS; |
| 695 CompareStub stub(equal, true, flags); |
692 __ CallStub(&stub); | 696 __ CallStub(&stub); |
693 __ testq(rax, rax); | 697 __ testq(rax, rax); |
694 __ j(not_equal, &next_test); | 698 __ j(not_equal, &next_test); |
695 __ Drop(1); // Switch value is no longer needed. | 699 __ Drop(1); // Switch value is no longer needed. |
696 __ jmp(clause->body_target()->entry_label()); | 700 __ jmp(clause->body_target()->entry_label()); |
697 } | 701 } |
698 | 702 |
699 // Discard the test value and jump to the default if present, otherwise to | 703 // Discard the test value and jump to the default if present, otherwise to |
700 // the end of the statement. | 704 // the end of the statement. |
701 __ bind(&next_test); | 705 __ bind(&next_test); |
(...skipping 2245 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2947 __ bind(&no_conversion); | 2951 __ bind(&no_conversion); |
2948 Apply(context_, result_register()); | 2952 Apply(context_, result_register()); |
2949 break; | 2953 break; |
2950 } | 2954 } |
2951 | 2955 |
2952 case Token::SUB: { | 2956 case Token::SUB: { |
2953 Comment cmt(masm_, "[ UnaryOperation (SUB)"); | 2957 Comment cmt(masm_, "[ UnaryOperation (SUB)"); |
2954 bool can_overwrite = expr->expression()->ResultOverwriteAllowed(); | 2958 bool can_overwrite = expr->expression()->ResultOverwriteAllowed(); |
2955 UnaryOverwriteMode overwrite = | 2959 UnaryOverwriteMode overwrite = |
2956 can_overwrite ? UNARY_OVERWRITE : UNARY_NO_OVERWRITE; | 2960 can_overwrite ? UNARY_OVERWRITE : UNARY_NO_OVERWRITE; |
2957 GenericUnaryOpStub stub(Token::SUB, overwrite); | 2961 GenericUnaryOpStub stub(Token::SUB, overwrite, NO_UNARY_FLAGS); |
2958 // GenericUnaryOpStub expects the argument to be in the | 2962 // GenericUnaryOpStub expects the argument to be in the |
2959 // accumulator register rax. | 2963 // accumulator register rax. |
2960 VisitForValue(expr->expression(), kAccumulator); | 2964 VisitForValue(expr->expression(), kAccumulator); |
2961 __ CallStub(&stub); | 2965 __ CallStub(&stub); |
2962 Apply(context_, rax); | 2966 Apply(context_, rax); |
2963 break; | 2967 break; |
2964 } | 2968 } |
2965 | 2969 |
2966 case Token::BIT_NOT: { | 2970 case Token::BIT_NOT: { |
2967 Comment cmt(masm_, "[ UnaryOperation (BIT_NOT)"); | 2971 Comment cmt(masm_, "[ UnaryOperation (BIT_NOT)"); |
2968 // The generic unary operation stub expects the argument to be | 2972 // The generic unary operation stub expects the argument to be |
2969 // in the accumulator register rax. | 2973 // in the accumulator register rax. |
2970 VisitForValue(expr->expression(), kAccumulator); | 2974 VisitForValue(expr->expression(), kAccumulator); |
2971 Label done; | 2975 Label done; |
2972 if (ShouldInlineSmiCase(expr->op())) { | 2976 bool inline_smi_case = ShouldInlineSmiCase(expr->op()); |
| 2977 if (inline_smi_case) { |
2973 Label call_stub; | 2978 Label call_stub; |
2974 __ JumpIfNotSmi(rax, &call_stub); | 2979 __ JumpIfNotSmi(rax, &call_stub); |
2975 __ SmiNot(rax, rax); | 2980 __ SmiNot(rax, rax); |
2976 __ jmp(&done); | 2981 __ jmp(&done); |
2977 __ bind(&call_stub); | 2982 __ bind(&call_stub); |
2978 } | 2983 } |
2979 bool overwrite = expr->expression()->ResultOverwriteAllowed(); | 2984 bool overwrite = expr->expression()->ResultOverwriteAllowed(); |
2980 UnaryOverwriteMode mode = | 2985 UnaryOverwriteMode mode = |
2981 overwrite ? UNARY_OVERWRITE : UNARY_NO_OVERWRITE; | 2986 overwrite ? UNARY_OVERWRITE : UNARY_NO_OVERWRITE; |
2982 GenericUnaryOpStub stub(Token::BIT_NOT, mode); | 2987 UnaryOpFlags flags = inline_smi_case |
| 2988 ? NO_UNARY_SMI_CODE_IN_STUB |
| 2989 : NO_UNARY_FLAGS; |
| 2990 GenericUnaryOpStub stub(Token::BIT_NOT, mode, flags); |
2983 __ CallStub(&stub); | 2991 __ CallStub(&stub); |
2984 __ bind(&done); | 2992 __ bind(&done); |
2985 Apply(context_, rax); | 2993 Apply(context_, rax); |
2986 break; | 2994 break; |
2987 } | 2995 } |
2988 | 2996 |
2989 default: | 2997 default: |
2990 UNREACHABLE(); | 2998 UNREACHABLE(); |
2991 } | 2999 } |
2992 } | 3000 } |
(...skipping 361 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3354 case Token::GTE: | 3362 case Token::GTE: |
3355 cc = greater_equal; | 3363 cc = greater_equal; |
3356 __ pop(rdx); | 3364 __ pop(rdx); |
3357 break; | 3365 break; |
3358 case Token::IN: | 3366 case Token::IN: |
3359 case Token::INSTANCEOF: | 3367 case Token::INSTANCEOF: |
3360 default: | 3368 default: |
3361 UNREACHABLE(); | 3369 UNREACHABLE(); |
3362 } | 3370 } |
3363 | 3371 |
3364 if (ShouldInlineSmiCase(op)) { | 3372 bool inline_smi_code = ShouldInlineSmiCase(op); |
| 3373 if (inline_smi_code) { |
3365 Label slow_case; | 3374 Label slow_case; |
3366 __ JumpIfNotBothSmi(rax, rdx, &slow_case); | 3375 __ JumpIfNotBothSmi(rax, rdx, &slow_case); |
3367 __ SmiCompare(rdx, rax); | 3376 __ SmiCompare(rdx, rax); |
3368 Split(cc, if_true, if_false, NULL); | 3377 Split(cc, if_true, if_false, NULL); |
3369 __ bind(&slow_case); | 3378 __ bind(&slow_case); |
3370 } | 3379 } |
3371 | 3380 |
3372 CompareStub stub(cc, strict); | 3381 CompareFlags flags = inline_smi_code |
| 3382 ? NO_SMI_COMPARE_IN_STUB |
| 3383 : NO_COMPARE_FLAGS; |
| 3384 CompareStub stub(cc, strict, flags); |
3373 __ CallStub(&stub); | 3385 __ CallStub(&stub); |
3374 __ testq(rax, rax); | 3386 __ testq(rax, rax); |
3375 Split(cc, if_true, if_false, fall_through); | 3387 Split(cc, if_true, if_false, fall_through); |
3376 } | 3388 } |
3377 } | 3389 } |
3378 | 3390 |
3379 // Convert the result of the comparison into one expected for this | 3391 // Convert the result of the comparison into one expected for this |
3380 // expression's context. | 3392 // expression's context. |
3381 Apply(context_, if_true, if_false); | 3393 Apply(context_, if_true, if_false); |
3382 } | 3394 } |
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3467 __ ret(0); | 3479 __ ret(0); |
3468 } | 3480 } |
3469 | 3481 |
3470 | 3482 |
3471 #undef __ | 3483 #undef __ |
3472 | 3484 |
3473 | 3485 |
3474 } } // namespace v8::internal | 3486 } } // namespace v8::internal |
3475 | 3487 |
3476 #endif // V8_TARGET_ARCH_X64 | 3488 #endif // V8_TARGET_ARCH_X64 |
OLD | NEW |