f554b1544f
This is a reland of c0e4e79ba4
Original change's description:
> [d8] implement setTimeout.
>
> R=ahaas@chromium.org, jarin@chromium.org
>
> Bug: v8:6770
> Change-Id: Iebf4dc9f2dd75079c5362e02d859c48e2113cf20
> Reviewed-on: https://chromium-review.googlesource.com/643067
> Reviewed-by: Jaroslav Sevcik <jarin@chromium.org>
> Reviewed-by: Yang Guo <yangguo@chromium.org>
> Commit-Queue: Yang Guo <yangguo@chromium.org>
> Cr-Commit-Position: refs/heads/master@{#47780}
Bug: v8:6770
Change-Id: I765b64cc597aa48871c6b2dca95dec9de94a8511
Reviewed-on: https://chromium-review.googlesource.com/647754
Reviewed-by: Jaroslav Sevcik <jarin@chromium.org>
Commit-Queue: Yang Guo <yangguo@chromium.org>
Cr-Commit-Position: refs/heads/master@{#47811}
27 lines
583 B
JavaScript
27 lines
583 B
JavaScript
// Copyright 2017 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: --no-stress-opt
|
|
|
|
var state = 0;
|
|
function inc() {
|
|
console.log("increment state");
|
|
state++;
|
|
}
|
|
|
|
function repeat() {
|
|
console.log("current state: " + state);
|
|
if (state < 3) {
|
|
setTimeout(inc, 0);
|
|
setTimeout(repeat, 0);
|
|
} else {
|
|
setTimeout(function() { throw new Error(); });
|
|
}
|
|
}
|
|
|
|
setTimeout(inc, 0);
|
|
console.log("state: " + state);
|
|
setTimeout(repeat, 0);
|
|
console.log("state: " + state);
|