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

Unified Diff: test/mjsunit/harmony/module-recompile.js

Issue 10690043: Implement proper module linking. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 8 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
Index: test/mjsunit/harmony/module-recompile.js
diff --git a/test/mjsunit/harmony/module-parsing.js b/test/mjsunit/harmony/module-recompile.js
similarity index 53%
copy from test/mjsunit/harmony/module-parsing.js
copy to test/mjsunit/harmony/module-recompile.js
index cdd0a2e00d91671767ace6773e1b3c40fa06ce62..23f5bfc4d4549c678804efe365bea90350d643fd 100644
--- a/test/mjsunit/harmony/module-parsing.js
+++ b/test/mjsunit/harmony/module-recompile.js
@@ -27,133 +27,61 @@
// Flags: --harmony-modules
-// Test basic module syntax, with and without automatic semicolon insertion.
+// Test that potential recompilation of the global scope does not screw up.
-module A {}
+"use strict";
-module A1 = A
-module A2 = A;
-module A3 = A2
+var N = 1e5; // Number of loop iterations that trigger optimization.
-module B {
- export vx
- export vy, lz, c, f
-
- var vx
- var vx, vy;
- var vx = 0, vy
- let lx, ly
- let lz = 1
- const c = 9
- function f() {}
-
- module C0 {}
-
- export module C {
- let x
- export module D { export let x }
- let y
- }
-
- let zz = ""
-
- export var x0
- export var x1, x2 = 6, x3
- export let y0
- export let y1 = 0, y2
- export const z0 = 0
- export const z1 = 2, z2 = 3
- export function f0() {}
- export module M1 {}
- export module M2 = C.D
- export module M3 at "http://where"
-
- import i0 from I
- import i1, i2, i3, M from I
- //import i4, i5 from "http://where"
+module A {
+ export var x = 1
+ export function f() { return x }
}
+var f = A.f
-module I {
- export let i0, i1, i2, i3;
- export module M {}
-}
+assertEquals(1, A.x)
+assertEquals(1, A.f())
+assertEquals(1, f())
-module C1 = B.C;
-module D1 = B.C.D
-module D2 = C1.D
-module D3 = D2
+A.x = 2
-module E1 at "http://where"
-module E2 at "http://where";
-module E3 = E1
+assertEquals(2, A.x)
+assertEquals(2, A.f())
+assertEquals(2, f())
-// Check that ASI does not interfere.
-
-module X
-{
-let x
+for (var i = 0; i < N; i++) {
+ if (i > N) print("impossible");
}
-module Y
-=
-X
-
-module Z
-at
-"file://local"
-
-import
-vx
-,
-vy
-from
-B
-
-
-module Wrap {
-export
-x
-,
-y
-
-export
-var
-v1 = 1
-
-export
-let
-v2 = 2
-
-export
-const
-v3 = 3
-
-export
-function
-f
-(
-)
-{
-}
+assertEquals(2, A.x)
+assertEquals(2, A.f())
+assertEquals(2, f())
-export
-module V
-{
-}
-}
-export A, A1, A2, A3, B, I, C1, D1, D2, D3, E1, E2, E3, X, Y, Z, Wrap, x, y, UU
+// Same test with loop inside a module.
+
+module B {
+ module A {
+ export var x = 1
+ export function f() { return x }
+ }
+ var f = A.f
+ assertEquals(1, A.x)
+ assertEquals(1, A.f())
+ assertEquals(1, f())
+ A.x = 2
-// Check that 'module' still works as an identifier.
+ assertEquals(2, A.x)
+ assertEquals(2, A.f())
+ assertEquals(2, f())
-var module
-module = {}
-module["a"] = 6
-function module() {}
-function f(module) { return module }
-try {} catch (module) {}
+ for (var i = 0; i < N; i++) {
+ if (i > N) print("impossible");
Michael Starzinger 2012/07/06 10:53:22 I am not sure if this will force recompilation. Un
+ }
-module
-v = 20
+ assertEquals(2, A.x)
+ assertEquals(2, A.f())
+ assertEquals(2, f())
+}

Powered by Google App Engine
This is Rietveld 408576698