| OLD | NEW |
| 1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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 784 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 795 : graph()->GetConstantUndefined(); | 795 : graph()->GetConstantUndefined(); |
| 796 } | 796 } |
| 797 | 797 |
| 798 | 798 |
| 799 Handle<Code> CompareNilICStub::GenerateCode() { | 799 Handle<Code> CompareNilICStub::GenerateCode() { |
| 800 return DoGenerateCode(this); | 800 return DoGenerateCode(this); |
| 801 } | 801 } |
| 802 | 802 |
| 803 | 803 |
| 804 template <> | 804 template <> |
| 805 HValue* CodeStubGraphBuilder<UnaryOpStub>::BuildCodeInitializedStub() { | |
| 806 UnaryOpStub* stub = casted_stub(); | |
| 807 ASSERT_EQ(Token::BIT_NOT, stub->operation()); | |
| 808 Handle<Type> type = stub->GetType(graph()->isolate()); | |
| 809 HValue* input = GetParameter(0); | |
| 810 | |
| 811 // Prevent unwanted HChange being inserted to ensure that the stub | |
| 812 // deopts on newly encountered types. | |
| 813 if (!type->Maybe(Type::Double())) { | |
| 814 input = Add<HForceRepresentation>(input, Representation::Smi()); | |
| 815 } | |
| 816 | |
| 817 if (!type->Is(Type::Number())) { | |
| 818 // If we expect to see other things than Numbers, we will create a generic | |
| 819 // stub, which handles all numbers and calls into the runtime for the rest. | |
| 820 IfBuilder if_number(this); | |
| 821 if_number.If<HIsNumberAndBranch>(input); | |
| 822 if_number.Then(); | |
| 823 HInstruction* res = BuildUnaryMathOp(input, type, stub->operation()); | |
| 824 if_number.Return(AddInstruction(res)); | |
| 825 if_number.Else(); | |
| 826 HValue* function = AddLoadJSBuiltin(stub->ToJSBuiltin()); | |
| 827 Add<HPushArgument>(GetParameter(0)); | |
| 828 HValue* result = Add<HInvokeFunction>(function, 1); | |
| 829 if_number.Return(result); | |
| 830 if_number.End(); | |
| 831 return graph()->GetConstantUndefined(); | |
| 832 } | |
| 833 | |
| 834 return AddInstruction(BuildUnaryMathOp(input, type, stub->operation())); | |
| 835 } | |
| 836 | |
| 837 | |
| 838 Handle<Code> UnaryOpStub::GenerateCode() { | |
| 839 return DoGenerateCode(this); | |
| 840 } | |
| 841 | |
| 842 | |
| 843 template <> | |
| 844 HValue* CodeStubGraphBuilder<ToBooleanStub>::BuildCodeInitializedStub() { | 805 HValue* CodeStubGraphBuilder<ToBooleanStub>::BuildCodeInitializedStub() { |
| 845 ToBooleanStub* stub = casted_stub(); | 806 ToBooleanStub* stub = casted_stub(); |
| 846 | 807 |
| 847 IfBuilder if_true(this); | 808 IfBuilder if_true(this); |
| 848 if_true.If<HBranch>(GetParameter(0), stub->GetTypes()); | 809 if_true.If<HBranch>(GetParameter(0), stub->GetTypes()); |
| 849 if_true.Then(); | 810 if_true.Then(); |
| 850 if_true.Return(graph()->GetConstant1()); | 811 if_true.Return(graph()->GetConstant1()); |
| 851 if_true.Else(); | 812 if_true.Else(); |
| 852 if_true.End(); | 813 if_true.End(); |
| 853 return graph()->GetConstant0(); | 814 return graph()->GetConstant0(); |
| (...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 936 return value; | 897 return value; |
| 937 } | 898 } |
| 938 | 899 |
| 939 | 900 |
| 940 Handle<Code> ElementsTransitionAndStoreStub::GenerateCode() { | 901 Handle<Code> ElementsTransitionAndStoreStub::GenerateCode() { |
| 941 return DoGenerateCode(this); | 902 return DoGenerateCode(this); |
| 942 } | 903 } |
| 943 | 904 |
| 944 | 905 |
| 945 } } // namespace v8::internal | 906 } } // namespace v8::internal |
| OLD | NEW |