summaryrefslogtreecommitdiff
path: root/deps/v8/test/mjsunit
diff options
context:
space:
mode:
Diffstat (limited to 'deps/v8/test/mjsunit')
-rw-r--r--deps/v8/test/mjsunit/allocation-site-info.js9
-rw-r--r--deps/v8/test/mjsunit/array-constructor-feedback.js29
-rw-r--r--[-rwxr-xr-x]deps/v8/test/mjsunit/array-reduce.js0
-rw-r--r--deps/v8/test/mjsunit/assert-opt-and-deopt.js3
-rw-r--r--deps/v8/test/mjsunit/compiler/compare-map-elim.js (renamed from deps/v8/test/mjsunit/compiler/compare_map_elim.js)0
-rw-r--r--deps/v8/test/mjsunit/compiler/compare-map-elim2.js (renamed from deps/v8/test/mjsunit/limit-locals.js)111
-rw-r--r--deps/v8/test/mjsunit/compiler/compare-objeq-elim.js (renamed from deps/v8/test/mjsunit/compiler/compare_objeq_elim.js)0
-rw-r--r--deps/v8/test/mjsunit/compiler/concurrent-invalidate-transition-map.js7
-rw-r--r--deps/v8/test/mjsunit/compiler/dead-string-char-code-at.js10
-rw-r--r--deps/v8/test/mjsunit/compiler/division-by-constant.js131
-rw-r--r--deps/v8/test/mjsunit/compiler/smi-stores-opt.js49
-rw-r--r--deps/v8/test/mjsunit/compiler/store-elimination.js94
-rw-r--r--deps/v8/test/mjsunit/compiler/to-fast-properties.js43
-rw-r--r--deps/v8/test/mjsunit/constant-fold-control-instructions.js47
-rw-r--r--deps/v8/test/mjsunit/debug-scopes.js27
-rw-r--r--deps/v8/test/mjsunit/debug-script.js2
-rw-r--r--deps/v8/test/mjsunit/dehoisted-array-index.js163
-rw-r--r--deps/v8/test/mjsunit/deopt-with-fp-regs.js90
-rw-r--r--deps/v8/test/mjsunit/div-mod.js6
-rw-r--r--deps/v8/test/mjsunit/double-intrinsics.js36
-rw-r--r--deps/v8/test/mjsunit/elements-kind.js113
-rw-r--r--deps/v8/test/mjsunit/es6/math-cbrt.js27
-rw-r--r--deps/v8/test/mjsunit/es6/math-clz32.js36
-rw-r--r--deps/v8/test/mjsunit/es6/math-expm1.js38
-rw-r--r--deps/v8/test/mjsunit/es6/math-fround.js99
-rw-r--r--deps/v8/test/mjsunit/es6/math-hyperbolic.js (renamed from deps/v8/test/mjsunit/harmony/math-hyperbolic.js)8
-rw-r--r--deps/v8/test/mjsunit/es6/math-hypot.js (renamed from deps/v8/test/mjsunit/harmony/math-hypot.js)0
-rw-r--r--deps/v8/test/mjsunit/es6/math-log1p.js41
-rw-r--r--deps/v8/test/mjsunit/es6/math-log2-log10.js (renamed from deps/v8/test/mjsunit/harmony/math-log2-log10.js)0
-rw-r--r--deps/v8/test/mjsunit/es6/math-sign.js (renamed from deps/v8/test/mjsunit/harmony/math-sign.js)0
-rw-r--r--deps/v8/test/mjsunit/es6/math-trunc.js (renamed from deps/v8/test/mjsunit/harmony/math-trunc.js)0
-rw-r--r--deps/v8/test/mjsunit/es6/microtask-delivery.js168
-rw-r--r--deps/v8/test/mjsunit/es6/promises.js (renamed from deps/v8/test/mjsunit/harmony/promises.js)210
-rw-r--r--deps/v8/test/mjsunit/es6/regress/regress-2034.js (renamed from deps/v8/test/mjsunit/regress/regress-2034.js)2
-rw-r--r--deps/v8/test/mjsunit/es6/regress/regress-2156.js (renamed from deps/v8/test/mjsunit/regress/regress-2156.js)2
-rw-r--r--deps/v8/test/mjsunit/es6/regress/regress-2829.js (renamed from deps/v8/test/mjsunit/regress/regress-2829.js)2
-rw-r--r--deps/v8/test/mjsunit/es6/weak_collections.js333
-rw-r--r--deps/v8/test/mjsunit/es7/object-observe.js (renamed from deps/v8/test/mjsunit/harmony/object-observe.js)2
-rw-r--r--deps/v8/test/mjsunit/external-array.js1
-rw-r--r--deps/v8/test/mjsunit/function-arguments-duplicate.js36
-rw-r--r--deps/v8/test/mjsunit/fuzz-natives-part1.js35
-rw-r--r--deps/v8/test/mjsunit/fuzz-natives-part2.js36
-rw-r--r--deps/v8/test/mjsunit/fuzz-natives-part3.js35
-rw-r--r--deps/v8/test/mjsunit/fuzz-natives-part4.js35
-rw-r--r--deps/v8/test/mjsunit/getters-on-elements.js7
-rw-r--r--deps/v8/test/mjsunit/harmony/block-let-declaration.js4
-rw-r--r--deps/v8/test/mjsunit/harmony/collections.js20
-rw-r--r--deps/v8/test/mjsunit/harmony/generators-objects.js4
-rw-r--r--deps/v8/test/mjsunit/harmony/generators-parsing.js4
-rw-r--r--deps/v8/test/mjsunit/harmony/private.js60
-rw-r--r--deps/v8/test/mjsunit/harmony/proxies-example-membrane.js2
-rw-r--r--deps/v8/test/mjsunit/harmony/proxies-function.js8
-rw-r--r--deps/v8/test/mjsunit/harmony/proxies.js6
-rw-r--r--deps/v8/test/mjsunit/harmony/regress/regress-173361.js (renamed from deps/v8/test/mjsunit/regress/regress-173361.js)0
-rw-r--r--deps/v8/test/mjsunit/harmony/regress/regress-2186.js (renamed from deps/v8/test/mjsunit/regress/regress-2186.js)0
-rw-r--r--deps/v8/test/mjsunit/harmony/regress/regress-2219.js (renamed from deps/v8/test/mjsunit/regress/regress-2219.js)0
-rw-r--r--deps/v8/test/mjsunit/harmony/regress/regress-2225.js (renamed from deps/v8/test/mjsunit/regress/regress-2225.js)0
-rw-r--r--deps/v8/test/mjsunit/harmony/regress/regress-2243.js (renamed from deps/v8/test/mjsunit/regress/regress-2243.js)0
-rw-r--r--deps/v8/test/mjsunit/harmony/regress/regress-2322.js (renamed from deps/v8/test/mjsunit/regress/regress-2322.js)0
-rw-r--r--deps/v8/test/mjsunit/harmony/regress/regress-2681.js (renamed from deps/v8/test/mjsunit/regress/regress-2681.js)0
-rw-r--r--deps/v8/test/mjsunit/harmony/regress/regress-2691.js (renamed from deps/v8/test/mjsunit/regress/regress-2691.js)0
-rw-r--r--deps/v8/test/mjsunit/harmony/regress/regress-343928.js22
-rw-r--r--deps/v8/test/mjsunit/harmony/regress/regress-crbug-248025.js (renamed from deps/v8/test/mjsunit/regress/regress-crbug-248025.js)0
-rw-r--r--deps/v8/test/mjsunit/harmony/regress/regress-crbug-346141.js11
-rw-r--r--deps/v8/test/mjsunit/harmony/regress/regress-crbug-347528.js36
-rw-r--r--deps/v8/test/mjsunit/harmony/regress/regress-lookup-transition.js14
-rw-r--r--deps/v8/test/mjsunit/harmony/regress/regress-observe-empty-double-array.js (renamed from deps/v8/test/mjsunit/regress/regress-observe-empty-double-array.js)2
-rw-r--r--deps/v8/test/mjsunit/harmony/set-prototype-of.js (renamed from deps/v8/test/mjsunit/set-prototype-of.js)0
-rw-r--r--deps/v8/test/mjsunit/harmony/symbols.js153
-rw-r--r--deps/v8/test/mjsunit/invalid-lhs.js52
-rw-r--r--deps/v8/test/mjsunit/math-floor-of-div.js11
-rw-r--r--deps/v8/test/mjsunit/mjsunit.status105
-rw-r--r--deps/v8/test/mjsunit/neuter-twice.js9
-rw-r--r--[-rwxr-xr-x]deps/v8/test/mjsunit/pixel-array-rounding.js0
-rw-r--r--deps/v8/test/mjsunit/proto-accessor.js144
-rw-r--r--deps/v8/test/mjsunit/readonly.js9
-rw-r--r--[-rwxr-xr-x]deps/v8/test/mjsunit/regexp-capture-3.js0
-rw-r--r--[-rwxr-xr-x]deps/v8/test/mjsunit/regexp-capture.js0
-rw-r--r--deps/v8/test/mjsunit/regress-3225.js48
-rw-r--r--deps/v8/test/mjsunit/regress-keyed-store-non-strict-arguments.js16
-rw-r--r--deps/v8/test/mjsunit/regress-sync-optimized-lists.js45
-rw-r--r--deps/v8/test/mjsunit/regress/compare-map-elim1.js57
-rw-r--r--deps/v8/test/mjsunit/regress/comparison-in-effect-context-deopt.js47
-rw-r--r--deps/v8/test/mjsunit/regress/number-named-call-deopt.js41
-rw-r--r--deps/v8/test/mjsunit/regress/polymorphic-accessor-test-context.js25
-rw-r--r--deps/v8/test/mjsunit/regress/regress-2273.js4
-rw-r--r--deps/v8/test/mjsunit/regress/regress-2318.js2
-rw-r--r--deps/v8/test/mjsunit/regress/regress-2564.js2
-rw-r--r--[-rwxr-xr-x]deps/v8/test/mjsunit/regress/regress-3032.js0
-rw-r--r--deps/v8/test/mjsunit/regress/regress-3135.js73
-rw-r--r--deps/v8/test/mjsunit/regress/regress-3138.js40
-rw-r--r--deps/v8/test/mjsunit/regress/regress-3158.js24
-rw-r--r--deps/v8/test/mjsunit/regress/regress-3159.js10
-rw-r--r--deps/v8/test/mjsunit/regress/regress-3183.js96
-rw-r--r--deps/v8/test/mjsunit/regress/regress-319722-ArrayBuffer.js2
-rw-r--r--deps/v8/test/mjsunit/regress/regress-319722-TypedArrays.js2
-rw-r--r--deps/v8/test/mjsunit/regress/regress-3204.js25
-rw-r--r--deps/v8/test/mjsunit/regress/regress-3220.js30
-rw-r--r--deps/v8/test/mjsunit/regress/regress-330046.js (renamed from deps/v8/test/mjsunit/regress-330046.js)0
-rw-r--r--deps/v8/test/mjsunit/regress/regress-333594.js (renamed from deps/v8/test/mjsunit/regress-333594.js)0
-rw-r--r--deps/v8/test/mjsunit/regress/regress-343609.js66
-rw-r--r--deps/v8/test/mjsunit/regress/regress-346587.js18
-rw-r--r--deps/v8/test/mjsunit/regress/regress-347530.js12
-rw-r--r--deps/v8/test/mjsunit/regress/regress-347542.js11
-rw-r--r--deps/v8/test/mjsunit/regress/regress-347906.js14
-rw-r--r--deps/v8/test/mjsunit/regress/regress-347912.js10
-rw-r--r--deps/v8/test/mjsunit/regress/regress-347914.js89
-rw-r--r--deps/v8/test/mjsunit/regress/regress-348280.js16
-rw-r--r--deps/v8/test/mjsunit/regress/regress-349870.js7
-rw-r--r--deps/v8/test/mjsunit/regress/regress-349885.js15
-rw-r--r--deps/v8/test/mjsunit/regress/regress-350865.js17
-rw-r--r--deps/v8/test/mjsunit/regress/regress-350887.js12
-rw-r--r--deps/v8/test/mjsunit/regress/regress-351261.js19
-rw-r--r--deps/v8/test/mjsunit/regress/regress-351263.js37
-rw-r--r--deps/v8/test/mjsunit/regress/regress-351315.js49
-rw-r--r--deps/v8/test/mjsunit/regress/regress-351319.js39
-rw-r--r--deps/v8/test/mjsunit/regress/regress-352059.js35
-rw-r--r--deps/v8/test/mjsunit/regress/regress-353551.js40
-rw-r--r--deps/v8/test/mjsunit/regress/regress-354357.js38
-rw-r--r--deps/v8/test/mjsunit/regress/regress-354433.js54
-rw-r--r--deps/v8/test/mjsunit/regress/regress-355485.js5
-rw-r--r--deps/v8/test/mjsunit/regress/regress-355523.js37
-rw-r--r--deps/v8/test/mjsunit/regress/regress-356053.js9
-rw-r--r--deps/v8/test/mjsunit/regress/regress-356589.js34
-rw-r--r--deps/v8/test/mjsunit/regress/regress-357108.js20
-rw-r--r--[-rwxr-xr-x]deps/v8/test/mjsunit/regress/regress-485.js0
-rw-r--r--deps/v8/test/mjsunit/regress/regress-check-eliminate-loop-phis.js21
-rw-r--r--deps/v8/test/mjsunit/regress/regress-cr-344285.js37
-rw-r--r--deps/v8/test/mjsunit/regress/regress-crbug-347903.js19
-rw-r--r--deps/v8/test/mjsunit/regress/regress-crbug-349853.js21
-rw-r--r--deps/v8/test/mjsunit/regress/regress-crbug-350434.js33
-rw-r--r--deps/v8/test/mjsunit/regress/regress-crbug-350864.js36
-rw-r--r--deps/v8/test/mjsunit/regress/regress-crbug-350867.js15
-rw-r--r--deps/v8/test/mjsunit/regress/regress-crbug-350890.js42
-rw-r--r--deps/v8/test/mjsunit/regress/regress-crbug-351262.js6
-rw-r--r--deps/v8/test/mjsunit/regress/regress-crbug-351320.js21
-rw-r--r--deps/v8/test/mjsunit/regress/regress-crbug-351658.js14
-rw-r--r--deps/v8/test/mjsunit/regress/regress-crbug-352058.js17
-rw-r--r--deps/v8/test/mjsunit/regress/regress-crbug-352586.js15
-rw-r--r--deps/v8/test/mjsunit/regress/regress-crbug-354391.js21
-rw-r--r--deps/v8/test/mjsunit/regress/regress-dictionary-to-fast-arguments.js11
-rw-r--r--deps/v8/test/mjsunit/regress/regress-fast-empty-string.js13
-rw-r--r--deps/v8/test/mjsunit/regress/regress-force-representation.js22
-rw-r--r--deps/v8/test/mjsunit/regress/regress-is-smi-repr.js18
-rw-r--r--deps/v8/test/mjsunit/regress/regress-keyed-store-global.js12
-rw-r--r--deps/v8/test/mjsunit/regress/regress-migrate-callbacks.js11
-rw-r--r--deps/v8/test/mjsunit/regress/regress-prepare-break-while-recompile.js2
-rw-r--r--deps/v8/test/mjsunit/regress/regress-sort-arguments.js10
-rw-r--r--deps/v8/test/mjsunit/regress/regress-store-global-proxy.js12
-rw-r--r--deps/v8/test/mjsunit/regress/regress-store-heapobject.js27
-rw-r--r--deps/v8/test/mjsunit/regress/setvalueof-deopt.js42
-rw-r--r--deps/v8/test/mjsunit/regress/string-set-char-deopt.js85
-rw-r--r--deps/v8/test/mjsunit/shift-for-integer-div.js13
-rw-r--r--[-rwxr-xr-x]deps/v8/test/mjsunit/simple-constructor.js0
-rw-r--r--deps/v8/test/mjsunit/smi-mul-const.js87
-rw-r--r--deps/v8/test/mjsunit/string-case.js16
-rw-r--r--[-rwxr-xr-x]deps/v8/test/mjsunit/string-match.js0
-rw-r--r--deps/v8/test/mjsunit/string-oom-array-join.js14
-rw-r--r--deps/v8/test/mjsunit/string-oom-concat.js12
-rw-r--r--deps/v8/test/mjsunit/string-oom-replace-global-regexp-with-string.js26
-rw-r--r--deps/v8/test/mjsunit/string-oom-replace-regexp-global-with-function.js14
-rw-r--r--[-rwxr-xr-x]deps/v8/test/mjsunit/string-slices.js0
-rw-r--r--[-rwxr-xr-x]deps/v8/test/mjsunit/substr.js0
-rw-r--r--deps/v8/test/mjsunit/test-hidden-string.js11
-rw-r--r--deps/v8/test/mjsunit/third_party/array-isarray.js48
-rw-r--r--deps/v8/test/mjsunit/third_party/array-splice-webkit.js62
-rw-r--r--deps/v8/test/mjsunit/third_party/string-trim.js107
-rw-r--r--deps/v8/test/mjsunit/value-wrapper-accessor.js2
-rw-r--r--deps/v8/test/mjsunit/whitespaces.js115
169 files changed, 4502 insertions, 699 deletions
diff --git a/deps/v8/test/mjsunit/allocation-site-info.js b/deps/v8/test/mjsunit/allocation-site-info.js
index cd086d350..35b60ee26 100644
--- a/deps/v8/test/mjsunit/allocation-site-info.js
+++ b/deps/v8/test/mjsunit/allocation-site-info.js
@@ -232,14 +232,13 @@ if (support_smi_only_arrays) {
obj = newarraycase_length_smidouble(2);
assertKind(elements_kind.fast_double, obj);
- // Try to continue the transition to fast object. This won't work for
- // constructed arrays because constructor dispatch is done on the
- // elements kind, and a DOUBLE array constructor won't create an allocation
- // memento.
+ // Try to continue the transition to fast object.
+ // TODO(mvstanton): re-enable commented out code when
+ // FLAG_pretenuring_call_new is turned on in the build.
obj = newarraycase_length_smidouble("coates");
assertKind(elements_kind.fast, obj);
obj = newarraycase_length_smidouble(2);
- assertKind(elements_kind.fast_double, obj);
+ // assertKind(elements_kind.fast, obj);
function newarraycase_length_smiobj(value) {
var a = new Array(3);
diff --git a/deps/v8/test/mjsunit/array-constructor-feedback.js b/deps/v8/test/mjsunit/array-constructor-feedback.js
index 7cd421bd1..45d5c58c7 100644
--- a/deps/v8/test/mjsunit/array-constructor-feedback.js
+++ b/deps/v8/test/mjsunit/array-constructor-feedback.js
@@ -82,8 +82,9 @@ function assertKind(expected, obj, name_opt) {
if (support_smi_only_arrays) {
- // Test: If a call site goes megamorphic, it loses the ability to
- // use allocation site feedback.
+ // Test: If a call site goes megamorphic, it retains the ability to
+ // use allocation site feedback (if FLAG_allocation_site_pretenuring
+ // is on).
(function() {
function bar(t, len) {
return new t(len);
@@ -95,10 +96,9 @@ if (support_smi_only_arrays) {
assertKind(elements_kind.fast_double, b);
c = bar(Object, 3);
b = bar(Array, 10);
- assertKind(elements_kind.fast_smi_only, b);
- b[0] = 3.5;
- c = bar(Array, 10);
- assertKind(elements_kind.fast_smi_only, c);
+ // TODO(mvstanton): re-enable when FLAG_allocation_site_pretenuring
+ // is on in the build.
+ // assertKind(elements_kind.fast_double, b);
})();
@@ -123,13 +123,16 @@ if (support_smi_only_arrays) {
bar0(Array);
%OptimizeFunctionOnNextCall(bar0);
b = bar0(Array);
- // We also lost our ability to record kind feedback, as the site
- // is megamorphic now.
- assertKind(elements_kind.fast_smi_only, b);
- assertOptimized(bar0);
- b[0] = 3.5;
- c = bar0(Array);
- assertKind(elements_kind.fast_smi_only, c);
+ // This only makes sense to test if we allow crankshafting
+ if (4 != %GetOptimizationStatus(bar0)) {
+ // We also lost our ability to record kind feedback, as the site
+ // is megamorphic now.
+ assertKind(elements_kind.fast_smi_only, b);
+ assertOptimized(bar0);
+ b[0] = 3.5;
+ c = bar0(Array);
+ assertKind(elements_kind.fast_smi_only, c);
+ }
})();
diff --git a/deps/v8/test/mjsunit/array-reduce.js b/deps/v8/test/mjsunit/array-reduce.js
index 429f34808..429f34808 100755..100644
--- a/deps/v8/test/mjsunit/array-reduce.js
+++ b/deps/v8/test/mjsunit/array-reduce.js
diff --git a/deps/v8/test/mjsunit/assert-opt-and-deopt.js b/deps/v8/test/mjsunit/assert-opt-and-deopt.js
index d653bb590..d0caafa27 100644
--- a/deps/v8/test/mjsunit/assert-opt-and-deopt.js
+++ b/deps/v8/test/mjsunit/assert-opt-and-deopt.js
@@ -25,7 +25,8 @@
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-// Flags: --allow-natives-syntax --noconcurrent-recompilation
+// Flags: --allow-natives-syntax
+// Flags: --noconcurrent-recompilation --noconcurrent-osr
if (%IsConcurrentRecompilationSupported()) {
print("Concurrent recompilation is turned on after all. Skipping this test.");
diff --git a/deps/v8/test/mjsunit/compiler/compare_map_elim.js b/deps/v8/test/mjsunit/compiler/compare-map-elim.js
index 288d4811a..288d4811a 100644
--- a/deps/v8/test/mjsunit/compiler/compare_map_elim.js
+++ b/deps/v8/test/mjsunit/compiler/compare-map-elim.js
diff --git a/deps/v8/test/mjsunit/limit-locals.js b/deps/v8/test/mjsunit/compiler/compare-map-elim2.js
index 1d36c80e5..0c0540cca 100644
--- a/deps/v8/test/mjsunit/limit-locals.js
+++ b/deps/v8/test/mjsunit/compiler/compare-map-elim2.js
@@ -25,23 +25,106 @@
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-// Test that there is a limit of 131071 locals.
+// Flags: --allow-natives-syntax --check-elimination
-// Flags: --stack-size=1200
-function function_with_n_locals(n) {
- test_prefix = "prefix ";
- test_suffix = " suffix";
- var src = "test_prefix + (function () {"
- for (var i = 1; i <= n; i++) {
- src += "; var x" + i;
+function test_empty() {
+ function foo(o) {
+ return { value: o.value };
}
- src += "; return " + n + ";})() + test_suffix";
- return eval(src);
+
+ function Base() {
+ this.v_ = 5;
+ }
+ Base.prototype.__defineGetter__("value", function() { return 1; });
+
+ var a = new Base();
+ a.a = 1;
+ foo(a);
+
+ Base.prototype.__defineGetter__("value", function() { return this.v_; });
+
+ var b = new Base();
+ b.b = 1;
+ foo(b);
+
+ var d = new Base();
+ d.d = 1;
+ d.value;
+
+ %OptimizeFunctionOnNextCall(foo);
+
+ var o = foo(b);
}
-assertEquals("prefix 0 suffix", function_with_n_locals(0));
-assertEquals("prefix 16000 suffix", function_with_n_locals(16000));
-assertEquals("prefix 131071 suffix", function_with_n_locals(131071));
-assertThrows("function_with_n_locals(131072)");
+function test_narrow1() {
+ function foo(o) {
+ return { value: o.value };
+ }
+
+ function Base() {
+ this.v_ = 5;
+ }
+ Base.prototype.__defineGetter__("value", function() { return 1; });
+
+ var a = new Base();
+ a.a = 1;
+ foo(a);
+
+ Base.prototype.__defineGetter__("value", function() { return this.v_; });
+
+ var b = new Base();
+ b.b = 1;
+ foo(b);
+
+ var c = new Base();
+ c.c = 1;
+ foo(c);
+
+ var d = new Base();
+ d.d = 1;
+ d.value;
+
+ %OptimizeFunctionOnNextCall(foo);
+
+ var o = foo(b);
+}
+
+
+function test_narrow2() {
+ function foo(o, flag) {
+ return { value: o.value(flag) };
+ }
+
+ function Base() {
+ this.v_ = 5;
+ }
+ Base.prototype.value = function(flag) { return flag ? this.v_ : this.v_; };
+
+
+ var a = new Base();
+ a.a = 1;
+ foo(a, false);
+ foo(a, false);
+
+ var b = new Base();
+ b.b = 1;
+ foo(b, true);
+
+ var c = new Base();
+ c.c = 1;
+ foo(c, true);
+
+ var d = new Base();
+ d.d = 1;
+ d.value(true);
+
+ %OptimizeFunctionOnNextCall(foo);
+
+ var o = foo(b);
+}
+
+test_empty();
+test_narrow1();
+test_narrow2();
diff --git a/deps/v8/test/mjsunit/compiler/compare_objeq_elim.js b/deps/v8/test/mjsunit/compiler/compare-objeq-elim.js
index 4492df45c..4492df45c 100644
--- a/deps/v8/test/mjsunit/compiler/compare_objeq_elim.js
+++ b/deps/v8/test/mjsunit/compiler/compare-objeq-elim.js
diff --git a/deps/v8/test/mjsunit/compiler/concurrent-invalidate-transition-map.js b/deps/v8/test/mjsunit/compiler/concurrent-invalidate-transition-map.js
index 2a20790ea..ab7d6d50e 100644
--- a/deps/v8/test/mjsunit/compiler/concurrent-invalidate-transition-map.js
+++ b/deps/v8/test/mjsunit/compiler/concurrent-invalidate-transition-map.js
@@ -43,9 +43,10 @@ function new_object() {
function add_field(obj) {
obj.c = 3;
}
-
-add_field(new_object());
-add_field(new_object());
+var obj1 = new_object();
+var obj2 = new_object();
+add_field(obj1);
+add_field(obj2);
%OptimizeFunctionOnNextCall(add_field, "concurrent");
var o = new_object();
diff --git a/deps/v8/test/mjsunit/compiler/dead-string-char-code-at.js b/deps/v8/test/mjsunit/compiler/dead-string-char-code-at.js
index 56835ce5a..9f01541c9 100644
--- a/deps/v8/test/mjsunit/compiler/dead-string-char-code-at.js
+++ b/deps/v8/test/mjsunit/compiler/dead-string-char-code-at.js
@@ -31,21 +31,21 @@ var S1 = "string1";
var S2 = "@@string2";
function dead1(a, b) {
- var x = %StringCharCodeAt(a, 4);
+ var x = %_StringCharCodeAt(a, 4);
return a; // x is dead code
}
function dead2(a, b) {
- var x = %StringCharCodeAt(a, 3);
- var y = %StringCharCodeAt(b, 1);
+ var x = %_StringCharCodeAt(a, 3);
+ var y = %_StringCharCodeAt(b, 1);
return a; // x and y are both dead
}
function dead3(a, b) {
a = a ? "11" : "12";
b = b ? "13" : "14";
- var x = %StringCharCodeAt(a, 2);
- var y = %StringCharCodeAt(b, 0);
+ var x = %_StringCharCodeAt(a, 2);
+ var y = %_StringCharCodeAt(b, 0);
return a; // x and y are both dead
}
diff --git a/deps/v8/test/mjsunit/compiler/division-by-constant.js b/deps/v8/test/mjsunit/compiler/division-by-constant.js
new file mode 100644
index 000000000..0778e95b8
--- /dev/null
+++ b/deps/v8/test/mjsunit/compiler/division-by-constant.js
@@ -0,0 +1,131 @@
+// Copyright 2014 the V8 project authors. All rights reserved.
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are
+// met:
+//
+// * Redistributions of source code must retain the above copyright
+// notice, this list of conditions and the following disclaimer.
+// * Redistributions in binary form must reproduce the above
+// copyright notice, this list of conditions and the following
+// disclaimer in the documentation and/or other materials provided
+// with the distribution.
+// * Neither the name of Google Inc. nor the names of its
+// contributors may be used to endorse or promote products derived
+// from this software without specific prior written permission.
+//
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+// Flags: --allow-natives-syntax --no-use-inlining
+
+// -----------------------------------------------------------------------------
+
+function ConstructDiv(divisor) {
+ return "return ((dividend | 0) / ((" + divisor + ") | 0)) | 0";
+}
+
+var RefDivByConstI =
+ new Function("dividend", "divisor", ConstructDiv("divisor"));
+
+%NeverOptimizeFunction(RefDivByConstI);
+
+// -----------------------------------------------------------------------------
+
+function ConstructMod(divisor) {
+ return "return ((dividend | 0) % ((" + divisor + ") | 0)) | 0";
+}
+
+var RefModByConstI =
+ new Function("dividend", "divisor", ConstructMod("divisor"));
+
+%NeverOptimizeFunction(RefModByConstI);
+
+// -----------------------------------------------------------------------------
+
+function ConstructFlooringDiv(divisor) {
+ return "return Math.floor(dividend / (" + divisor + ")) | 0";
+}
+
+var RefFlooringDivByConstI =
+ new Function("dividend", "divisor", ConstructFlooringDiv("divisor"));
+
+%NeverOptimizeFunction(RefFlooringDivByConstI);
+
+// -----------------------------------------------------------------------------
+
+function PushSymmetric(values, x) {
+ values.push(x, -x);
+}
+
+function PushRangeSymmetric(values, from, to) {
+ for (var x = from; x <= to; x++) {
+ PushSymmetric(values, x);
+ }
+}
+
+function CreateTestValues() {
+ var values = [
+ // -(2^31)
+ -2147483648,
+ // Some values from "Hacker's Delight", chapter 10-7.
+ 715827883, 1431655766, -1431655765, -1431655764,
+ // Some "randomly" chosen numbers.
+ 123, -1234, 12345, -123456, 1234567, -12345678, 123456789
+ ];
+ // Powers of 2
+ for (var shift = 6; shift < 31; shift++) {
+ PushSymmetric(values, 1 << shift);
+ }
+ // Values near zero
+ PushRangeSymmetric(values, 1, 32);
+ // Various magnitudes
+ PushRangeSymmetric(values, 100, 109);
+ PushRangeSymmetric(values, 1000, 1009);
+ PushRangeSymmetric(values, 10000, 10009);
+ PushRangeSymmetric(values, 100000, 100009);
+ PushRangeSymmetric(values, 1000000, 1000009);
+ PushRangeSymmetric(values, 10000000, 10000009);
+ PushRangeSymmetric(values, 100000000, 100000009);
+ PushRangeSymmetric(values, 1000000000, 1000000009);
+ return values;
+}
+
+// -----------------------------------------------------------------------------
+
+function TestDivisionLike(ref, construct, values, divisor) {
+ // Define the function to test.
+ var OptFun = new Function("dividend", construct(divisor));
+
+ // Warm up type feedback.
+ OptFun(7);
+ OptFun(11);
+ %OptimizeFunctionOnNextCall(OptFun);
+ OptFun(13);
+
+ // Check results.
+ values.forEach(function(dividend) {
+ // Avoid deopt caused by overflow, we do not want to test this here.
+ if (dividend === -2147483648 && divisor === -1) return;
+ assertEquals(ref(dividend, divisor), OptFun(dividend));
+ });
+}
+
+function Test(ref, construct) {
+ var values = CreateTestValues();
+ values.forEach(function(divisor) {
+ TestDivisionLike(ref, construct, values, divisor);
+ });
+}
+
+Test(RefDivByConstI, ConstructDiv);
+Test(RefModByConstI, ConstructMod);
+Test(RefFlooringDivByConstI, ConstructFlooringDiv);
diff --git a/deps/v8/test/mjsunit/compiler/smi-stores-opt.js b/deps/v8/test/mjsunit/compiler/smi-stores-opt.js
new file mode 100644
index 000000000..ca0923abc
--- /dev/null
+++ b/deps/v8/test/mjsunit/compiler/smi-stores-opt.js
@@ -0,0 +1,49 @@
+// Copyright 2014 the V8 project authors. All rights reserved.
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are
+// met:
+//
+// * Redistributions of source code must retain the above copyright
+// notice, this list of conditions and the following disclaimer.
+// * Redistributions in binary form must reproduce the above
+// copyright notice, this list of conditions and the following
+// disclaimer in the documentation and/or other materials provided
+// with the distribution.
+// * Neither the name of Google Inc. nor the names of its
+// contributors may be used to endorse or promote products derived
+// from this software without specific prior written permission.
+//
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+// Flags: --allow-natives-syntax
+
+var o = {a:1.5};
+o.a = 0;
+var a = o.a;
+
+function g() {
+ return 1;
+}
+
+var o2 = {a:{}};
+
+function f() {
+ var result = {a: a};
+ var literal = {x:g()};
+ return [result, literal];
+}
+
+f();
+f();
+%OptimizeFunctionOnNextCall(f);
+assertEquals(1, f()[1].x);
diff --git a/deps/v8/test/mjsunit/compiler/store-elimination.js b/deps/v8/test/mjsunit/compiler/store-elimination.js
new file mode 100644
index 000000000..1806ed963
--- /dev/null
+++ b/deps/v8/test/mjsunit/compiler/store-elimination.js
@@ -0,0 +1,94 @@
+// Copyright 2013 the V8 project authors. All rights reserved.
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are
+// met:
+//
+// * Redistributions of source code must retain the above copyright
+// notice, this list of conditions and the following disclaimer.
+// * Redistributions in binary form must reproduce the above
+// copyright notice, this list of conditions and the following
+// disclaimer in the documentation and/or other materials provided
+// with the distribution.
+// * Neither the name of Google Inc. nor the names of its
+// contributors may be used to endorse or promote products derived
+// from this software without specific prior written permission.
+//
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+// Flags: --allow-natives-syntax --store-elimination
+
+// Test local elimination of unobservable stores.
+
+function B(x, y) {
+ this.x = x;
+ this.y = y;
+ return this;
+}
+
+function test_store_store() {
+ var a = new B(1, 2);
+ a.x = 3; // eliminatable.
+ a.x = 4;
+ return a.x;
+}
+
+function test_store_load_store1() {
+ var a = new B(6, 7);
+ a.x = 3; // eliminatable.
+ var r = a.y;
+ a.x = 4;
+ return r;
+}
+
+function test_store_load_store2() {
+ var a = new B(6, 8);
+ a.x = 3; // not eliminatable, unless next load is eliminated.
+ var r = a.x;
+ a.x = 4;
+ return r;
+}
+
+function test_store_call_store() {
+ var a = new B(2, 9);
+ a.x = 3; // not eliminatable.
+ killall();
+ a.x = 4;
+ return a.y;
+}
+
+function test_store_deopt_store() {
+ var a = new B(2, 1);
+ a.x = 3; // not eliminatable (implicit ValueOf following)
+ var c = a + 2;
+ a.x = 4;
+ return a.y;
+}
+
+function killall() {
+ try { } catch(e) { }
+}
+
+%NeverOptimizeFunction(killall);
+
+function test(x, f) {
+ assertEquals(x, f());
+ assertEquals(x, f());
+ %OptimizeFunctionOnNextCall(f);
+ assertEquals(x, f());
+}
+
+test(4, test_store_store);
+test(7, test_store_load_store1);
+test(3, test_store_load_store2);
+test(9, test_store_call_store);
+test(1, test_store_deopt_store);
diff --git a/deps/v8/test/mjsunit/compiler/to-fast-properties.js b/deps/v8/test/mjsunit/compiler/to-fast-properties.js
new file mode 100644
index 000000000..26829d95e
--- /dev/null
+++ b/deps/v8/test/mjsunit/compiler/to-fast-properties.js
@@ -0,0 +1,43 @@
+// Copyright 2014 the V8 project authors. All rights reserved.
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are
+// met:
+//
+// * Redistributions of source code must retain the above copyright
+// notice, this list of conditions and the following disclaimer.
+// * Redistributions in binary form must reproduce the above
+// copyright notice, this list of conditions and the following
+// disclaimer in the documentation and/or other materials provided
+// with the distribution.
+// * Neither the name of Google Inc. nor the names of its
+// contributors may be used to endorse or promote products derived
+// from this software without specific prior written permission.
+//
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+// (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 test requires OSR or --stress-runs=3 to optimize the top level script.
+
+for (var i = 0; i < 3; i++) {
+ // HToFastProperties is used for top-level object literals that have
+ // function property.
+ var obj = {
+ index: function() { return i; },
+ x: 0
+ }
+ var n = 10000;
+ // Loop to hit OSR.
+ for (var j = 0; j < n; j++) {
+ obj.x += i;
+ }
+ assertEquals(obj.index() * n, obj.x);
+}
diff --git a/deps/v8/test/mjsunit/constant-fold-control-instructions.js b/deps/v8/test/mjsunit/constant-fold-control-instructions.js
new file mode 100644
index 000000000..eb1b0f3c0
--- /dev/null
+++ b/deps/v8/test/mjsunit/constant-fold-control-instructions.js
@@ -0,0 +1,47 @@
+// Copyright 2014 the V8 project authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+// Flags: --allow-natives-syntax --fold-constants
+
+function test() {
+ assertEquals("string", typeof "");
+ assertEquals("number", typeof 1.1);
+ assertEquals("number", typeof 1);
+ assertEquals("boolean", typeof true);
+ assertEquals("function", typeof function() {});
+ assertEquals("object", typeof null);
+ assertEquals("object", typeof {});
+
+ assertTrue(%_IsObject({}));
+ assertTrue(%_IsObject(null));
+ assertTrue(%_IsObject(/regex/));
+ assertFalse(%_IsObject(0));
+ assertFalse(%_IsObject(""));
+
+ assertTrue(%_IsSmi(1));
+ assertFalse(%_IsSmi(1.1));
+ assertFalse(%_IsSmi({}));
+
+ assertTrue(%_IsRegExp(/regexp/));
+ assertFalse(%_IsRegExp({}));
+
+ assertTrue(%_IsArray([1]));
+ assertFalse(%_IsArray(function() {}));
+
+ assertTrue(%_IsFunction(function() {}));
+ assertFalse(%_IsFunction(null));
+
+ assertTrue(%_IsSpecObject(new Date()));
+ assertFalse(%_IsSpecObject(1));
+
+ assertTrue(%_IsMinusZero(-0.0));
+ assertFalse(%_IsMinusZero(1));
+ assertFalse(%_IsMinusZero(""));
+}
+
+
+test();
+test();
+%OptimizeFunctionOnNextCall(test);
+test();
diff --git a/deps/v8/test/mjsunit/debug-scopes.js b/deps/v8/test/mjsunit/debug-scopes.js
index 942bd2bb0..f5b5ec913 100644
--- a/deps/v8/test/mjsunit/debug-scopes.js
+++ b/deps/v8/test/mjsunit/debug-scopes.js
@@ -71,18 +71,42 @@ function BeginTest(name) {
// Check result of a test.
function EndTest() {
assertTrue(listener_called, "listerner not called for " + test_name);
- assertNull(exception, test_name);
+ assertNull(exception, test_name + " / " + exception);
end_test_count++;
}
+// Check that two scope are the same.
+function assertScopeMirrorEquals(scope1, scope2) {
+ assertEquals(scope1.scopeType(), scope2.scopeType());
+ assertEquals(scope1.frameIndex(), scope2.frameIndex());
+ assertEquals(scope1.scopeIndex(), scope2.scopeIndex());
+ assertPropertiesEqual(scope1.scopeObject().value(), scope2.scopeObject().value());
+}
+
+function CheckFastAllScopes(scopes, exec_state)
+{
+ var fast_all_scopes = exec_state.frame().allScopes(true);
+ var length = fast_all_scopes.length;
+ assertTrue(scopes.length >= length);
+ for (var i = 0; i < scopes.length && i < length; i++) {
+ var scope = fast_all_scopes[length - i - 1];
+ assertTrue(scope.isScope());
+ assertEquals(scopes[scopes.length - i - 1], scope.scopeType());
+ }
+}
+
+
// Check that the scope chain contains the expected types of scopes.
function CheckScopeChain(scopes, exec_state) {
+ var all_scopes = exec_state.frame().allScopes();
assertEquals(scopes.length, exec_state.frame().scopeCount());
+ assertEquals(scopes.length, all_scopes.length, "FrameMirror.allScopes length");
for (var i = 0; i < scopes.length; i++) {
var scope = exec_state.frame().scope(i);
assertTrue(scope.isScope());
assertEquals(scopes[i], scope.scopeType());
+ assertScopeMirrorEquals(all_scopes[i], scope);
// Check the global object when hitting the global scope.
if (scopes[i] == debug.ScopeType.Global) {
@@ -91,6 +115,7 @@ function CheckScopeChain(scopes, exec_state) {
assertPropertiesEqual(this, scope.scopeObject().value());
}
}
+ CheckFastAllScopes(scopes, exec_state);
// Get the debug command processor.
var dcp = exec_state.debugCommandProcessor("unspecified_running_state");
diff --git a/deps/v8/test/mjsunit/debug-script.js b/deps/v8/test/mjsunit/debug-script.js
index 1cbdb376c..80d423e10 100644
--- a/deps/v8/test/mjsunit/debug-script.js
+++ b/deps/v8/test/mjsunit/debug-script.js
@@ -59,7 +59,7 @@ for (i = 0; i < scripts.length; i++) {
}
// This has to be updated if the number of native scripts change.
-assertTrue(named_native_count == 16 || named_native_count == 17);
+assertTrue(named_native_count == 19 || named_native_count == 20);
// Only the 'gc' extension is loaded.
assertEquals(1, extension_count);
// This script and mjsunit.js has been loaded. If using d8, d8 loads
diff --git a/deps/v8/test/mjsunit/dehoisted-array-index.js b/deps/v8/test/mjsunit/dehoisted-array-index.js
new file mode 100644
index 000000000..f4a32c103
--- /dev/null
+++ b/deps/v8/test/mjsunit/dehoisted-array-index.js
@@ -0,0 +1,163 @@
+// Copyright 2013 the V8 project authors. All rights reserved.
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are
+// met:
+//
+// * Redistributions of source code must retain the above copyright
+// notice, this list of conditions and the following disclaimer.
+// * Redistributions in binary form must reproduce the above
+// copyright notice, this list of conditions and the following
+// disclaimer in the documentation and/or other materials provided
+// with the distribution.
+// * Neither the name of Google Inc. nor the names of its
+// contributors may be used to endorse or promote products derived
+// from this software without specific prior written permission.
+//
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+// Flags: --allow-natives-syntax
+
+var a = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10];
+
+// Key is HParameter
+function aoo(i) {
+ return a[i + 1];
+}
+
+aoo(1);
+aoo(-1);
+%OptimizeFunctionOnNextCall(aoo);
+aoo(-1);
+
+
+// Key is HChange, used by either dehoised or non-dehoisted
+function boo(i) {
+ var ret = 0;
+ if (i < 0) {
+ ret = a[i + 10];
+ } else {
+ ret = a[i];
+ }
+ return ret;
+}
+
+boo(1);
+boo(-1);
+%OptimizeFunctionOnNextCall(boo);
+boo(-1);
+
+
+// Key is HMul(-i ==> i * (-1))
+function coo() {
+ var ret = 0;
+ for (var i = 4; i > 0; i -= 1) {
+ ret += a[-i + 4]; // dehoisted
+ }
+
+ return ret;
+}
+
+coo();
+coo();
+%OptimizeFunctionOnNextCall(coo);
+coo();
+
+
+// Key is HPhi, used only by dehoisted
+function doo() {
+ var ret = 0;
+ for (var i = 0; i < 5; i += 1) {
+ ret += a[i + 1]; // dehoisted
+ }
+ return ret;
+}
+doo();
+doo();
+%OptimizeFunctionOnNextCall(doo);
+doo();
+
+// Key is HPhi, but used by both dehoisted and non-dehoisted
+// sign extend is useless
+function eoo() {
+ var ret = 0;
+ for (var i = 0; i < 5; i += 1) {
+ ret += a[i]; // non-dehoisted
+ ret += a[i + 1]; // dehoisted
+ }
+
+ return ret;
+}
+eoo();
+eoo();
+%OptimizeFunctionOnNextCall(eoo);
+eoo();
+
+
+
+// Key is HPhi, but used by either dehoisted or non-dehoisted
+function foo() {
+ var ret = 0;
+ for (var i = -3; i < 4; i += 1) {
+ if (i < 0) {
+ ret += a[i + 4]; // dehoisted
+ } else {
+ ret += a[i]; // non-dehoisted
+ }
+ }
+
+ return ret;
+}
+
+foo();
+foo();
+%OptimizeFunctionOnNextCall(foo);
+foo();
+
+// Key is HPhi, but not induction variable
+function goo(i) {
+ if (i > 0) {
+ i += 1;
+ } else {
+ i += -1;
+ }
+
+ return a[i + 3];
+}
+goo(-1);
+goo(-1);
+%OptimizeFunctionOnNextCall(goo);
+goo(-1);
+
+// Key is return value of function
+function index() {
+ return 1;
+}
+%NeverOptimizeFunction(index);
+function hoo() {
+ return a[index() + 3];
+}
+
+hoo();
+hoo();
+%OptimizeFunctionOnNextCall(hoo);
+hoo();
+
+// Sign extension of key makes AssertZeroExtended fail in DoBoundsCheck
+function ioo(i) {
+ return a[i] + a[i + 1];
+}
+
+ioo(1);
+ioo(1);
+%OptimizeFunctionOnNextCall(ioo);
+ioo(-1);
diff --git a/deps/v8/test/mjsunit/deopt-with-fp-regs.js b/deps/v8/test/mjsunit/deopt-with-fp-regs.js
new file mode 100644
index 000000000..10e3d9abb
--- /dev/null
+++ b/deps/v8/test/mjsunit/deopt-with-fp-regs.js
@@ -0,0 +1,90 @@
+// Copyright 2013 the V8 project authors. All rights reserved.
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are
+// met:
+//
+// * Redistributions of source code must retain the above copyright
+// notice, this list of conditions and the following disclaimer.
+// * Redistributions in binary form must reproduce the above
+// copyright notice, this list of conditions and the following
+// disclaimer in the documentation and/or other materials provided
+// with the distribution.
+// * Neither the name of Google Inc. nor the names of its
+// contributors may be used to endorse or promote products derived
+// from this software without specific prior written permission.
+//
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+// Flags: --allow-natives-syntax
+
+deopt_trigger = 0;
+side_effect = 0;
+
+function test(a, b, c, d, e, v) {
+ // This test expects some specific input values.
+ assertEquals(10.0, a);
+ assertEquals(20.0, b);
+ assertEquals(30.0, c);
+ assertEquals(40.0, d);
+ assertEquals(50.0, e);
+ assertEquals(1.5, v);
+
+ // Perform a few double calculations.
+ a = a * 0.1;
+ b = b * 0.2;
+ c = c * 0.3;
+ d = d * 0.4;
+ e = e * 0.5;
+
+ // Write to a field of a global object. As for any side effect, a HSimulate
+ // will be introduced after the instructions to support this. If we deopt
+ // later in this function, the execution will resume in full-codegen after
+ // this point.
+ side_effect++;
+ // The following field of the global object will be deleted to force a deopt.
+ // If we use type feedback to deopt, then tests ran with --stress-opt will
+ // not deopt after a few iteration.
+ // If we use %DeoptimizeFunction, all values will be on the frame due to the
+ // call and we will not exercise the translation mechanism handling fp
+ // registers.
+ deopt_trigger = v;
+
+ // Do a few more calculations using the previous values after our deopt point
+ // so the floating point registers which hold those values are recorded in the
+ // environment and will be used during deoptimization.
+ a = a * v;
+ b = b * v;
+ c = c * v;
+ d = d * v;
+ e = e * v;
+
+ // Check that we got the expected results.
+ assertEquals(1.5, a);
+ assertEquals(6, b);
+ assertEquals(13.5, c);
+ assertEquals(24, d);
+ assertEquals(37.5, e);
+}
+
+
+test(10.0, 20.0, 30.0, 40.0, 50.0, 1.5);
+test(10.0, 20.0, 30.0, 40.0, 50.0, 1.5);
+%OptimizeFunctionOnNextCall(test);
+test(10.0, 20.0, 30.0, 40.0, 50.0, 1.5);
+assertTrue(2 != %GetOptimizationStatus(test));
+
+// By deleting the field we are forcing the code to deopt when the field is
+// read on next execution.
+delete deopt_trigger;
+test(10.0, 20.0, 30.0, 40.0, 50.0, 1.5);
+assertTrue(1 != %GetOptimizationStatus(test));
diff --git a/deps/v8/test/mjsunit/div-mod.js b/deps/v8/test/mjsunit/div-mod.js
index c3144955c..08cee8cdd 100644
--- a/deps/v8/test/mjsunit/div-mod.js
+++ b/deps/v8/test/mjsunit/div-mod.js
@@ -126,9 +126,15 @@ function compute_mod(dividend, divisor) {
var example_numbers = [
NaN,
0,
+
+ // Due to a bug in fmod(), modulos involving denormals
+ // return the wrong result for glibc <= 2.16.
+ // Details: http://sourceware.org/bugzilla/show_bug.cgi?id=14048
+
Number.MIN_VALUE,
3 * Number.MIN_VALUE,
max_denormal,
+
min_normal,
repeating_decimal,
finite_decimal,
diff --git a/deps/v8/test/mjsunit/double-intrinsics.js b/deps/v8/test/mjsunit/double-intrinsics.js
new file mode 100644
index 000000000..16d653893
--- /dev/null
+++ b/deps/v8/test/mjsunit/double-intrinsics.js
@@ -0,0 +1,36 @@
+// Copyright 2014 the V8 project authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+// Flags: --allow-natives-syntax
+
+function assertDoubleBits(hi, lo, x) {
+ hi = hi | 0;
+ lo = lo | 0;
+ assertEquals(x, %_ConstructDouble(hi, lo));
+ assertEquals(hi, %_DoubleHi(x));
+ assertEquals(lo, %_DoubleLo(x));
+ assertEquals(x, %_ConstructDouble(%_DoubleHi(x), %_DoubleLo(x)));
+}
+
+
+var tests = [0x7ff00000, 0x00000000, Infinity,
+ 0xfff00000, 0x00000000, -Infinity,
+ 0x80000000, 0x00000000, -0,
+ 0x400921fb, 0x54442d18, Math.PI,
+ 0xc00921fb, 0x54442d18, -Math.PI,
+ 0x4005bf0a, 0x8b145769, Math.E,
+ 0xc005bf0a, 0x8b145769, -Math.E,
+ 0xbfe80000, 0x00000000, -0.75];
+
+
+for (var i = 0; i < tests.length; i += 3) {
+ assertDoubleBits(tests[i], tests[i + 1], tests[i + 2]);
+}
+
+%OptimizeFunctionOnNextCall(assertDoubleBits);
+
+for (var i = 0; i < tests.length; i += 3) {
+ assertDoubleBits(tests[i], tests[i + 1], tests[i + 2]);
+ assertOptimized(assertDoubleBits);
+}
diff --git a/deps/v8/test/mjsunit/elements-kind.js b/deps/v8/test/mjsunit/elements-kind.js
index e2bbc31a4..3aa513a37 100644
--- a/deps/v8/test/mjsunit/elements-kind.js
+++ b/deps/v8/test/mjsunit/elements-kind.js
@@ -25,7 +25,7 @@
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-// Flags: --allow-natives-syntax --smi-only-arrays --expose-gc --nostress-opt
+// Flags: --allow-natives-syntax --smi-only-arrays --expose-gc --nostress-opt --typed-array-max_size_in-heap=2048
// Test element kind of objects.
// Since --smi-only-arrays affects builtins, its default setting at compile
@@ -43,19 +43,28 @@ if (support_smi_only_arrays) {
}
var elements_kind = {
- fast_smi_only : 'fast smi only elements',
- fast : 'fast elements',
- fast_double : 'fast double elements',
- dictionary : 'dictionary elements',
- external_byte : 'external byte elements',
- external_unsigned_byte : 'external unsigned byte elements',
- external_short : 'external short elements',
- external_unsigned_short : 'external unsigned short elements',
- external_int : 'external int elements',
- external_unsigned_int : 'external unsigned int elements',
- external_float : 'external float elements',
- external_double : 'external double elements',
- external_pixel : 'external pixel elements'
+ fast_smi_only : 'fast smi only elements',
+ fast : 'fast elements',
+ fast_double : 'fast double elements',
+ dictionary : 'dictionary elements',
+ external_int32 : 'external int8 elements',
+ external_uint8 : 'external uint8 elements',
+ external_int16 : 'external int16 elements',
+ external_uint16 : 'external uint16 elements',
+ external_int32 : 'external int32 elements',
+ external_uint32 : 'external uint32 elements',
+ external_float32 : 'external float32 elements',
+ external_float64 : 'external float64 elements',
+ external_uint8_clamped : 'external uint8_clamped elements',
+ fixed_int32 : 'fixed int8 elements',
+ fixed_uint8 : 'fixed uint8 elements',
+ fixed_int16 : 'fixed int16 elements',
+ fixed_uint16 : 'fixed uint16 elements',
+ fixed_int32 : 'fixed int32 elements',
+ fixed_uint32 : 'fixed uint32 elements',
+ fixed_float32 : 'fixed float32 elements',
+ fixed_float64 : 'fixed float64 elements',
+ fixed_uint8_clamped : 'fixed uint8_clamped elements'
}
function getKind(obj) {
@@ -63,34 +72,61 @@ function getKind(obj) {
if (%HasFastObjectElements(obj)) return elements_kind.fast;
if (%HasFastDoubleElements(obj)) return elements_kind.fast_double;
if (%HasDictionaryElements(obj)) return elements_kind.dictionary;
+
// Every external kind is also an external array.
- assertTrue(%HasExternalArrayElements(obj));
if (%HasExternalInt8Elements(obj)) {
- return elements_kind.external_byte;
+ return elements_kind.external_int8;
}
if (%HasExternalUint8Elements(obj)) {
- return elements_kind.external_unsigned_byte;
+ return elements_kind.external_uint8;
}
if (%HasExternalInt16Elements(obj)) {
- return elements_kind.external_short;
+ return elements_kind.external_int16;
}
if (%HasExternalUint16Elements(obj)) {
- return elements_kind.external_unsigned_short;
+ return elements_kind.external_uint16;
}
if (%HasExternalInt32Elements(obj)) {
- return elements_kind.external_int;
+ return elements_kind.external_int32;
}
if (%HasExternalUint32Elements(obj)) {
- return elements_kind.external_unsigned_int;
+ return elements_kind.external_uint32;
}
if (%HasExternalFloat32Elements(obj)) {
- return elements_kind.external_float;
+ return elements_kind.external_float32;
}
if (%HasExternalFloat64Elements(obj)) {
- return elements_kind.external_double;
+ return elements_kind.external_float64;
}
if (%HasExternalUint8ClampedElements(obj)) {
- return elements_kind.external_pixel;
+ return elements_kind.external_uint8_clamped;
+ }
+ if (%HasFixedInt8Elements(obj)) {
+ return elements_kind.fixed_int8;
+ }
+ if (%HasFixedUint8Elements(obj)) {
+ return elements_kind.fixed_uint8;
+ }
+ if (%HasFixedInt16Elements(obj)) {
+ return elements_kind.fixed_int16;
+ }
+ if (%HasFixedUint16Elements(obj)) {
+ return elements_kind.fixed_uint16;
+ }
+ if (%HasFixedInt32Elements(obj)) {
+ return elements_kind.fixed_int32;
+ }
+ if (%HasFixedUint32Elements(obj)) {
+ return elements_kind.fixed_uint32;
+ }
+ if (%HasFixedFloat32Elements(obj)) {
+ return elements_kind.fixed_float32;
+ }
+ if (%HasFixedFloat64Elements(obj)) {
+ return elements_kind.fixed_float64;
+ }
+ if (%HasFixedUint8ClampedElements(obj)) {
+ return elements_kind.fixed_uint8_clamped;
}
}
@@ -136,15 +172,26 @@ function test_wrapper() {
for (var i = 0; i < 0xDECAF; i++) fast_double_array[i] = i / 2;
assertKind(elements_kind.fast_double, fast_double_array);
- assertKind(elements_kind.external_byte, new Int8Array(9001));
- assertKind(elements_kind.external_unsigned_byte, new Uint8Array(007));
- assertKind(elements_kind.external_short, new Int16Array(666));
- assertKind(elements_kind.external_unsigned_short, new Uint16Array(42));
- assertKind(elements_kind.external_int, new Int32Array(0xF));
- assertKind(elements_kind.external_unsigned_int, new Uint32Array(23));
- assertKind(elements_kind.external_float, new Float32Array(7));
- assertKind(elements_kind.external_double, new Float64Array(0));
- assertKind(elements_kind.external_pixel, new Uint8ClampedArray(512));
+ assertKind(elements_kind.fixed_int8, new Int8Array(007));
+ assertKind(elements_kind.fixed_uint8, new Uint8Array(007));
+ assertKind(elements_kind.fixed_int16, new Int16Array(666));
+ assertKind(elements_kind.fixed_uint16, new Uint16Array(42));
+ assertKind(elements_kind.fixed_int32, new Int32Array(0xF));
+ assertKind(elements_kind.fixed_uint32, new Uint32Array(23));
+ assertKind(elements_kind.fixed_float32, new Float32Array(7));
+ assertKind(elements_kind.fixed_float64, new Float64Array(0));
+ assertKind(elements_kind.fixed_uint8_clamped, new Uint8ClampedArray(512));
+
+ var ab = new ArrayBuffer(128);
+ assertKind(elements_kind.external_int8, new Int8Array(ab));
+ assertKind(elements_kind.external_uint8, new Uint8Array(ab));
+ assertKind(elements_kind.external_int16, new Int16Array(ab));
+ assertKind(elements_kind.external_uint16, new Uint16Array(ab));
+ assertKind(elements_kind.external_int32, new Int32Array(ab));
+ assertKind(elements_kind.external_uint32, new Uint32Array(ab));
+ assertKind(elements_kind.external_float32, new Float32Array(ab));
+ assertKind(elements_kind.external_float64, new Float64Array(ab));
+ assertKind(elements_kind.external_uint8_clamped, new Uint8ClampedArray(ab));
// Crankshaft support for smi-only array elements.
function monomorphic(array) {
diff --git a/deps/v8/test/mjsunit/es6/math-cbrt.js b/deps/v8/test/mjsunit/es6/math-cbrt.js
new file mode 100644
index 000000000..83d9eb5d7
--- /dev/null
+++ b/deps/v8/test/mjsunit/es6/math-cbrt.js
@@ -0,0 +1,27 @@
+// Copyright 2014 the V8 project authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+// Flags: --harmony-maths
+
+assertTrue(isNaN(Math.cbrt(NaN)));
+assertTrue(isNaN(Math.cbrt(function() {})));
+assertTrue(isNaN(Math.cbrt({ toString: function() { return NaN; } })));
+assertTrue(isNaN(Math.cbrt({ valueOf: function() { return "abc"; } })));
+assertEquals("Infinity", String(1/Math.cbrt(0)));
+assertEquals("-Infinity", String(1/Math.cbrt(-0)));
+assertEquals("Infinity", String(Math.cbrt(Infinity)));
+assertEquals("-Infinity", String(Math.cbrt(-Infinity)));
+
+for (var i = 1E-100; i < 1E100; i *= Math.PI) {
+ assertEqualsDelta(i, Math.cbrt(i*i*i), i * 1E-15);
+}
+
+for (var i = -1E-100; i > -1E100; i *= Math.E) {
+ assertEqualsDelta(i, Math.cbrt(i*i*i), -i * 1E-15);
+}
+
+// Let's be exact at least for small integers.
+for (var i = 2; i < 10000; i++) {
+ assertEquals(i, Math.cbrt(i*i*i));
+}
diff --git a/deps/v8/test/mjsunit/es6/math-clz32.js b/deps/v8/test/mjsunit/es6/math-clz32.js
new file mode 100644
index 000000000..816f6a936
--- /dev/null
+++ b/deps/v8/test/mjsunit/es6/math-clz32.js
@@ -0,0 +1,36 @@
+// Copyright 2014 the V8 project authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+// Flags: --harmony-maths --allow-natives-syntax
+
+[NaN, Infinity, -Infinity, 0, -0, "abc", "Infinity", "-Infinity", {}].forEach(
+ function(x) {
+ assertEquals(32, Math.clz32(x));
+ }
+);
+
+function testclz(x) {
+ for (var i = 0; i < 33; i++) {
+ if (x & 0x80000000) return i;
+ x <<= 1;
+ }
+ return 32;
+}
+
+
+function f(e) {
+ var max = Math.pow(2, e);
+ for (var x = 0; x < max; x = x * 1.01 + 1) {
+ assertEquals(testclz(x), Math.clz32(x));
+ assertEquals(testclz(-x), Math.clz32(-x));
+ assertEquals(testclz(x), Math.clz32({ valueOf: function() { return x; } }));
+ assertEquals(testclz(-x),
+ Math.clz32({ toString: function() { return -x; } }));
+ }
+}
+
+f(5);
+f(5);
+%OptimizeFunctionOnNextCall(f);
+f(40);
diff --git a/deps/v8/test/mjsunit/es6/math-expm1.js b/deps/v8/test/mjsunit/es6/math-expm1.js
new file mode 100644
index 000000000..de915c096
--- /dev/null
+++ b/deps/v8/test/mjsunit/es6/math-expm1.js
@@ -0,0 +1,38 @@
+// Copyright 2014 the V8 project authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+// Flags: --harmony-maths --no-fast-math
+
+assertTrue(isNaN(Math.expm1(NaN)));
+assertTrue(isNaN(Math.expm1(function() {})));
+assertTrue(isNaN(Math.expm1({ toString: function() { return NaN; } })));
+assertTrue(isNaN(Math.expm1({ valueOf: function() { return "abc"; } })));
+assertEquals("Infinity", String(1/Math.expm1(0)));
+assertEquals("-Infinity", String(1/Math.expm1(-0)));
+assertEquals("Infinity", String(Math.expm1(Infinity)));
+assertEquals(-1, Math.expm1(-Infinity));
+
+for (var x = 0.1; x < 700; x += 0.1) {
+ var expected = Math.exp(x) - 1;
+ assertEqualsDelta(expected, Math.expm1(x), expected * 1E-14);
+ expected = Math.exp(-x) - 1;
+ assertEqualsDelta(expected, Math.expm1(-x), -expected * 1E-14);
+}
+
+// Values close to 0:
+// Use six terms of Taylor expansion at 0 for exp(x) as test expectation:
+// exp(x) - 1 == exp(0) + exp(0) * x + x * x / 2 + ... - 1
+// == x + x * x / 2 + x * x * x / 6 + ...
+function expm1(x) {
+ return x * (1 + x * (1/2 + x * (
+ 1/6 + x * (1/24 + x * (
+ 1/120 + x * (1/720 + x * (
+ 1/5040 + x * (1/40320 + x*(
+ 1/362880 + x * (1/3628800))))))))));
+}
+
+for (var x = 1E-1; x > 1E-300; x *= 0.8) {
+ var expected = expm1(x);
+ assertEqualsDelta(expected, Math.expm1(x), expected * 1E-14);
+}
diff --git a/deps/v8/test/mjsunit/es6/math-fround.js b/deps/v8/test/mjsunit/es6/math-fround.js
new file mode 100644
index 000000000..ea432ea2d
--- /dev/null
+++ b/deps/v8/test/mjsunit/es6/math-fround.js
@@ -0,0 +1,99 @@
+// Copyright 2014 the V8 project authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+// Flags: --harmony-maths
+
+// Monkey-patch Float32Array.
+Float32Array = function(x) { this[0] = 0; };
+
+assertTrue(isNaN(Math.fround(NaN)));
+assertTrue(isNaN(Math.fround(function() {})));
+assertTrue(isNaN(Math.fround({ toString: function() { return NaN; } })));
+assertTrue(isNaN(Math.fround({ valueOf: function() { return "abc"; } })));
+assertEquals("Infinity", String(1/Math.fround(0)));
+assertEquals("-Infinity", String(1/Math.fround(-0)));
+assertEquals("Infinity", String(Math.fround(Infinity)));
+assertEquals("-Infinity", String(Math.fround(-Infinity)));
+
+assertEquals("Infinity", String(Math.fround(1E200)));
+assertEquals("-Infinity", String(Math.fround(-1E200)));
+assertEquals("Infinity", String(1/Math.fround(1E-300)));
+assertEquals("-Infinity", String(1/Math.fround(-1E-300)));
+
+mantissa_23_shift = Math.pow(2, -23);
+mantissa_29_shift = Math.pow(2, -23-29);
+
+// Javascript implementation of IEEE 754 to test double to single conversion.
+function ieee754float(sign_bit,
+ exponent_bits,
+ mantissa_23_bits,
+ mantissa_29_bits) {
+ this.sign_bit = sign_bit & 1;
+ this.exponent_bits = exponent_bits & ((1 << 11) - 1);
+ this.mantissa_23_bits = mantissa_23_bits & ((1 << 23) - 1);
+ this.mantissa_29_bits = mantissa_29_bits & ((1 << 29) - 1);
+}
+
+ieee754float.prototype.returnSpecial = function() {
+ if (mantissa_23_bits == 0 && mantissa_29_bits == 0) return sign * Infinity;
+ return NaN;
+}
+
+ieee754float.prototype.toDouble = function() {
+ var sign = this.sign_bit ? -1 : 1;
+ var exponent = this.exponent_bits - 1023;
+ if (exponent == -1023) returnSpecial();
+ var mantissa = 1 + this.mantissa_23_bits * mantissa_23_shift +
+ this.mantissa_29_bits * mantissa_29_shift;
+ return sign * Math.pow(2, exponent) * mantissa;
+}
+
+ieee754float.prototype.toSingle = function() {
+ var sign = this.sign_bit ? -1 : 1;
+ var exponent = this.exponent_bits - 1023;
+ if (exponent == -1023) returnSpecial();
+ if (exponent > 127) return sign * Infinity;
+ if (exponent < -126) return this.toSingleSubnormal(sign, exponent);
+ var round = this.mantissa_29_bits >> 28;
+ var mantissa = 1 + (this.mantissa_23_bits + round) * mantissa_23_shift;
+ return sign * Math.pow(2, exponent) * mantissa;
+}
+
+ieee754float.prototype.toSingleSubnormal = function(sign, exponent) {
+ var shift = -126 - exponent;
+ if (shift > 24) return sign * 0;
+ var round_mask = 1 << (shift - 1);
+ var mantissa_23_bits = this.mantissa_23_bits + (1 << 23);
+ var round = ((mantissa_23_bits & round_mask) != 0) | 0;
+ if (round) { // Round to even if tied.
+ var tied_mask = round_mask - 1;
+ var result_last_bit_mask = 1 << shift;
+ var tied = this.mantissa_29_bits == 0 &&
+ (mantissa_23_bits & tied_mask ) == 0;
+ var result_already_even = (mantissa_23_bits & result_last_bit_mask) == 0;
+ if (tied && result_already_even) round = 0;
+ }
+ mantissa_23_bits >>= shift;
+ var mantissa = (mantissa_23_bits + round) * mantissa_23_shift;
+ return sign * Math.pow(2, -126) * mantissa;
+}
+
+
+var pi = new ieee754float(0, 0x400, 0x490fda, 0x14442d18);
+assertEquals(pi.toSingle(), Math.fround(pi.toDouble()));
+
+function fuzz_mantissa(sign, exp, m1inc, m2inc) {
+ for (var m1 = 0; m1 < (1 << 23); m1 += m1inc) {
+ for (var m2 = 0; m2 < (1 << 29); m2 += m2inc) {
+ var float = new ieee754float(sign, exp, m1, m2);
+ assertEquals(float.toSingle(), Math.fround(float.toDouble()));
+ }
+ }
+}
+
+for (var sign = 0; sign < 2; sign++) {
+ for (var exp = 1024 - 170; exp < 1024 + 170; exp++) {
+ fuzz_mantissa(sign, exp, 1337 * exp - sign, 127913 * exp - sign);
+ }
+}
diff --git a/deps/v8/test/mjsunit/harmony/math-hyperbolic.js b/deps/v8/test/mjsunit/es6/math-hyperbolic.js
index 604448d89..c45a19c52 100644
--- a/deps/v8/test/mjsunit/harmony/math-hyperbolic.js
+++ b/deps/v8/test/mjsunit/es6/math-hyperbolic.js
@@ -60,7 +60,7 @@ function test_id(fun, rev, value) {
});
-[Math.sinh, Math.asinh, Math.cosh].forEach(function(fun) {
+[Math.sinh, Math.asinh].forEach(function(fun) {
assertEquals("-Infinity", String(fun(-Infinity)));
assertEquals("Infinity", String(fun(Infinity)));
assertEquals("-Infinity", String(fun("-Infinity")));
@@ -68,6 +68,12 @@ function test_id(fun, rev, value) {
});
+assertEquals("Infinity", String(Math.cosh(-Infinity)));
+assertEquals("Infinity", String(Math.cosh(Infinity)));
+assertEquals("Infinity", String(Math.cosh("-Infinity")));
+assertEquals("Infinity", String(Math.cosh("Infinity")));
+
+
assertEquals("-Infinity", String(Math.atanh(-1)));
assertEquals("Infinity", String(Math.atanh(1)));
diff --git a/deps/v8/test/mjsunit/harmony/math-hypot.js b/deps/v8/test/mjsunit/es6/math-hypot.js
index 105262721..105262721 100644
--- a/deps/v8/test/mjsunit/harmony/math-hypot.js
+++ b/deps/v8/test/mjsunit/es6/math-hypot.js
diff --git a/deps/v8/test/mjsunit/es6/math-log1p.js b/deps/v8/test/mjsunit/es6/math-log1p.js
new file mode 100644
index 000000000..eefea6ee3
--- /dev/null
+++ b/deps/v8/test/mjsunit/es6/math-log1p.js
@@ -0,0 +1,41 @@
+// Copyright 2014 the V8 project authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+// Flags: --harmony-maths
+
+assertTrue(isNaN(Math.log1p(NaN)));
+assertTrue(isNaN(Math.log1p(function() {})));
+assertTrue(isNaN(Math.log1p({ toString: function() { return NaN; } })));
+assertTrue(isNaN(Math.log1p({ valueOf: function() { return "abc"; } })));
+assertEquals("Infinity", String(1/Math.log1p(0)));
+assertEquals("-Infinity", String(1/Math.log1p(-0)));
+assertEquals("Infinity", String(Math.log1p(Infinity)));
+assertEquals("-Infinity", String(Math.log1p(-1)));
+assertTrue(isNaN(Math.log1p(-2)));
+assertTrue(isNaN(Math.log1p(-Infinity)));
+
+for (var x = 1E300; x > 1E-1; x *= 0.8) {
+ var expected = Math.log(x + 1);
+ assertEqualsDelta(expected, Math.log1p(x), expected * 1E-14);
+}
+
+// Values close to 0:
+// Use Taylor expansion at 1 for log(x) as test expectation:
+// log1p(x) == log(x + 1) == 0 + x / 1 - x^2 / 2 + x^3 / 3 - ...
+function log1p(x) {
+ var terms = [];
+ var prod = x;
+ for (var i = 1; i <= 20; i++) {
+ terms.push(prod / i);
+ prod *= -x;
+ }
+ var sum = 0;
+ while (terms.length > 0) sum += terms.pop();
+ return sum;
+}
+
+for (var x = 1E-1; x > 1E-300; x *= 0.8) {
+ var expected = log1p(x);
+ assertEqualsDelta(expected, Math.log1p(x), expected * 1E-14);
+}
diff --git a/deps/v8/test/mjsunit/harmony/math-log2-log10.js b/deps/v8/test/mjsunit/es6/math-log2-log10.js
index 2ab496012..2ab496012 100644
--- a/deps/v8/test/mjsunit/harmony/math-log2-log10.js
+++ b/deps/v8/test/mjsunit/es6/math-log2-log10.js
diff --git a/deps/v8/test/mjsunit/harmony/math-sign.js b/deps/v8/test/mjsunit/es6/math-sign.js
index 8a89d6282..8a89d6282 100644
--- a/deps/v8/test/mjsunit/harmony/math-sign.js
+++ b/deps/v8/test/mjsunit/es6/math-sign.js
diff --git a/deps/v8/test/mjsunit/harmony/math-trunc.js b/deps/v8/test/mjsunit/es6/math-trunc.js
index ed91ed138..ed91ed138 100644
--- a/deps/v8/test/mjsunit/harmony/math-trunc.js
+++ b/deps/v8/test/mjsunit/es6/math-trunc.js
diff --git a/deps/v8/test/mjsunit/es6/microtask-delivery.js b/deps/v8/test/mjsunit/es6/microtask-delivery.js
new file mode 100644
index 000000000..f74385e63
--- /dev/null
+++ b/deps/v8/test/mjsunit/es6/microtask-delivery.js
@@ -0,0 +1,168 @@
+// Copyright 2012 the V8 project authors. All rights reserved.
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are
+// met:
+//
+// * Redistributions of source code must retain the above copyright
+// notice, this list of conditions and the following disclaimer.
+// * Redistributions in binary form must reproduce the above
+// copyright notice, this list of conditions and the following
+// disclaimer in the documentation and/or other materials provided
+// with the distribution.
+// * Neither the name of Google Inc. nor the names of its
+// contributors may be used to endorse or promote products derived
+// from this software without specific prior written permission.
+//
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+// Flags: --allow-natives-syntax
+
+var ordering = [];
+function reset() {
+ ordering = [];
+}
+
+function assertArrayValues(expected, actual) {
+ assertEquals(expected.length, actual.length);
+ for (var i = 0; i < expected.length; i++) {
+ assertEquals(expected[i], actual[i]);
+ }
+}
+
+function assertOrdering(expected) {
+ %RunMicrotasks();
+ assertArrayValues(expected, ordering);
+}
+
+function newPromise(id, fn) {
+ var r;
+ var t = 1;
+ var promise = new Promise(function(resolve) {
+ r = resolve;
+ if (fn) fn();
+ });
+
+ var next = promise.then(function(value) {
+ ordering.push('p' + id);
+ return value;
+ });
+
+ return {
+ resolve: r,
+ then: function(fn) {
+ next = next.then(function(value) {
+ ordering.push('p' + id + ':' + t++);
+ return fn ? fn(value) : value;
+ });
+
+ return this;
+ }
+ };
+}
+
+function newObserver(id, fn, obj) {
+ var observer = {
+ value: 1,
+ recordCounts: []
+ };
+
+ Object.observe(observer, function(records) {
+ ordering.push('o' + id);
+ observer.recordCounts.push(records.length);
+ if (fn) fn();
+ });
+
+ return observer;
+}
+
+
+(function PromiseThens() {
+ reset();
+
+ var p1 = newPromise(1).then();
+ var p2 = newPromise(2).then();
+
+ p1.resolve();
+ p2.resolve();
+
+ assertOrdering(['p1', 'p2', 'p1:1', 'p2:1']);
+})();
+
+
+(function ObserversBatch() {
+ reset();
+
+ var p1 = newPromise(1);
+ var p2 = newPromise(2);
+ var p3 = newPromise(3);
+
+ var ob1 = newObserver(1);
+ var ob2 = newObserver(2, function() {
+ ob3.value++;
+ p3.resolve();
+ ob1.value++;
+ });
+ var ob3 = newObserver(3);
+
+ p1.resolve();
+ ob1.value++;
+ p2.resolve();
+ ob2.value++;
+
+ assertOrdering(['p1', 'o1', 'o2', 'p2', 'o1', 'o3', 'p3']);
+ assertArrayValues([1, 1], ob1.recordCounts);
+ assertArrayValues([1], ob2.recordCounts);
+ assertArrayValues([1], ob3.recordCounts);
+})();
+
+
+(function ObserversGetAllRecords() {
+ reset();
+
+ var p1 = newPromise(1);
+ var p2 = newPromise(2);
+ var ob1 = newObserver(1, function() {
+ ob2.value++;
+ });
+ var ob2 = newObserver(2);
+
+ p1.resolve();
+ ob1.value++;
+ p2.resolve();
+ ob2.value++;
+
+ assertOrdering(['p1', 'o1', 'o2', 'p2']);
+ assertArrayValues([1], ob1.recordCounts);
+ assertArrayValues([2], ob2.recordCounts);
+})();
+
+
+(function NewObserverDeliveryGetsNewMicrotask() {
+ reset();
+
+ var p1 = newPromise(1);
+ var p2 = newPromise(2);
+ var ob1 = newObserver(1);
+ var ob2 = newObserver(2, function() {
+ ob1.value++;
+ });
+
+ p1.resolve();
+ ob1.value++;
+ p2.resolve();
+ ob2.value++;
+
+ assertOrdering(['p1', 'o1', 'o2', 'p2', 'o1']);
+ assertArrayValues([1, 1], ob1.recordCounts);
+ assertArrayValues([1], ob2.recordCounts);
+})();
diff --git a/deps/v8/test/mjsunit/harmony/promises.js b/deps/v8/test/mjsunit/es6/promises.js
index 38ccd7fb2..96a7bbbf3 100644
--- a/deps/v8/test/mjsunit/harmony/promises.js
+++ b/deps/v8/test/mjsunit/es6/promises.js
@@ -25,7 +25,7 @@
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-// Flags: --harmony-promises --harmony-observation --allow-natives-syntax
+// Flags: --allow-natives-syntax
var asyncAssertsExpected = 0;
@@ -82,8 +82,8 @@ function assertAsyncDone(iteration) {
})();
(function() {
- Promise.resolve(5);
- Promise.resolve(5).chain(undefined, assertUnreachable).chain(
+ Promise.accept(5);
+ Promise.accept(5).chain(undefined, assertUnreachable).chain(
function(x) { assertAsync(x === 5, "resolved/chain-nohandler") },
assertUnreachable
)
@@ -99,8 +99,13 @@ function assertAsyncDone(iteration) {
})();
(function() {
- Promise.resolve(5).then(undefined, assertUnreachable).chain(
- function(x) { assertAsync(x === 5, "resolved/then-nohandler") },
+ Promise.accept(5).then(undefined, assertUnreachable).chain(
+ function(x) { assertAsync(x === 5, "resolved/then-nohandler-undefined") },
+ assertUnreachable
+ )
+ assertAsyncRan()
+ Promise.accept(6).then(null, assertUnreachable).chain(
+ function(x) { assertAsync(x === 6, "resolved/then-nohandler-null") },
assertUnreachable
)
assertAsyncRan()
@@ -109,15 +114,20 @@ function assertAsyncDone(iteration) {
(function() {
Promise.reject(5).then(assertUnreachable, undefined).chain(
assertUnreachable,
- function(r) { assertAsync(r === 5, "rejected/then-nohandler") }
+ function(r) { assertAsync(r === 5, "rejected/then-nohandler-undefined") }
+ )
+ assertAsyncRan()
+ Promise.reject(6).then(assertUnreachable, null).chain(
+ assertUnreachable,
+ function(r) { assertAsync(r === 6, "rejected/then-nohandler-null") }
)
assertAsyncRan()
})();
(function() {
- var p1 = Promise.resolve(5)
- var p2 = Promise.resolve(p1)
- var p3 = Promise.resolve(p2)
+ var p1 = Promise.accept(5)
+ var p2 = Promise.accept(p1)
+ var p3 = Promise.accept(p2)
p3.chain(
function(x) { assertAsync(x === p2, "resolved/chain") },
assertUnreachable
@@ -126,9 +136,9 @@ function assertAsyncDone(iteration) {
})();
(function() {
- var p1 = Promise.resolve(5)
- var p2 = Promise.resolve(p1)
- var p3 = Promise.resolve(p2)
+ var p1 = Promise.accept(5)
+ var p2 = Promise.accept(p1)
+ var p3 = Promise.accept(p2)
p3.then(
function(x) { assertAsync(x === 5, "resolved/then") },
assertUnreachable
@@ -138,8 +148,8 @@ function assertAsyncDone(iteration) {
(function() {
var p1 = Promise.reject(5)
- var p2 = Promise.resolve(p1)
- var p3 = Promise.resolve(p2)
+ var p2 = Promise.accept(p1)
+ var p3 = Promise.accept(p2)
p3.chain(
function(x) { assertAsync(x === p2, "rejected/chain") },
assertUnreachable
@@ -149,8 +159,8 @@ function assertAsyncDone(iteration) {
(function() {
var p1 = Promise.reject(5)
- var p2 = Promise.resolve(p1)
- var p3 = Promise.resolve(p2)
+ var p2 = Promise.accept(p1)
+ var p3 = Promise.accept(p2)
p3.then(
assertUnreachable,
function(x) { assertAsync(x === 5, "rejected/then") }
@@ -159,9 +169,9 @@ function assertAsyncDone(iteration) {
})();
(function() {
- var p1 = Promise.resolve(5)
- var p2 = Promise.resolve(p1)
- var p3 = Promise.resolve(p2)
+ var p1 = Promise.accept(5)
+ var p2 = Promise.accept(p1)
+ var p3 = Promise.accept(p2)
p3.chain(function(x) { return x }, assertUnreachable).chain(
function(x) { assertAsync(x === p1, "resolved/chain/chain") },
assertUnreachable
@@ -170,9 +180,9 @@ function assertAsyncDone(iteration) {
})();
(function() {
- var p1 = Promise.resolve(5)
- var p2 = Promise.resolve(p1)
- var p3 = Promise.resolve(p2)
+ var p1 = Promise.accept(5)
+ var p2 = Promise.accept(p1)
+ var p3 = Promise.accept(p2)
p3.chain(function(x) { return x }, assertUnreachable).then(
function(x) { assertAsync(x === 5, "resolved/chain/then") },
assertUnreachable
@@ -181,9 +191,9 @@ function assertAsyncDone(iteration) {
})();
(function() {
- var p1 = Promise.resolve(5)
- var p2 = Promise.resolve(p1)
- var p3 = Promise.resolve(p2)
+ var p1 = Promise.accept(5)
+ var p2 = Promise.accept(p1)
+ var p3 = Promise.accept(p2)
p3.chain(function(x) { return 6 }, assertUnreachable).chain(
function(x) { assertAsync(x === 6, "resolved/chain/chain2") },
assertUnreachable
@@ -192,9 +202,9 @@ function assertAsyncDone(iteration) {
})();
(function() {
- var p1 = Promise.resolve(5)
- var p2 = Promise.resolve(p1)
- var p3 = Promise.resolve(p2)
+ var p1 = Promise.accept(5)
+ var p2 = Promise.accept(p1)
+ var p3 = Promise.accept(p2)
p3.chain(function(x) { return 6 }, assertUnreachable).then(
function(x) { assertAsync(x === 6, "resolved/chain/then2") },
assertUnreachable
@@ -203,9 +213,9 @@ function assertAsyncDone(iteration) {
})();
(function() {
- var p1 = Promise.resolve(5)
- var p2 = Promise.resolve(p1)
- var p3 = Promise.resolve(p2)
+ var p1 = Promise.accept(5)
+ var p2 = Promise.accept(p1)
+ var p3 = Promise.accept(p2)
p3.then(function(x) { return x + 1 }, assertUnreachable).chain(
function(x) { assertAsync(x === 6, "resolved/then/chain") },
assertUnreachable
@@ -214,9 +224,9 @@ function assertAsyncDone(iteration) {
})();
(function() {
- var p1 = Promise.resolve(5)
- var p2 = Promise.resolve(p1)
- var p3 = Promise.resolve(p2)
+ var p1 = Promise.accept(5)
+ var p2 = Promise.accept(p1)
+ var p3 = Promise.accept(p2)
p3.then(function(x) { return x + 1 }, assertUnreachable).then(
function(x) { assertAsync(x === 6, "resolved/then/then") },
assertUnreachable
@@ -225,10 +235,10 @@ function assertAsyncDone(iteration) {
})();
(function() {
- var p1 = Promise.resolve(5)
- var p2 = Promise.resolve(p1)
- var p3 = Promise.resolve(p2)
- p3.then(function(x){ return Promise.resolve(x+1) }, assertUnreachable).chain(
+ var p1 = Promise.accept(5)
+ var p2 = Promise.accept(p1)
+ var p3 = Promise.accept(p2)
+ p3.then(function(x){ return Promise.accept(x+1) }, assertUnreachable).chain(
function(x) { assertAsync(x === 6, "resolved/then/chain2") },
assertUnreachable
)
@@ -236,10 +246,10 @@ function assertAsyncDone(iteration) {
})();
(function() {
- var p1 = Promise.resolve(5)
- var p2 = Promise.resolve(p1)
- var p3 = Promise.resolve(p2)
- p3.then(function(x) { return Promise.resolve(x+1) }, assertUnreachable).then(
+ var p1 = Promise.accept(5)
+ var p2 = Promise.accept(p1)
+ var p3 = Promise.accept(p2)
+ p3.then(function(x) { return Promise.accept(x+1) }, assertUnreachable).then(
function(x) { assertAsync(x === 6, "resolved/then/then2") },
assertUnreachable
)
@@ -247,9 +257,9 @@ function assertAsyncDone(iteration) {
})();
(function() {
- var p1 = Promise.resolve(5)
- var p2 = Promise.resolve(p1)
- var p3 = Promise.resolve(p2)
+ var p1 = Promise.accept(5)
+ var p2 = Promise.accept(p1)
+ var p3 = Promise.accept(p2)
p3.chain(function(x) { throw 6 }, assertUnreachable).chain(
assertUnreachable,
function(x) { assertAsync(x === 6, "resolved/chain-throw/chain") }
@@ -258,9 +268,9 @@ function assertAsyncDone(iteration) {
})();
(function() {
- var p1 = Promise.resolve(5)
- var p2 = Promise.resolve(p1)
- var p3 = Promise.resolve(p2)
+ var p1 = Promise.accept(5)
+ var p2 = Promise.accept(p1)
+ var p3 = Promise.accept(p2)
p3.chain(function(x) { throw 6 }, assertUnreachable).then(
assertUnreachable,
function(x) { assertAsync(x === 6, "resolved/chain-throw/then") }
@@ -269,9 +279,9 @@ function assertAsyncDone(iteration) {
})();
(function() {
- var p1 = Promise.resolve(5)
- var p2 = Promise.resolve(p1)
- var p3 = Promise.resolve(p2)
+ var p1 = Promise.accept(5)
+ var p2 = Promise.accept(p1)
+ var p3 = Promise.accept(p2)
p3.then(function(x) { throw 6 }, assertUnreachable).chain(
assertUnreachable,
function(x) { assertAsync(x === 6, "resolved/then-throw/chain") }
@@ -280,9 +290,9 @@ function assertAsyncDone(iteration) {
})();
(function() {
- var p1 = Promise.resolve(5)
- var p2 = Promise.resolve(p1)
- var p3 = Promise.resolve(p2)
+ var p1 = Promise.accept(5)
+ var p2 = Promise.accept(p1)
+ var p3 = Promise.accept(p2)
p3.then(function(x) { throw 6 }, assertUnreachable).then(
assertUnreachable,
function(x) { assertAsync(x === 6, "resolved/then-throw/then") }
@@ -291,9 +301,9 @@ function assertAsyncDone(iteration) {
})();
(function() {
- var p1 = Promise.resolve(5)
+ var p1 = Promise.accept(5)
var p2 = {then: function(onResolve, onReject) { onResolve(p1) }}
- var p3 = Promise.resolve(p2)
+ var p3 = Promise.accept(p2)
p3.chain(
function(x) { assertAsync(x === p2, "resolved/thenable/chain") },
assertUnreachable
@@ -302,9 +312,9 @@ function assertAsyncDone(iteration) {
})();
(function() {
- var p1 = Promise.resolve(5)
+ var p1 = Promise.accept(5)
var p2 = {then: function(onResolve, onReject) { onResolve(p1) }}
- var p3 = Promise.resolve(p2)
+ var p3 = Promise.accept(p2)
p3.then(
function(x) { assertAsync(x === 5, "resolved/thenable/then") },
assertUnreachable
@@ -315,7 +325,7 @@ function assertAsyncDone(iteration) {
(function() {
var p1 = Promise.reject(5)
var p2 = {then: function(onResolve, onReject) { onResolve(p1) }}
- var p3 = Promise.resolve(p2)
+ var p3 = Promise.accept(p2)
p3.chain(
function(x) { assertAsync(x === p2, "rejected/thenable/chain") },
assertUnreachable
@@ -326,7 +336,7 @@ function assertAsyncDone(iteration) {
(function() {
var p1 = Promise.reject(5)
var p2 = {then: function(onResolve, onReject) { onResolve(p1) }}
- var p3 = Promise.resolve(p2)
+ var p3 = Promise.accept(p2)
p3.then(
assertUnreachable,
function(x) { assertAsync(x === 5, "rejected/thenable/then") }
@@ -337,8 +347,8 @@ function assertAsyncDone(iteration) {
(function() {
var deferred = Promise.defer()
var p1 = deferred.promise
- var p2 = Promise.resolve(p1)
- var p3 = Promise.resolve(p2)
+ var p2 = Promise.accept(p1)
+ var p3 = Promise.accept(p2)
p3.chain(
function(x) { assertAsync(x === p2, "chain/resolve") },
assertUnreachable
@@ -350,8 +360,8 @@ function assertAsyncDone(iteration) {
(function() {
var deferred = Promise.defer()
var p1 = deferred.promise
- var p2 = Promise.resolve(p1)
- var p3 = Promise.resolve(p2)
+ var p2 = Promise.accept(p1)
+ var p3 = Promise.accept(p2)
p3.then(
function(x) { assertAsync(x === 5, "then/resolve") },
assertUnreachable
@@ -363,8 +373,8 @@ function assertAsyncDone(iteration) {
(function() {
var deferred = Promise.defer()
var p1 = deferred.promise
- var p2 = Promise.resolve(p1)
- var p3 = Promise.resolve(p2)
+ var p2 = Promise.accept(p1)
+ var p3 = Promise.accept(p2)
p3.chain(
function(x) { assertAsync(x === p2, "chain/reject") },
assertUnreachable
@@ -376,8 +386,8 @@ function assertAsyncDone(iteration) {
(function() {
var deferred = Promise.defer()
var p1 = deferred.promise
- var p2 = Promise.resolve(p1)
- var p3 = Promise.resolve(p2)
+ var p2 = Promise.accept(p1)
+ var p3 = Promise.accept(p2)
p3.then(
assertUnreachable,
function(x) { assertAsync(x === 5, "then/reject") }
@@ -390,7 +400,7 @@ function assertAsyncDone(iteration) {
var deferred = Promise.defer()
var p1 = deferred.promise
var p2 = {then: function(onResolve, onReject) { onResolve(p1) }}
- var p3 = Promise.resolve(p2)
+ var p3 = Promise.accept(p2)
p3.chain(
function(x) { assertAsync(x === p2, "chain/resolve/thenable") },
assertUnreachable
@@ -403,7 +413,7 @@ function assertAsyncDone(iteration) {
var deferred = Promise.defer()
var p1 = deferred.promise
var p2 = {then: function(onResolve, onReject) { onResolve(p1) }}
- var p3 = Promise.resolve(p2)
+ var p3 = Promise.accept(p2)
p3.then(
function(x) { assertAsync(x === 5, "then/resolve/thenable") },
assertUnreachable
@@ -416,7 +426,7 @@ function assertAsyncDone(iteration) {
var deferred = Promise.defer()
var p1 = deferred.promise
var p2 = {then: function(onResolve, onReject) { onResolve(p1) }}
- var p3 = Promise.resolve(p2)
+ var p3 = Promise.accept(p2)
p3.chain(
function(x) { assertAsync(x === p2, "chain/reject/thenable") },
assertUnreachable
@@ -429,7 +439,7 @@ function assertAsyncDone(iteration) {
var deferred = Promise.defer()
var p1 = deferred.promise
var p2 = {then: function(onResolve, onReject) { onResolve(p1) }}
- var p3 = Promise.resolve(p2)
+ var p3 = Promise.accept(p2)
p3.then(
assertUnreachable,
function(x) { assertAsync(x === 5, "then/reject/thenable") }
@@ -439,8 +449,8 @@ function assertAsyncDone(iteration) {
})();
(function() {
- var p1 = Promise.resolve(5)
- var p2 = Promise.resolve(p1)
+ var p1 = Promise.accept(5)
+ var p2 = Promise.accept(p1)
var deferred = Promise.defer()
var p3 = deferred.promise
p3.chain(
@@ -452,8 +462,8 @@ function assertAsyncDone(iteration) {
})();
(function() {
- var p1 = Promise.resolve(5)
- var p2 = Promise.resolve(p1)
+ var p1 = Promise.accept(5)
+ var p2 = Promise.accept(p1)
var deferred = Promise.defer()
var p3 = deferred.promise
p3.then(
@@ -465,8 +475,8 @@ function assertAsyncDone(iteration) {
})();
(function() {
- var p1 = Promise.resolve(5)
- var p2 = Promise.resolve(p1)
+ var p1 = Promise.accept(5)
+ var p2 = Promise.accept(p1)
var deferred = Promise.defer()
var p3 = deferred.promise
p3.chain(
@@ -478,8 +488,8 @@ function assertAsyncDone(iteration) {
})();
(function() {
- var p1 = Promise.resolve(5)
- var p2 = Promise.resolve(p1)
+ var p1 = Promise.accept(5)
+ var p2 = Promise.accept(p1)
var deferred = Promise.defer()
var p3 = deferred.promise
p3.then(
@@ -491,7 +501,7 @@ function assertAsyncDone(iteration) {
})();
(function() {
- var p1 = Promise.resolve(5)
+ var p1 = Promise.accept(5)
var p2 = {then: function(onResolve, onReject) { onResolve(p1) }}
var deferred = Promise.defer()
var p3 = deferred.promise
@@ -504,7 +514,7 @@ function assertAsyncDone(iteration) {
})();
(function() {
- var p1 = Promise.resolve(5)
+ var p1 = Promise.accept(5)
var p2 = {then: function(onResolve, onReject) { onResolve(p1) }}
var deferred = Promise.defer()
var p3 = deferred.promise
@@ -517,7 +527,7 @@ function assertAsyncDone(iteration) {
})();
(function() {
- var p1 = Promise.resolve(0)
+ var p1 = Promise.accept(0)
var p2 = p1.chain(function(x) { return p2 }, assertUnreachable)
p2.chain(
assertUnreachable,
@@ -527,7 +537,7 @@ function assertAsyncDone(iteration) {
})();
(function() {
- var p1 = Promise.resolve(0)
+ var p1 = Promise.accept(0)
var p2 = p1.then(function(x) { return p2 }, assertUnreachable)
p2.chain(
assertUnreachable,
@@ -559,9 +569,9 @@ function assertAsyncDone(iteration) {
})();
(function() {
- Promise.all({get length() { throw 666 }}).chain(
+ Promise.all({}).chain(
assertUnreachable,
- function(r) { assertAsync(r === 666, "all/no-array") }
+ function(r) { assertAsync(r instanceof TypeError, "all/no-array") }
)
assertAsyncRan()
})();
@@ -602,7 +612,7 @@ function assertAsyncDone(iteration) {
(function() {
var deferred = Promise.defer()
var p1 = deferred.promise
- var p2 = Promise.resolve(2)
+ var p2 = Promise.accept(2)
var p3 = Promise.defer().promise
Promise.all([p1, p2, p3]).chain(
assertUnreachable,
@@ -636,9 +646,9 @@ function assertAsyncDone(iteration) {
})();
(function() {
- var p1 = Promise.resolve(1)
- var p2 = Promise.resolve(2)
- var p3 = Promise.resolve(3)
+ var p1 = Promise.accept(1)
+ var p2 = Promise.accept(2)
+ var p3 = Promise.accept(3)
Promise.race([p1, p2, p3]).chain(
function(x) { assertAsync(x === 1, "resolved/one") },
assertUnreachable
@@ -647,9 +657,9 @@ function assertAsyncDone(iteration) {
})();
(function() {
- var p1 = Promise.resolve(1)
- var p2 = Promise.resolve(2)
- var p3 = Promise.resolve(3)
+ var p1 = Promise.accept(1)
+ var p2 = Promise.accept(2)
+ var p3 = Promise.accept(3)
Promise.race([0, p1, p2, p3]).chain(
function(x) { assertAsync(x === 0, "resolved-const/one") },
assertUnreachable
@@ -658,9 +668,9 @@ function assertAsyncDone(iteration) {
})();
(function() {
- Promise.race({get length() { throw 666 }}).chain(
+ Promise.race({}).chain(
assertUnreachable,
- function(r) { assertAsync(r === 666, "one/no-array") }
+ function(r) { assertAsync(r instanceof TypeError, "one/no-array") }
)
assertAsyncRan()
})();
@@ -684,7 +694,7 @@ function assertAsyncDone(iteration) {
(function() {
var deferred = Promise.defer()
var p1 = deferred.promise
- var p2 = Promise.resolve(2)
+ var p2 = Promise.accept(2)
var p3 = Promise.defer().promise
Promise.race([p1, p2, p3]).chain(
function(x) { assertAsync(x === 2, "resolved/one") },
@@ -779,12 +789,12 @@ function assertAsyncDone(iteration) {
assertTrue(log === "dncncnx6", "subclass/chain")
log = ""
- Promise.all([11, Promise.resolve(12), 13, MyPromise.resolve(14), 15, 16])
- assertTrue(log === "nx14cn", "subclass/all/arg")
+ Promise.all([11, Promise.accept(12), 13, MyPromise.accept(14), 15, 16])
+ assertTrue(log === "nx14n", "subclass/all/arg")
log = ""
- MyPromise.all([21, Promise.resolve(22), 23, MyPromise.resolve(24), 25, 26])
- assertTrue(log === "nx24nnx21cnnx23cncnnx25cnnx26cn", "subclass/all/self")
+ MyPromise.all([21, Promise.accept(22), 23, MyPromise.accept(24), 25, 26])
+ assertTrue(log === "nx24nnx21nnx23nnnx25nnx26n", "subclass/all/self")
})();
diff --git a/deps/v8/test/mjsunit/regress/regress-2034.js b/deps/v8/test/mjsunit/es6/regress/regress-2034.js
index c510f97fc..5c738bf84 100644
--- a/deps/v8/test/mjsunit/regress/regress-2034.js
+++ b/deps/v8/test/mjsunit/es6/regress/regress-2034.js
@@ -25,8 +25,6 @@
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-// Flags: --harmony-collections
-
var key = {};
var map = new WeakMap;
Object.preventExtensions(key);
diff --git a/deps/v8/test/mjsunit/regress/regress-2156.js b/deps/v8/test/mjsunit/es6/regress/regress-2156.js
index 348257113..fba2a2986 100644
--- a/deps/v8/test/mjsunit/regress/regress-2156.js
+++ b/deps/v8/test/mjsunit/es6/regress/regress-2156.js
@@ -25,7 +25,7 @@
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-// Flags: --allow-natives-syntax --harmony-collections
+// Flags: --allow-natives-syntax
var key1 = {};
var key2 = {};
diff --git a/deps/v8/test/mjsunit/regress/regress-2829.js b/deps/v8/test/mjsunit/es6/regress/regress-2829.js
index a046ae039..b48039cf0 100644
--- a/deps/v8/test/mjsunit/regress/regress-2829.js
+++ b/deps/v8/test/mjsunit/es6/regress/regress-2829.js
@@ -25,8 +25,6 @@
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-// Flags: --harmony-collections
-
(function test1() {
var wm1 = new WeakMap();
wm1.set(Object.prototype, 23);
diff --git a/deps/v8/test/mjsunit/es6/weak_collections.js b/deps/v8/test/mjsunit/es6/weak_collections.js
new file mode 100644
index 000000000..74235e7d2
--- /dev/null
+++ b/deps/v8/test/mjsunit/es6/weak_collections.js
@@ -0,0 +1,333 @@
+// Copyright 2012 the V8 project authors. All rights reserved.
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are
+// met:
+//
+// * Redistributions of source code must retain the above copyright
+// notice, this list of conditions and the following disclaimer.
+// * Redistributions in binary form must reproduce the above
+// copyright notice, this list of conditions and the following
+// disclaimer in the documentation and/or other materials provided
+// with the distribution.
+// * Neither the name of Google Inc. nor the names of its
+// contributors may be used to endorse or promote products derived
+// from this software without specific prior written permission.
+//
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+// Flags: --expose-gc --allow-natives-syntax
+
+
+// Note: this test is superseded by harmony/collections.js.
+// IF YOU CHANGE THIS FILE, apply the same changes to harmony/collections.js!
+// TODO(rossberg): Remove once non-weak collections have caught up.
+
+// Test valid getter and setter calls on WeakSets.
+function TestValidSetCalls(m) {
+ assertDoesNotThrow(function () { m.add(new Object) });
+ assertDoesNotThrow(function () { m.has(new Object) });
+ assertDoesNotThrow(function () { m.delete(new Object) });
+}
+TestValidSetCalls(new WeakSet);
+
+
+// Test valid getter and setter calls on WeakMaps
+function TestValidMapCalls(m) {
+ assertDoesNotThrow(function () { m.get(new Object) });
+ assertDoesNotThrow(function () { m.set(new Object) });
+ assertDoesNotThrow(function () { m.has(new Object) });
+ assertDoesNotThrow(function () { m.delete(new Object) });
+}
+TestValidMapCalls(new WeakMap);
+
+
+// Test invalid getter and setter calls for WeakMap
+function TestInvalidCalls(m) {
+ assertThrows(function () { m.get(undefined) }, TypeError);
+ assertThrows(function () { m.set(undefined, 0) }, TypeError);
+ assertThrows(function () { m.get(null) }, TypeError);
+ assertThrows(function () { m.set(null, 0) }, TypeError);
+ assertThrows(function () { m.get(0) }, TypeError);
+ assertThrows(function () { m.set(0, 0) }, TypeError);
+ assertThrows(function () { m.get('a-key') }, TypeError);
+ assertThrows(function () { m.set('a-key', 0) }, TypeError);
+}
+TestInvalidCalls(new WeakMap);
+
+
+// Test expected behavior for WeakSets
+function TestSet(set, key) {
+ assertFalse(set.has(key));
+ assertSame(undefined, set.add(key));
+ assertTrue(set.has(key));
+ assertTrue(set.delete(key));
+ assertFalse(set.has(key));
+ assertFalse(set.delete(key));
+ assertFalse(set.has(key));
+}
+function TestSetBehavior(set) {
+ for (var i = 0; i < 20; i++) {
+ TestSet(set, new Object);
+ TestSet(set, i);
+ TestSet(set, i / 100);
+ TestSet(set, 'key-' + i);
+ }
+ var keys = [ +0, -0, +Infinity, -Infinity, true, false, null, undefined ];
+ for (var i = 0; i < keys.length; i++) {
+ TestSet(set, keys[i]);
+ }
+}
+TestSet(new WeakSet, new Object);
+
+
+// Test expected mapping behavior for WeakMaps
+function TestMapping(map, key, value) {
+ assertSame(undefined, map.set(key, value));
+ assertSame(value, map.get(key));
+}
+function TestMapBehavior1(m) {
+ TestMapping(m, new Object, 23);
+ TestMapping(m, new Object, 'the-value');
+ TestMapping(m, new Object, new Object);
+}
+TestMapBehavior1(new WeakMap);
+
+
+// Test expected querying behavior of WeakMaps
+function TestQuery(m) {
+ var key = new Object;
+ var values = [ 'x', 0, +Infinity, -Infinity, true, false, null, undefined ];
+ for (var i = 0; i < values.length; i++) {
+ TestMapping(m, key, values[i]);
+ assertTrue(m.has(key));
+ assertFalse(m.has(new Object));
+ }
+}
+TestQuery(new WeakMap);
+
+
+// Test expected deletion behavior of WeakMaps
+function TestDelete(m) {
+ var key = new Object;
+ TestMapping(m, key, 'to-be-deleted');
+ assertTrue(m.delete(key));
+ assertFalse(m.delete(key));
+ assertFalse(m.delete(new Object));
+ assertSame(m.get(key), undefined);
+}
+TestDelete(new WeakMap);
+
+
+// Test GC of WeakMaps with entry
+function TestGC1(m) {
+ var key = new Object;
+ m.set(key, 'not-collected');
+ gc();
+ assertSame('not-collected', m.get(key));
+}
+TestGC1(new WeakMap);
+
+
+// Test GC of WeakMaps with chained entries
+function TestGC2(m) {
+ var head = new Object;
+ for (key = head, i = 0; i < 10; i++, key = m.get(key)) {
+ m.set(key, new Object);
+ }
+ gc();
+ var count = 0;
+ for (key = head; key != undefined; key = m.get(key)) {
+ count++;
+ }
+ assertEquals(11, count);
+}
+TestGC2(new WeakMap);
+
+
+// Test property attribute [[Enumerable]]
+function TestEnumerable(func) {
+ function props(x) {
+ var array = [];
+ for (var p in x) array.push(p);
+ return array.sort();
+ }
+ assertArrayEquals([], props(func));
+ assertArrayEquals([], props(func.prototype));
+ assertArrayEquals([], props(new func()));
+}
+TestEnumerable(WeakMap);
+TestEnumerable(WeakSet);
+
+
+// Test arbitrary properties on WeakMaps
+function TestArbitrary(m) {
+ function TestProperty(map, property, value) {
+ map[property] = value;
+ assertEquals(value, map[property]);
+ }
+ for (var i = 0; i < 20; i++) {
+ TestProperty(m, i, 'val' + i);
+ TestProperty(m, 'foo' + i, 'bar' + i);
+ }
+ TestMapping(m, new Object, 'foobar');
+}
+TestArbitrary(new WeakMap);
+
+
+// Test direct constructor call
+assertThrows(function() { WeakMap(); }, TypeError);
+assertThrows(function() { WeakSet(); }, TypeError);
+
+
+// Test some common JavaScript idioms for WeakMaps
+var m = new WeakMap;
+assertTrue(m instanceof WeakMap);
+assertTrue(WeakMap.prototype.set instanceof Function)
+assertTrue(WeakMap.prototype.get instanceof Function)
+assertTrue(WeakMap.prototype.has instanceof Function)
+assertTrue(WeakMap.prototype.delete instanceof Function)
+assertTrue(WeakMap.prototype.clear instanceof Function)
+
+
+// Test some common JavaScript idioms for WeakSets
+var s = new WeakSet;
+assertTrue(s instanceof WeakSet);
+assertTrue(WeakSet.prototype.add instanceof Function)
+assertTrue(WeakSet.prototype.has instanceof Function)
+assertTrue(WeakSet.prototype.delete instanceof Function)
+assertTrue(WeakSet.prototype.clear instanceof Function)
+
+
+// Test class of instance and prototype.
+assertEquals("WeakMap", %_ClassOf(new WeakMap))
+assertEquals("Object", %_ClassOf(WeakMap.prototype))
+assertEquals("WeakSet", %_ClassOf(new WeakSet))
+assertEquals("Object", %_ClassOf(WeakMap.prototype))
+
+
+// Test name of constructor.
+assertEquals("WeakMap", WeakMap.name);
+assertEquals("WeakSet", WeakSet.name);
+
+
+// Test prototype property of WeakMap and WeakSet.
+function TestPrototype(C) {
+ assertTrue(C.prototype instanceof Object);
+ assertEquals({
+ value: {},
+ writable: false,
+ enumerable: false,
+ configurable: false
+ }, Object.getOwnPropertyDescriptor(C, "prototype"));
+}
+TestPrototype(WeakMap);
+TestPrototype(WeakSet);
+
+
+// Test constructor property of the WeakMap and WeakSet prototype.
+function TestConstructor(C) {
+ assertFalse(C === Object.prototype.constructor);
+ assertSame(C, C.prototype.constructor);
+ assertSame(C, (new C).__proto__.constructor);
+}
+TestConstructor(WeakMap);
+TestConstructor(WeakSet);
+
+
+// Test the WeakMap and WeakSet global properties themselves.
+function TestDescriptor(global, C) {
+ assertEquals({
+ value: C,
+ writable: true,
+ enumerable: false,
+ configurable: true
+ }, Object.getOwnPropertyDescriptor(global, C.name));
+}
+TestDescriptor(this, WeakMap);
+TestDescriptor(this, WeakSet);
+
+
+// Regression test for WeakMap prototype.
+assertTrue(WeakMap.prototype.constructor === WeakMap)
+assertTrue(Object.getPrototypeOf(WeakMap.prototype) === Object.prototype)
+
+
+// Regression test for issue 1617: The prototype of the WeakMap constructor
+// needs to be unique (i.e. different from the one of the Object constructor).
+assertFalse(WeakMap.prototype === Object.prototype);
+var o = Object.create({});
+assertFalse("get" in o);
+assertFalse("set" in o);
+assertEquals(undefined, o.get);
+assertEquals(undefined, o.set);
+var o = Object.create({}, { myValue: {
+ value: 10,
+ enumerable: false,
+ configurable: true,
+ writable: true
+}});
+assertEquals(10, o.myValue);
+
+
+// Regression test for issue 1884: Invoking any of the methods for Harmony
+// maps, sets, or weak maps, with a wrong type of receiver should be throwing
+// a proper TypeError.
+var alwaysBogus = [ undefined, null, true, "x", 23, {} ];
+var bogusReceiversTestSet = [
+ { proto: WeakMap.prototype,
+ funcs: [ 'get', 'set', 'has', 'delete' ],
+ receivers: alwaysBogus.concat([ new WeakSet ]),
+ },
+ { proto: WeakSet.prototype,
+ funcs: [ 'add', 'has', 'delete' ],
+ receivers: alwaysBogus.concat([ new WeakMap ]),
+ },
+];
+function TestBogusReceivers(testSet) {
+ for (var i = 0; i < testSet.length; i++) {
+ var proto = testSet[i].proto;
+ var funcs = testSet[i].funcs;
+ var receivers = testSet[i].receivers;
+ for (var j = 0; j < funcs.length; j++) {
+ var func = proto[funcs[j]];
+ for (var k = 0; k < receivers.length; k++) {
+ assertThrows(function () { func.call(receivers[k], {}) }, TypeError);
+ }
+ }
+ }
+}
+TestBogusReceivers(bogusReceiversTestSet);
+
+
+// Test WeakMap clear
+(function() {
+ var k = new Object();
+ var w = new WeakMap();
+ w.set(k, 23);
+ assertTrue(w.has(k));
+ assertEquals(23, w.get(k));
+ w.clear();
+ assertFalse(w.has(k));
+ assertEquals(undefined, w.get(k));
+})();
+
+
+// Test WeakSet clear
+(function() {
+ var k = new Object();
+ var w = new WeakSet();
+ w.add(k);
+ assertTrue(w.has(k));
+ w.clear();
+ assertFalse(w.has(k));
+})();
diff --git a/deps/v8/test/mjsunit/harmony/object-observe.js b/deps/v8/test/mjsunit/es7/object-observe.js
index fb15a1fa8..f5e84a628 100644
--- a/deps/v8/test/mjsunit/harmony/object-observe.js
+++ b/deps/v8/test/mjsunit/es7/object-observe.js
@@ -25,7 +25,7 @@
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-// Flags: --harmony-observation --harmony-proxies --harmony-collections
+// Flags: --harmony-proxies --harmony-collections
// Flags: --harmony-symbols --allow-natives-syntax
var allObservers = [];
diff --git a/deps/v8/test/mjsunit/external-array.js b/deps/v8/test/mjsunit/external-array.js
index ab5435e5d..108b9f2e6 100644
--- a/deps/v8/test/mjsunit/external-array.js
+++ b/deps/v8/test/mjsunit/external-array.js
@@ -530,6 +530,7 @@ assertThrows(function() { ArrayBuffer.apply(null, [1000]); }, TypeError);
assertThrows(function() { Float32Array.apply(null, [b, 128, 1]); }, TypeError);
// Test array.set in different combinations.
+var b = new ArrayBuffer(4)
function assertArrayPrefix(expected, array) {
for (var i = 0; i < expected.length; ++i) {
diff --git a/deps/v8/test/mjsunit/function-arguments-duplicate.js b/deps/v8/test/mjsunit/function-arguments-duplicate.js
new file mode 100644
index 000000000..80f03a106
--- /dev/null
+++ b/deps/v8/test/mjsunit/function-arguments-duplicate.js
@@ -0,0 +1,36 @@
+// Copyright 2014 the V8 project authors. All rights reserved.
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are
+// met:
+//
+// * Redistributions of source code must retain the above copyright
+// notice, this list of conditions and the following disclaimer.
+// * Redistributions in binary form must reproduce the above
+// copyright notice, this list of conditions and the following
+// disclaimer in the documentation and/or other materials provided
+// with the distribution.
+// * Neither the name of Google Inc. nor the names of its
+// contributors may be used to endorse or promote products derived
+// from this software without specific prior written permission.
+//
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+// Execises ArgumentsAccessStub::GenerateNewNonStrictSlow.
+
+function f(a, a) {
+ assertEquals(2, a);
+ assertEquals(1, arguments[0]);
+ assertEquals(2, arguments[1]);
+}
+
+f(1, 2);
diff --git a/deps/v8/test/mjsunit/fuzz-natives-part1.js b/deps/v8/test/mjsunit/fuzz-natives-part1.js
index e22ac4947..0bd0dc1ab 100644
--- a/deps/v8/test/mjsunit/fuzz-natives-part1.js
+++ b/deps/v8/test/mjsunit/fuzz-natives-part1.js
@@ -116,7 +116,6 @@ function testArgumentTypes(name, argc) {
var knownProblems = {
"Abort": true,
- "ThrowMessage": true,
// Avoid calling the concat operation, because weird lengths
// may lead to out-of-memory. Ditto for StringBuilderJoin.
@@ -141,33 +140,8 @@ var knownProblems = {
"DisableAccessChecks": true,
"EnableAccessChecks": true,
- // These functions should not be callable as runtime functions.
- "NewFunctionContext": true,
- "NewArgumentsFast": true,
- "NewStrictArgumentsFast": true,
- "PushWithContext": true,
- "PushCatchContext": true,
- "PushBlockContext": true,
- "PushModuleContext": true,
- "CompileUnoptimized": true,
- "CompileOptimized": true,
- "CompileOptimizedConcurrent": true,
- "NotifyDeoptimized": true,
- "NotifyStubFailure": true,
- "NotifyOSR": true,
- "CreateObjectLiteralBoilerplate": true,
- "CloneLiteralBoilerplate": true,
- "CloneShallowLiteralBoilerplate": true,
- "CreateArrayLiteralBoilerplate": true,
+ // IS_VAR is special.
"IS_VAR": true,
- "ResolvePossiblyDirectEval": true,
- "Log": true,
- "DeclareGlobals": true,
- "ArrayConstructor": true,
- "InternalArrayConstructor": true,
-
- "PromoteScheduledException": true,
- "DeleteHandleScopeExtensions": true,
// Vararg with minimum number > 0.
"Call": true,
@@ -206,17 +180,14 @@ var knownProblems = {
"_TwoByteSeqStringSetChar": true,
// Only applicable to TypedArrays.
- "TypedArrayInitialize": true,
+ "_TypedArrayInitialize": true,
// Only applicable to generators.
"_GeneratorNext": true,
"_GeneratorThrow": true,
// Only applicable to DataViews.
- "DataViewInitialize": true,
- "DataViewGetBuffer": true,
- "DataViewGetByteLength": true,
- "DataViewGetByteOffset": true
+ "_DataViewInitialize": true,
};
var currentlyUncallable = {
diff --git a/deps/v8/test/mjsunit/fuzz-natives-part2.js b/deps/v8/test/mjsunit/fuzz-natives-part2.js
index 293ad7e52..103e13291 100644
--- a/deps/v8/test/mjsunit/fuzz-natives-part2.js
+++ b/deps/v8/test/mjsunit/fuzz-natives-part2.js
@@ -116,7 +116,6 @@ function testArgumentTypes(name, argc) {
var knownProblems = {
"Abort": true,
- "ThrowMessage": true,
// Avoid calling the concat operation, because weird lengths
// may lead to out-of-memory. Ditto for StringBuilderJoin.
@@ -141,34 +140,8 @@ var knownProblems = {
"DisableAccessChecks": true,
"EnableAccessChecks": true,
- // These functions should not be callable as runtime functions.
- "NewFunctionContext": true,
- "NewArgumentsFast": true,
- "NewStrictArgumentsFast": true,
- "PushWithContext": true,
- "PushCatchContext": true,
- "PushBlockContext": true,
- "PushModuleContext": true,
- "CompileUnoptimized": true,
- "CompileOptimized": true,
- "CompileOptimizedConcurrent": true,
- "NotifyDeoptimized": true,
- "NotifyStubFailure": true,
- "NotifyOSR": true,
- "CreateObjectLiteralBoilerplate": true,
- "CloneLiteralBoilerplate": true,
- "CloneShallowLiteralBoilerplate": true,
- "CreateArrayLiteralBoilerplate": true,
+ // IS_VAR is special.
"IS_VAR": true,
- "ResolvePossiblyDirectEval": true,
- "Log": true,
- "DeclareGlobals": true,
- "ArrayConstructor": true,
- "InternalArrayConstructor": true,
- "SetAccessorProperty": true,
-
- "PromoteScheduledException": true,
- "DeleteHandleScopeExtensions": true,
// Vararg with minimum number > 0.
"Call": true,
@@ -207,17 +180,14 @@ var knownProblems = {
"_TwoByteSeqStringSetChar": true,
// Only applicable to TypedArrays.
- "TypedArrayInitialize": true,
+ "_TypedArrayInitialize": true,
// Only applicable to generators.
"_GeneratorNext": true,
"_GeneratorThrow": true,
// Only applicable to DataViews.
- "DataViewInitialize": true,
- "DataViewGetBuffer": true,
- "DataViewGetByteLength": true,
- "DataViewGetByteOffset": true
+ "_DataViewInitialize": true,
};
var currentlyUncallable = {
diff --git a/deps/v8/test/mjsunit/fuzz-natives-part3.js b/deps/v8/test/mjsunit/fuzz-natives-part3.js
index ba51b3db7..7a8125a73 100644
--- a/deps/v8/test/mjsunit/fuzz-natives-part3.js
+++ b/deps/v8/test/mjsunit/fuzz-natives-part3.js
@@ -116,7 +116,6 @@ function testArgumentTypes(name, argc) {
var knownProblems = {
"Abort": true,
- "ThrowMessage": true,
// Avoid calling the concat operation, because weird lengths
// may lead to out-of-memory. Ditto for StringBuilderJoin.
@@ -141,33 +140,8 @@ var knownProblems = {
"DisableAccessChecks": true,
"EnableAccessChecks": true,
- // These functions should not be callable as runtime functions.
- "NewFunctionContext": true,
- "NewArgumentsFast": true,
- "NewStrictArgumentsFast": true,
- "PushWithContext": true,
- "PushCatchContext": true,
- "PushBlockContext": true,
- "PushModuleContext": true,
- "CompileUnoptimized": true,
- "CompileOptimized": true,
- "CompileOptimizedConcurrent": true,
- "NotifyDeoptimized": true,
- "NotifyStubFailure": true,
- "NotifyOSR": true,
- "CreateObjectLiteralBoilerplate": true,
- "CloneLiteralBoilerplate": true,
- "CloneShallowLiteralBoilerplate": true,
- "CreateArrayLiteralBoilerplate": true,
+ // IS_VAR is special.
"IS_VAR": true,
- "ResolvePossiblyDirectEval": true,
- "Log": true,
- "DeclareGlobals": true,
- "ArrayConstructor": true,
- "InternalArrayConstructor": true,
-
- "PromoteScheduledException": true,
- "DeleteHandleScopeExtensions": true,
// Vararg with minimum number > 0.
"Call": true,
@@ -206,17 +180,14 @@ var knownProblems = {
"_TwoByteSeqStringSetChar": true,
// Only applicable to TypedArrays.
- "TypedArrayInitialize": true,
+ "_TypedArrayInitialize": true,
// Only applicable to generators.
"_GeneratorNext": true,
"_GeneratorThrow": true,
// Only applicable to DataViews.
- "DataViewInitialize":true,
- "DataViewGetBuffer": true,
- "DataViewGetByteLength": true,
- "DataViewGetByteOffset": true
+ "_DataViewInitialize": true,
};
var currentlyUncallable = {
diff --git a/deps/v8/test/mjsunit/fuzz-natives-part4.js b/deps/v8/test/mjsunit/fuzz-natives-part4.js
index 5f1f91206..952374925 100644
--- a/deps/v8/test/mjsunit/fuzz-natives-part4.js
+++ b/deps/v8/test/mjsunit/fuzz-natives-part4.js
@@ -116,7 +116,6 @@ function testArgumentTypes(name, argc) {
var knownProblems = {
"Abort": true,
- "ThrowMessage": true,
// Avoid calling the concat operation, because weird lengths
// may lead to out-of-memory. Ditto for StringBuilderJoin.
@@ -141,33 +140,8 @@ var knownProblems = {
"DisableAccessChecks": true,
"EnableAccessChecks": true,
- // These functions should not be callable as runtime functions.
- "NewFunctionContext": true,
- "NewArgumentsFast": true,
- "NewStrictArgumentsFast": true,
- "PushWithContext": true,
- "PushCatchContext": true,
- "PushBlockContext": true,
- "PushModuleContext": true,
- "CompileUnoptimized": true,
- "CompileOptimized": true,
- "CompileOptimizedConcurrent": true,
- "NotifyDeoptimized": true,
- "NotifyStubFailure": true,
- "NotifyOSR": true,
- "CreateObjectLiteralBoilerplate": true,
- "CloneLiteralBoilerplate": true,
- "CloneShallowLiteralBoilerplate": true,
- "CreateArrayLiteralBoilerplate": true,
+ // IS_VAR is special.
"IS_VAR": true,
- "ResolvePossiblyDirectEval": true,
- "Log": true,
- "DeclareGlobals": true,
- "ArrayConstructor": true,
- "InternalArrayConstructor": true,
-
- "PromoteScheduledException": true,
- "DeleteHandleScopeExtensions": true,
// Vararg with minimum number > 0.
"Call": true,
@@ -206,17 +180,14 @@ var knownProblems = {
"_TwoByteSeqStringSetChar": true,
// Only applicable to TypedArrays.
- "TypedArrayInitialize": true,
+ "_TypedArrayInitialize": true,
// Only applicable to generators.
"_GeneratorNext": true,
"_GeneratorThrow": true,
// Only applicable to DataViews.
- "DataViewInitialize": true,
- "DataViewGetBuffer": true,
- "DataViewGetByteLength": true,
- "DataViewGetByteOffset": true
+ "_DataViewInitialize": true,
};
var currentlyUncallable = {
diff --git a/deps/v8/test/mjsunit/getters-on-elements.js b/deps/v8/test/mjsunit/getters-on-elements.js
index 55fc86b84..3bc360f14 100644
--- a/deps/v8/test/mjsunit/getters-on-elements.js
+++ b/deps/v8/test/mjsunit/getters-on-elements.js
@@ -26,10 +26,17 @@
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
// Flags: --allow-natives-syntax --max-opt-count=100 --noalways-opt
+// Flags: --nocollect-maps
// We specify max-opt-count because we opt/deopt the same function many
// times.
+// We specify nocollect-maps because in gcstress we can end up deoptimizing
+// a function in a gc in the stack guard at the beginning of the (optimized)
+// function due to leftover map clearing work that results in deoptimizing
+// dependent code from those maps. The choice is to insert strategic gc()
+// calls or specify this flag.
+
// It's nice to run this in other browsers too.
var standalone = false;
if (standalone) {
diff --git a/deps/v8/test/mjsunit/harmony/block-let-declaration.js b/deps/v8/test/mjsunit/harmony/block-let-declaration.js
index 480e03348..4ddeefdba 100644
--- a/deps/v8/test/mjsunit/harmony/block-let-declaration.js
+++ b/deps/v8/test/mjsunit/harmony/block-let-declaration.js
@@ -109,9 +109,9 @@ TestLocalDoesNotThrow("switch (true) { case true: var x; }");
TestLocalDoesNotThrow("switch (true) { default: var x; }");
// Test function declarations in source element and
-// non-strict statement positions.
+// sloppy statement positions.
function f() {
- // Non-strict source element positions.
+ // Sloppy source element positions.
function g0() {
"use strict";
// Strict source element positions.
diff --git a/deps/v8/test/mjsunit/harmony/collections.js b/deps/v8/test/mjsunit/harmony/collections.js
index 7e95b9e11..804a320f3 100644
--- a/deps/v8/test/mjsunit/harmony/collections.js
+++ b/deps/v8/test/mjsunit/harmony/collections.js
@@ -25,10 +25,11 @@
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-// Flags: --harmony-collections --expose-gc --allow-natives-syntax
+// Flags: --harmony-collections
+// Flags: --expose-gc --allow-natives-syntax
-// Test valid getter and setter calls on Sets.
+// Test valid getter and setter calls on Sets and WeakSets
function TestValidSetCalls(m) {
assertDoesNotThrow(function () { m.add(new Object) });
assertDoesNotThrow(function () { m.has(new Object) });
@@ -63,7 +64,7 @@ function TestInvalidCalls(m) {
TestInvalidCalls(new WeakMap);
-// Test expected behavior for Sets
+// Test expected behavior for Sets and WeakSets
function TestSet(set, key) {
assertFalse(set.has(key));
assertSame(undefined, set.add(key));
@@ -289,19 +290,20 @@ assertEquals("WeakSet", WeakSet.name);
// Test prototype property of Set, Map, WeakMap and WeakSet.
-function TestPrototype(C) {
+// TODO(2793): Should all be non-writable, and the extra flag removed.
+function TestPrototype(C, writable) {
assertTrue(C.prototype instanceof Object);
assertEquals({
value: {},
- writable: true, // TODO(2793): This should be non-writable.
+ writable: writable,
enumerable: false,
configurable: false
}, Object.getOwnPropertyDescriptor(C, "prototype"));
}
-TestPrototype(Set);
-TestPrototype(Map);
-TestPrototype(WeakMap);
-TestPrototype(WeakSet);
+TestPrototype(Set, true);
+TestPrototype(Map, true);
+TestPrototype(WeakMap, false);
+TestPrototype(WeakSet, false);
// Test constructor property of the Set, Map, WeakMap and WeakSet prototype.
diff --git a/deps/v8/test/mjsunit/harmony/generators-objects.js b/deps/v8/test/mjsunit/harmony/generators-objects.js
index bb29bed00..c1cda07db 100644
--- a/deps/v8/test/mjsunit/harmony/generators-objects.js
+++ b/deps/v8/test/mjsunit/harmony/generators-objects.js
@@ -55,7 +55,7 @@ function TestGeneratorObject() {
var iter = g();
assertSame(g.prototype, Object.getPrototypeOf(iter));
assertTrue(iter instanceof g);
- assertEquals("Generator", %ClassOf(iter));
+ assertEquals("Generator", %_ClassOf(iter));
assertEquals("[object Generator]", String(iter));
assertEquals([], Object.getOwnPropertyNames(iter));
assertTrue(iter !== g());
@@ -64,7 +64,7 @@ function TestGeneratorObject() {
iter = new g();
assertSame(g.prototype, Object.getPrototypeOf(iter));
assertTrue(iter instanceof g);
- assertEquals("Generator", %ClassOf(iter));
+ assertEquals("Generator", %_ClassOf(iter));
assertEquals("[object Generator]", String(iter));
assertEquals([], Object.getOwnPropertyNames(iter));
assertTrue(iter !== new g());
diff --git a/deps/v8/test/mjsunit/harmony/generators-parsing.js b/deps/v8/test/mjsunit/harmony/generators-parsing.js
index 941fa202c..2a4a68c37 100644
--- a/deps/v8/test/mjsunit/harmony/generators-parsing.js
+++ b/deps/v8/test/mjsunit/harmony/generators-parsing.js
@@ -68,7 +68,7 @@ function* yield() { (yield 3) + (yield 4); }
assertThrows("function* yield() { \"use strict\"; (yield 3) + (yield 4); }",
SyntaxError);
-// In classic mode, yield is a normal identifier, outside of generators.
+// In sloppy mode, yield is a normal identifier, outside of generators.
function yield(yield) { yield: yield (yield + yield (0)); }
// Yield is always valid as a key in an object literal.
@@ -76,7 +76,7 @@ function yield(yield) { yield: yield (yield + yield (0)); }
function* g() { yield ({ yield: 1 }) }
function* g() { yield ({ get yield() { return 1; }}) }
-// Checks that yield is a valid label in classic mode, but not valid in a strict
+// Checks that yield is a valid label in sloppy mode, but not valid in a strict
// mode or in generators.
function f() { yield: 1 }
assertThrows("function f() { \"use strict\"; yield: 1 }", SyntaxError)
diff --git a/deps/v8/test/mjsunit/harmony/private.js b/deps/v8/test/mjsunit/harmony/private.js
index 09cf7f740..225799831 100644
--- a/deps/v8/test/mjsunit/harmony/private.js
+++ b/deps/v8/test/mjsunit/harmony/private.js
@@ -30,6 +30,16 @@
var symbols = []
+
+// Returns true if the string is a valid
+// serialization of Symbols added to the 'symbols'
+// array. Adjust if you extend 'symbols' with other
+// values.
+function isValidSymbolString(s) {
+ return ["Symbol(66)"].indexOf(s) >= 0;
+}
+
+
// Test different forms of constructor calls, all equivalent.
function TestNew() {
for (var i = 0; i < 2; ++i) {
@@ -49,7 +59,6 @@ function TestType() {
assertTrue(typeof symbols[i] === "symbol")
assertTrue(%SymbolIsPrivate(symbols[i]))
assertEquals(null, %_ClassOf(symbols[i]))
- assertEquals("Symbol", %_ClassOf(new Symbol(symbols[i])))
assertEquals("Symbol", %_ClassOf(Object(symbols[i])))
}
}
@@ -67,28 +76,21 @@ TestPrototype()
function TestConstructor() {
for (var i in symbols) {
assertSame(Symbol, symbols[i].__proto__.constructor)
+ assertSame(Symbol, Object(symbols[i]).__proto__.constructor)
}
}
TestConstructor()
-function TestName() {
- for (var i in symbols) {
- var name = symbols[i].name
- assertTrue(name === "66")
- }
-}
-TestName()
-
-
function TestToString() {
for (var i in symbols) {
assertThrows(function() { String(symbols[i]) }, TypeError)
assertThrows(function() { symbols[i] + "" }, TypeError)
- assertThrows(function() { symbols[i].toString() }, TypeError)
- assertThrows(function() { (new Symbol(symbols[i])).toString() }, TypeError)
- assertThrows(function() { Object(symbols[i]).toString() }, TypeError)
- assertEquals("[object Symbol]", Object.prototype.toString.call(symbols[i]))
+ assertTrue(isValidSymbolString(symbols[i].toString()))
+ assertTrue(isValidSymbolString(Object(symbols[i]).toString()))
+ assertTrue(isValidSymbolString(Symbol.prototype.toString.call(symbols[i])))
+ assertEquals(
+ "[object Symbol]", Object.prototype.toString.call(symbols[i]))
}
}
TestToString()
@@ -128,10 +130,14 @@ function TestEquality() {
assertTrue(Object.is(symbols[i], symbols[i]))
assertTrue(symbols[i] === symbols[i])
assertTrue(symbols[i] == symbols[i])
- assertFalse(symbols[i] === new Symbol(symbols[i]))
- assertFalse(new Symbol(symbols[i]) === symbols[i])
- assertTrue(symbols[i] == new Symbol(symbols[i]))
- assertTrue(new Symbol(symbols[i]) == symbols[i])
+ assertFalse(symbols[i] === Object(symbols[i]))
+ assertFalse(Object(symbols[i]) === symbols[i])
+ assertFalse(symbols[i] == Object(symbols[i]))
+ assertFalse(Object(symbols[i]) == symbols[i])
+ assertTrue(symbols[i] === symbols[i].valueOf())
+ assertTrue(symbols[i].valueOf() === symbols[i])
+ assertTrue(symbols[i] == symbols[i].valueOf())
+ assertTrue(symbols[i].valueOf() == symbols[i])
}
// All symbols should be distinct.
@@ -159,7 +165,7 @@ TestEquality()
function TestGet() {
for (var i in symbols) {
- assertThrows(function() { symbols[i].toString() }, TypeError)
+ assertTrue(isValidSymbolString(symbols[i].toString()))
assertEquals(symbols[i], symbols[i].valueOf())
assertEquals(undefined, symbols[i].a)
assertEquals(undefined, symbols[i]["a" + "b"])
@@ -173,7 +179,7 @@ TestGet()
function TestSet() {
for (var i in symbols) {
symbols[i].toString = 0
- assertThrows(function() { symbols[i].toString() }, TypeError)
+ assertTrue(isValidSymbolString(symbols[i].toString()))
symbols[i].valueOf = 0
assertEquals(symbols[i], symbols[i].valueOf())
symbols[i].a = 0
@@ -322,3 +328,17 @@ function TestCachedKeyAfterScavenge() {
}
}
TestCachedKeyAfterScavenge();
+
+
+function TestGetOwnPropertySymbols() {
+ var privateSymbol = %CreatePrivateSymbol("private")
+ var publicSymbol = Symbol()
+ var publicSymbol2 = Symbol()
+ var obj = {}
+ obj[publicSymbol] = 1
+ obj[privateSymbol] = 2
+ obj[publicSymbol2] = 3
+ var syms = Object.getOwnPropertySymbols(obj)
+ assertEquals(syms, [publicSymbol, publicSymbol2])
+}
+TestGetOwnPropertySymbols()
diff --git a/deps/v8/test/mjsunit/harmony/proxies-example-membrane.js b/deps/v8/test/mjsunit/harmony/proxies-example-membrane.js
index 9e2228a63..a645a6603 100644
--- a/deps/v8/test/mjsunit/harmony/proxies-example-membrane.js
+++ b/deps/v8/test/mjsunit/harmony/proxies-example-membrane.js
@@ -72,7 +72,7 @@ function createHandler(obj) {
hasOwn: function(name) { return ({}).hasOwnProperty.call(obj, name); },
get: function(receiver, name) { return obj[name]; },
set: function(receiver, name, val) {
- obj[name] = val; // bad behavior when set fails in non-strict mode
+ obj[name] = val; // bad behavior when set fails in sloppy mode
return true;
},
enumerate: function() {
diff --git a/deps/v8/test/mjsunit/harmony/proxies-function.js b/deps/v8/test/mjsunit/harmony/proxies-function.js
index 7b07d4242..c024cef94 100644
--- a/deps/v8/test/mjsunit/harmony/proxies-function.js
+++ b/deps/v8/test/mjsunit/harmony/proxies-function.js
@@ -707,7 +707,7 @@ function TestCalls() {
function(f, x, y, o) { if (typeof o == "object") return (1, o)["f"](x, y) },
]
var receivers = [o, global_object, undefined, null, 2, "bla", true]
- var expectedNonStricts = [o, global_object, global_object, global_object]
+ var expectedSloppies = [o, global_object, global_object, global_object]
for (var t = 0; t < traps.length; ++t) {
for (var i = 0; i < creates.length; ++i) {
@@ -719,7 +719,7 @@ function TestCalls() {
var receiver = receivers[n]
var func = binds[j](creates[i](traps[t]), bound, 31, 11)
var expected = j > 0 ? bound : receiver
- var expectedNonStrict = expectedNonStricts[j > 0 ? m : n]
+ var expectedSloppy = expectedSloppies[j > 0 ? m : n]
o.f = func
global_object.f = func
var x = calls[k](func, 11, 31, receiver)
@@ -729,10 +729,10 @@ function TestCalls() {
assertSame(x.strict ? undefined : global_object, x.receiver)
else if (x.strict)
assertSame(expected, x.receiver)
- else if (expectedNonStrict === undefined)
+ else if (expectedSloppy === undefined)
assertSame(expected, x.receiver.valueOf())
else
- assertSame(expectedNonStrict, x.receiver)
+ assertSame(expectedSloppy, x.receiver)
}
}
}
diff --git a/deps/v8/test/mjsunit/harmony/proxies.js b/deps/v8/test/mjsunit/harmony/proxies.js
index f68e3bd15..00e605f8d 100644
--- a/deps/v8/test/mjsunit/harmony/proxies.js
+++ b/deps/v8/test/mjsunit/harmony/proxies.js
@@ -25,7 +25,11 @@
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-// Flags: --harmony-proxies
+// We change the stack size for the ARM64 simulator because at one point this
+// test enters an infinite recursion which goes through the runtime and we
+// overflow the system stack before the simulator stack.
+
+// Flags: --harmony-proxies --sim-stack-size=500
// Helper.
diff --git a/deps/v8/test/mjsunit/regress/regress-173361.js b/deps/v8/test/mjsunit/harmony/regress/regress-173361.js
index f9cfb6684..f9cfb6684 100644
--- a/deps/v8/test/mjsunit/regress/regress-173361.js
+++ b/deps/v8/test/mjsunit/harmony/regress/regress-173361.js
diff --git a/deps/v8/test/mjsunit/regress/regress-2186.js b/deps/v8/test/mjsunit/harmony/regress/regress-2186.js
index 0921dcead..0921dcead 100644
--- a/deps/v8/test/mjsunit/regress/regress-2186.js
+++ b/deps/v8/test/mjsunit/harmony/regress/regress-2186.js
diff --git a/deps/v8/test/mjsunit/regress/regress-2219.js b/deps/v8/test/mjsunit/harmony/regress/regress-2219.js
index 946c75bd8..946c75bd8 100644
--- a/deps/v8/test/mjsunit/regress/regress-2219.js
+++ b/deps/v8/test/mjsunit/harmony/regress/regress-2219.js
diff --git a/deps/v8/test/mjsunit/regress/regress-2225.js b/deps/v8/test/mjsunit/harmony/regress/regress-2225.js
index 9957d8d46..9957d8d46 100644
--- a/deps/v8/test/mjsunit/regress/regress-2225.js
+++ b/deps/v8/test/mjsunit/harmony/regress/regress-2225.js
diff --git a/deps/v8/test/mjsunit/regress/regress-2243.js b/deps/v8/test/mjsunit/harmony/regress/regress-2243.js
index 31c2e55fe..31c2e55fe 100644
--- a/deps/v8/test/mjsunit/regress/regress-2243.js
+++ b/deps/v8/test/mjsunit/harmony/regress/regress-2243.js
diff --git a/deps/v8/test/mjsunit/regress/regress-2322.js b/deps/v8/test/mjsunit/harmony/regress/regress-2322.js
index 1195bab67..1195bab67 100644
--- a/deps/v8/test/mjsunit/regress/regress-2322.js
+++ b/deps/v8/test/mjsunit/harmony/regress/regress-2322.js
diff --git a/deps/v8/test/mjsunit/regress/regress-2681.js b/deps/v8/test/mjsunit/harmony/regress/regress-2681.js
index 9841d8484..9841d8484 100644
--- a/deps/v8/test/mjsunit/regress/regress-2681.js
+++ b/deps/v8/test/mjsunit/harmony/regress/regress-2681.js
diff --git a/deps/v8/test/mjsunit/regress/regress-2691.js b/deps/v8/test/mjsunit/harmony/regress/regress-2691.js
index e17be1081..e17be1081 100644
--- a/deps/v8/test/mjsunit/regress/regress-2691.js
+++ b/deps/v8/test/mjsunit/harmony/regress/regress-2691.js
diff --git a/deps/v8/test/mjsunit/harmony/regress/regress-343928.js b/deps/v8/test/mjsunit/harmony/regress/regress-343928.js
new file mode 100644
index 000000000..b102ab9c4
--- /dev/null
+++ b/deps/v8/test/mjsunit/harmony/regress/regress-343928.js
@@ -0,0 +1,22 @@
+// Copyright 2014 the V8 project authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+// Flags: --harmony --expose-debug-as=debug
+
+(function () { // Scope for utility functions.
+ escaping_function = function(object) {
+ // Argument must not be null or undefined.
+ var string = Object.prototype.toString.call(object);
+ // String has format [object <ClassName>].
+ return string.substring(8, string.length - 1);
+ }
+})();
+
+module B {
+ var stuff = 3
+}
+
+var __v_0 = {};
+var __v_4 = debug.MakeMirror(__v_0);
+print(__v_4.referencedBy().length); // core dump here if not fixed.
diff --git a/deps/v8/test/mjsunit/regress/regress-crbug-248025.js b/deps/v8/test/mjsunit/harmony/regress/regress-crbug-248025.js
index c59885956..c59885956 100644
--- a/deps/v8/test/mjsunit/regress/regress-crbug-248025.js
+++ b/deps/v8/test/mjsunit/harmony/regress/regress-crbug-248025.js
diff --git a/deps/v8/test/mjsunit/harmony/regress/regress-crbug-346141.js b/deps/v8/test/mjsunit/harmony/regress/regress-crbug-346141.js
new file mode 100644
index 000000000..798b7704e
--- /dev/null
+++ b/deps/v8/test/mjsunit/harmony/regress/regress-crbug-346141.js
@@ -0,0 +1,11 @@
+// Copyright 2014 the V8 project authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+// Flags: --harmony-symbols
+
+var s = Symbol()
+var o = {}
+o[s] = 2
+o[""] = 3
+Object.getOwnPropertySymbols(o)
diff --git a/deps/v8/test/mjsunit/harmony/regress/regress-crbug-347528.js b/deps/v8/test/mjsunit/harmony/regress/regress-crbug-347528.js
new file mode 100644
index 000000000..e4e8efbc9
--- /dev/null
+++ b/deps/v8/test/mjsunit/harmony/regress/regress-crbug-347528.js
@@ -0,0 +1,36 @@
+// Copyright 2014 the V8 project authors. All rights reserved.
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are
+// met:
+//
+// * Redistributions of source code must retain the above copyright
+// notice, this list of conditions and the following disclaimer.
+// * Redistributions in binary form must reproduce the above
+// copyright notice, this list of conditions and the following
+// disclaimer in the documentation and/or other materials provided
+// with the distribution.
+// * Neither the name of Google Inc. nor the names of its
+// contributors may be used to endorse or promote products derived
+// from this software without specific prior written permission.
+//
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+// Flags: --allow-natives-syntax --harmony
+
+"use strict";
+let unused_var = 1;
+function __f_12() { new Array(); }
+__f_12();
+__f_12();
+%OptimizeFunctionOnNextCall(__f_12);
+__f_12();
diff --git a/deps/v8/test/mjsunit/harmony/regress/regress-lookup-transition.js b/deps/v8/test/mjsunit/harmony/regress/regress-lookup-transition.js
new file mode 100644
index 000000000..9b3293930
--- /dev/null
+++ b/deps/v8/test/mjsunit/harmony/regress/regress-lookup-transition.js
@@ -0,0 +1,14 @@
+// Copyright 2014 the V8 project authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+// Flags: --harmony-proxies --expose-gc
+
+var proxy = Proxy.create({ getPropertyDescriptor:function(key) {
+ gc();
+}});
+
+function f() { this.x = 23; }
+f.prototype = proxy;
+new f();
+new f();
diff --git a/deps/v8/test/mjsunit/regress/regress-observe-empty-double-array.js b/deps/v8/test/mjsunit/harmony/regress/regress-observe-empty-double-array.js
index 4b651694a..301ece70f 100644
--- a/deps/v8/test/mjsunit/regress/regress-observe-empty-double-array.js
+++ b/deps/v8/test/mjsunit/harmony/regress/regress-observe-empty-double-array.js
@@ -25,7 +25,7 @@
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-// Flags: --harmony-observation --allow-natives-syntax
+// Flags: --allow-natives-syntax
//
// Test passes if it does not crash.
diff --git a/deps/v8/test/mjsunit/set-prototype-of.js b/deps/v8/test/mjsunit/harmony/set-prototype-of.js
index 02bd5e2ee..02bd5e2ee 100644
--- a/deps/v8/test/mjsunit/set-prototype-of.js
+++ b/deps/v8/test/mjsunit/harmony/set-prototype-of.js
diff --git a/deps/v8/test/mjsunit/harmony/symbols.js b/deps/v8/test/mjsunit/harmony/symbols.js
index ce02a05ac..220439291 100644
--- a/deps/v8/test/mjsunit/harmony/symbols.js
+++ b/deps/v8/test/mjsunit/harmony/symbols.js
@@ -30,27 +30,35 @@
var symbols = []
-// Test different forms of constructor calls, all equivalent.
+
+// Returns true if the string is a valid
+// serialization of Symbols added to the 'symbols'
+// array. Adjust if you extend 'symbols' with other
+// values.
+function isValidSymbolString(s) {
+ return ["Symbol(66)", "Symbol()"].indexOf(s) >= 0;
+}
+
+
+// Test different forms of constructor calls.
function TestNew() {
- function IndirectSymbol() { return new Symbol }
- function indirect() { return new IndirectSymbol() }
+ function indirectSymbol() { return Symbol() }
+ function indirect() { return indirectSymbol() }
for (var i = 0; i < 2; ++i) {
for (var j = 0; j < 5; ++j) {
symbols.push(Symbol())
symbols.push(Symbol(undefined))
symbols.push(Symbol("66"))
symbols.push(Symbol(66))
- symbols.push(Symbol(Symbol()))
- symbols.push((new Symbol).valueOf())
- symbols.push((new Symbol()).valueOf())
- symbols.push((new Symbol(Symbol())).valueOf())
- symbols.push(Object(Symbol()).valueOf())
- symbols.push((indirect()).valueOf())
+ symbols.push(Symbol().valueOf())
+ symbols.push(indirect())
}
%OptimizeFunctionOnNextCall(indirect)
indirect() // Call once before GC throws away type feedback.
gc() // Promote existing symbols and then allocate some more.
}
+ assertThrows(function () { Symbol(Symbol()) }, TypeError)
+ assertThrows(function () { new Symbol(66) }, TypeError)
}
TestNew()
@@ -61,7 +69,6 @@ function TestType() {
assertTrue(typeof symbols[i] === "symbol")
assertFalse(%SymbolIsPrivate(symbols[i]))
assertEquals(null, %_ClassOf(symbols[i]))
- assertEquals("Symbol", %_ClassOf(new Symbol(symbols[i])))
assertEquals("Symbol", %_ClassOf(Object(symbols[i])))
}
}
@@ -71,10 +78,6 @@ TestType()
function TestPrototype() {
assertSame(Object.prototype, Symbol.prototype.__proto__)
assertSame(Symbol.prototype, Symbol().__proto__)
- assertSame(Symbol.prototype, Symbol(Symbol()).__proto__)
- assertSame(Symbol.prototype, (new Symbol).__proto__)
- assertSame(Symbol.prototype, (new Symbol()).__proto__)
- assertSame(Symbol.prototype, (new Symbol(Symbol())).__proto__)
assertSame(Symbol.prototype, Object(Symbol()).__proto__)
for (var i in symbols) {
assertSame(Symbol.prototype, symbols[i].__proto__)
@@ -84,14 +87,11 @@ TestPrototype()
function TestConstructor() {
+ assertSame(Function.prototype, Symbol.__proto__)
assertFalse(Object === Symbol.prototype.constructor)
assertFalse(Symbol === Object.prototype.constructor)
assertSame(Symbol, Symbol.prototype.constructor)
assertSame(Symbol, Symbol().__proto__.constructor)
- assertSame(Symbol, Symbol(Symbol()).__proto__.constructor)
- assertSame(Symbol, (new Symbol).__proto__.constructor)
- assertSame(Symbol, (new Symbol()).__proto__.constructor)
- assertSame(Symbol, (new Symbol(Symbol())).__proto__.constructor)
assertSame(Symbol, Object(Symbol()).__proto__.constructor)
for (var i in symbols) {
assertSame(Symbol, symbols[i].__proto__.constructor)
@@ -100,23 +100,26 @@ function TestConstructor() {
TestConstructor()
-function TestName() {
+function TestValueOf() {
for (var i in symbols) {
- var name = symbols[i].name
- assertTrue(name === undefined || name === "66")
+ assertTrue(symbols[i] === symbols[i].valueOf())
+ assertTrue(Symbol.prototype.valueOf.call(symbols[i]) === symbols[i])
}
}
-TestName()
+TestValueOf()
function TestToString() {
for (var i in symbols) {
assertThrows(function() { String(symbols[i]) }, TypeError)
assertThrows(function() { symbols[i] + "" }, TypeError)
- assertThrows(function() { symbols[i].toString() }, TypeError)
- assertThrows(function() { (new Symbol(symbols[i])).toString() }, TypeError)
- assertThrows(function() { Object(symbols[i]).toString() }, TypeError)
- assertEquals("[object Symbol]", Object.prototype.toString.call(symbols[i]))
+ assertTrue(isValidSymbolString(String(Object(symbols[i]))))
+ assertTrue(isValidSymbolString(symbols[i].toString()))
+ assertTrue(isValidSymbolString(Object(symbols[i]).toString()))
+ assertTrue(
+ isValidSymbolString(Symbol.prototype.toString.call(symbols[i])))
+ assertEquals(
+ "[object Symbol]", Object.prototype.toString.call(symbols[i]))
}
}
TestToString()
@@ -156,10 +159,16 @@ function TestEquality() {
assertTrue(Object.is(symbols[i], symbols[i]))
assertTrue(symbols[i] === symbols[i])
assertTrue(symbols[i] == symbols[i])
- assertFalse(symbols[i] === new Symbol(symbols[i]))
- assertFalse(new Symbol(symbols[i]) === symbols[i])
- assertTrue(symbols[i] == new Symbol(symbols[i]))
- assertTrue(new Symbol(symbols[i]) == symbols[i])
+ assertFalse(symbols[i] === Object(symbols[i]))
+ assertFalse(Object(symbols[i]) === symbols[i])
+ assertFalse(symbols[i] == Object(symbols[i]))
+ assertFalse(Object(symbols[i]) == symbols[i])
+ assertTrue(symbols[i] === symbols[i].valueOf())
+ assertTrue(symbols[i].valueOf() === symbols[i])
+ assertTrue(symbols[i] == symbols[i].valueOf())
+ assertTrue(symbols[i].valueOf() == symbols[i])
+ assertFalse(Object(symbols[i]) === Object(symbols[i]))
+ assertEquals(Object(symbols[i]).valueOf(), Object(symbols[i]).valueOf())
}
// All symbols should be distinct.
@@ -187,7 +196,7 @@ TestEquality()
function TestGet() {
for (var i in symbols) {
- assertThrows(function() { symbols[i].toString() }, TypeError)
+ assertTrue(isValidSymbolString(symbols[i].toString()))
assertEquals(symbols[i], symbols[i].valueOf())
assertEquals(undefined, symbols[i].a)
assertEquals(undefined, symbols[i]["a" + "b"])
@@ -201,7 +210,7 @@ TestGet()
function TestSet() {
for (var i in symbols) {
symbols[i].toString = 0
- assertThrows(function() { symbols[i].toString() }, TypeError)
+ assertTrue(isValidSymbolString(symbols[i].toString()))
symbols[i].valueOf = 0
assertEquals(symbols[i], symbols[i].valueOf())
symbols[i].a = 0
@@ -215,6 +224,18 @@ function TestSet() {
TestSet()
+// Test Symbol wrapping/boxing over non-builtins.
+Symbol.prototype.getThisProto = function () {
+ return Object.getPrototypeOf(this);
+}
+function TestCall() {
+ for (var i in symbols) {
+ assertTrue(symbols[i].getThisProto() === Symbol.prototype)
+ }
+}
+TestCall()
+
+
function TestCollections() {
var set = new Set
var map = new Map
@@ -309,7 +330,7 @@ function TestGetOwnPropertySymbols(obj) {
function TestKeyDescriptor(obj) {
for (var i in symbols) {
- var desc = Object.getOwnPropertyDescriptor(obj, symbols[i]);
+ var desc = Object.getOwnPropertyDescriptor(obj, symbols[i])
assertEquals(i|0, desc.value)
assertTrue(desc.configurable)
assertEquals(i % 2 == 0, desc.writable)
@@ -389,15 +410,59 @@ function TestGetOwnPropertySymbolsWithProto() {
TestGetOwnPropertySymbolsWithProto()
-function TestGetOwnPropertySymbolsWithPrivateSymbols() {
- var privateSymbol = %CreatePrivateSymbol("private")
- var publicSymbol = Symbol()
- var publicSymbol2 = Symbol()
- var obj = {}
- obj[publicSymbol] = 1
- obj[privateSymbol] = 2
- obj[publicSymbol2] = 3
- var syms = Object.getOwnPropertySymbols(obj)
- assertEquals(syms, [publicSymbol, publicSymbol2])
+function TestWellKnown() {
+ var symbols = [
+ "create", "hasInstance", "isConcatSpreadable", "isRegExp",
+ "iterator", "toStringTag", "unscopables"
+ ]
+
+ for (var i in symbols) {
+ var name = symbols[i]
+ var desc = Object.getOwnPropertyDescriptor(Symbol, name)
+ assertSame("symbol", typeof desc.value)
+ assertSame("Symbol(Symbol." + name + ")", desc.value.toString())
+ assertFalse(desc.writable)
+ assertFalse(desc.configurable)
+ assertFalse(desc.enumerable)
+
+ assertFalse(Symbol.for("Symbol." + name) === desc.value)
+ assertTrue(Symbol.keyFor(desc.value) === undefined)
+ }
+}
+TestWellKnown()
+
+
+function TestRegistry() {
+ var symbol1 = Symbol.for("x1")
+ var symbol2 = Symbol.for("x2")
+ assertFalse(symbol1 === symbol2)
+
+ assertSame(symbol1, Symbol.for("x1"))
+ assertSame(symbol2, Symbol.for("x2"))
+ assertSame("x1", Symbol.keyFor(symbol1))
+ assertSame("x2", Symbol.keyFor(symbol2))
+
+ assertSame(Symbol.for("1"), Symbol.for(1))
+ assertThrows(function() { Symbol.keyFor("bla") }, TypeError)
+ assertThrows(function() { Symbol.keyFor({}) }, TypeError)
+
+ var realm = Realm.create()
+ assertFalse(Symbol === Realm.eval(realm, "Symbol"))
+ assertFalse(Symbol.for === Realm.eval(realm, "Symbol.for"))
+ assertFalse(Symbol.keyFor === Realm.eval(realm, "Symbol.keyFor"))
+ assertSame(Symbol.create, Realm.eval(realm, "Symbol.create"))
+ assertSame(Symbol.iterator, Realm.eval(realm, "Symbol.iterator"))
+
+ assertSame(symbol1, Realm.eval(realm, "Symbol.for")("x1"))
+ assertSame(symbol1, Realm.eval(realm, "Symbol.for('x1')"))
+ assertSame("x1", Realm.eval(realm, "Symbol.keyFor")(symbol1))
+ Realm.shared = symbol1
+ assertSame("x1", Realm.eval(realm, "Symbol.keyFor(Realm.shared)"))
+
+ var symbol3 = Realm.eval(realm, "Symbol.for('x3')")
+ assertFalse(symbol1 === symbol3)
+ assertFalse(symbol2 === symbol3)
+ assertSame(symbol3, Symbol.for("x3"))
+ assertSame("x3", Symbol.keyFor(symbol3))
}
-TestGetOwnPropertySymbolsWithPrivateSymbols()
+TestRegistry()
diff --git a/deps/v8/test/mjsunit/invalid-lhs.js b/deps/v8/test/mjsunit/invalid-lhs.js
index ef63add77..92f5c6ff7 100644
--- a/deps/v8/test/mjsunit/invalid-lhs.js
+++ b/deps/v8/test/mjsunit/invalid-lhs.js
@@ -29,37 +29,37 @@
// exceptions are delayed until runtime.
// Normal assignments:
-assertThrows("12 = 12");
-assertThrows("x++ = 12");
-assertThrows("eval('var x') = 12");
-assertDoesNotThrow("if (false) eval('var x') = 12");
+assertThrows("12 = 12", ReferenceError);
+assertThrows("x++ = 12", ReferenceError);
+assertThrows("eval('var x') = 12", ReferenceError);
+assertThrows("if (false) eval('var x') = 12", ReferenceError);
// Pre- and post-fix operations:
-assertThrows("12++");
-assertThrows("12--");
-assertThrows("--12");
-assertThrows("++12");
-assertThrows("++(eval('12'))");
-assertThrows("(eval('12'))++");
-assertDoesNotThrow("if (false) ++(eval('12'))");
-assertDoesNotThrow("if (false) (eval('12'))++");
+assertThrows("12++", ReferenceError);
+assertThrows("12--", ReferenceError);
+assertThrows("--12", ReferenceError);
+assertThrows("++12", ReferenceError);
+assertThrows("++(eval('12'))", ReferenceError);
+assertThrows("(eval('12'))++", ReferenceError);
+assertThrows("if (false) ++(eval('12'))", ReferenceError);
+assertThrows("if (false) (eval('12'))++", ReferenceError);
// For in:
-assertThrows("for (12 in [1]) print(12);");
-assertThrows("for (eval('var x') in [1]) print(12);");
-assertDoesNotThrow("if (false) for (eval('var x') in [1]) print(12);");
+assertThrows("for (12 in [1]) print(12);", ReferenceError);
+assertThrows("for (eval('var x') in [1]) print(12);", ReferenceError);
+assertThrows("if (false) for (eval('0') in [1]) print(12);", ReferenceError);
// For:
-assertThrows("for (12 = 1;;) print(12);");
-assertThrows("for (eval('var x') = 1;;) print(12);");
-assertDoesNotThrow("if (false) for (eval('var x') = 1;;) print(12);");
+assertThrows("for (12 = 1;;) print(12);", ReferenceError);
+assertThrows("for (eval('var x') = 1;;) print(12);", ReferenceError);
+assertThrows("if (false) for (eval('var x') = 1;;) print(12);", ReferenceError);
// Assignments to 'this'.
-assertThrows("this = 42");
-assertDoesNotThrow("function f() { this = 12; }");
-assertThrows("for (this in {x:3, y:4, z:5}) ;");
-assertThrows("for (this = 0;;) ;");
-assertThrows("this++");
-assertThrows("++this");
-assertThrows("this--");
-assertThrows("--this");
+assertThrows("this = 42", ReferenceError);
+assertThrows("function f() { this = 12; }", ReferenceError);
+assertThrows("for (this in {x:3, y:4, z:5}) ;", ReferenceError);
+assertThrows("for (this = 0;;) ;", ReferenceError);
+assertThrows("this++", ReferenceError);
+assertThrows("++this", ReferenceError);
+assertThrows("this--", ReferenceError);
+assertThrows("--this", ReferenceError);
diff --git a/deps/v8/test/mjsunit/math-floor-of-div.js b/deps/v8/test/mjsunit/math-floor-of-div.js
index d528b8510..707f65714 100644
--- a/deps/v8/test/mjsunit/math-floor-of-div.js
+++ b/deps/v8/test/mjsunit/math-floor-of-div.js
@@ -286,3 +286,14 @@ test_div_deopt_div_by_zero_v();
test_div_deopt_minus_zero_v();
test_div_deopt_overflow_v();
test_div_deopt_div_by_zero_v();
+
+
+// Test for flooring division with negative dividend.
+function flooring_div_by_3(y) {
+ return Math.floor(y / 3);
+}
+
+assertEquals(-1, flooring_div_by_3(-2));
+assertEquals(-1, flooring_div_by_3(-2));
+%OptimizeFunctionOnNextCall(flooring_div_by_3);
+assertEquals(-1, flooring_div_by_3(-2));
diff --git a/deps/v8/test/mjsunit/mjsunit.status b/deps/v8/test/mjsunit/mjsunit.status
index 9f2af491a..3283070c6 100644
--- a/deps/v8/test/mjsunit/mjsunit.status
+++ b/deps/v8/test/mjsunit/mjsunit.status
@@ -70,15 +70,15 @@
##############################################################################
# These use a built-in that's only present in debug mode. They take
# too long to run in debug mode on ARM and MIPS.
- 'fuzz-natives-part*': [PASS, ['mode == release or arch == arm or arch == android_arm or arch == mipsel', SKIP]],
+ 'fuzz-natives-part*': [PASS, ['mode == release or arch == arm or arch == android_arm or arch == android_arm64 or arch == mipsel', SKIP]],
- 'big-object-literal': [PASS, ['arch == arm or arch == android_arm', SKIP]],
+ 'big-object-literal': [PASS, ['arch == arm or arch == android_arm or arch == android_arm64', SKIP]],
# Issue 488: this test sometimes times out.
'array-constructor': [PASS, TIMEOUT],
# Very slow on ARM and MIPS, contains no architecture dependent code.
- 'unicode-case-overoptimization': [PASS, NO_VARIANTS, ['arch == arm or arch == android_arm or arch == mipsel', TIMEOUT]],
+ 'unicode-case-overoptimization': [PASS, NO_VARIANTS, ['arch == arm or arch == android_arm or arch == android_arm64 or arch == mipsel', TIMEOUT]],
##############################################################################
# This test expects to reach a certain recursion depth, which may not work
@@ -93,8 +93,8 @@
# This test sets the umask on a per-process basis and hence cannot be
# used in multi-threaded runs.
# On android there is no /tmp directory.
- 'd8-os': [PASS, ['isolates or arch == android_arm or arch == android_ia32', SKIP]],
- 'tools/tickprocessor': [PASS, ['arch == android_arm or arch == android_ia32', SKIP]],
+ 'd8-os': [PASS, ['isolates or arch == android_arm or arch == android_arm64 or arch == android_ia32', SKIP]],
+ 'tools/tickprocessor': [PASS, ['arch == android_arm or arch == android_arm64 or arch == android_ia32', SKIP]],
##############################################################################
# Long running test that reproduces memory leak and should be run manually.
@@ -134,9 +134,97 @@
'osr-elements-kind': [SKIP],
'regress/regress-165637': [SKIP],
'regress/regress-2249': [SKIP],
+ 'debug-stepout-scope-part8': [PASS, ['arch == arm ', FAIL]],
}], # 'gc_stress == True'
##############################################################################
+['arch == arm64 or arch == android_arm64', {
+
+ # Requires bigger stack size in the Genesis and if stack size is increased,
+ # the test requires too much time to run. However, the problem test covers
+ # should be platform-independent.
+ 'regress/regress-1132': [SKIP],
+
+ # Pass but take too long to run. Skip.
+ # Some similar tests (with fewer iterations) may be included in arm64-js
+ # tests.
+ 'compiler/regress-arguments': [SKIP],
+ 'compiler/regress-gvn': [SKIP],
+ 'compiler/regress-max-locals-for-osr': [SKIP],
+ 'compiler/regress-4': [SKIP],
+ 'compiler/regress-or': [SKIP],
+ 'compiler/regress-rep-change': [SKIP],
+ 'regress/regress-1117': [SKIP],
+ 'regress/regress-1145': [SKIP],
+ 'regress/regress-1849': [SKIP],
+ 'regress/regress-3247124': [SKIP],
+ 'regress/regress-634': [SKIP],
+ 'regress/regress-91008': [SKIP],
+ 'regress/regress-91010': [SKIP],
+ 'regress/regress-91013': [SKIP],
+ 'regress/regress-99167': [SKIP],
+
+ # Long running tests.
+ 'regress/regress-2185': [PASS, ['mode == debug', PASS, TIMEOUT]],
+ 'regress/regress-2185-2': [PASS, TIMEOUT],
+ 'whitespaces': [PASS, TIMEOUT, SLOW],
+
+ # Stack manipulations in LiveEdit is not implemented for this arch.
+ 'debug-liveedit-check-stack': [SKIP],
+ 'debug-liveedit-stack-padding': [SKIP],
+ 'debug-liveedit-restart-frame': [SKIP],
+ 'debug-liveedit-double-call': [SKIP],
+
+ # BUG(v8:3147). It works on other architectures by accident.
+ 'regress/regress-conditional-position': [FAIL],
+
+ # Slow tests.
+ 'array-concat': [PASS, SLOW],
+ 'array-constructor': [PASS, SLOW],
+ 'array-indexing': [PASS, SLOW],
+ 'array-reduce': [PASS, SLOW],
+ 'array-sort': [PASS, SLOW],
+ 'array-splice': [PASS, SLOW],
+ 'bit-not': [PASS, SLOW],
+ 'compiler/alloc-number': [PASS, SLOW],
+ 'compiler/osr-assert': [PASS, SLOW],
+ 'compiler/osr-warm': [PASS, SLOW],
+ 'compiler/osr-with-args': [PASS, SLOW],
+ 'debug-scopes': [PASS, SLOW],
+ 'generated-transition-stub': [PASS, SLOW],
+ 'json2': [PASS, SLOW],
+ 'math-floor-of-div-nosudiv': [PASS, SLOW],
+ 'math-floor-of-div': [PASS, SLOW],
+ 'mirror-object': [PASS, SLOW],
+ 'packed-elements': [PASS, SLOW],
+ 'regress/regress-1122': [PASS, SLOW],
+ 'regress/regress-2185-2': [PASS, SLOW],
+ 'regress/regress-2185': [PASS, SLOW],
+ 'regress/regress-2790': [PASS, SLOW],
+ 'regress/regress-331444': [PASS, SLOW],
+ 'regress/regress-490': [PASS, SLOW],
+ 'regress/regress-crbug-217858': [PASS, SLOW],
+ 'regress/regress-create-exception': [PASS, SLOW],
+ 'regress/regress-json-stringify-gc': [PASS, SLOW],
+ 'string-indexof-2': [PASS, SLOW],
+ 'unicodelctest-no-optimization': [PASS, SLOW],
+ 'unicodelctest': [PASS, SLOW],
+ 'unicode-test': [PASS, SLOW],
+}], # 'arch == arm64'
+
+['arch == arm64 and mode == debug and simulator_run == True', {
+
+ # Pass but take too long with the simulator in debug mode.
+ 'array-sort': [PASS, TIMEOUT],
+ 'packed-elements': [SKIP],
+ 'regexp-global': [SKIP],
+ 'compiler/alloc-numbers': [SKIP],
+ 'harmony/symbols': [SKIP],
+ # Issue 3219:
+ 'getters-on-elements': [PASS, ['gc_stress == True', FAIL]],
+}], # 'arch == arm64 and mode == debug and simulator_run == True'
+
+##############################################################################
['asan == True', {
# Skip tests not suitable for ASAN.
'big-array-literal': [SKIP],
@@ -157,7 +245,7 @@
'unicode-test': [PASS, ['mode == debug', PASS, FAIL]],
# Times out often in release mode on ARM.
- 'compiler/regress-stacktrace-methods': [PASS, PASS, ['mode == release', TIMEOUT]],
+ 'compiler/regress-stacktrace-methods': [PASS, ['mode == release', TIMEOUT]],
'array-splice': [PASS, TIMEOUT],
# Long running test.
@@ -208,7 +296,7 @@
'array-constructor': [PASS, ['mode == debug', SKIP]],
# Times out often in release mode on MIPS.
- 'compiler/regress-stacktrace-methods': [PASS, PASS, ['mode == release', TIMEOUT]],
+ 'compiler/regress-stacktrace-methods': [PASS, ['mode == release', TIMEOUT]],
'array-splice': [PASS, TIMEOUT],
# Long running test.
@@ -276,6 +364,9 @@
# Bug(v8:2978).
'lithium/MathExp': [PASS, FAIL],
+
+ # Lead to OOM:
+ 'string-oom-*': [SKIP],
}], # 'arch == nacl_ia32 or arch == nacl_x64'
##############################################################################
diff --git a/deps/v8/test/mjsunit/neuter-twice.js b/deps/v8/test/mjsunit/neuter-twice.js
new file mode 100644
index 000000000..3501cee43
--- /dev/null
+++ b/deps/v8/test/mjsunit/neuter-twice.js
@@ -0,0 +1,9 @@
+// Copyright 2014 the V8 project authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+// Flags: --allow-natives-syntax
+
+var ab = new ArrayBuffer(100);
+%ArrayBufferNeuter(ab);
+%ArrayBufferNeuter(ab);
diff --git a/deps/v8/test/mjsunit/pixel-array-rounding.js b/deps/v8/test/mjsunit/pixel-array-rounding.js
index b7db51c2c..b7db51c2c 100755..100644
--- a/deps/v8/test/mjsunit/pixel-array-rounding.js
+++ b/deps/v8/test/mjsunit/pixel-array-rounding.js
diff --git a/deps/v8/test/mjsunit/proto-accessor.js b/deps/v8/test/mjsunit/proto-accessor.js
index aca6ec542..b2e7d3466 100644
--- a/deps/v8/test/mjsunit/proto-accessor.js
+++ b/deps/v8/test/mjsunit/proto-accessor.js
@@ -25,57 +25,123 @@
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+// Flags: --harmony-symbols
+
+// Fake Symbol if undefined, allowing test to run in non-Harmony mode as well.
+this.Symbol = typeof Symbol != 'undefined' ? Symbol : String;
+
+
var desc = Object.getOwnPropertyDescriptor(Object.prototype, "__proto__");
-assertEquals("function", typeof desc.get);
-assertEquals("function", typeof desc.set);
-assertDoesNotThrow("desc.get.call({})");
-assertDoesNotThrow("desc.set.call({}, {})");
+var getProto = desc.get;
+var setProto = desc.set;
+
+function TestNoPoisonPill() {
+ assertEquals("function", typeof desc.get);
+ assertEquals("function", typeof desc.set);
+ assertDoesNotThrow("desc.get.call({})");
+ assertDoesNotThrow("desc.set.call({}, {})");
+
+ var obj = {};
+ var obj2 = {};
+ desc.set.call(obj, obj2);
+ assertEquals(obj.__proto__, obj2);
+ assertEquals(desc.get.call(obj), obj2);
+}
+TestNoPoisonPill();
+
+
+function TestRedefineObjectPrototypeProtoGetter() {
+ Object.defineProperty(Object.prototype, "__proto__", {
+ get: function() {
+ return 42;
+ }
+ });
+ assertEquals({}.__proto__, 42);
+ assertEquals(desc.get.call({}), Object.prototype);
+
+ var desc2 = Object.getOwnPropertyDescriptor(Object.prototype, "__proto__");
+ assertEquals(desc2.get.call({}), 42);
+ assertEquals(desc2.set.call({}), undefined);
+
+ Object.defineProperty(Object.prototype, "__proto__", {
+ set: function(x) {}
+ });
+ var desc3 = Object.getOwnPropertyDescriptor(Object.prototype, "__proto__");
+ assertEquals(desc3.get.call({}), 42);
+ assertEquals(desc3.set.call({}), undefined);
+}
+TestRedefineObjectPrototypeProtoGetter();
-var obj = {};
-var obj2 = {};
-desc.set.call(obj, obj2);
-assertEquals(obj.__proto__, obj2);
-assertEquals(desc.get.call(obj), obj2);
+function TestRedefineObjectPrototypeProtoSetter() {
+ Object.defineProperty(Object.prototype, "__proto__", { set: undefined });
+ assertThrows(function() {
+ "use strict";
+ var o = {};
+ var p = {};
+ o.__proto__ = p;
+ }, TypeError);
+}
+TestRedefineObjectPrototypeProtoSetter();
-// Check that any redefinition of the __proto__ accessor works.
-Object.defineProperty(Object.prototype, "__proto__", {
- get: function() {
- return 42;
+function TestGetProtoOfValues() {
+ assertEquals(getProto.call(1), Number.prototype);
+ assertEquals(getProto.call(true), Boolean.prototype);
+ assertEquals(getProto.call(false), Boolean.prototype);
+ assertEquals(getProto.call('s'), String.prototype);
+ assertEquals(getProto.call(Symbol()), Symbol.prototype);
+
+ assertThrows(function() { getProto.call(null); }, TypeError);
+ assertThrows(function() { getProto.call(undefined); }, TypeError);
+}
+TestGetProtoOfValues();
+
+
+var values = [1, true, false, 's', Symbol()];
+
+
+function TestSetProtoOfValues() {
+ var proto = {};
+ for (var i = 0; i < values.length; i++) {
+ assertEquals(setProto.call(values[i], proto), undefined);
}
-});
-assertEquals({}.__proto__, 42);
-assertEquals(desc.get.call({}), Object.prototype);
+
+ assertThrows(function() { setProto.call(null, proto); }, TypeError);
+ assertThrows(function() { setProto.call(undefined, proto); }, TypeError);
+}
+TestSetProtoOfValues();
-var desc2 = Object.getOwnPropertyDescriptor(Object.prototype, "__proto__");
-assertEquals(desc2.get.call({}), 42);
-assertDoesNotThrow("desc2.set.call({})");
+function TestSetProtoToValue() {
+ var object = {};
+ var proto = {};
+ setProto.call(object, proto);
+ var valuesWithUndefined = values.concat(undefined);
+
+ for (var i = 0; i < valuesWithUndefined.length; i++) {
+ assertEquals(setProto.call(object, valuesWithUndefined[i]), undefined);
+ assertEquals(getProto.call(object), proto);
+ }
-Object.defineProperty(Object.prototype, "__proto__", { set:function(x){} });
-var desc3 = Object.getOwnPropertyDescriptor(Object.prototype, "__proto__");
-assertDoesNotThrow("desc3.get.call({})");
-assertDoesNotThrow("desc3.set.call({})");
+ // null is the only valid value that can be used as a [[Prototype]].
+ assertEquals(setProto.call(object, null), undefined);
+ assertEquals(getProto.call(object), null);
+}
+TestSetProtoToValue();
-Object.defineProperty(Object.prototype, "__proto__", { set: undefined });
-assertThrows(function() {
- "use strict";
+function TestDeleteProto() {
+ assertTrue(delete Object.prototype.__proto__);
var o = {};
var p = {};
o.__proto__ = p;
-}, TypeError);
-
-
-assertTrue(delete Object.prototype.__proto__);
-var o = {};
-var p = {};
-o.__proto__ = p;
-assertEquals(Object.getPrototypeOf(o), Object.prototype);
-var desc4 = Object.getOwnPropertyDescriptor(o, "__proto__");
-assertTrue(desc4.configurable);
-assertTrue(desc4.enumerable);
-assertTrue(desc4.writable);
-assertEquals(desc4.value, p);
+ assertEquals(Object.getPrototypeOf(o), Object.prototype);
+ var desc4 = Object.getOwnPropertyDescriptor(o, "__proto__");
+ assertTrue(desc4.configurable);
+ assertTrue(desc4.enumerable);
+ assertTrue(desc4.writable);
+ assertEquals(desc4.value, p);
+}
+TestDeleteProto();
diff --git a/deps/v8/test/mjsunit/readonly.js b/deps/v8/test/mjsunit/readonly.js
index 4d06b7cf4..050e25627 100644
--- a/deps/v8/test/mjsunit/readonly.js
+++ b/deps/v8/test/mjsunit/readonly.js
@@ -25,7 +25,8 @@
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-// Flags: --allow-natives-syntax --harmony-proxies --es5_readonly
+// Flags: --allow-natives-syntax --es5_readonly
+// Flags: --harmony-proxies
// Different ways to create an object.
@@ -120,8 +121,12 @@ function ReadonlyByProto(o, name) {
o.__proto__ = p;
}
+// Allow Proxy to be undefined, so test can run in non-Harmony mode as well.
+var global = this;
+
function ReadonlyByProxy(o, name) {
- var p = Proxy.create({
+ if (!global.Proxy) return ReadonlyByFreeze(o, name); // Dummy.
+ var p = global.Proxy.create({
getPropertyDescriptor: function() {
return {value: -46, writable: false, configurable: true};
}
diff --git a/deps/v8/test/mjsunit/regexp-capture-3.js b/deps/v8/test/mjsunit/regexp-capture-3.js
index 4c27ea454..4c27ea454 100755..100644
--- a/deps/v8/test/mjsunit/regexp-capture-3.js
+++ b/deps/v8/test/mjsunit/regexp-capture-3.js
diff --git a/deps/v8/test/mjsunit/regexp-capture.js b/deps/v8/test/mjsunit/regexp-capture.js
index 307309482..307309482 100755..100644
--- a/deps/v8/test/mjsunit/regexp-capture.js
+++ b/deps/v8/test/mjsunit/regexp-capture.js
diff --git a/deps/v8/test/mjsunit/regress-3225.js b/deps/v8/test/mjsunit/regress-3225.js
new file mode 100644
index 000000000..357f94b24
--- /dev/null
+++ b/deps/v8/test/mjsunit/regress-3225.js
@@ -0,0 +1,48 @@
+// Copyright 2014 the V8 project authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+// Flags: --expose-debug-as debug --harmony-generators
+
+Debug = debug.Debug
+
+var debug_step = 0;
+var failure = null;
+
+function listener(event, exec_state, event_data, data) {
+ if (event != Debug.DebugEvent.Break) return;
+ try {
+ if (debug_step == 0) {
+ assertEquals(1, exec_state.frame(0).evaluate('a').value());
+ assertEquals(3, exec_state.frame(0).evaluate('b').value());
+ exec_state.frame(0).evaluate("a = 4").value();
+ debug_step++;
+ } else {
+ assertEquals(4, exec_state.frame(0).evaluate('a').value());
+ assertEquals(3, exec_state.frame(0).evaluate('b').value());
+ exec_state.frame(0).evaluate("b = 5").value();
+ }
+ } catch (e) {
+ failure = e;
+ }
+}
+
+Debug.setListener(listener);
+
+function* generator(a, b) {
+ var b = 3; // Shadows a parameter.
+ debugger;
+ yield a;
+ yield b;
+ debugger;
+ return b;
+}
+
+var foo = generator(1, 2);
+
+assertEquals(4, foo.next().value);
+assertEquals(3, foo.next().value);
+assertEquals(5, foo.next().value);
+assertNull(failure);
+
+Debug.setListener(null);
diff --git a/deps/v8/test/mjsunit/regress-keyed-store-non-strict-arguments.js b/deps/v8/test/mjsunit/regress-keyed-store-non-strict-arguments.js
new file mode 100644
index 000000000..865d600ad
--- /dev/null
+++ b/deps/v8/test/mjsunit/regress-keyed-store-non-strict-arguments.js
@@ -0,0 +1,16 @@
+// Copyright 2014 the V8 project authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+function args(arg) { return arguments; }
+var a = args(false);
+
+(function () {
+ "use strict";
+ a["const" + 0] = 0;
+})();
+
+(function () {
+ "use strict";
+ a[0] = 0;
+})();
diff --git a/deps/v8/test/mjsunit/regress-sync-optimized-lists.js b/deps/v8/test/mjsunit/regress-sync-optimized-lists.js
new file mode 100644
index 000000000..f07c12b2c
--- /dev/null
+++ b/deps/v8/test/mjsunit/regress-sync-optimized-lists.js
@@ -0,0 +1,45 @@
+// Copyright 2014 the V8 project authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+// Flags: --allow-natives-syntax --block-concurrent-recompilation
+// Flags: --no-concurrent-osr
+
+function Ctor() {
+ this.a = 1;
+}
+
+function get_closure() {
+ return function add_field(obj, osr) {
+ obj.c = 3;
+ var x = 0;
+ if (osr) {
+ %OptimizeFunctionOnNextCall(add_field, "osr");
+ }
+ for (var i = 0; i < 10; i++) {
+ x = i + 1;
+ }
+ return x;
+ }
+}
+
+var f1 = get_closure();
+f1(new Ctor(), false);
+f1(new Ctor(), false);
+
+%OptimizeFunctionOnNextCall(f1, "concurrent");
+
+// Kick off concurrent recompilation and OSR.
+var o = new Ctor();
+f1(o, true);
+assertOptimized(f1, "no sync");
+
+// Flush the optimizing compiler's queue.
+%NotifyContextDisposed();
+assertUnoptimized(f1, "no sync");
+
+// Trigger deopt.
+o.c = 2.2;
+
+var f2 = get_closure();
+f2(new Ctor(), true);
diff --git a/deps/v8/test/mjsunit/regress/compare-map-elim1.js b/deps/v8/test/mjsunit/regress/compare-map-elim1.js
new file mode 100644
index 000000000..c7ea05def
--- /dev/null
+++ b/deps/v8/test/mjsunit/regress/compare-map-elim1.js
@@ -0,0 +1,57 @@
+// Copyright 2010 the V8 project authors. All rights reserved.
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are
+// met:
+//
+// * Redistributions of source code must retain the above copyright
+// notice, this list of conditions and the following disclaimer.
+// * Redistributions in binary form must reproduce the above
+// copyright notice, this list of conditions and the following
+// disclaimer in the documentation and/or other materials provided
+// with the distribution.
+// * Neither the name of Google Inc. nor the names of its
+// contributors may be used to endorse or promote products derived
+// from this software without specific prior written permission.
+//
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+// Flags: --allow-natives-syntax --check-elimination
+
+
+function foo(o) {
+ return o.foo1;
+}
+
+function getter() {
+ return this.x + this.z + foo2(this);
+}
+
+function foo2(o) {
+ return o.a;
+}
+
+var o1 = {z:0, x:1};
+var o2 = {z:0, a:1.5, x:1};
+var o3 = {z:0, a:1.5};
+Object.defineProperty(o1, "foo1", {get:getter});
+Object.defineProperty(o2, "foo1", {get:getter});
+
+foo(o1);
+foo(o1);
+foo(o2);
+%ClearFunctionTypeFeedback(foo2);
+foo2(o2);
+foo2(o2);
+foo2(o3);
+%OptimizeFunctionOnNextCall(foo);
+foo(o1);
diff --git a/deps/v8/test/mjsunit/regress/comparison-in-effect-context-deopt.js b/deps/v8/test/mjsunit/regress/comparison-in-effect-context-deopt.js
new file mode 100644
index 000000000..b28dff73a
--- /dev/null
+++ b/deps/v8/test/mjsunit/regress/comparison-in-effect-context-deopt.js
@@ -0,0 +1,47 @@
+// Copyright 2014 the V8 project authors. All rights reserved.
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are
+// met:
+//
+// * Redistributions of source code must retain the above copyright
+// notice, this list of conditions and the following disclaimer.
+// * Redistributions in binary form must reproduce the above
+// copyright notice, this list of conditions and the following
+// disclaimer in the documentation and/or other materials provided
+// with the distribution.
+// * Neither the name of Google Inc. nor the names of its
+// contributors may be used to endorse or promote products derived
+// from this software without specific prior written permission.
+//
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+// Flags: --allow-natives-syntax
+
+function lazyDeopt() {
+ %DeoptimizeFunction(test);
+ return "deopt";
+}
+
+var x = { toString : lazyDeopt };
+
+function g(x) {
+ return "result";
+}
+
+function test(x) {
+ return g(void(x == ""));
+}
+
+test(x);
+%OptimizeFunctionOnNextCall(test);
+assertEquals("result", test(x));
diff --git a/deps/v8/test/mjsunit/regress/number-named-call-deopt.js b/deps/v8/test/mjsunit/regress/number-named-call-deopt.js
new file mode 100644
index 000000000..1598af12b
--- /dev/null
+++ b/deps/v8/test/mjsunit/regress/number-named-call-deopt.js
@@ -0,0 +1,41 @@
+// Copyright 2014 the V8 project authors. All rights reserved.
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are
+// met:
+//
+// * Redistributions of source code must retain the above copyright
+// notice, this list of conditions and the following disclaimer.
+// * Redistributions in binary form must reproduce the above
+// copyright notice, this list of conditions and the following
+// disclaimer in the documentation and/or other materials provided
+// with the distribution.
+// * Neither the name of Google Inc. nor the names of its
+// contributors may be used to endorse or promote products derived
+// from this software without specific prior written permission.
+//
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+// Flags: --allow-natives-syntax
+
+function f(x, deopt, osr) {
+ var res = "result";
+ void(x.toString(10, deopt + 0));
+ if (osr) for (var i = 0; i < 100000; i++) { }
+ return res;
+}
+
+f(4, 0, false);
+f(4, 0, false);
+f(4, 0, false);
+%OptimizeFunctionOnNextCall(f);
+assertEquals("result", f(4, "deopt", true));
diff --git a/deps/v8/test/mjsunit/regress/polymorphic-accessor-test-context.js b/deps/v8/test/mjsunit/regress/polymorphic-accessor-test-context.js
new file mode 100644
index 000000000..618827924
--- /dev/null
+++ b/deps/v8/test/mjsunit/regress/polymorphic-accessor-test-context.js
@@ -0,0 +1,25 @@
+// Copyright 2014 the V8 project authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+// Flags: --allow-natives-syntax
+
+function t1() { return this instanceof t1; }
+function t2() { return this instanceof t2; }
+
+var o1 = new (function() { })();
+Object.defineProperty(o1, "t", {get:function() { return this instanceof o1.constructor; }});
+var o2 = new (function() { })();
+Object.defineProperty(o2, "t", {get:function() { return this instanceof o1.constructor; }});
+var o3 = new (function() { })();
+o3.t = true;
+
+function f(o) {
+ return 1 + (o.t ? 1 : 2);
+}
+
+f(o1);
+f(o1);
+f(o2);
+%OptimizeFunctionOnNextCall(f);
+f(o3);
diff --git a/deps/v8/test/mjsunit/regress/regress-2273.js b/deps/v8/test/mjsunit/regress/regress-2273.js
index 7868b8da2..76b5ab6aa 100644
--- a/deps/v8/test/mjsunit/regress/regress-2273.js
+++ b/deps/v8/test/mjsunit/regress/regress-2273.js
@@ -79,7 +79,7 @@ function strict_mode() {
};
strict_mode();
-function classic_mode() {
+function sloppy_mode() {
CheckStringReceiver.call("foo");
CheckNumberReceiver.call(42);
CheckUndefinedReceiver.call(undefined);
@@ -100,4 +100,4 @@ function classic_mode() {
[4].some(CheckCoersion, 42);
[5].map(CheckCoersion, 42);
};
-classic_mode();
+sloppy_mode();
diff --git a/deps/v8/test/mjsunit/regress/regress-2318.js b/deps/v8/test/mjsunit/regress/regress-2318.js
index 5fa8a4f96..e31e0f904 100644
--- a/deps/v8/test/mjsunit/regress/regress-2318.js
+++ b/deps/v8/test/mjsunit/regress/regress-2318.js
@@ -25,7 +25,7 @@
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-// Flags: --expose-debug-as debug --nostack-trace-on-abort --stack-size=100
+// Flags: --expose-debug-as debug --nostack-trace-on-abort --stack-size=150
function f() {
var i = 0;
diff --git a/deps/v8/test/mjsunit/regress/regress-2564.js b/deps/v8/test/mjsunit/regress/regress-2564.js
index 1d7cdaeae..21b40e0b0 100644
--- a/deps/v8/test/mjsunit/regress/regress-2564.js
+++ b/deps/v8/test/mjsunit/regress/regress-2564.js
@@ -66,7 +66,7 @@ Error.prepareStackTrace = function(error, frames) {
try {
assertEquals(5, frames.length);
for (var i = 0; i < 2; i++) {
- // The first two frames are still classic mode.
+ // The first two frames are still sloppy mode.
assertEquals(o[i], frames[i].getFunction());
assertEquals(o, frames[i].getThis());
}
diff --git a/deps/v8/test/mjsunit/regress/regress-3032.js b/deps/v8/test/mjsunit/regress/regress-3032.js
index ae5454375..ae5454375 100755..100644
--- a/deps/v8/test/mjsunit/regress/regress-3032.js
+++ b/deps/v8/test/mjsunit/regress/regress-3032.js
diff --git a/deps/v8/test/mjsunit/regress/regress-3135.js b/deps/v8/test/mjsunit/regress/regress-3135.js
new file mode 100644
index 000000000..f15c9a86d
--- /dev/null
+++ b/deps/v8/test/mjsunit/regress/regress-3135.js
@@ -0,0 +1,73 @@
+// Copyright 2014 the V8 project authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+// Properties are serialized once.
+assertEquals('{"x":1}', JSON.stringify({ x : 1 }, ["x", 1, "x", 1]));
+assertEquals('{"1":1}', JSON.stringify({ 1 : 1 }, ["x", 1, "x", 1]));
+assertEquals('{"1":1}', JSON.stringify({ 1 : 1 }, ["1", 1, "1", 1]));
+assertEquals('{"1":1}', JSON.stringify({ 1 : 1 }, [1, "1", 1, "1"]));
+
+// Properties are visited at most once.
+var fired = 0;
+var getter_obj = { get x() { fired++; return 2; } };
+assertEquals('{"x":2}', JSON.stringify(getter_obj, ["x", "y", "x"]));
+assertEquals(1, fired);
+
+// Order of the replacer array is followed.
+assertEquals('{"y":4,"x":3}', JSON.stringify({ x : 3, y : 4}, ["y", "x"]));
+assertEquals('{"y":4,"1":2,"x":3}',
+ JSON.stringify({ x : 3, y : 4, 1 : 2 }, ["y", 1, "x"]));
+
+// With a replacer array the value of the property is retrieved using [[Get]]
+// ignoring own and enumerability.
+var a = { x : 8 };
+assertEquals('{"__proto__":{"__proto__":null},"x":8}',
+ JSON.stringify(a, ["__proto__", "x", "__proto__"]));
+a.__proto__ = { x : 7 };
+assertEquals('{"__proto__":{"__proto__":{"__proto__":null},"x":7},"x":8}',
+ JSON.stringify(a, ["__proto__", "x"]));
+var b = { __proto__: { x: 9 } };
+assertEquals('{}', JSON.stringify(b));
+assertEquals('{"x":9}', JSON.stringify(b, ["x"]));
+var c = {x: 10};
+Object.defineProperty(c, 'x', { enumerable: false });
+assertEquals('{}', JSON.stringify(c));
+assertEquals('{"x":10}', JSON.stringify(c, ["x"]));
+
+// Arrays are not affected by the replacer array.
+assertEquals("[9,8,7]", JSON.stringify([9, 8, 7], [1, 1]));
+var mixed_arr = [11,12,13];
+mixed_arr.x = 10;
+assertEquals('[11,12,13]', JSON.stringify(mixed_arr, [1, 0, 1]));
+
+// Array elements of objects are affected.
+var mixed_obj = { x : 3 };
+mixed_obj[0] = 6;
+mixed_obj[1] = 5;
+assertEquals('{"1":5,"0":6}', JSON.stringify(mixed_obj, [1, 0, 1]));
+
+// Nested object.
+assertEquals('{"z":{"x":3},"x":1}',
+ JSON.stringify({ x: 1, y:2, z: {x:3, b:4}}, ["z","x"]));
+
+// Objects in the replacer array are ignored.
+assertEquals('{}',
+ JSON.stringify({ x : 1, "1": 1 }, [{}]));
+assertEquals('{}',
+ JSON.stringify({ x : 1, "1": 1 }, [true, undefined, null]));
+assertEquals('{}',
+ JSON.stringify({ x : 1, "1": 1 },
+ [{ toString: function() { return "x";} }]));
+assertEquals('{}',
+ JSON.stringify({ x : 1, "1": 1 },
+ [{ valueOf: function() { return 1;} }]));
+
+// Make sure that property names that clash with the names of Object.prototype
+// still works.
+assertEquals('{"toString":42}', JSON.stringify({ toString: 42 }, ["toString"]));
+
+// Number wrappers and String wrappers should be unwrapped.
+assertEquals('{"1":1,"s":"s"}',
+ JSON.stringify({ 1: 1, s: "s" },
+ [new Number(1), new String("s")]));
diff --git a/deps/v8/test/mjsunit/regress/regress-3138.js b/deps/v8/test/mjsunit/regress/regress-3138.js
new file mode 100644
index 000000000..acb121d2b
--- /dev/null
+++ b/deps/v8/test/mjsunit/regress/regress-3138.js
@@ -0,0 +1,40 @@
+// Copyright 2014 the V8 project authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+(function f(){
+ assertEquals("function", typeof f);
+})();
+
+(function f(){
+ var f; // Variable shadows function name.
+ assertEquals("undefined", typeof f);
+})();
+
+(function f(){
+ var f;
+ assertEquals("undefined", typeof f);
+ with ({}); // Force context allocation of both variable and function name.
+})();
+
+assertEquals("undefined", typeof f);
+
+// var initialization is intercepted by with scope.
+(function() {
+ var o = { a: 1 };
+ with (o) {
+ var a = 2;
+ }
+ assertEquals("undefined", typeof a);
+ assertEquals(2, o.a);
+})();
+
+// const initialization is not intercepted by with scope.
+(function() {
+ var o = { a: 1 };
+ with (o) {
+ const a = 2;
+ }
+ assertEquals(2, a);
+ assertEquals(1, o.a);
+})();
diff --git a/deps/v8/test/mjsunit/regress/regress-3158.js b/deps/v8/test/mjsunit/regress/regress-3158.js
new file mode 100644
index 000000000..c69127395
--- /dev/null
+++ b/deps/v8/test/mjsunit/regress/regress-3158.js
@@ -0,0 +1,24 @@
+// Copyright 2014 the V8 project authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+// Flags: --allow-natives-syntax
+
+Array.prototype[0] = 'a';
+delete Array.prototype[0];
+
+function foo(a, i) {
+ return a[i];
+}
+
+var a = new Array(100000);
+a[3] = 'x';
+
+foo(a, 3);
+foo(a, 3);
+foo(a, 3);
+%OptimizeFunctionOnNextCall(foo);
+foo(a, 3);
+Array.prototype[0] = 'a';
+var z = foo(a, 0);
+assertEquals('a', z);
diff --git a/deps/v8/test/mjsunit/regress/regress-3159.js b/deps/v8/test/mjsunit/regress/regress-3159.js
new file mode 100644
index 000000000..cfc8a39b8
--- /dev/null
+++ b/deps/v8/test/mjsunit/regress/regress-3159.js
@@ -0,0 +1,10 @@
+// Copyright 2014 the V8 project authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+try {
+ new Uint32Array(new ArrayBuffer(1), 2, 3);
+} catch (e) {
+ assertEquals("start offset of Uint32Array should be a multiple of 4",
+ e.message);
+}
diff --git a/deps/v8/test/mjsunit/regress/regress-3183.js b/deps/v8/test/mjsunit/regress/regress-3183.js
new file mode 100644
index 000000000..0c915b0ae
--- /dev/null
+++ b/deps/v8/test/mjsunit/regress/regress-3183.js
@@ -0,0 +1,96 @@
+// Copyright 2014 the V8 project authors. All rights reserved.
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are
+// met:
+//
+// * Redistributions of source code must retain the above copyright
+// notice, this list of conditions and the following disclaimer.
+// * Redistributions in binary form must reproduce the above
+// copyright notice, this list of conditions and the following
+// disclaimer in the documentation and/or other materials provided
+// with the distribution.
+// * Neither the name of Google Inc. nor the names of its
+// contributors may be used to endorse or promote products derived
+// from this software without specific prior written permission.
+//
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+// Flags: --allow-natives-syntax
+
+(function DeoptimizeArgCallFunctionGeneric() {
+ var a = [];
+
+ function f1(method, array, elem, deopt) {
+ assertEquals('push', method);
+ }
+
+ function f2() { }
+
+ function bar(x, deopt, f) {
+ f('push', a, [x], deopt + 0);
+ }
+
+ function foo() { return bar(arguments[0], arguments[1], arguments[2]); }
+ function baz(f, deopt) { return foo("x", deopt, f); }
+
+ baz(f1, 0);
+ baz(f2, 0);
+ %OptimizeFunctionOnNextCall(baz);
+ baz(f1, "deopt");
+})();
+
+
+(function DeoptimizeArgGlobalFunctionGeneric() {
+ var a = [];
+
+ var f1;
+
+ f1 = function(method, array, elem, deopt) {
+ assertEquals('push', method);
+ }
+
+ function bar(x, deopt, f) {
+ f1('push', a, [x], deopt + 0);
+ }
+
+ function foo() { return bar(arguments[0], arguments[1]); }
+ function baz(deopt) { return foo("x", deopt); }
+
+ baz(0);
+ baz(0);
+ %OptimizeFunctionOnNextCall(baz);
+ baz("deopt");
+})();
+
+
+(function DeoptimizeArgCallFunctionRuntime() {
+ var a = [];
+
+ var f1;
+
+ f1 = function(method, array, elem, deopt) {
+ assertEquals('push', method);
+ }
+
+ function bar(x, deopt) {
+ %_CallFunction(null, 'push', [x][0], ((deopt + 0), 1), f1);
+ }
+
+ function foo() { return bar(arguments[0], arguments[1]); }
+ function baz(deopt) { return foo(0, deopt); }
+
+ baz(0);
+ baz(0);
+ %OptimizeFunctionOnNextCall(baz);
+ baz("deopt");
+})();
diff --git a/deps/v8/test/mjsunit/regress/regress-319722-ArrayBuffer.js b/deps/v8/test/mjsunit/regress/regress-319722-ArrayBuffer.js
index 4a48a61ab..9a24fc5c7 100644
--- a/deps/v8/test/mjsunit/regress/regress-319722-ArrayBuffer.js
+++ b/deps/v8/test/mjsunit/regress/regress-319722-ArrayBuffer.js
@@ -26,7 +26,7 @@
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
// Flags: --nostress-opt --allow-natives-syntax --mock-arraybuffer-allocator
-var maxSize = %MaxSmi() + 1;
+var maxSize = %_MaxSmi() + 1;
var ab;
// Allocate the largest ArrayBuffer we can on this architecture.
diff --git a/deps/v8/test/mjsunit/regress/regress-319722-TypedArrays.js b/deps/v8/test/mjsunit/regress/regress-319722-TypedArrays.js
index 0445e2d2c..e497aecbe 100644
--- a/deps/v8/test/mjsunit/regress/regress-319722-TypedArrays.js
+++ b/deps/v8/test/mjsunit/regress/regress-319722-TypedArrays.js
@@ -27,7 +27,7 @@
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
// Flags: --nostress-opt --allow-natives-syntax
-var maxSize = %MaxSmi() + 1;
+var maxSize = %_MaxSmi() + 1;
function TestArray(constr) {
assertThrows(function() {
new constr(maxSize);
diff --git a/deps/v8/test/mjsunit/regress/regress-3204.js b/deps/v8/test/mjsunit/regress/regress-3204.js
new file mode 100644
index 000000000..dc754ff2d
--- /dev/null
+++ b/deps/v8/test/mjsunit/regress/regress-3204.js
@@ -0,0 +1,25 @@
+// Copyright 2014 the V8 project authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+// Flags: --allow-natives-syntax
+
+function ModILeftCanBeNegative() {
+ var x = 0;
+ for (var i = -1; i < 0; ++i) x = i % 2;
+ return x;
+}
+
+ModILeftCanBeNegative();
+%OptimizeFunctionOnNextCall(ModILeftCanBeNegative);
+assertEquals(-1, ModILeftCanBeNegative());
+
+function ModIRightCanBeZero() {
+ var x = 0;
+ for (var i = -1; i <= 0; ++i) x = (2 % i) | 0;
+ return x;
+}
+
+ModIRightCanBeZero();
+%OptimizeFunctionOnNextCall(ModIRightCanBeZero);
+ModIRightCanBeZero();
diff --git a/deps/v8/test/mjsunit/regress/regress-3220.js b/deps/v8/test/mjsunit/regress/regress-3220.js
new file mode 100644
index 000000000..6f8e8c8f0
--- /dev/null
+++ b/deps/v8/test/mjsunit/regress/regress-3220.js
@@ -0,0 +1,30 @@
+// Copyright 2014 the V8 project authors. All rights reserved.
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are
+// met:
+//
+// * Redistributions of source code must retain the above copyright
+// notice, this list of conditions and the following disclaimer.
+// * Redistributions in binary form must reproduce the above
+// copyright notice, this list of conditions and the following
+// disclaimer in the documentation and/or other materials provided
+// with the distribution.
+// * Neither the name of Google Inc. nor the names of its
+// contributors may be used to endorse or promote products derived
+// from this software without specific prior written permission.
+//
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+// Flags: --use-strict
+
+String(new Date());
diff --git a/deps/v8/test/mjsunit/regress-330046.js b/deps/v8/test/mjsunit/regress/regress-330046.js
index d94b804ac..d94b804ac 100644
--- a/deps/v8/test/mjsunit/regress-330046.js
+++ b/deps/v8/test/mjsunit/regress/regress-330046.js
diff --git a/deps/v8/test/mjsunit/regress-333594.js b/deps/v8/test/mjsunit/regress/regress-333594.js
index 6f6dbaafc..6f6dbaafc 100644
--- a/deps/v8/test/mjsunit/regress-333594.js
+++ b/deps/v8/test/mjsunit/regress/regress-333594.js
diff --git a/deps/v8/test/mjsunit/regress/regress-343609.js b/deps/v8/test/mjsunit/regress/regress-343609.js
new file mode 100644
index 000000000..5205ca133
--- /dev/null
+++ b/deps/v8/test/mjsunit/regress/regress-343609.js
@@ -0,0 +1,66 @@
+// Copyright 2014 the V8 project authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+// Flags: --allow-natives-syntax --block-concurrent-recompilation
+// Flags: --no-concurrent-osr --expose-gc
+
+function Ctor() {
+ this.a = 1;
+}
+
+function get_closure() {
+ return function add_field(obj) {
+ obj.c = 3;
+ obj.a = obj.a + obj.c;
+ return obj.a;
+ }
+}
+function get_closure2() {
+ return function cc(obj) {
+ obj.c = 3;
+ obj.a = obj.a + obj.c;
+ }
+}
+
+function dummy() {
+ (function () {
+ var o = {c: 10};
+ var f1 = get_closure2();
+ f1(o);
+ f1(o);
+ %OptimizeFunctionOnNextCall(f1);
+ f1(o);
+ })();
+}
+
+var o = new Ctor();
+function opt() {
+ (function () {
+ var f1 = get_closure();
+ f1(new Ctor());
+ f1(new Ctor());
+ %OptimizeFunctionOnNextCall(f1);
+ f1(o);
+ })();
+}
+
+// Optimize add_field and install its code in optimized code cache.
+opt();
+opt();
+opt();
+
+// Optimize dummy function to remove the add_field from head of optimized
+// function list in the context.
+dummy();
+dummy();
+
+// Kill add_field in new space GC.
+for(var i = 0; i < 3; i++) gc(true);
+
+// Trigger deopt.
+o.c = 2.2;
+
+// Fetch optimized code of add_field from cache and crash.
+var f2 = get_closure();
+f2(new Ctor());
diff --git a/deps/v8/test/mjsunit/regress/regress-346587.js b/deps/v8/test/mjsunit/regress/regress-346587.js
new file mode 100644
index 000000000..40e3ac116
--- /dev/null
+++ b/deps/v8/test/mjsunit/regress/regress-346587.js
@@ -0,0 +1,18 @@
+// Copyright 2014 the V8 project authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+// Flags: --fold-constants --allow-natives-syntax
+
+function bar(obj) {
+ assertTrue(obj.x === 'baz');
+}
+
+function foo() {
+ bar({ x : 'baz' });
+}
+
+foo();
+foo();
+%OptimizeFunctionOnNextCall(foo);
+foo();
diff --git a/deps/v8/test/mjsunit/regress/regress-347530.js b/deps/v8/test/mjsunit/regress/regress-347530.js
new file mode 100644
index 000000000..330fda38c
--- /dev/null
+++ b/deps/v8/test/mjsunit/regress/regress-347530.js
@@ -0,0 +1,12 @@
+// Copyright 2014 the V8 project authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+// Flags: --expose-gc
+a = [];
+a[1000] = .1;
+a.length = 0;
+gc();
+gc();
+a[1000] = .1;
+assertEquals(.1, a[1000]);
diff --git a/deps/v8/test/mjsunit/regress/regress-347542.js b/deps/v8/test/mjsunit/regress/regress-347542.js
new file mode 100644
index 000000000..901d798fb
--- /dev/null
+++ b/deps/v8/test/mjsunit/regress/regress-347542.js
@@ -0,0 +1,11 @@
+// Copyright 2014 the V8 project authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+// Flags: --allow-natives-syntax
+
+function foo() {}
+foo();
+%OptimizeFunctionOnNextCall(foo);
+foo();
+%NeverOptimizeFunction(foo);
diff --git a/deps/v8/test/mjsunit/regress/regress-347906.js b/deps/v8/test/mjsunit/regress/regress-347906.js
new file mode 100644
index 000000000..c75161892
--- /dev/null
+++ b/deps/v8/test/mjsunit/regress/regress-347906.js
@@ -0,0 +1,14 @@
+// Copyright 2014 the V8 project authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+// Flags: --allow-natives-syntax --harmony
+
+function foo() {
+ return Math.clz32(12.34);
+}
+
+foo();
+foo();
+%OptimizeFunctionOnNextCall(foo);
+foo();
diff --git a/deps/v8/test/mjsunit/regress/regress-347912.js b/deps/v8/test/mjsunit/regress/regress-347912.js
new file mode 100644
index 000000000..b609e36c3
--- /dev/null
+++ b/deps/v8/test/mjsunit/regress/regress-347912.js
@@ -0,0 +1,10 @@
+// Copyright 2014 the V8 project authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+// Flags: --allow-natives-syntax
+
+var __v_4 = {};
+__v_2 = {};
+__v_2[1024] = 0;
+%DebugPrint(__v_4);
diff --git a/deps/v8/test/mjsunit/regress/regress-347914.js b/deps/v8/test/mjsunit/regress/regress-347914.js
new file mode 100644
index 000000000..bc4dcd7f7
--- /dev/null
+++ b/deps/v8/test/mjsunit/regress/regress-347914.js
@@ -0,0 +1,89 @@
+ // Copyright 2014 the V8 project authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+// Flags: --allow-natives-syntax --debug-code --gc-interval=201 --verify-heap --max-inlined-source-size=999999 --max-inlined-nodes=999999 --max-inlined-nodes-cumulative=999999
+
+// Begin stripped down and modified version of mjsunit.js for easy minimization in CF.
+function MjsUnitAssertionError(message) {}
+MjsUnitAssertionError.prototype.toString = function () { return this.message; };
+var assertSame;
+var assertEquals;
+var assertEqualsDelta;
+var assertArrayEquals;
+var assertPropertiesEqual;
+var assertToStringEquals;
+var assertTrue;
+var assertFalse;
+var triggerAssertFalse;
+var assertNull;
+var assertNotNull;
+var assertThrows;
+var assertDoesNotThrow;
+var assertInstanceof;
+var assertUnreachable;
+var assertOptimized;
+var assertUnoptimized;
+function classOf(object) { var string = Object.prototype.toString.call(object); return string.substring(8, string.length - 1); }
+function PrettyPrint(value) { return ""; }
+function PrettyPrintArrayElement(value, index, array) { return ""; }
+function fail(expectedText, found, name_opt) { }
+function deepObjectEquals(a, b) { var aProps = Object.keys(a); aProps.sort(); var bProps = Object.keys(b); bProps.sort(); if (!deepEquals(aProps, bProps)) { return false; } for (var i = 0; i < aProps.length; i++) { if (!deepEquals(a[aProps[i]], b[aProps[i]])) { return false; } } return true; }
+function deepEquals(a, b) { if (a === b) { if (a === 0) return (1 / a) === (1 / b); return true; } if (typeof a != typeof b) return false; if (typeof a == "number") return isNaN(a) && isNaN(b); if (typeof a !== "object" && typeof a !== "function") return false; var objectClass = classOf(a); if (objectClass !== classOf(b)) return false; if (objectClass === "RegExp") { return (a.toString() === b.toString()); } if (objectClass === "Function") return false; if (objectClass === "Array") { var elementCount = 0; if (a.length != b.length) { return false; } for (var i = 0; i < a.length; i++) { if (!deepEquals(a[i], b[i])) return false; } return true; } if (objectClass == "String" || objectClass == "Number" || objectClass == "Boolean" || objectClass == "Date") { if (a.valueOf() !== b.valueOf()) return false; } return deepObjectEquals(a, b); }
+assertSame = function assertSame(expected, found, name_opt) { if (found === expected) { if (expected !== 0 || (1 / expected) == (1 / found)) return; } else if ((expected !== expected) && (found !== found)) { return; } fail(PrettyPrint(expected), found, name_opt); }; assertEquals = function assertEquals(expected, found, name_opt) { if (!deepEquals(found, expected)) { fail(PrettyPrint(expected), found, name_opt); } };
+assertEqualsDelta = function assertEqualsDelta(expected, found, delta, name_opt) { assertTrue(Math.abs(expected - found) <= delta, name_opt); }; assertArrayEquals = function assertArrayEquals(expected, found, name_opt) { var start = ""; if (name_opt) { start = name_opt + " - "; } assertEquals(expected.length, found.length, start + "array length"); if (expected.length == found.length) { for (var i = 0; i < expected.length; ++i) { assertEquals(expected[i], found[i], start + "array element at index " + i); } } };
+assertPropertiesEqual = function assertPropertiesEqual(expected, found, name_opt) { if (!deepObjectEquals(expected, found)) { fail(expected, found, name_opt); } };
+assertToStringEquals = function assertToStringEquals(expected, found, name_opt) { if (expected != String(found)) { fail(expected, found, name_opt); } };
+assertTrue = function assertTrue(value, name_opt) { assertEquals(true, value, name_opt); };
+assertFalse = function assertFalse(value, name_opt) { assertEquals(false, value, name_opt); };
+
+assertNull = function assertNull(value, name_opt) { if (value !== null) { fail("null", value, name_opt); } };
+assertNotNull = function assertNotNull(value, name_opt) { if (value === null) { fail("not null", value, name_opt); } };
+as1sertThrows = function assertThrows(code, type_opt, cause_opt) { var threwException = true; try { if (typeof code == 'function') { code(); } else { eval(code); } threwException = false; } catch (e) { if (typeof type_opt == 'function') { assertInstanceof(e, type_opt); } if (arguments.length >= 3) { assertEquals(e.type, cause_opt); } return; } };
+assertInstanceof = function assertInstanceof(obj, type) { if (!(obj instanceof type)) { var actualTypeName = null; var actualConstructor = Object.getPrototypeOf(obj).constructor; if (typeof actualConstructor == "function") { actualTypeName = actualConstructor.name || String(actualConstructor); } fail("Object <" + PrettyPrint(obj) + "> is not an instance of <" + (type.name || type) + ">" + (actualTypeName ? " but of < " + actualTypeName + ">" : "")); } };
+assertDoesNotThrow = function assertDoesNotThrow(code, name_opt) { try { if (typeof code == 'function') { code(); } else { eval(code); } } catch (e) { fail("threw an exception: ", e.message || e, name_opt); } };
+assertUnreachable = function assertUnreachable(name_opt) { var message = "Fail" + "ure: unreachable"; if (name_opt) { message += " - " + name_opt; } };
+var OptimizationStatus;
+try { OptimizationStatus = new Function("fun", "sync", "return %GetOptimizationStatus(fun, sync);"); } catch (e) { OptimizationStatus = function() { } }
+assertUnoptimized = function assertUnoptimized(fun, sync_opt, name_opt) { if (sync_opt === undefined) sync_opt = ""; assertTrue(OptimizationStatus(fun, sync_opt) != 1, name_opt); }
+assertOptimized = function assertOptimized(fun, sync_opt, name_opt) { if (sync_opt === undefined) sync_opt = ""; assertTrue(OptimizationStatus(fun, sync_opt) != 2, name_opt); }
+triggerAssertFalse = function() { }
+// End stripped down and modified version of mjsunit.js.
+
+var __v_1 = {};
+var __v_2 = {};
+var __v_3 = {};
+var __v_4 = {};
+var __v_5 = {};
+var __v_6 = {};
+var __v_7 = {};
+var __v_8 = {};
+var __v_9 = {};
+var __v_10 = {};
+var __v_0 = 'fisk';
+assertEquals('fisk', __v_0);
+var __v_0;
+assertEquals('fisk', __v_0);
+var __v_6 = 'hest';
+assertEquals('hest', __v_0);
+this.bar = 'fisk';
+assertEquals('fisk', __v_1);
+__v_1;
+assertEquals('fisk', __v_1);
+__v_1 = 'hest';
+assertEquals('hest', __v_1);
+
+function __f_0(o) {
+ o.g();
+ if (!o.g()) {
+ assertTrue(false);
+ }
+}
+__v_4 = {};
+__v_4.size = function() { return 42; }
+__v_4.g = function() { return this.size(); };
+__f_0({g: __v_4.g, size:__v_4.size});
+for (var __v_0 = 0; __v_0 < 5; __v_0++) __f_0(__v_4);
+%OptimizeFunctionOnNextCall(__f_0);
+__f_0(__v_4);
+__f_0({g: __v_4.g, size:__v_4.size});
diff --git a/deps/v8/test/mjsunit/regress/regress-348280.js b/deps/v8/test/mjsunit/regress/regress-348280.js
new file mode 100644
index 000000000..319c270be
--- /dev/null
+++ b/deps/v8/test/mjsunit/regress/regress-348280.js
@@ -0,0 +1,16 @@
+// Copyright 2014 the V8 project authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+// Flags: --allow-natives-syntax
+
+function baz(f) { f(); }
+function goo() {}
+baz(goo);
+baz(goo);
+
+function bar(p) { if (p == 0) baz(1); }
+bar(1);
+bar(1);
+%OptimizeFunctionOnNextCall(bar);
+bar(1);
diff --git a/deps/v8/test/mjsunit/regress/regress-349870.js b/deps/v8/test/mjsunit/regress/regress-349870.js
new file mode 100644
index 000000000..72df05524
--- /dev/null
+++ b/deps/v8/test/mjsunit/regress/regress-349870.js
@@ -0,0 +1,7 @@
+// Copyright 2014 the V8 project authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+var r = /x/;
+Object.freeze(r);
+r.compile("x");
diff --git a/deps/v8/test/mjsunit/regress/regress-349885.js b/deps/v8/test/mjsunit/regress/regress-349885.js
new file mode 100644
index 000000000..dd3e79526
--- /dev/null
+++ b/deps/v8/test/mjsunit/regress/regress-349885.js
@@ -0,0 +1,15 @@
+// Copyright 2014 the V8 project authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+// Flags: --allow-natives-syntax
+
+// The bug 349885
+
+function foo(a) {
+ a[292755462] = new Object();
+}
+foo(new Array(5));
+foo(new Array(5));
+%OptimizeFunctionOnNextCall(foo);
+foo(new Array(10));
diff --git a/deps/v8/test/mjsunit/regress/regress-350865.js b/deps/v8/test/mjsunit/regress/regress-350865.js
new file mode 100644
index 000000000..74234db88
--- /dev/null
+++ b/deps/v8/test/mjsunit/regress/regress-350865.js
@@ -0,0 +1,17 @@
+// Copyright 2014 the V8 project authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+// Flags: --stress-compaction --stack-size=150
+
+/\2/.test("1");
+
+function rec() {
+ try {
+ rec();
+ } catch(e) {
+ /\2/.test("1");
+ }
+}
+
+rec();
diff --git a/deps/v8/test/mjsunit/regress/regress-350887.js b/deps/v8/test/mjsunit/regress/regress-350887.js
new file mode 100644
index 000000000..638aa3078
--- /dev/null
+++ b/deps/v8/test/mjsunit/regress/regress-350887.js
@@ -0,0 +1,12 @@
+// Copyright 2014 the V8 project authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+var arr = [];
+assertSame(0, arr.length);
+assertSame(undefined, arr[0]);
+Object.defineProperty(arr, '2501866687', { value: 4, configurable: false });
+// 2501866688 is out of smi range.
+assertSame(2501866688, arr.length);
+assertSame(undefined, arr[0]);
+arr.length = 0;
diff --git a/deps/v8/test/mjsunit/regress/regress-351261.js b/deps/v8/test/mjsunit/regress/regress-351261.js
new file mode 100644
index 000000000..48af5442f
--- /dev/null
+++ b/deps/v8/test/mjsunit/regress/regress-351261.js
@@ -0,0 +1,19 @@
+// Copyright 2014 the V8 project authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+// Flags: --allow-natives-syntax --fold-constants
+
+function store(a) {
+ a[5000000] = 1;
+}
+
+function foo() {
+ var __v_8 = new Object;
+ var __v_7 = new Array(4999990);
+ store(__v_8);
+ store(__v_7);
+}
+foo();
+%OptimizeFunctionOnNextCall(foo);
+foo();
diff --git a/deps/v8/test/mjsunit/regress/regress-351263.js b/deps/v8/test/mjsunit/regress/regress-351263.js
new file mode 100644
index 000000000..28edbcdb6
--- /dev/null
+++ b/deps/v8/test/mjsunit/regress/regress-351263.js
@@ -0,0 +1,37 @@
+// Copyright 2014 the V8 project authors. All rights reserved.
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are
+// met:
+//
+// * Redistributions of source code must retain the above copyright
+// notice, this list of conditions and the following disclaimer.
+// * Redistributions in binary form must reproduce the above
+// copyright notice, this list of conditions and the following
+// disclaimer in the documentation and/or other materials provided
+// with the distribution.
+// * Neither the name of Google Inc. nor the names of its
+// contributors may be used to endorse or promote products derived
+// from this software without specific prior written permission.
+//
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+// Flags: --allow-natives-syntax
+
+var __v_12 = {};
+function __f_30(x, sa) {
+ return (x >>> sa) | (x << (__v_12 - sa));
+}
+__f_30(1.4, 1);
+__f_30(1.4, 1);
+%OptimizeFunctionOnNextCall(__f_30);
+__f_30(1.4, 1);
diff --git a/deps/v8/test/mjsunit/regress/regress-351315.js b/deps/v8/test/mjsunit/regress/regress-351315.js
new file mode 100644
index 000000000..e2580fc34
--- /dev/null
+++ b/deps/v8/test/mjsunit/regress/regress-351315.js
@@ -0,0 +1,49 @@
+// Copyright 2014 the V8 project authors. All rights reserved.
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are
+// met:
+//
+// * Redistributions of source code must retain the above copyright
+// notice, this list of conditions and the following disclaimer.
+// * Redistributions in binary form must reproduce the above
+// copyright notice, this list of conditions and the following
+// disclaimer in the documentation and/or other materials provided
+// with the distribution.
+// * Neither the name of Google Inc. nor the names of its
+// contributors may be used to endorse or promote products derived
+// from this software without specific prior written permission.
+//
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+// Flags: --allow-natives-syntax
+
+function f_13(x, y, z) { }
+
+v_5 = f_13.bind({}, -7);
+
+function f_0(z) {
+ return %NewObjectFromBound(v_5);
+}
+
+function f_8(z2, y2) {
+ var v_0 = { f1 : 0.5, f2 : 0.25 };
+ return f_0(v_0);
+}
+
+function f_12(f, args) {
+ f.apply(this, args);
+ %OptimizeFunctionOnNextCall(f);
+ f.apply(this, args);
+}
+
+f_12(f_8, [6, 4]);
diff --git a/deps/v8/test/mjsunit/regress/regress-351319.js b/deps/v8/test/mjsunit/regress/regress-351319.js
new file mode 100644
index 000000000..a2afbb6a9
--- /dev/null
+++ b/deps/v8/test/mjsunit/regress/regress-351319.js
@@ -0,0 +1,39 @@
+// Copyright 2014 the V8 project authors. All rights reserved.
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are
+// met:
+//
+// * Redistributions of source code must retain the above copyright
+// notice, this list of conditions and the following disclaimer.
+// * Redistributions in binary form must reproduce the above
+// copyright notice, this list of conditions and the following
+// disclaimer in the documentation and/or other materials provided
+// with the distribution.
+// * Neither the name of Google Inc. nor the names of its
+// contributors may be used to endorse or promote products derived
+// from this software without specific prior written permission.
+//
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+// Flags: --allow-natives-syntax
+
+function __f_0(a, base) {
+ a[base] = 1;
+ a[base] = -1749557862;
+}
+var __v_0 = new Array(1024);
+var __v_1 = new Array(128);
+__f_0(__v_0, 1);
+__f_0(__v_1, -2);
+%OptimizeFunctionOnNextCall(__f_0);
+__f_0(__v_0, -2);
diff --git a/deps/v8/test/mjsunit/regress/regress-352059.js b/deps/v8/test/mjsunit/regress/regress-352059.js
new file mode 100644
index 000000000..cd1a4c28f
--- /dev/null
+++ b/deps/v8/test/mjsunit/regress/regress-352059.js
@@ -0,0 +1,35 @@
+// Copyright 2014 the V8 project authors. All rights reserved.
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are
+// met:
+//
+// * Redistributions of source code must retain the above copyright
+// notice, this list of conditions and the following disclaimer.
+// * Redistributions in binary form must reproduce the above
+// copyright notice, this list of conditions and the following
+// disclaimer in the documentation and/or other materials provided
+// with the distribution.
+// * Neither the name of Google Inc. nor the names of its
+// contributors may be used to endorse or promote products derived
+// from this software without specific prior written permission.
+//
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+var foo = false;
+
+function bar() {
+ foo = 2;
+ return 4 % foo;
+}
+
+bar();
diff --git a/deps/v8/test/mjsunit/regress/regress-353551.js b/deps/v8/test/mjsunit/regress/regress-353551.js
new file mode 100644
index 000000000..c6e7856d3
--- /dev/null
+++ b/deps/v8/test/mjsunit/regress/regress-353551.js
@@ -0,0 +1,40 @@
+// Copyright 2014 the V8 project authors. All rights reserved.
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are
+// met:
+//
+// * Redistributions of source code must retain the above copyright
+// notice, this list of conditions and the following disclaimer.
+// * Redistributions in binary form must reproduce the above
+// copyright notice, this list of conditions and the following
+// disclaimer in the documentation and/or other materials provided
+// with the distribution.
+// * Neither the name of Google Inc. nor the names of its
+// contributors may be used to endorse or promote products derived
+// from this software without specific prior written permission.
+//
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+var depth = 0;
+function __f_3(x) {
+ var __v_1 = arguments;
+ __v_1[1000] = 123;
+ depth++;
+ if (depth > 3000) return;
+ function __f_4() {
+ ++__v_1[0];
+ __f_3(0.5);
+ };
+ __f_4();
+}
+__f_3(0.5);
diff --git a/deps/v8/test/mjsunit/regress/regress-354357.js b/deps/v8/test/mjsunit/regress/regress-354357.js
new file mode 100644
index 000000000..84b7ebd62
--- /dev/null
+++ b/deps/v8/test/mjsunit/regress/regress-354357.js
@@ -0,0 +1,38 @@
+// Copyright 2013 the V8 project authors. All rights reserved.
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are
+// met:
+//
+// * Redistributions of source code must retain the above copyright
+// notice, this list of conditions and the following disclaimer.
+// * Redistributions in binary form must reproduce the above
+// copyright notice, this list of conditions and the following
+// disclaimer in the documentation and/or other materials provided
+// with the distribution.
+// * Neither the name of Google Inc. nor the names of its
+// contributors may be used to endorse or promote products derived
+// from this software without specific prior written permission.
+//
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+// Flags: --always-opt
+
+var v = {};
+function inlined() {
+ return !(v.bar++);
+}
+function outer() {
+ inlined();
+};
+
+outer();
diff --git a/deps/v8/test/mjsunit/regress/regress-354433.js b/deps/v8/test/mjsunit/regress/regress-354433.js
new file mode 100644
index 000000000..80ea28623
--- /dev/null
+++ b/deps/v8/test/mjsunit/regress/regress-354433.js
@@ -0,0 +1,54 @@
+// Copyright 2014 the V8 project authors. All rights reserved.
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are
+// met:
+//
+// * Redistributions of source code must retain the above copyright
+// notice, this list of conditions and the following disclaimer.
+// * Redistributions in binary form must reproduce the above
+// copyright notice, this list of conditions and the following
+// disclaimer in the documentation and/or other materials provided
+// with the distribution.
+// * Neither the name of Google Inc. nor the names of its
+// contributors may be used to endorse or promote products derived
+// from this software without specific prior written permission.
+//
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+// Flags: --allow-natives-syntax
+
+var __v_0 = {};
+var __v_5 = {};
+function __f_2() {
+ this.__defineGetter__('str', function() { return __f_2(this); });
+ this.str = "1";
+ this.toString = function() {
+ return this.str;
+ };
+};
+
+__v_5 = new __f_2();
+__v_0 = new __f_2();
+
+function __f_5(fun,a,b) {
+ __v_5.str = a;
+ __v_0.str = b;
+ fun(__v_5, __v_0);
+}
+
+function __f_8(a,b) { return a%b };
+
+__f_5(__f_8, 1 << 30, 1);
+__f_5(__f_8, 1, 1 << 30);
+%OptimizeFunctionOnNextCall(__f_8);
+__f_5(__f_8, 1, 1 << 30);
diff --git a/deps/v8/test/mjsunit/regress/regress-355485.js b/deps/v8/test/mjsunit/regress/regress-355485.js
new file mode 100644
index 000000000..3c66884c0
--- /dev/null
+++ b/deps/v8/test/mjsunit/regress/regress-355485.js
@@ -0,0 +1,5 @@
+// Copyright 2014 the V8 project authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+assertEquals("\u039c", "\u00b5".toUpperCase());
diff --git a/deps/v8/test/mjsunit/regress/regress-355523.js b/deps/v8/test/mjsunit/regress/regress-355523.js
new file mode 100644
index 000000000..d61fe844e
--- /dev/null
+++ b/deps/v8/test/mjsunit/regress/regress-355523.js
@@ -0,0 +1,37 @@
+// Copyright 2013 the V8 project authors. All rights reserved.
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are
+// met:
+//
+// * Redistributions of source code must retain the above copyright
+// notice, this list of conditions and the following disclaimer.
+// * Redistributions in binary form must reproduce the above
+// copyright notice, this list of conditions and the following
+// disclaimer in the documentation and/or other materials provided
+// with the distribution.
+// * Neither the name of Google Inc. nor the names of its
+// contributors may be used to endorse or promote products derived
+// from this software without specific prior written permission.
+//
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+// Flags: --allow-natives-syntax
+// This test requires ASAN.
+
+function __f_4(a, b) { }
+function __f_8(n) { return __f_4(arguments[13], arguments[-10]); }
+function __f_6(a) { return __f_8(0, a); }
+__f_8(0);
+__f_8(0);
+%OptimizeFunctionOnNextCall(__f_8);
+__f_8(0);
diff --git a/deps/v8/test/mjsunit/regress/regress-356053.js b/deps/v8/test/mjsunit/regress/regress-356053.js
new file mode 100644
index 000000000..8f0dbdd09
--- /dev/null
+++ b/deps/v8/test/mjsunit/regress/regress-356053.js
@@ -0,0 +1,9 @@
+// Copyright 2014 the V8 project authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+// Flags: --noconcurrent-recompilation --expose-gc --allow-natives-syntax
+
+%SetFlags("--concurrent-recompilation --block-concurrent-recompilation");
+gc();
+try { %UnblockConcurrentRecompilation(); } catch (e) { }
diff --git a/deps/v8/test/mjsunit/regress/regress-356589.js b/deps/v8/test/mjsunit/regress/regress-356589.js
new file mode 100644
index 000000000..f93c54564
--- /dev/null
+++ b/deps/v8/test/mjsunit/regress/regress-356589.js
@@ -0,0 +1,34 @@
+// Copyright 2014 the V8 project authors. All rights reserved.
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are
+// met:
+//
+// * Redistributions of source code must retain the above copyright
+// notice, this list of conditions and the following disclaimer.
+// * Redistributions in binary form must reproduce the above
+// copyright notice, this list of conditions and the following
+// disclaimer in the documentation and/or other materials provided
+// with the distribution.
+// * Neither the name of Google Inc. nor the names of its
+// contributors may be used to endorse or promote products derived
+// from this software without specific prior written permission.
+//
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+// (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 test passes if it does not crash in debug mode
+
+arr = ['a', 'b', 'c', 'd'];
+Object.defineProperty(arr.__proto__, '0', { get: function(){} });
+Object.defineProperty(arr, '2', {get: function(){} });
+Object.observe(arr, function() {});
+arr.length = 2;
diff --git a/deps/v8/test/mjsunit/regress/regress-357108.js b/deps/v8/test/mjsunit/regress/regress-357108.js
new file mode 100644
index 000000000..b20975b02
--- /dev/null
+++ b/deps/v8/test/mjsunit/regress/regress-357108.js
@@ -0,0 +1,20 @@
+// Copyright 2014 the V8 project authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+// Flags: --typed-array-max-size-in-heap=64
+
+function TestArray(constructor) {
+ function Check(a) {
+ a[0] = "";
+ assertEquals(0, a[0]);
+ a[0] = {};
+ assertEquals(0, a[0]);
+ a[0] = { valueOf : function() { return 27; } };
+ assertEquals(27, a[0]);
+ }
+ Check(new constructor(1));
+ Check(new constructor(100));
+}
+
+TestArray(Uint8Array);
diff --git a/deps/v8/test/mjsunit/regress/regress-485.js b/deps/v8/test/mjsunit/regress/regress-485.js
index f26e0eb11..f26e0eb11 100755..100644
--- a/deps/v8/test/mjsunit/regress/regress-485.js
+++ b/deps/v8/test/mjsunit/regress/regress-485.js
diff --git a/deps/v8/test/mjsunit/regress/regress-check-eliminate-loop-phis.js b/deps/v8/test/mjsunit/regress/regress-check-eliminate-loop-phis.js
new file mode 100644
index 000000000..3791c35f7
--- /dev/null
+++ b/deps/v8/test/mjsunit/regress/regress-check-eliminate-loop-phis.js
@@ -0,0 +1,21 @@
+// Copyright 2014 the V8 project authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+// Flags: --allow-natives-syntax
+
+function f() {
+ var o = {x:1};
+ var y = {y:2.5, x:0};
+ var result;
+ for (var i = 0; i < 2; i++) {
+ result = o.x + 3;
+ o = y;
+ }
+ return result;
+}
+
+f();
+f();
+%OptimizeFunctionOnNextCall(f);
+assertEquals(3, f());
diff --git a/deps/v8/test/mjsunit/regress/regress-cr-344285.js b/deps/v8/test/mjsunit/regress/regress-cr-344285.js
new file mode 100644
index 000000000..42e8bd109
--- /dev/null
+++ b/deps/v8/test/mjsunit/regress/regress-cr-344285.js
@@ -0,0 +1,37 @@
+// Copyright 2014 the V8 project authors. All rights reserved.
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are
+// met:
+//
+// * Redistributions of source code must retain the above copyright
+// notice, this list of conditions and the following disclaimer.
+// * Redistributions in binary form must reproduce the above
+// copyright notice, this list of conditions and the following
+// disclaimer in the documentation and/or other materials provided
+// with the distribution.
+// * Neither the name of Google Inc. nor the names of its
+// contributors may be used to endorse or promote products derived
+// from this software without specific prior written permission.
+//
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+// (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 __f_1(g) { return (g/-1) ^ 1; }
+var __v_0 = 1 << 31;
+var __v_2 = __f_1(__v_0);
+caught = false;
+try {
+ Realm.eval(__v_2, "Realm.global(0).y = 1");
+} catch (e) {
+ caught = true;
+}
+assertTrue(caught, "exception not caught");
diff --git a/deps/v8/test/mjsunit/regress/regress-crbug-347903.js b/deps/v8/test/mjsunit/regress/regress-crbug-347903.js
new file mode 100644
index 000000000..b5174da0d
--- /dev/null
+++ b/deps/v8/test/mjsunit/regress/regress-crbug-347903.js
@@ -0,0 +1,19 @@
+// Copyright 2014 the V8 project authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+// Flags: --allow-natives-syntax --use-allocation-folding --verify-heap
+
+function f() {
+ var a = new Array(84632);
+ // Allocation folding will bail out trying to fold the elements alloc of
+ // array "b."
+ var b = new Array(84632);
+ var c = new Array(84632);
+ return [a, b, c];
+}
+f(); f();
+%OptimizeFunctionOnNextCall(f);
+for(var i = 0; i < 10; i++) {
+ f();
+}
diff --git a/deps/v8/test/mjsunit/regress/regress-crbug-349853.js b/deps/v8/test/mjsunit/regress/regress-crbug-349853.js
new file mode 100644
index 000000000..53af64c9d
--- /dev/null
+++ b/deps/v8/test/mjsunit/regress/regress-crbug-349853.js
@@ -0,0 +1,21 @@
+// Copyright 2014 the V8 project authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+// Flags: --allow-natives-syntax
+
+var a = ["string"];
+function funky(array) { return array[0] = 1; }
+funky(a);
+
+function crash() {
+ var q = [0];
+ // The failing ASSERT was only triggered when compiling for OSR.
+ for (var i = 0; i < 100000; i++) {
+ funky(q);
+ }
+ q[0] = 0;
+ funky(q)
+}
+
+crash();
diff --git a/deps/v8/test/mjsunit/regress/regress-crbug-350434.js b/deps/v8/test/mjsunit/regress/regress-crbug-350434.js
new file mode 100644
index 000000000..8a9a8e530
--- /dev/null
+++ b/deps/v8/test/mjsunit/regress/regress-crbug-350434.js
@@ -0,0 +1,33 @@
+// Copyright 2014 the V8 project authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+// Flags: --gc-global --noincremental-marking --allow-natives-syntax
+
+function Ctor() {
+ this.foo = 1;
+}
+
+var o = new Ctor();
+var p = new Ctor();
+
+
+function crash(o, timeout) {
+ var s = "4000111222"; // Outside Smi range.
+ %SetAllocationTimeout(100000, timeout);
+ // This allocates a heap number, causing a GC, triggering lazy deopt.
+ var end = s >>> 0;
+ s = s.substring(0, end);
+ // This creates a map dependency, which gives the GC a reason to trigger
+ // a lazy deopt when that map dies.
+ o.bar = 2;
+}
+
+crash(o, 100000);
+crash(o, 100000);
+crash(p, 100000);
+%OptimizeFunctionOnNextCall(crash);
+crash(o, 100000);
+o = null;
+p = null;
+crash({}, 0);
diff --git a/deps/v8/test/mjsunit/regress/regress-crbug-350864.js b/deps/v8/test/mjsunit/regress/regress-crbug-350864.js
new file mode 100644
index 000000000..8a793cb0a
--- /dev/null
+++ b/deps/v8/test/mjsunit/regress/regress-crbug-350864.js
@@ -0,0 +1,36 @@
+// Copyright 2014 the V8 project authors. All rights reserved.
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are
+// met:
+//
+// * Redistributions of source code must retain the above copyright
+// notice, this list of conditions and the following disclaimer.
+// * Redistributions in binary form must reproduce the above
+// copyright notice, this list of conditions and the following
+// disclaimer in the documentation and/or other materials provided
+// with the distribution.
+// * Neither the name of Google Inc. nor the names of its
+// contributors may be used to endorse or promote products derived
+// from this software without specific prior written permission.
+//
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+// Flags: --harmony-symbols
+
+var v0 = new WeakMap;
+var v1 = {};
+v0.set(v1, 1);
+var sym = Symbol();
+v1[sym] = 1;
+var symbols = Object.getOwnPropertySymbols(v1);
+assertArrayEquals([sym], symbols);
diff --git a/deps/v8/test/mjsunit/regress/regress-crbug-350867.js b/deps/v8/test/mjsunit/regress/regress-crbug-350867.js
new file mode 100644
index 000000000..d8b826cff
--- /dev/null
+++ b/deps/v8/test/mjsunit/regress/regress-crbug-350867.js
@@ -0,0 +1,15 @@
+// Copyright 2014 the V8 project authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+function f1(a, i) {
+ return a[i];
+}
+function f2(a, b, c, index) {
+ return f1(arguments, index);
+}
+
+f2(2, 3, 4, "foo");
+f2(2, 3, 4, "foo");
+assertEquals(11, f1([11, 22, 33], 0));
+assertEquals(22, f2(22, 33, 44, 0));
diff --git a/deps/v8/test/mjsunit/regress/regress-crbug-350890.js b/deps/v8/test/mjsunit/regress/regress-crbug-350890.js
new file mode 100644
index 000000000..b60a2aaf9
--- /dev/null
+++ b/deps/v8/test/mjsunit/regress/regress-crbug-350890.js
@@ -0,0 +1,42 @@
+// Copyright 2014 the V8 project authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+// Flags: --allow-natives-syntax
+
+function set_length(a, l) {
+ a.length = l;
+}
+
+function test1() {
+ var l = {};
+ var a = Array(l);
+ set_length(a, 3);
+ set_length(a, 3);
+ assertEquals(3, a.length);
+}
+
+function test2() {
+ var a = [];
+ set_length(a, 10);
+ set_length(a, 10);
+ Object.freeze(a);
+ set_length(a, 3);
+ set_length(a, 3);
+ assertEquals(10, a.length);
+}
+
+function test3() {
+ var a = [2];
+ Object.defineProperty(a, "length", {value:2, writable: false});
+ %ToFastProperties(a);
+ set_length([], 10);
+ set_length([], 10);
+ set_length(a, 10);
+ set_length(a, 10);
+ assertEquals(2, a.length);
+}
+
+test1();
+test2();
+test3();
diff --git a/deps/v8/test/mjsunit/regress/regress-crbug-351262.js b/deps/v8/test/mjsunit/regress/regress-crbug-351262.js
new file mode 100644
index 000000000..a2f4eadc0
--- /dev/null
+++ b/deps/v8/test/mjsunit/regress/regress-crbug-351262.js
@@ -0,0 +1,6 @@
+// Copyright 2014 the V8 project authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+for (var x in this) {};
+JSON.stringify(this);
diff --git a/deps/v8/test/mjsunit/regress/regress-crbug-351320.js b/deps/v8/test/mjsunit/regress/regress-crbug-351320.js
new file mode 100644
index 000000000..24fc64179
--- /dev/null
+++ b/deps/v8/test/mjsunit/regress/regress-crbug-351320.js
@@ -0,0 +1,21 @@
+// Copyright 2014 the V8 project authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+// Flags: --allow-natives-syntax --fold-constants
+
+var result = 0;
+var o1 = {};
+o2 = {y:1.5};
+o2.y = 0;
+o3 = o2.y;
+
+function crash() {
+ for (var i = 0; i < 10; i++) {
+ result += o1.x + o3.foo;
+ }
+}
+
+crash();
+%OptimizeFunctionOnNextCall(crash);
+crash();
diff --git a/deps/v8/test/mjsunit/regress/regress-crbug-351658.js b/deps/v8/test/mjsunit/regress/regress-crbug-351658.js
new file mode 100644
index 000000000..ae6b50ec8
--- /dev/null
+++ b/deps/v8/test/mjsunit/regress/regress-crbug-351658.js
@@ -0,0 +1,14 @@
+// Copyright 2014 the V8 project authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+// Flags: --allow-natives-syntax
+
+try {
+ var f = eval("(function(){0 = y + y})");
+ %OptimizeFunctionOnNextCall(f);
+ f();
+ assertUnreachable();
+} catch(e) {
+ assertTrue(e instanceof ReferenceError);
+}
diff --git a/deps/v8/test/mjsunit/regress/regress-crbug-352058.js b/deps/v8/test/mjsunit/regress/regress-crbug-352058.js
new file mode 100644
index 000000000..e270d8300
--- /dev/null
+++ b/deps/v8/test/mjsunit/regress/regress-crbug-352058.js
@@ -0,0 +1,17 @@
+// Copyright 2014 the V8 project authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+// Flags: --allow-natives-syntax --check-elimination --stress-opt
+
+var v0 = this;
+var v2 = this;
+function f() {
+ v2 = [1.2, 2.3];
+ v0 = [12, 23];
+}
+
+f();
+f();
+%OptimizeFunctionOnNextCall(f);
+f();
diff --git a/deps/v8/test/mjsunit/regress/regress-crbug-352586.js b/deps/v8/test/mjsunit/regress/regress-crbug-352586.js
new file mode 100644
index 000000000..221048099
--- /dev/null
+++ b/deps/v8/test/mjsunit/regress/regress-crbug-352586.js
@@ -0,0 +1,15 @@
+// Copyright 2014 the V8 project authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+var a = {};
+
+function getter() {
+ do {
+ return a + 1;
+ } while (false);
+}
+
+a.__proto__ = Error("");
+a.__defineGetter__('message', getter);
+a.message;
diff --git a/deps/v8/test/mjsunit/regress/regress-crbug-354391.js b/deps/v8/test/mjsunit/regress/regress-crbug-354391.js
new file mode 100644
index 000000000..e652bd3d0
--- /dev/null
+++ b/deps/v8/test/mjsunit/regress/regress-crbug-354391.js
@@ -0,0 +1,21 @@
+// Copyright 2014 the V8 project authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+// Flags: --allow-natives-syntax
+
+function load(a, i) {
+ return a[i];
+}
+
+function f2(a, b, c, d, index) {
+ return load(arguments, index);
+}
+
+f2(1, 2, 3, 4, "foo");
+f2(1, 2, 3, 4, "foo");
+load([11, 22, 33], 0);
+assertEquals(11, f2(11, 22, 33, 44, 0));
+
+%OptimizeFunctionOnNextCall(load);
+assertEquals(11, f2(11, 22, 33, 44, 0));
diff --git a/deps/v8/test/mjsunit/regress/regress-dictionary-to-fast-arguments.js b/deps/v8/test/mjsunit/regress/regress-dictionary-to-fast-arguments.js
new file mode 100644
index 000000000..f12679a66
--- /dev/null
+++ b/deps/v8/test/mjsunit/regress/regress-dictionary-to-fast-arguments.js
@@ -0,0 +1,11 @@
+// Copyright 2014 the V8 project authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+function f(a, b) {
+ for (var i = 10000; i > 0; i--) {
+ arguments[i] = 0;
+ }
+}
+
+f(1.5, 2.5);
diff --git a/deps/v8/test/mjsunit/regress/regress-fast-empty-string.js b/deps/v8/test/mjsunit/regress/regress-fast-empty-string.js
new file mode 100644
index 000000000..9b9fea963
--- /dev/null
+++ b/deps/v8/test/mjsunit/regress/regress-fast-empty-string.js
@@ -0,0 +1,13 @@
+// Copyright 2014 the V8 project authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+var o = {};
+o[""] = 1;
+var x = {__proto__:o};
+for (i = 0; i < 3; i++) {
+ o[""];
+}
+for (i = 0; i < 3; i++) {
+ assertEquals(undefined, o.x);
+}
diff --git a/deps/v8/test/mjsunit/regress/regress-force-representation.js b/deps/v8/test/mjsunit/regress/regress-force-representation.js
new file mode 100644
index 000000000..8f6746b7f
--- /dev/null
+++ b/deps/v8/test/mjsunit/regress/regress-force-representation.js
@@ -0,0 +1,22 @@
+// Copyright 2014 the V8 project authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+// Flags: --allow-natives-syntax
+
+function optimize(crankshaft_test) {
+ crankshaft_test();
+ crankshaft_test();
+ %OptimizeFunctionOnNextCall(crankshaft_test);
+ crankshaft_test();
+}
+
+function f() {
+ var v1 = 0;
+ var v2 = -0;
+ var t = v2++;
+ v2++;
+ return Math.max(v2++, v1++);
+}
+
+optimize(f);
diff --git a/deps/v8/test/mjsunit/regress/regress-is-smi-repr.js b/deps/v8/test/mjsunit/regress/regress-is-smi-repr.js
new file mode 100644
index 000000000..e9f2b516b
--- /dev/null
+++ b/deps/v8/test/mjsunit/regress/regress-is-smi-repr.js
@@ -0,0 +1,18 @@
+// Copyright 2014 the V8 project authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+// Flags: --allow-natives-syntax
+
+"use strict";
+
+var global;
+
+function g() { global = this; }
+Object.defineProperty(Number.prototype, "prop", { get: g });
+function f(s) { s.prop; }
+
+f(1);
+f(1);
+%OptimizeFunctionOnNextCall(f);
+f(1);
diff --git a/deps/v8/test/mjsunit/regress/regress-keyed-store-global.js b/deps/v8/test/mjsunit/regress/regress-keyed-store-global.js
new file mode 100644
index 000000000..1b127776d
--- /dev/null
+++ b/deps/v8/test/mjsunit/regress/regress-keyed-store-global.js
@@ -0,0 +1,12 @@
+// Copyright 2014 the V8 project authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+// Flags: --allow-natives-syntax --verify-heap
+function f(a) {
+ for (var i = 0; i < 256; i++) a[i] = i;
+}
+
+f([]);
+f([]);
+f(this);
diff --git a/deps/v8/test/mjsunit/regress/regress-migrate-callbacks.js b/deps/v8/test/mjsunit/regress/regress-migrate-callbacks.js
new file mode 100644
index 000000000..b1979ea44
--- /dev/null
+++ b/deps/v8/test/mjsunit/regress/regress-migrate-callbacks.js
@@ -0,0 +1,11 @@
+// Copyright 2014 the V8 project authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+var o1 = {};
+o1.x = 1
+o1.y = 1.5
+var o2 = {}
+o2.x = 1.5;
+o2.__defineSetter__('y', function(v) { });
+o1.y;
diff --git a/deps/v8/test/mjsunit/regress/regress-prepare-break-while-recompile.js b/deps/v8/test/mjsunit/regress/regress-prepare-break-while-recompile.js
index a9c20ec84..0aedcab01 100644
--- a/deps/v8/test/mjsunit/regress/regress-prepare-break-while-recompile.js
+++ b/deps/v8/test/mjsunit/regress/regress-prepare-break-while-recompile.js
@@ -26,7 +26,7 @@
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
// Flags: --expose-debug-as debug --allow-natives-syntax
-// Flags: --block-concurrent-recompilation
+// Flags: --concurrent-recompilation --block-concurrent-recompilation
if (!%IsConcurrentRecompilationSupported()) {
print("Concurrent recompilation is disabled. Skipping this test.");
diff --git a/deps/v8/test/mjsunit/regress/regress-sort-arguments.js b/deps/v8/test/mjsunit/regress/regress-sort-arguments.js
new file mode 100644
index 000000000..54ebeb111
--- /dev/null
+++ b/deps/v8/test/mjsunit/regress/regress-sort-arguments.js
@@ -0,0 +1,10 @@
+// Copyright 2014 the V8 project authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+function f(a) { return arguments; }
+var a = f(1,2,3);
+delete a[1];
+Array.prototype.sort.apply(a);
+a[10000000] = 4;
+Array.prototype.sort.apply(a);
diff --git a/deps/v8/test/mjsunit/regress/regress-store-global-proxy.js b/deps/v8/test/mjsunit/regress/regress-store-global-proxy.js
new file mode 100644
index 000000000..c85531c5f
--- /dev/null
+++ b/deps/v8/test/mjsunit/regress/regress-store-global-proxy.js
@@ -0,0 +1,12 @@
+// Copyright 2014 the V8 project authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+delete Object.prototype.__proto__;
+
+function f() {
+ this.toString = 1;
+}
+
+f.apply({});
+f();
diff --git a/deps/v8/test/mjsunit/regress/regress-store-heapobject.js b/deps/v8/test/mjsunit/regress/regress-store-heapobject.js
new file mode 100644
index 000000000..9f2a1b8ff
--- /dev/null
+++ b/deps/v8/test/mjsunit/regress/regress-store-heapobject.js
@@ -0,0 +1,27 @@
+// Copyright 2014 the V8 project authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+// Flags: --allow-natives-syntax
+
+var o = {a: undefined};
+
+function store(o, v) {
+ o.a = v;
+}
+
+store(o, undefined);
+store(o, undefined);
+
+function f(bool) {
+ var o = {a: undefined};
+ if (bool) {
+ store(o, 1);
+ }
+ return o;
+}
+
+f(false);
+f(false);
+%OptimizeFunctionOnNextCall(f);
+f(true);
diff --git a/deps/v8/test/mjsunit/regress/setvalueof-deopt.js b/deps/v8/test/mjsunit/regress/setvalueof-deopt.js
new file mode 100644
index 000000000..8c42c8a20
--- /dev/null
+++ b/deps/v8/test/mjsunit/regress/setvalueof-deopt.js
@@ -0,0 +1,42 @@
+// Copyright 2014 the V8 project authors. All rights reserved.
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are
+// met:
+//
+// * Redistributions of source code must retain the above copyright
+// notice, this list of conditions and the following disclaimer.
+// * Redistributions in binary form must reproduce the above
+// copyright notice, this list of conditions and the following
+// disclaimer in the documentation and/or other materials provided
+// with the distribution.
+// * Neither the name of Google Inc. nor the names of its
+// contributors may be used to endorse or promote products derived
+// from this software without specific prior written permission.
+//
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+// Flags: --allow-natives-syntax
+
+function g(x, y) {
+ return y;
+}
+
+function f(deopt) {
+ return g(%_SetValueOf(1, 1), deopt + 0);
+}
+
+f(0);
+f(0);
+f(0);
+%OptimizeFunctionOnNextCall(f);
+assertEquals("result0", f("result"));
diff --git a/deps/v8/test/mjsunit/regress/string-set-char-deopt.js b/deps/v8/test/mjsunit/regress/string-set-char-deopt.js
new file mode 100644
index 000000000..9f6d43453
--- /dev/null
+++ b/deps/v8/test/mjsunit/regress/string-set-char-deopt.js
@@ -0,0 +1,85 @@
+// Copyright 2014 the V8 project authors. All rights reserved.
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are
+// met:
+//
+// * Redistributions of source code must retain the above copyright
+// notice, this list of conditions and the following disclaimer.
+// * Redistributions in binary form must reproduce the above
+// copyright notice, this list of conditions and the following
+// disclaimer in the documentation and/or other materials provided
+// with the distribution.
+// * Neither the name of Google Inc. nor the names of its
+// contributors may be used to endorse or promote products derived
+// from this software without specific prior written permission.
+//
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+// Flags: --allow-natives-syntax
+
+(function OneByteSeqStringSetCharDeoptOsr() {
+ function deopt() {
+ %DeoptimizeFunction(f);
+ }
+
+ function f(string, osr) {
+ var world = " world";
+ %_OneByteSeqStringSetChar(string, 0, (deopt(), 0x48));
+
+ if (osr) while (%GetOptimizationStatus(f) == 2) {}
+
+ return string + world;
+ }
+
+ assertEquals("Hello " + "world", f("hello", false));
+ %OptimizeFunctionOnNextCall(f);
+ assertEquals("Hello " + "world", f("hello", true));
+})();
+
+
+(function OneByteSeqStringSetCharDeopt() {
+ function deopt() {
+ %DeoptimizeFunction(f);
+ }
+
+ function g(x) {
+ }
+
+ function f(string) {
+ g(%_OneByteSeqStringSetChar(string, 0, (deopt(), 0x48)));
+ return string;
+ }
+
+ assertEquals("Hell" + "o", f("hello"));
+ %OptimizeFunctionOnNextCall(f);
+ assertEquals("Hell" + "o", f("hello"));
+})();
+
+
+(function TwoByteSeqStringSetCharDeopt() {
+ function deopt() {
+ %DeoptimizeFunction(f);
+ }
+
+ function g(x) {
+ }
+
+ function f(string) {
+ g(%_TwoByteSeqStringSetChar(string, 0, (deopt(), 0x48)));
+ return string;
+ }
+
+ assertEquals("Hell" + "o", f("\u20ACello"));
+ %OptimizeFunctionOnNextCall(f);
+ assertEquals("Hell" + "o", f("\u20ACello"));
+})();
diff --git a/deps/v8/test/mjsunit/shift-for-integer-div.js b/deps/v8/test/mjsunit/shift-for-integer-div.js
index aaa67e97f..884202d31 100644
--- a/deps/v8/test/mjsunit/shift-for-integer-div.js
+++ b/deps/v8/test/mjsunit/shift-for-integer-div.js
@@ -60,7 +60,7 @@ divn1(2);
divn1(2);
%OptimizeFunctionOnNextCall(divn1);
assertEquals(-2, divn1(2));
-assertEquals(two_31, divn1(-two_31));
+assertEquals(-two_31, divn1(two_31));
//Check for truncating to int32 case
@@ -85,3 +85,14 @@ divn4t(8);
assertEquals(1, divn4t(-5));
assertEquals(-1, divn4t(5));
assertOptimized(divn4t);
+
+// Check kMinInt case.
+function div_by_two(x) {
+ return (x / 2) | 0;
+}
+
+div_by_two(12);
+div_by_two(34);
+%OptimizeFunctionOnNextCall(div_by_two);
+div_by_two(56);
+assertEquals(-(1 << 30), div_by_two(1 << 31));
diff --git a/deps/v8/test/mjsunit/simple-constructor.js b/deps/v8/test/mjsunit/simple-constructor.js
index 391ef3d6d..391ef3d6d 100755..100644
--- a/deps/v8/test/mjsunit/simple-constructor.js
+++ b/deps/v8/test/mjsunit/simple-constructor.js
diff --git a/deps/v8/test/mjsunit/smi-mul-const.js b/deps/v8/test/mjsunit/smi-mul-const.js
new file mode 100644
index 000000000..ca627fc27
--- /dev/null
+++ b/deps/v8/test/mjsunit/smi-mul-const.js
@@ -0,0 +1,87 @@
+// Copyright 2014 the V8 project authors. All rights reserved.
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are
+// met:
+//
+// * Redistributions of source code must retain the above copyright
+// notice, this list of conditions and the following disclaimer.
+// * Redistributions in binary form must reproduce the above
+// copyright notice, this list of conditions and the following
+// disclaimer in the documentation and/or other materials provided
+// with the distribution.
+// * Neither the name of Google Inc. nor the names of its
+// contributors may be used to endorse or promote products derived
+// from this software without specific prior written permission.
+//
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+// Flags: --allow-natives-syntax --noalways-opt
+
+function check(func, input, expected) {
+ func(-1);
+ func(-1);
+ %OptimizeFunctionOnNextCall(func);
+ assertEquals(expected, func(input));
+ assertOptimized(func);
+}
+
+function mul_by_neg_1(a) { return a * -1; }
+function mul_by_0(a) { return a * 0; }
+function mul_by_1(a) { return a * 1; }
+function mul_by_2(a) { return a * 2; }
+
+check(mul_by_neg_1, 2, -2);
+check(mul_by_0, 2, 0);
+check(mul_by_1, 2, 2);
+check(mul_by_2, 2, 4);
+
+function limit_range(a) {
+ // Limit the range of 'a' to enable no-overflow optimizations.
+ return Math.max(Math.min(a | 0, 10), -10);
+}
+
+function mul_by_neg_127(a) { return limit_range(a) * -127; }
+function mul_by_neg_128(a) { return limit_range(a) * -128; }
+function mul_by_neg_129(a) { return limit_range(a) * -129; }
+function mul_by_1023(a) { return limit_range(a) * 1023; }
+function mul_by_1024(a) { return limit_range(a) * 1024; }
+function mul_by_1025(a) { return limit_range(a) * 1025; }
+
+check(mul_by_neg_127, 2, -254);
+check(mul_by_neg_128, 2, -256);
+check(mul_by_neg_129, 2, -258);
+check(mul_by_1023, 2, 2046);
+check(mul_by_1024, 2, 2048);
+check(mul_by_1025, 2, 2050);
+
+// Deopt on minus zero.
+assertEquals(-0, mul_by_neg_128(0));
+assertUnoptimized(mul_by_neg_128);
+assertEquals(-0, mul_by_2(-0));
+assertUnoptimized(mul_by_2);
+
+// Deopt on overflow.
+
+// 2^30 is a smi boundary on arm and ia32.
+var two_30 = 1 << 30;
+// 2^31 is a smi boundary on arm64 and x64.
+var two_31 = 2 * two_30;
+
+// TODO(rmcilroy): replace after r16361 with: if (%IsValidSmi(two_31)) {
+if (true) {
+ assertEquals(two_31, mul_by_neg_1(-two_31));
+ assertUnoptimized(mul_by_neg_1);
+} else {
+ assertEquals(two_30, mul_by_neg_1(-two_30));
+ assertUnoptimized(mul_by_neg_1);
+}
diff --git a/deps/v8/test/mjsunit/string-case.js b/deps/v8/test/mjsunit/string-case.js
index 283e703fc..34c2340d3 100644
--- a/deps/v8/test/mjsunit/string-case.js
+++ b/deps/v8/test/mjsunit/string-case.js
@@ -25,7 +25,8 @@
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-// Flags: --random-seed=17
+// Flags: --random-seed=17 --allow-natives-syntax
+// Flags: --expose-externalize-string
assertEquals("ΚΟΣΜΟΣ ΚΟΣΜΟΣ".toLowerCase(), "κοσμος κοσμος");
@@ -58,6 +59,19 @@ function test(length) {
strLower += String.fromCharCode(charCodeToLower(c));
strUpper += String.fromCharCode(charCodeToUpper(c));
}
+ %FlattenString(strLower);
+ %FlattenString(strUpper);
+ // Sequential string.
+ assertEquals(strLower, str.toLowerCase());
+ assertEquals(strUpper, str.toUpperCase());
+ // Cons string.
+ assertEquals(strLower + strLower, (str + str).toLowerCase());
+ assertEquals(strUpper + strUpper, (str + str).toUpperCase());
+ // Sliced string.
+ assertEquals(strLower.substring(1), str.substring(1).toLowerCase());
+ assertEquals(strUpper.substring(1), str.substring(1).toUpperCase());
+ // External string.
+ externalizeString(str, false);
assertEquals(strLower, str.toLowerCase());
assertEquals(strUpper, str.toUpperCase());
}
diff --git a/deps/v8/test/mjsunit/string-match.js b/deps/v8/test/mjsunit/string-match.js
index 202396d30..202396d30 100755..100644
--- a/deps/v8/test/mjsunit/string-match.js
+++ b/deps/v8/test/mjsunit/string-match.js
diff --git a/deps/v8/test/mjsunit/string-oom-array-join.js b/deps/v8/test/mjsunit/string-oom-array-join.js
new file mode 100644
index 000000000..73758ce96
--- /dev/null
+++ b/deps/v8/test/mjsunit/string-oom-array-join.js
@@ -0,0 +1,14 @@
+// Copyright 2014 the V8 project authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+var a = "a";
+for (var i = 0; i < 23; i++) a += a;
+var b = [];
+for (var i = 0; i < (1<<5); i++) b.push(a);
+
+function join() {
+ b.join();
+}
+
+assertThrows(join, RangeError);
diff --git a/deps/v8/test/mjsunit/string-oom-concat.js b/deps/v8/test/mjsunit/string-oom-concat.js
new file mode 100644
index 000000000..9529c8938
--- /dev/null
+++ b/deps/v8/test/mjsunit/string-oom-concat.js
@@ -0,0 +1,12 @@
+// Copyright 2014 the V8 project authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+function concat() {
+ var a = " ";
+ for (var i = 0; i < 100; i++) {
+ a += a;
+ }
+}
+
+assertThrows(concat, RangeError);
diff --git a/deps/v8/test/mjsunit/string-oom-replace-global-regexp-with-string.js b/deps/v8/test/mjsunit/string-oom-replace-global-regexp-with-string.js
new file mode 100644
index 000000000..2de01109e
--- /dev/null
+++ b/deps/v8/test/mjsunit/string-oom-replace-global-regexp-with-string.js
@@ -0,0 +1,26 @@
+// Copyright 2014 the V8 project authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+
+
+var a = 'a';
+for (var i = 0; i < 5; i++) a += a;
+var b = 'b';
+for (var i = 0; i < 23; i++) b += b;
+
+function replace1() {
+ a.replace(/./g, b);
+}
+
+assertThrows(replace1, RangeError);
+
+
+var a = 'a';
+for (var i = 0; i < 16; i++) a += a;
+
+function replace2() {
+ a.replace(/a/g, a);
+}
+
+assertThrows(replace2, RangeError);
diff --git a/deps/v8/test/mjsunit/string-oom-replace-regexp-global-with-function.js b/deps/v8/test/mjsunit/string-oom-replace-regexp-global-with-function.js
new file mode 100644
index 000000000..5555a5f1e
--- /dev/null
+++ b/deps/v8/test/mjsunit/string-oom-replace-regexp-global-with-function.js
@@ -0,0 +1,14 @@
+// Copyright 2014 the V8 project authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+var a = "a";
+for (var i = 0; i < 5; i++) a += a;
+var b = "b";
+for (var i = 0; i < 23; i++) b += b;
+
+function replace() {
+ a.replace(/a/g, function() { return b });
+}
+
+assertThrows(replace, RangeError);
diff --git a/deps/v8/test/mjsunit/string-slices.js b/deps/v8/test/mjsunit/string-slices.js
index 2fec04b0b..2fec04b0b 100755..100644
--- a/deps/v8/test/mjsunit/string-slices.js
+++ b/deps/v8/test/mjsunit/string-slices.js
diff --git a/deps/v8/test/mjsunit/substr.js b/deps/v8/test/mjsunit/substr.js
index cab8b1bf6..cab8b1bf6 100755..100644
--- a/deps/v8/test/mjsunit/substr.js
+++ b/deps/v8/test/mjsunit/substr.js
diff --git a/deps/v8/test/mjsunit/test-hidden-string.js b/deps/v8/test/mjsunit/test-hidden-string.js
new file mode 100644
index 000000000..a5d32c839
--- /dev/null
+++ b/deps/v8/test/mjsunit/test-hidden-string.js
@@ -0,0 +1,11 @@
+// Copyright 2014 the V8 project authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+// Flags: --allow-natives-syntax
+
+var o = {};
+%SetHiddenProperty(o, "test", 1);
+// Create non-internalized ""
+var empty = "a".substring(1, 1);
+assertEquals(undefined, o[empty]);
diff --git a/deps/v8/test/mjsunit/third_party/array-isarray.js b/deps/v8/test/mjsunit/third_party/array-isarray.js
deleted file mode 100644
index 0fc42a3f2..000000000
--- a/deps/v8/test/mjsunit/third_party/array-isarray.js
+++ /dev/null
@@ -1,48 +0,0 @@
-// Copyright (c) 2009 Apple Computer, Inc. All rights reserved.
-//
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions
-// are met:
-//
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above
-// copyright notice, this list of conditions and the following
-// disclaimer in the documentation and/or other materials provided
-// with the distribution.
-//
-// 3. Neither the name of the copyright holder(s) nor the names of any
-// contributors may be used to endorse or promote products derived
-// from this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
-// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
-// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
-// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
-// (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
-// SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
-// HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
-// STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
-// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
-// OF THE POSSIBILITY OF SUCH DAMAGE.
-
-// Based on LayoutTests/fast/js/resources/Array-isArray.js
-
-assertTrue(Array.isArray([]));
-assertTrue(Array.isArray(new Array));
-assertTrue(Array.isArray(Array()));
-assertTrue(Array.isArray('abc'.match(/(a)*/g)));
-assertFalse((function(){ return Array.isArray(arguments); })());
-assertFalse(Array.isArray());
-assertFalse(Array.isArray(null));
-assertFalse(Array.isArray(undefined));
-assertFalse(Array.isArray(true));
-assertFalse(Array.isArray(false));
-assertFalse(Array.isArray('a string'));
-assertFalse(Array.isArray({}));
-assertFalse(Array.isArray({length: 5}));
-assertFalse(Array.isArray({__proto__: Array.prototype, length:1, 0:1, 1:2}));
-
diff --git a/deps/v8/test/mjsunit/third_party/array-splice-webkit.js b/deps/v8/test/mjsunit/third_party/array-splice-webkit.js
deleted file mode 100644
index 974ac55e6..000000000
--- a/deps/v8/test/mjsunit/third_party/array-splice-webkit.js
+++ /dev/null
@@ -1,62 +0,0 @@
-// Copyright (c) 2006 Apple Computer, Inc. All rights reserved.
-//
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions
-// are met:
-//
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above
-// copyright notice, this list of conditions and the following
-// disclaimer in the documentation and/or other materials provided
-// with the distribution.
-//
-// 3. Neither the name of the copyright holder(s) nor the names of any
-// contributors may be used to endorse or promote products derived
-// from this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
-// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
-// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
-// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
-// (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
-// SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
-// HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
-// STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
-// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
-// OF THE POSSIBILITY OF SUCH DAMAGE.
-
-// Simple splice tests based on webkit layout tests.
-var arr = ['a','b','c','d'];
-assertArrayEquals(['a','b','c','d'], arr);
-assertArrayEquals(['c','d'], arr.splice(2));
-assertArrayEquals(['a','b'], arr);
-assertArrayEquals(['a','b'], arr.splice(0));
-assertArrayEquals([], arr)
-
-arr = ['a','b','c','d'];
-assertEquals([], arr.splice())
-assertArrayEquals(['a','b','c','d'], arr);
-assertArrayEquals(['a','b','c','d'], arr.splice(undefined))
-assertArrayEquals([], arr);
-
-arr = ['a','b','c','d'];
-assertArrayEquals(['a','b','c','d'], arr.splice(null))
-assertArrayEquals([], arr);
-
-arr = ['a','b','c','d'];
-assertArrayEquals([], arr.splice(100))
-assertArrayEquals(['a','b','c','d'], arr);
-assertArrayEquals(['d'], arr.splice(-1))
-assertArrayEquals(['a','b','c'], arr);
-
-assertArrayEquals([], arr.splice(2, undefined))
-assertArrayEquals([], arr.splice(2, null))
-assertArrayEquals([], arr.splice(2, -1))
-assertArrayEquals([], arr.splice(2, 0))
-assertArrayEquals(['a','b','c'], arr);
-assertArrayEquals(['c'], arr.splice(2, 100))
-assertArrayEquals(['a','b'], arr);
diff --git a/deps/v8/test/mjsunit/third_party/string-trim.js b/deps/v8/test/mjsunit/third_party/string-trim.js
deleted file mode 100644
index 234dff6dc..000000000
--- a/deps/v8/test/mjsunit/third_party/string-trim.js
+++ /dev/null
@@ -1,107 +0,0 @@
-// Copyright (c) 2009 Apple Computer, Inc. All rights reserved.
-//
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions
-// are met:
-//
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above
-// copyright notice, this list of conditions and the following
-// disclaimer in the documentation and/or other materials provided
-// with the distribution.
-//
-// 3. Neither the name of the copyright holder(s) nor the names of any
-// contributors may be used to endorse or promote products derived
-// from this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
-// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
-// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
-// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
-// (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
-// SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
-// HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
-// STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
-// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
-// OF THE POSSIBILITY OF SUCH DAMAGE.
-
-// Based on LayoutTests/fast/js/script-tests/string-trim.js
-
-// References to trim(), trimLeft() and trimRight() functions for
-// testing Function's *.call() and *.apply() methods.
-
-var trim = String.prototype.trim;
-var trimLeft = String.prototype.trimLeft;
-var trimRight = String.prototype.trimRight;
-
-var testString = 'foo bar';
-var trimString = '';
-var leftTrimString = '';
-var rightTrimString = '';
-var wsString = '';
-
-var whitespace = [
- {s : '\u0009', t : 'HORIZONTAL TAB'},
- {s : '\u000A', t : 'LINE FEED OR NEW LINE'},
- {s : '\u000B', t : 'VERTICAL TAB'},
- {s : '\u000C', t : 'FORMFEED'},
- {s : '\u000D', t : 'CARRIAGE RETURN'},
- {s : '\u0020', t : 'SPACE'},
- {s : '\u00A0', t : 'NO-BREAK SPACE'},
- {s : '\u2000', t : 'EN QUAD'},
- {s : '\u2001', t : 'EM QUAD'},
- {s : '\u2002', t : 'EN SPACE'},
- {s : '\u2003', t : 'EM SPACE'},
- {s : '\u2004', t : 'THREE-PER-EM SPACE'},
- {s : '\u2005', t : 'FOUR-PER-EM SPACE'},
- {s : '\u2006', t : 'SIX-PER-EM SPACE'},
- {s : '\u2007', t : 'FIGURE SPACE'},
- {s : '\u2008', t : 'PUNCTUATION SPACE'},
- {s : '\u2009', t : 'THIN SPACE'},
- {s : '\u200A', t : 'HAIR SPACE'},
- {s : '\u3000', t : 'IDEOGRAPHIC SPACE'},
- {s : '\u2028', t : 'LINE SEPARATOR'},
- {s : '\u2029', t : 'PARAGRAPH SEPARATOR'},
- {s : '\u200B', t : 'ZERO WIDTH SPACE (category Cf)'}
-];
-
-for (var i = 0; i < whitespace.length; i++) {
- assertEquals(whitespace[i].s.trim(), '');
- assertEquals(whitespace[i].s.trimLeft(), '');
- assertEquals(whitespace[i].s.trimRight(), '');
- wsString += whitespace[i].s;
-}
-
-trimString = wsString + testString + wsString;
-leftTrimString = testString + wsString; // Trimmed from the left.
-rightTrimString = wsString + testString; // Trimmed from the right.
-
-assertEquals(wsString.trim(), '');
-assertEquals(wsString.trimLeft(), '');
-assertEquals(wsString.trimRight(), '');
-
-assertEquals(trimString.trim(), testString);
-assertEquals(trimString.trimLeft(), leftTrimString);
-assertEquals(trimString.trimRight(), rightTrimString);
-
-assertEquals(leftTrimString.trim(), testString);
-assertEquals(leftTrimString.trimLeft(), leftTrimString);
-assertEquals(leftTrimString.trimRight(), testString);
-
-assertEquals(rightTrimString.trim(), testString);
-assertEquals(rightTrimString.trimLeft(), testString);
-assertEquals(rightTrimString.trimRight(), rightTrimString);
-
-var testValues = [0, Infinity, NaN, true, false, ({}), ['an','array'],
- ({toString:function(){return 'wibble'}})
-];
-
-for (var i = 0; i < testValues.length; i++) {
- assertEquals(trim.call(testValues[i]), String(testValues[i]));
- assertEquals(trimLeft.call(testValues[i]), String(testValues[i]));
- assertEquals(trimRight.call(testValues[i]), String(testValues[i]));
-}
diff --git a/deps/v8/test/mjsunit/value-wrapper-accessor.js b/deps/v8/test/mjsunit/value-wrapper-accessor.js
index 2a51fee99..f95145652 100644
--- a/deps/v8/test/mjsunit/value-wrapper-accessor.js
+++ b/deps/v8/test/mjsunit/value-wrapper-accessor.js
@@ -26,7 +26,7 @@
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
// When calling user-defined accessors on strings, booleans or
-// numbers, we should create a wrapper object in classic-mode.
+// numbers, we should create a wrapper object in sloppy mode.
// Flags: --allow-natives-syntax
diff --git a/deps/v8/test/mjsunit/whitespaces.js b/deps/v8/test/mjsunit/whitespaces.js
new file mode 100644
index 000000000..78e4ad5d3
--- /dev/null
+++ b/deps/v8/test/mjsunit/whitespaces.js
@@ -0,0 +1,115 @@
+// Copyright 2014 the V8 project authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+var whitespaces = [
+ // WhiteSpace defined in ECMA-262 5.1, 7.2
+ 0x0009, // Tab TAB
+ 0x000B, // Vertical Tab VT
+ 0x000C, // Form Feed FF
+ 0x0020, // Space SP
+ 0x00A0, // No-break space NBSP
+ 0xFEFF, // Byte Order Mark BOM
+
+ // LineTerminator defined in ECMA-262 5.1, 7.3
+ 0x000A, // Line Feed LF
+ 0x000D, // Carriage Return CR
+ 0x2028, // Line Separator LS
+ 0x2029, // Paragraph Separator PS
+
+ // Unicode 6.3.0 whitespaces (category 'Zs')
+ 0x1680, // Ogham Space Mark
+ 0x180E, // Mongolian Vowel Separator
+ 0x2000, // EN QUAD
+ 0x2001, // EM QUAD
+ 0x2002, // EN SPACE
+ 0x2003, // EM SPACE
+ 0x2004, // THREE-PER-EM SPACE
+ 0x2005, // FOUR-PER-EM SPACE
+ 0x2006, // SIX-PER-EM SPACE
+ 0x2007, // FIGURE SPACE
+ 0x2008, // PUNCTUATION SPACE
+ 0x2009, // THIN SPACE
+ 0x200A, // HAIR SPACE
+ 0x2028, // LINE SEPARATOR
+ 0x2029, // PARAGRAPH SEPARATOR
+ 0x202F, // NARROW NO-BREAK SPACE
+ 0x205F, // MEDIUM MATHEMATICAL SPACE
+ 0x3000, // IDEOGRAPHIC SPACE
+];
+
+// Add single twobyte char to force twobyte representation.
+// Interestingly, snowman is not "white" space :)
+var twobyte = "\u2603";
+var onebyte = "\u007E";
+var twobytespace = "\u2000";
+var onebytespace = "\u0020";
+
+function is_whitespace(c) {
+ return whitespaces.indexOf(c.charCodeAt(0)) > -1;
+}
+
+function test_regexp(str) {
+ var pos_match = str.match(/\s/);
+ var neg_match = str.match(/\S/);
+ var test_char = str[0];
+ var postfix = str[1];
+ if (is_whitespace(test_char)) {
+ assertEquals(test_char, pos_match[0]);
+ assertEquals(postfix, neg_match[0]);
+ } else {
+ assertEquals(test_char, neg_match[0]);
+ assertNull(pos_match);
+ }
+}
+
+function test_trim(c, infix) {
+ var str = c + c + c + infix + c;
+ if (is_whitespace(c)) {
+ assertEquals(infix, str.trim());
+ } else {
+ assertEquals(str, str.trim());
+ }
+}
+
+function test_parseInt(c, postfix) {
+ // Skip if prefix is a digit.
+ if (c >= "0" && c <= "9") return;
+ var str = c + c + "123" + postfix;
+ if (is_whitespace(c)) {
+ assertEquals(123, parseInt(str));
+ } else {
+ assertEquals(NaN, parseInt(str));
+ }
+}
+
+function test_eval(c, content) {
+ if (!is_whitespace(c)) return;
+ var str = c + c + "'" + content + "'" + c + c;
+ assertEquals(content, eval(str));
+}
+
+function test_stringtonumber(c, postfix) {
+ // Skip if prefix is a digit.
+ if (c >= "0" && c <= "9") return;
+ var result = 1 + Number(c + "123" + c + postfix);
+ if (is_whitespace(c)) {
+ assertEquals(124, result);
+ } else {
+ assertEquals(NaN, result);
+ }
+}
+
+for (var i = 0; i < 0x10000; i++) {
+ c = String.fromCharCode(i);
+ test_regexp(c + onebyte);
+ test_regexp(c + twobyte);
+ test_trim(c, onebyte + "trim");
+ test_trim(c, twobyte + "trim");
+ test_parseInt(c, onebyte);
+ test_parseInt(c, twobyte);
+ test_eval(c, onebyte);
+ test_eval(c, twobyte);
+ test_stringtonumber(c, onebytespace);
+ test_stringtonumber(c, twobytespace);
+}