Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(129)

Side by Side Diff: src/code-stubs-hydrogen.cc

Issue 22184004: Desugar bitwise negation into XOR and kill all UnaryOp stuff. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Rebased. Feedback. Created 7 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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
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
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
OLDNEW
« no previous file with comments | « src/code-stubs.cc ('k') | src/debug.cc » ('j') | src/x64/lithium-codegen-x64.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698