diff --git a/tests/perf/test-prop-read-long-inherit.js b/tests/perf/test-prop-read-long-inherit.js new file mode 100644 index 0000000000..e8f93f1963 --- /dev/null +++ b/tests/perf/test-prop-read-long-inherit.js @@ -0,0 +1,20 @@ +function test() { + var i; + var obj; + + obj = { foo: 123 }; + for (i = 0; i < 100; i++) { + obj = Object.create(obj); +  } + + for (i = 0; i < 1e7; i++) { + void obj.foo; + } +} + +try { + test(); +} catch (e) { + print(e.stack || e); + throw e; +} diff --git a/tests/perf/test-prop-read-math-pi.js b/tests/perf/test-prop-read-math-pi.js new file mode 100644 index 0000000000..7cb2111b73 --- /dev/null +++ b/tests/perf/test-prop-read-math-pi.js @@ -0,0 +1,14 @@ +function test() { + var i; + + for (i = 0; i < 1e7; i++) { + void Math.PI + } +} + +try { + test(); +} catch (e) { + print(e.stack || e); + throw e; +} diff --git a/tests/perf/test-prop-write-long-inherit.js b/tests/perf/test-prop-write-long-inherit.js new file mode 100644 index 0000000000..174ec7f3b0 --- /dev/null +++ b/tests/perf/test-prop-write-long-inherit.js @@ -0,0 +1,23 @@ +function test() { + var i; + var obj; + + obj = { foo: 123 }; + for (i = 0; i < 100; i++) { + obj = Object.create(obj); +  } + + for (i = 0; i < 1e7; i++) { + // Because a write always causes an own property to be created, + // there's no difference between a shallow and deep object except + // on the very first write. + obj.foo = 123; + } +} + +try { + test(); +} catch (e) { + print(e.stack || e); + throw e; +}