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 3818 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
3829 cc = greater; | 3829 cc = greater; |
3830 break; | 3830 break; |
3831 case Token::LTE: | 3831 case Token::LTE: |
3832 cc = less_equal; | 3832 cc = less_equal; |
3833 break; | 3833 break; |
3834 case Token::GTE: | 3834 case Token::GTE: |
3835 cc = greater_equal; | 3835 cc = greater_equal; |
3836 break; | 3836 break; |
3837 case Token::IN: { | 3837 case Token::IN: { |
3838 Load(left); | 3838 Load(left); |
3839 Load(right); | 3839 Load(right); |
Lasse Reichstein
2010/06/24 08:59:48
The optimization is likely to apply here too, beca
William Hesse
2010/06/24 14:43:53
But since we are going to a builtin, it will be sp
| |
3840 Result answer = frame_->InvokeBuiltin(Builtins::IN, CALL_FUNCTION, 2); | 3840 Result answer = frame_->InvokeBuiltin(Builtins::IN, CALL_FUNCTION, 2); |
3841 frame_->Push(&answer); // push the result | 3841 frame_->Push(&answer); // push the result |
3842 return; | 3842 return; |
3843 } | 3843 } |
3844 case Token::INSTANCEOF: { | 3844 case Token::INSTANCEOF: { |
3845 Load(left); | 3845 Load(left); |
3846 Load(right); | 3846 Load(right); |
Lasse Reichstein
2010/06/24 08:59:48
... but it's probably not worth it here, since lef
| |
3847 InstanceofStub stub; | 3847 InstanceofStub stub; |
3848 Result answer = frame_->CallStub(&stub, 2); | 3848 Result answer = frame_->CallStub(&stub, 2); |
3849 answer.ToRegister(); | 3849 answer.ToRegister(); |
3850 __ testq(answer.reg(), answer.reg()); | 3850 __ testq(answer.reg(), answer.reg()); |
3851 answer.Unuse(); | 3851 answer.Unuse(); |
3852 destination()->Split(zero); | 3852 destination()->Split(zero); |
3853 return; | 3853 return; |
3854 } | 3854 } |
3855 default: | 3855 default: |
3856 UNREACHABLE(); | 3856 UNREACHABLE(); |
3857 } | 3857 } |
3858 Load(left); | 3858 |
3859 Load(right); | 3859 if (left->IsTrivial()) { |
3860 Load(right); | |
3861 Result right_result = frame_->Pop(); | |
3862 frame_->Push(left); | |
3863 frame_->Push(&right_result); | |
Lasse Reichstein
2010/06/24 08:59:48
Could we reverse the comparison instead, and keep
William Hesse
2010/06/24 14:43:53
I don't think so, because the ToNumber calls insid
| |
3864 } else { | |
3865 Load(left); | |
3866 Load(right); | |
3867 } | |
3868 | |
3860 Comparison(node, cc, strict, destination()); | 3869 Comparison(node, cc, strict, destination()); |
3861 } | 3870 } |
3862 | 3871 |
3863 | 3872 |
3864 void CodeGenerator::VisitThisFunction(ThisFunction* node) { | 3873 void CodeGenerator::VisitThisFunction(ThisFunction* node) { |
3865 frame_->PushFunction(); | 3874 frame_->PushFunction(); |
3866 } | 3875 } |
3867 | 3876 |
3868 | 3877 |
3869 void CodeGenerator::GenerateArguments(ZoneList<Expression*>* args) { | 3878 void CodeGenerator::GenerateArguments(ZoneList<Expression*>* args) { |
(...skipping 8024 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
11894 } | 11903 } |
11895 | 11904 |
11896 #endif | 11905 #endif |
11897 | 11906 |
11898 | 11907 |
11899 #undef __ | 11908 #undef __ |
11900 | 11909 |
11901 } } // namespace v8::internal | 11910 } } // namespace v8::internal |
11902 | 11911 |
11903 #endif // V8_TARGET_ARCH_X64 | 11912 #endif // V8_TARGET_ARCH_X64 |
OLD | NEW |