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

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

Issue 1109223004: [strong] Disallow implicit conversions for add (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: cl feedback 3 Created 5 years, 7 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
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/bailout-reason.h" 7 #include "src/bailout-reason.h"
8 #include "src/code-stubs.h" 8 #include "src/code-stubs.h"
9 #include "src/field-index.h" 9 #include "src/field-index.h"
10 #include "src/hydrogen.h" 10 #include "src/hydrogen.h"
(...skipping 1169 matching lines...) Expand 10 before | Expand all | Expand 10 after
1180 // critical. 1180 // critical.
1181 if (left_type->Maybe(Type::String())) { 1181 if (left_type->Maybe(Type::String())) {
1182 IfBuilder if_leftisstring(this); 1182 IfBuilder if_leftisstring(this);
1183 if_leftisstring.If<HIsStringAndBranch>(left); 1183 if_leftisstring.If<HIsStringAndBranch>(left);
1184 if_leftisstring.Then(); 1184 if_leftisstring.Then();
1185 { 1185 {
1186 Push(BuildBinaryOperation( 1186 Push(BuildBinaryOperation(
1187 state.op(), left, right, 1187 state.op(), left, right,
1188 Type::String(zone()), right_type, 1188 Type::String(zone()), right_type,
1189 result_type, state.fixed_right_arg(), 1189 result_type, state.fixed_right_arg(),
1190 allocation_mode)); 1190 allocation_mode, state.language_mode()));
1191 } 1191 }
1192 if_leftisstring.Else(); 1192 if_leftisstring.Else();
1193 { 1193 {
1194 Push(BuildBinaryOperation( 1194 Push(BuildBinaryOperation(
1195 state.op(), left, right, 1195 state.op(), left, right,
1196 left_type, right_type, result_type, 1196 left_type, right_type, result_type,
1197 state.fixed_right_arg(), allocation_mode)); 1197 state.fixed_right_arg(), allocation_mode,
1198 state.language_mode()));
1198 } 1199 }
1199 if_leftisstring.End(); 1200 if_leftisstring.End();
1200 result = Pop(); 1201 result = Pop();
1201 } else { 1202 } else {
1202 IfBuilder if_rightisstring(this); 1203 IfBuilder if_rightisstring(this);
1203 if_rightisstring.If<HIsStringAndBranch>(right); 1204 if_rightisstring.If<HIsStringAndBranch>(right);
1204 if_rightisstring.Then(); 1205 if_rightisstring.Then();
1205 { 1206 {
1206 Push(BuildBinaryOperation( 1207 Push(BuildBinaryOperation(
1207 state.op(), left, right, 1208 state.op(), left, right,
1208 left_type, Type::String(zone()), 1209 left_type, Type::String(zone()),
1209 result_type, state.fixed_right_arg(), 1210 result_type, state.fixed_right_arg(),
1210 allocation_mode)); 1211 allocation_mode, state.language_mode()));
1211 } 1212 }
1212 if_rightisstring.Else(); 1213 if_rightisstring.Else();
1213 { 1214 {
1214 Push(BuildBinaryOperation( 1215 Push(BuildBinaryOperation(
1215 state.op(), left, right, 1216 state.op(), left, right,
1216 left_type, right_type, result_type, 1217 left_type, right_type, result_type,
1217 state.fixed_right_arg(), allocation_mode)); 1218 state.fixed_right_arg(), allocation_mode,
1219 state.language_mode()));
1218 } 1220 }
1219 if_rightisstring.End(); 1221 if_rightisstring.End();
1220 result = Pop(); 1222 result = Pop();
1221 } 1223 }
1222 } else { 1224 } else {
1223 result = BuildBinaryOperation( 1225 result = BuildBinaryOperation(
1224 state.op(), left, right, 1226 state.op(), left, right,
1225 left_type, right_type, result_type, 1227 left_type, right_type, result_type,
1226 state.fixed_right_arg(), allocation_mode); 1228 state.fixed_right_arg(), allocation_mode, state.language_mode());
1227 } 1229 }
1228 1230
1229 // If we encounter a generic argument, the number conversion is 1231 // If we encounter a generic argument, the number conversion is
1230 // observable, thus we cannot afford to bail out after the fact. 1232 // observable, thus we cannot afford to bail out after the fact.
1231 if (!state.HasSideEffects()) { 1233 if (!state.HasSideEffects()) {
1232 result = EnforceNumberType(result, result_type); 1234 result = EnforceNumberType(result, result_type);
1233 } 1235 }
1234 1236
1235 return result; 1237 return result;
1236 } 1238 }
(...skipping 13 matching lines...) Expand all
1250 HValue* left = GetParameter(BinaryOpWithAllocationSiteStub::kLeft); 1252 HValue* left = GetParameter(BinaryOpWithAllocationSiteStub::kLeft);
1251 HValue* right = GetParameter(BinaryOpWithAllocationSiteStub::kRight); 1253 HValue* right = GetParameter(BinaryOpWithAllocationSiteStub::kRight);
1252 1254
1253 Type* left_type = state.GetLeftType(zone()); 1255 Type* left_type = state.GetLeftType(zone());
1254 Type* right_type = state.GetRightType(zone()); 1256 Type* right_type = state.GetRightType(zone());
1255 Type* result_type = state.GetResultType(zone()); 1257 Type* result_type = state.GetResultType(zone());
1256 HAllocationMode allocation_mode(allocation_site); 1258 HAllocationMode allocation_mode(allocation_site);
1257 1259
1258 return BuildBinaryOperation(state.op(), left, right, 1260 return BuildBinaryOperation(state.op(), left, right,
1259 left_type, right_type, result_type, 1261 left_type, right_type, result_type,
1260 state.fixed_right_arg(), allocation_mode); 1262 state.fixed_right_arg(), allocation_mode,
1263 state.language_mode());
1261 } 1264 }
1262 1265
1263 1266
1264 Handle<Code> BinaryOpWithAllocationSiteStub::GenerateCode() { 1267 Handle<Code> BinaryOpWithAllocationSiteStub::GenerateCode() {
1265 return DoGenerateCode(this); 1268 return DoGenerateCode(this);
1266 } 1269 }
1267 1270
1268 1271
1269 template <> 1272 template <>
1270 HValue* CodeStubGraphBuilder<StringAddStub>::BuildCodeInitializedStub() { 1273 HValue* CodeStubGraphBuilder<StringAddStub>::BuildCodeInitializedStub() {
(...skipping 809 matching lines...) Expand 10 before | Expand all | Expand 10 after
2080 // need. 2083 // need.
2081 info()->MarkMustNotHaveEagerFrame(); 2084 info()->MarkMustNotHaveEagerFrame();
2082 2085
2083 // Probe the stub cache. 2086 // Probe the stub cache.
2084 Add<HTailCallThroughMegamorphicCache>(receiver, name); 2087 Add<HTailCallThroughMegamorphicCache>(receiver, name);
2085 2088
2086 // We never continue. 2089 // We never continue.
2087 return graph()->GetConstant0(); 2090 return graph()->GetConstant0();
2088 } 2091 }
2089 } } // namespace v8::internal 2092 } } // namespace v8::internal
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698