Chromium Code Reviews

Unified Diff: src/compiler/js-typed-lowering.cc

Issue 1109223004: [strong] Disallow implicit conversions for add (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View side-by-side diff with in-line comments
« no previous file with comments | « src/code-stubs-hydrogen.cc ('k') | src/hydrogen.h » ('j') | src/runtime.js » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/compiler/js-typed-lowering.cc
diff --git a/src/compiler/js-typed-lowering.cc b/src/compiler/js-typed-lowering.cc
index c0ed7c46797660ca0e036caa012b8e2874703970..628172a3029f3f8a8ee3326b3734799acbc2e41f 100644
--- a/src/compiler/js-typed-lowering.cc
+++ b/src/compiler/js-typed-lowering.cc
@@ -320,7 +320,8 @@ Reduction JSTypedLowering::ReduceJSAdd(Node* node) {
// JSAdd(x:number, y:number) => NumberAdd(x, y)
return r.ChangeToPureOperator(simplified()->NumberAdd(), Type::Number());
}
- if (r.NeitherInputCanBe(Type::StringOrReceiver())) {
+ if (r.NeitherInputCanBe(Type::StringOrReceiver()) &&
+ !is_strong(OpParameter<LanguageMode>(node))) {
// JSAdd(x:-string, y:-string) => NumberAdd(ToNumber(x), ToNumber(y))
Node* frame_state = NodeProperties::GetFrameStateInput(node, 1);
r.ConvertInputsToNumber(frame_state);
@@ -331,7 +332,9 @@ Reduction JSTypedLowering::ReduceJSAdd(Node* node) {
// a) The inserted ToString operation screws up valueOf vs. toString order.
// b) Deoptimization at ToString doesn't have corresponding bailout id.
// c) Our current StringAddStub is actually non-pure and requires context.
- if (r.OneInputIs(Type::String())) {
+ if (r.OneInputIs(Type::String()) &&
+ (!is_strong(OpParameter<LanguageMode>(node)) ||
+ r.BothInputsAre(Type::String()))) {
// JSAdd(x:string, y:string) => StringAdd(x, y)
// JSAdd(x:string, y) => StringAdd(x, ToString(y))
// JSAdd(x, y:string) => StringAdd(ToString(x), y)
« no previous file with comments | « src/code-stubs-hydrogen.cc ('k') | src/hydrogen.h » ('j') | src/runtime.js » ('J')

Powered by Google App Engine