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

Unified Diff: test/mjsunit/smi-representation.js

Issue 15303004: Implement HChange support for Smis and use it in Load/StoreNameField (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Review feedback Created 7 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 side-by-side diff with in-line comments
Download patch
« src/ia32/lithium-ia32.cc ('K') | « src/x64/macro-assembler-x64.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test/mjsunit/smi-representation.js
diff --git a/test/mjsunit/regress/readonly5.js b/test/mjsunit/smi-representation.js
similarity index 61%
copy from test/mjsunit/regress/readonly5.js
copy to test/mjsunit/smi-representation.js
index b1499ddfcfd75b3d49d7aed2719394eb8c974994..882b5b91f0d5ebb1f57f8cf58955591dd975b63c 100644
--- a/test/mjsunit/regress/readonly5.js
+++ b/test/mjsunit/smi-representation.js
@@ -25,44 +25,44 @@
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-this.__proto__ = null;
-this.x = 10;
-delete this.x;
+// Flags: --track-fields --track-double-fields --allow-natives-syntax
-function s(v) {
- return v.x = 1;
+function smi_field() {
+ return {"smi":0};
}
-function s_strict(v) {
- "use strict";
- return v.x = 1;
-}
-
-function c() {
- var o = {__proto__:this};
+function check_smi_repr(o, d1, d2) {
+ var s = o.smi;
+ var d = d1 - d2;
+ s = s + d;
+ o.smi = s;
return o;
}
-var o1 = c();
-var o2 = c();
-var o1_strict = c();
-var o2_strict = c();
-var o3 = c();
-var o4 = c();
+var test = smi_field();
+check_smi_repr(smi_field(), 5, 3);
+check_smi_repr(smi_field(), 6, 2);
+%OptimizeFunctionOnNextCall(check_smi_repr);
+var val = check_smi_repr(smi_field(), 8, 1);
+assertTrue(%HaveSameMap(val, test));
-// Initialize the store IC.
-s(o1);
-s(o2);
-s_strict(o1_strict);
-s_strict(o2_strict);
-
-Object.defineProperty(this, "x", {writable:false, configurable:true});
+function tagged_smi_field() {
+ var o = {"tag":false};
+ o.tag = 10;
+ return o;
+}
-// Verify that directly setting x fails.
-o3.x = 1;
-assertEquals(undefined, o3.x);
+function check_smi_repr_from_tagged(o, o2) {
+ var t = o2.tag;
+ o.smi = t;
+ return o;
+}
-// Verify that setting x through the IC fails.
-assertThrows("s_strict(o4)", TypeError);
-s(o4);
-assertEquals(undefined, o4.x);
+check_smi_repr_from_tagged(smi_field(), tagged_smi_field());
+check_smi_repr_from_tagged(smi_field(), tagged_smi_field());
+%OptimizeFunctionOnNextCall(check_smi_repr_from_tagged);
+var val = check_smi_repr_from_tagged(smi_field(), tagged_smi_field());
+assertTrue(%HaveSameMap(val, test));
+var overflow = tagged_smi_field();
+overflow.tag = 0x80000000;
+var val = check_smi_repr_from_tagged(smi_field(), overflow);
« src/ia32/lithium-ia32.cc ('K') | « src/x64/macro-assembler-x64.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698