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

Unified Diff: src/runtime.js

Issue 1102923002: [strong] Disallow implicit conversions for bitwise ops, shifts (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: cl feedback 2 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.cc ('k') | test/mjsunit/strong/implicit-conversions.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/runtime.js
diff --git a/src/runtime.js b/src/runtime.js
index a4677da316d1cb28a3c96ce730e0fb1cc5926573..9bb02aecb711ab6fbb932075a187905f9b72731f 100644
--- a/src/runtime.js
+++ b/src/runtime.js
@@ -272,6 +272,15 @@ function BIT_OR(y) {
}
+//ECMA-262, section 11.10, page 57.
+function BIT_OR_STRONG(y) {
+ if (IS_NUMBER(this) && IS_NUMBER(y)) {
+ return %NumberOr(this, y);
+ }
+ throw %MakeTypeError('strong_implicit_cast');
+}
+
+
// ECMA-262, section 11.10, page 57.
function BIT_AND(y) {
var x;
@@ -294,6 +303,15 @@ function BIT_AND(y) {
}
+//ECMA-262, section 11.10, page 57.
+function BIT_AND_STRONG(y) {
+ if (IS_NUMBER(this) && IS_NUMBER(y)) {
+ return %NumberAnd(this, y);
+ }
+ throw %MakeTypeError('strong_implicit_cast');
+}
+
+
// ECMA-262, section 11.10, page 57.
function BIT_XOR(y) {
var x = IS_NUMBER(this) ? this : %NonNumberToNumber(this);
@@ -302,6 +320,15 @@ function BIT_XOR(y) {
}
+//ECMA-262, section 11.10, page 57.
+function BIT_XOR_STRONG(y) {
+ if (IS_NUMBER(this) && IS_NUMBER(y)) {
+ return %NumberXor(this, y);
+ }
+ throw %MakeTypeError('strong_implicit_cast');
+}
+
+
// ECMA-262, section 11.7.1, page 51.
function SHL(y) {
var x = IS_NUMBER(this) ? this : %NonNumberToNumber(this);
@@ -310,6 +337,15 @@ function SHL(y) {
}
+//ECMA-262, section 11.7.1, page 51.
+function SHL_STRONG(y) {
+ if (IS_NUMBER(this) && IS_NUMBER(y)) {
+ return %NumberShl(this, y);
+ }
+ throw %MakeTypeError('strong_implicit_cast');
+}
+
+
// ECMA-262, section 11.7.2, page 51.
function SAR(y) {
var x;
@@ -332,6 +368,15 @@ function SAR(y) {
}
+//ECMA-262, section 11.7.2, page 51.
+function SAR_STRONG(y) {
+ if (IS_NUMBER(this) && IS_NUMBER(y)) {
+ return %NumberSar(this, y);
+ }
+ throw %MakeTypeError('strong_implicit_cast');
+}
+
+
// ECMA-262, section 11.7.3, page 52.
function SHR(y) {
var x = IS_NUMBER(this) ? this : %NonNumberToNumber(this);
@@ -340,6 +385,14 @@ function SHR(y) {
}
+//ECMA-262, section 11.7.3, page 52.
+function SHR_STRONG(y) {
+ if (IS_NUMBER(this) && IS_NUMBER(y)) {
+ return %NumberShr(this, y);
+ }
+ throw %MakeTypeError('strong_implicit_cast');
+}
+
/* -----------------------------
- - - H e l p e r s - - -
« no previous file with comments | « src/ic/ic.cc ('k') | test/mjsunit/strong/implicit-conversions.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698