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

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

Issue 22715004: Version 3.20.15 (Closed) Base URL: https://v8.googlecode.com/svn/trunk
Patch Set: Add TypedArray API and correctness patches r16033 and r16084 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
« no previous file with comments | « src/code-stubs.cc ('k') | src/compiler.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 23 matching lines...) Expand all
34 namespace v8 { 34 namespace v8 {
35 namespace internal { 35 namespace internal {
36 36
37 37
38 static LChunk* OptimizeGraph(HGraph* graph) { 38 static LChunk* OptimizeGraph(HGraph* graph) {
39 DisallowHeapAllocation no_allocation; 39 DisallowHeapAllocation no_allocation;
40 DisallowHandleAllocation no_handles; 40 DisallowHandleAllocation no_handles;
41 DisallowHandleDereference no_deref; 41 DisallowHandleDereference no_deref;
42 42
43 ASSERT(graph != NULL); 43 ASSERT(graph != NULL);
44 BailoutReason bailout_reason = kNoReason; 44 SmartArrayPointer<char> bailout_reason;
45 if (!graph->Optimize(&bailout_reason)) { 45 if (!graph->Optimize(&bailout_reason)) {
46 FATAL(GetBailoutReason(bailout_reason)); 46 FATAL(bailout_reason.is_empty() ? "unknown" : *bailout_reason);
47 } 47 }
48 LChunk* chunk = LChunk::NewChunk(graph); 48 LChunk* chunk = LChunk::NewChunk(graph);
49 if (chunk == NULL) { 49 if (chunk == NULL) {
50 FATAL(GetBailoutReason(graph->info()->bailout_reason())); 50 FATAL(graph->info()->bailout_reason());
51 } 51 }
52 return chunk; 52 return chunk;
53 } 53 }
54 54
55 55
56 class CodeStubGraphBuilderBase : public HGraphBuilder { 56 class CodeStubGraphBuilderBase : public HGraphBuilder {
57 public: 57 public:
58 CodeStubGraphBuilderBase(Isolate* isolate, HydrogenCodeStub* stub) 58 CodeStubGraphBuilderBase(Isolate* isolate, HydrogenCodeStub* stub)
59 : HGraphBuilder(&info_), 59 : HGraphBuilder(&info_),
60 arguments_length_(NULL), 60 arguments_length_(NULL),
(...skipping 734 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 Handle<Type> type = stub->GetType(graph()->isolate());
808 HValue* input = GetParameter(0);
809
810 // Prevent unwanted HChange being inserted to ensure that the stub
811 // deopts on newly encountered types.
812 if (!type->Maybe(Type::Double())) {
813 input = Add<HForceRepresentation>(input, Representation::Smi());
814 }
815
816 if (!type->Is(Type::Number())) {
817 // If we expect to see other things than Numbers, we will create a generic
818 // stub, which handles all numbers and calls into the runtime for the rest.
819 IfBuilder if_number(this);
820 if_number.If<HIsNumberAndBranch>(input);
821 if_number.Then();
822 HInstruction* res = BuildUnaryMathOp(input, type, stub->operation());
823 if_number.Return(AddInstruction(res));
824 if_number.Else();
825 HValue* function = AddLoadJSBuiltin(stub->ToJSBuiltin());
826 Add<HPushArgument>(GetParameter(0));
827 HValue* result = Add<HInvokeFunction>(function, 1);
828 if_number.Return(result);
829 if_number.End();
830 return graph()->GetConstantUndefined();
831 }
832
833 return AddInstruction(BuildUnaryMathOp(input, type, stub->operation()));
834 }
835
836
837 Handle<Code> UnaryOpStub::GenerateCode() {
838 return DoGenerateCode(this);
839 }
840
841
842 template <>
805 HValue* CodeStubGraphBuilder<ToBooleanStub>::BuildCodeInitializedStub() { 843 HValue* CodeStubGraphBuilder<ToBooleanStub>::BuildCodeInitializedStub() {
806 ToBooleanStub* stub = casted_stub(); 844 ToBooleanStub* stub = casted_stub();
807 845
808 IfBuilder if_true(this); 846 IfBuilder if_true(this);
809 if_true.If<HBranch>(GetParameter(0), stub->GetTypes()); 847 if_true.If<HBranch>(GetParameter(0), stub->GetTypes());
810 if_true.Then(); 848 if_true.Then();
811 if_true.Return(graph()->GetConstant1()); 849 if_true.Return(graph()->GetConstant1());
812 if_true.Else(); 850 if_true.Else();
813 if_true.End(); 851 if_true.End();
814 return graph()->GetConstant0(); 852 return graph()->GetConstant0();
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after
897 return value; 935 return value;
898 } 936 }
899 937
900 938
901 Handle<Code> ElementsTransitionAndStoreStub::GenerateCode() { 939 Handle<Code> ElementsTransitionAndStoreStub::GenerateCode() {
902 return DoGenerateCode(this); 940 return DoGenerateCode(this);
903 } 941 }
904 942
905 943
906 } } // namespace v8::internal 944 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/code-stubs.cc ('k') | src/compiler.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698