| OLD | NEW |
| 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/code-stubs.h" | 5 #include "src/code-stubs.h" |
| 6 | 6 |
| 7 #include <memory> | 7 #include <memory> |
| 8 | 8 |
| 9 #include "src/bailout-reason.h" | 9 #include "src/bailout-reason.h" |
| 10 #include "src/code-factory.h" | 10 #include "src/code-factory.h" |
| (...skipping 1102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1113 { | 1113 { |
| 1114 // TODO(bmeurer): Add support for fast ToPrimitive conversion using | 1114 // TODO(bmeurer): Add support for fast ToPrimitive conversion using |
| 1115 // a dedicated ToPrimitiveStub. | 1115 // a dedicated ToPrimitiveStub. |
| 1116 Add<HPushArguments>(input); | 1116 Add<HPushArguments>(input); |
| 1117 Push(Add<HCallRuntime>(Runtime::FunctionForId(Runtime::kToPrimitive), 1)); | 1117 Push(Add<HCallRuntime>(Runtime::FunctionForId(Runtime::kToPrimitive), 1)); |
| 1118 } | 1118 } |
| 1119 if_inputisstringwrapper.End(); | 1119 if_inputisstringwrapper.End(); |
| 1120 return Pop(); | 1120 return Pop(); |
| 1121 } | 1121 } |
| 1122 | 1122 |
| 1123 | |
| 1124 template <> | |
| 1125 HValue* CodeStubGraphBuilder<StringAddStub>::BuildCodeInitializedStub() { | |
| 1126 StringAddStub* stub = casted_stub(); | |
| 1127 StringAddFlags flags = stub->flags(); | |
| 1128 PretenureFlag pretenure_flag = stub->pretenure_flag(); | |
| 1129 | |
| 1130 HValue* left = GetParameter(Descriptor::kLeft); | |
| 1131 HValue* right = GetParameter(Descriptor::kRight); | |
| 1132 | |
| 1133 // Make sure that both arguments are strings if not known in advance. | |
| 1134 if ((flags & STRING_ADD_CHECK_LEFT) == STRING_ADD_CHECK_LEFT) { | |
| 1135 left = | |
| 1136 BuildToString(left, (flags & STRING_ADD_CONVERT) == STRING_ADD_CONVERT); | |
| 1137 } | |
| 1138 if ((flags & STRING_ADD_CHECK_RIGHT) == STRING_ADD_CHECK_RIGHT) { | |
| 1139 right = BuildToString(right, | |
| 1140 (flags & STRING_ADD_CONVERT) == STRING_ADD_CONVERT); | |
| 1141 } | |
| 1142 | |
| 1143 return BuildStringAdd(left, right, HAllocationMode(pretenure_flag)); | |
| 1144 } | |
| 1145 | |
| 1146 | |
| 1147 Handle<Code> StringAddStub::GenerateCode() { | |
| 1148 return DoGenerateCode(this); | |
| 1149 } | |
| 1150 | |
| 1151 template <> | 1123 template <> |
| 1152 HValue* CodeStubGraphBuilder<ToBooleanICStub>::BuildCodeInitializedStub() { | 1124 HValue* CodeStubGraphBuilder<ToBooleanICStub>::BuildCodeInitializedStub() { |
| 1153 ToBooleanICStub* stub = casted_stub(); | 1125 ToBooleanICStub* stub = casted_stub(); |
| 1154 IfBuilder if_true(this); | 1126 IfBuilder if_true(this); |
| 1155 if_true.If<HBranch>(GetParameter(Descriptor::kArgument), stub->types()); | 1127 if_true.If<HBranch>(GetParameter(Descriptor::kArgument), stub->types()); |
| 1156 if_true.Then(); | 1128 if_true.Then(); |
| 1157 if_true.Return(graph()->GetConstantTrue()); | 1129 if_true.Return(graph()->GetConstantTrue()); |
| 1158 if_true.Else(); | 1130 if_true.Else(); |
| 1159 if_true.End(); | 1131 if_true.End(); |
| 1160 return graph()->GetConstantFalse(); | 1132 return graph()->GetConstantFalse(); |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1199 return BuildRegExpConstructResult(length, index, input); | 1171 return BuildRegExpConstructResult(length, index, input); |
| 1200 } | 1172 } |
| 1201 | 1173 |
| 1202 | 1174 |
| 1203 Handle<Code> RegExpConstructResultStub::GenerateCode() { | 1175 Handle<Code> RegExpConstructResultStub::GenerateCode() { |
| 1204 return DoGenerateCode(this); | 1176 return DoGenerateCode(this); |
| 1205 } | 1177 } |
| 1206 | 1178 |
| 1207 } // namespace internal | 1179 } // namespace internal |
| 1208 } // namespace v8 | 1180 } // namespace v8 |
| OLD | NEW |