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

Unified Diff: src/ic/ic.cc

Issue 1092353002: [strong] Disallow implicit conversions for binary arithmetic operations (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: cl feedback 5 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
« no previous file with comments | « src/ic/ic.h ('k') | src/ic/ic-state.h » ('j') | src/ic/ic-state.h » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/ic/ic.cc
diff --git a/src/ic/ic.cc b/src/ic/ic.cc
index a6ae92a892c06ac9dcc88ecf093a0201e9f0eb12..e71692592a12faa10c84be01279a8c472213b536 100644
--- a/src/ic/ic.cc
+++ b/src/ic/ic.cc
@@ -2568,7 +2568,7 @@ MaybeHandle<Object> BinaryOpIC::Transition(
// Compute the actual result using the builtin for the binary operation.
Object* builtin = isolate()->js_builtins_object()->javascript_builtin(
- TokenToJSBuiltin(state.op()));
+ TokenToJSBuiltin(state.op(), state.language_mode()));
Handle<JSFunction> function = handle(JSFunction::cast(builtin), isolate());
Handle<Object> result;
ASSIGN_RETURN_ON_EXCEPTION(
@@ -2805,43 +2805,38 @@ RUNTIME_FUNCTION(Unreachable) {
}
-Builtins::JavaScript BinaryOpIC::TokenToJSBuiltin(Token::Value op) {
- switch (op) {
- default:
- UNREACHABLE();
- case Token::ADD:
- return Builtins::ADD;
- break;
- case Token::SUB:
- return Builtins::SUB;
- break;
- case Token::MUL:
- return Builtins::MUL;
- break;
- case Token::DIV:
- return Builtins::DIV;
- break;
- case Token::MOD:
- return Builtins::MOD;
- break;
- case Token::BIT_OR:
- return Builtins::BIT_OR;
- break;
- case Token::BIT_AND:
- return Builtins::BIT_AND;
- break;
- case Token::BIT_XOR:
- return Builtins::BIT_XOR;
- break;
- case Token::SAR:
- return Builtins::SAR;
- break;
- case Token::SHR:
- return Builtins::SHR;
- break;
- case Token::SHL:
- return Builtins::SHL;
- break;
+Builtins::JavaScript BinaryOpIC::TokenToJSBuiltin(Token::Value op,
+ LanguageMode language_mode) {
+ if (is_strong(language_mode)) {
arv (Not doing code reviews) 2015/04/24 14:14:23 Why is this needed? The two branches looks identic
conradw 2015/04/24 14:42:32 In strong mode, the strong version of the builtin
+ switch (op) {
+ default: UNREACHABLE();
+ case Token::ADD: return Builtins::ADD;
+ case Token::SUB: return Builtins::SUB_STRONG;
+ case Token::MUL: return Builtins::MUL_STRONG;
+ case Token::DIV: return Builtins::DIV_STRONG;
+ case Token::MOD: return Builtins::MOD_STRONG;
+ case Token::BIT_OR: return Builtins::BIT_OR;
+ case Token::BIT_AND: return Builtins::BIT_AND;
+ case Token::BIT_XOR: return Builtins::BIT_XOR;
+ case Token::SAR: return Builtins::SAR;
+ case Token::SHR: return Builtins::SHR;
+ case Token::SHL: return Builtins::SHL;
+ }
+ } else {
+ switch (op) {
+ default: UNREACHABLE();
+ case Token::ADD: return Builtins::ADD;
+ case Token::SUB: return Builtins::SUB;
+ case Token::MUL: return Builtins::MUL;
+ case Token::DIV: return Builtins::DIV;
+ case Token::MOD: return Builtins::MOD;
+ case Token::BIT_OR: return Builtins::BIT_OR;
+ case Token::BIT_AND: return Builtins::BIT_AND;
+ case Token::BIT_XOR: return Builtins::BIT_XOR;
+ case Token::SAR: return Builtins::SAR;
+ case Token::SHR: return Builtins::SHR;
+ case Token::SHL: return Builtins::SHL;
+ }
}
}
« no previous file with comments | « src/ic/ic.h ('k') | src/ic/ic-state.h » ('j') | src/ic/ic-state.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698