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

Unified Diff: test/mjsunit/harmony/asm.js

Issue 1161393007: OLD type Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: fix Created 5 years, 6 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/variables.h ('k') | tools/gyp/v8.gyp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test/mjsunit/harmony/asm.js
diff --git a/test/mjsunit/regress/regress-3010.js b/test/mjsunit/harmony/asm.js
similarity index 65%
copy from test/mjsunit/regress/regress-3010.js
copy to test/mjsunit/harmony/asm.js
index 7aeec648280b8108e7b3254859c0defc9f242e16..204c58e8a93e4b9713bb89043180978e2545935d 100644
--- a/test/mjsunit/regress/regress-3010.js
+++ b/test/mjsunit/harmony/asm.js
@@ -25,41 +25,50 @@
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-(function() {
- function testOneSize(current_size) {
- var eval_string = 'obj = {';
- for (var current = 0; current <= current_size; ++current) {
- eval_string += 'k' + current + ':' + current + ','
+// Flags: --crankshaft --asm
+
+var stdlib = this
+var foreign = {out: function() {return 3.1}}
+var heap = new ArrayBuffer(1024)
+
+var asm_module =
+ function module(stdlib, foreign, heap) {
+ "use asm"
+ var nan = stdlib.NaN
+ var sin = stdlib.Math.sin
+ var out = foreign.out
+ var mem = new stdlib.Int32Array(heap)
+ var x = 0
+ var y = 3.1
+
+ function f() {}
+ function g(x, y) {
+ x = +x
+ y = y|0
+ return ~~(x + y)|0
}
- eval_string += '};';
- eval(eval_string);
- for (var i = 0; i <= current_size; i++) {
- assertEquals(i, obj['k'+i]);
+ function h() {
+ return out()|0
}
- var current_number = 0;
- for (var x in obj) {
- assertEquals(current_number, obj[x]);
- current_number++;
+ function i() {
+ return mem[0]|0
+ }
+ function j(i) {
+ i = i|0
+ return table[i]()|0
}
- }
- testOneSize(127);
- testOneSize(128);
- testOneSize(129);
+ var table = [h, i]
- testOneSize(255);
- testOneSize(256);
- testOneSize(257);
+ return {g: g, h: h, i: i, j: j}
+ }
- testOneSize(511);
- testOneSize(512);
- testOneSize(513);
+print("Initialize")
- testOneSize(1023);
- testOneSize(1024);
- testOneSize(1025);
+var asm = asm_module(stdlib, foreign, heap)
- testOneSize(2047);
- testOneSize(2048);
- testOneSize(2049);
-}())
+assertEquals(5, asm.g(2, 3))
+assertEquals(3, asm.h())
+assertEquals(0, asm.i())
+assertEquals(3, asm.j(0))
+assertEquals(0, asm.j(1))
« no previous file with comments | « src/variables.h ('k') | tools/gyp/v8.gyp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698