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

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

Issue 450273002: Extend ToBooleanStub to be able to return oddballs. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 6 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.h ('k') | src/compiler/js-generic-lowering.cc » ('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 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "src/v8.h" 5 #include "src/v8.h"
6 6
7 #include "src/code-stubs.h" 7 #include "src/code-stubs.h"
8 #include "src/field-index.h" 8 #include "src/field-index.h"
9 #include "src/hydrogen.h" 9 #include "src/hydrogen.h"
10 #include "src/lithium.h" 10 #include "src/lithium.h"
(...skipping 1047 matching lines...) Expand 10 before | Expand all | Expand 10 after
1058 1058
1059 1059
1060 Handle<Code> StringAddStub::GenerateCode() { 1060 Handle<Code> StringAddStub::GenerateCode() {
1061 return DoGenerateCode(this); 1061 return DoGenerateCode(this);
1062 } 1062 }
1063 1063
1064 1064
1065 template <> 1065 template <>
1066 HValue* CodeStubGraphBuilder<ToBooleanStub>::BuildCodeInitializedStub() { 1066 HValue* CodeStubGraphBuilder<ToBooleanStub>::BuildCodeInitializedStub() {
1067 ToBooleanStub* stub = casted_stub(); 1067 ToBooleanStub* stub = casted_stub();
1068 HValue* true_value = NULL;
1069 HValue* false_value = NULL;
1070
1071 switch (stub->GetMode()) {
1072 case ToBooleanStub::RESULT_AS_SMI:
1073 true_value = graph()->GetConstant1();
1074 false_value = graph()->GetConstant0();
1075 break;
1076 case ToBooleanStub::RESULT_AS_ODDBALL:
1077 true_value = graph()->GetConstantTrue();
1078 false_value = graph()->GetConstantFalse();
1079 break;
1080 case ToBooleanStub::RESULT_AS_INVERSE_ODDBALL:
1081 true_value = graph()->GetConstantFalse();
1082 false_value = graph()->GetConstantTrue();
1083 break;
1084 }
1068 1085
1069 IfBuilder if_true(this); 1086 IfBuilder if_true(this);
1070 if_true.If<HBranch>(GetParameter(0), stub->GetTypes()); 1087 if_true.If<HBranch>(GetParameter(0), stub->GetTypes());
1071 if_true.Then(); 1088 if_true.Then();
1072 if_true.Return(graph()->GetConstant1()); 1089 if_true.Return(true_value);
1073 if_true.Else(); 1090 if_true.Else();
1074 if_true.End(); 1091 if_true.End();
1075 return graph()->GetConstant0(); 1092 return false_value;
1076 } 1093 }
1077 1094
1078 1095
1079 Handle<Code> ToBooleanStub::GenerateCode() { 1096 Handle<Code> ToBooleanStub::GenerateCode() {
1080 return DoGenerateCode(this); 1097 return DoGenerateCode(this);
1081 } 1098 }
1082 1099
1083 1100
1084 template <> 1101 template <>
1085 HValue* CodeStubGraphBuilder<StoreGlobalStub>::BuildCodeInitializedStub() { 1102 HValue* CodeStubGraphBuilder<StoreGlobalStub>::BuildCodeInitializedStub() {
(...skipping 686 matching lines...) Expand 10 before | Expand all | Expand 10 after
1772 return Pop(); 1789 return Pop();
1773 } 1790 }
1774 1791
1775 1792
1776 Handle<Code> KeyedLoadGenericStub::GenerateCode() { 1793 Handle<Code> KeyedLoadGenericStub::GenerateCode() {
1777 return DoGenerateCode(this); 1794 return DoGenerateCode(this);
1778 } 1795 }
1779 1796
1780 1797
1781 } } // namespace v8::internal 1798 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/code-stubs.h ('k') | src/compiler/js-generic-lowering.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698