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

Unified Diff: src/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, 8 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 side-by-side diff with in-line comments
Download patch
Index: src/hydrogen.cc
diff --git a/src/hydrogen.cc b/src/hydrogen.cc
index 937f5b086b41029a1e4c70130ae3953cca3d1fe8..f6a6d8d147d356129bd17f80d6a200695b9899e4 100644
--- a/src/hydrogen.cc
+++ b/src/hydrogen.cc
@@ -10611,23 +10611,27 @@ HValue* HGraphBuilder::BuildBinaryOperation(
}
// Convert left argument as necessary.
- if (left_type->Is(Type::Number())) {
+ if (left_type->Is(Type::Number()) && !is_strong(language_mode)) {
DCHECK(right_type->Is(Type::String()));
left = BuildNumberToString(left, left_type);
} else if (!left_type->Is(Type::String())) {
DCHECK(right_type->Is(Type::String()));
- HValue* function = AddLoadJSBuiltin(Builtins::STRING_ADD_RIGHT);
+ HValue* function = AddLoadJSBuiltin(is_strong(language_mode) ?
+ Builtins::STRING_ADD_RIGHT_STRONG :
+ Builtins::STRING_ADD_RIGHT);
Add<HPushArguments>(left, right);
return AddUncasted<HInvokeFunction>(function, 2);
}
// Convert right argument as necessary.
- if (right_type->Is(Type::Number())) {
+ if (right_type->Is(Type::Number()) && !is_strong(language_mode)) {
DCHECK(left_type->Is(Type::String()));
right = BuildNumberToString(right, right_type);
} else if (!right_type->Is(Type::String())) {
DCHECK(left_type->Is(Type::String()));
- HValue* function = AddLoadJSBuiltin(Builtins::STRING_ADD_LEFT);
+ HValue* function = AddLoadJSBuiltin(is_strong(language_mode) ?
+ Builtins::STRING_ADD_LEFT_STRONG :
+ Builtins::STRING_ADD_LEFT);
Add<HPushArguments>(left, right);
return AddUncasted<HInvokeFunction>(function, 2);
}
« no previous file with comments | « src/hydrogen.h ('k') | src/ic/ic.cc » ('j') | test/mjsunit/strong/implicit-conversions.js » ('J')

Powered by Google App Engine
This is Rietveld 408576698