Closed
Bug 800064
Opened 13 years ago
Closed 13 years ago
The watchdog time computation in JS Shell fails to properly account for units
Categories
(Core :: JavaScript Engine, defect)
Tracking
()
RESOLVED
FIXED
mozilla19
People
(Reporter: nmatsakis, Unassigned)
Details
Attachments
(1 file, 4 obsolete files)
2.73 KB,
patch
|
Details | Diff | Splinter Review |
This test looks infinitely but should not:
timeout(1);
var start = new Date();
while (true) {
var end = new Date();
var duration = (end.getTime() - start.getTime()) / 1000;
if (duration > 1) {
print("tick");
start = new Date();
}
}
The problem is that the watchdog code in the shell fails to convert into the correct NSPR interval units.
Reporter | ||
Updated•13 years ago
|
Attachment #670055 -
Flags: review?(terrence)
Updated•13 years ago
|
Attachment #670055 -
Attachment is patch: true
Comment 1•13 years ago
|
||
Comment on attachment 670055 [details] [diff] [review]
Patch to convert units.
Review of attachment 670055 [details] [diff] [review]:
-----------------------------------------------------------------
Bugzilla won't auto-detect patches so you have to check the |patch| checkbox when attaching a patch for the spliter review button to show up.
r=me with the nit below and a jit-test, as we discussed on IRC.
::: js/src/shell/js.cpp
@@ +2782,4 @@
> } else {
> + int64_t sleepDuration = gWatchdogHasTimeout
> + ? (gWatchdogTimeout - now) / PRMJ_USEC_PER_SEC * PR_TicksPerSecond()
> + : PR_INTERVAL_NO_TIMEOUT;
This is getting to0 long to look nice as a ternary. Please adjust this to:
uint64_t sleepDuration = PR_INTERVAL_NO_TIMEOUT;
if (gWatchdogHasTimeout)
sleepDuration = (gWatchdogTimeout - now) / PRMJ_USEC_PER_SEC * PR_TicksPerSecond();
Attachment #670055 -
Flags: review?(terrence) → review+
Reporter | ||
Comment 2•13 years ago
|
||
Attachment #670055 -
Attachment is obsolete: true
Attachment #670108 -
Flags: review?(terrence)
Comment 3•13 years ago
|
||
Comment on attachment 670108 [details] [diff] [review]
Fix bug, add a test.
Review of attachment 670108 [details] [diff] [review]:
-----------------------------------------------------------------
::: js/src/shell/js.cpp
@@ +2782,4 @@
> } else {
> + int64_t sleepDuration = gWatchdogHasTimeout
> + ? (gWatchdogTimeout - now) / PRMJ_USEC_PER_SEC * PR_TicksPerSecond()
> + : PR_INTERVAL_NO_TIMEOUT;
Did you forget to hg qref?
Reporter | ||
Comment 4•13 years ago
|
||
Sorry, missed your first comment about reformatting.
Attachment #670108 -
Attachment is obsolete: true
Attachment #670108 -
Flags: review?(terrence)
Attachment #670114 -
Flags: review?(terrence)
Comment 5•13 years ago
|
||
Comment on attachment 670114 [details] [diff] [review]
reformat.
Review of attachment 670114 [details] [diff] [review]:
-----------------------------------------------------------------
Looks great!
Attachment #670114 -
Flags: review?(terrence) → review+
Comment 6•13 years ago
|
||
We should get this in: I can push it for you if you'd like.
Reporter | ||
Comment 7•13 years ago
|
||
Attachment #670114 -
Attachment is obsolete: true
Reporter | ||
Comment 8•13 years ago
|
||
Terrence, just realized I forgot to add "commit-needed" to this bug (missed your comment). I'll do that now.
Reporter | ||
Updated•13 years ago
|
Keywords: checkin-needed
Reporter | ||
Comment 9•13 years ago
|
||
Attachment #680408 -
Attachment is obsolete: true
Comment 10•13 years ago
|
||
Flags: in-testsuite+
Keywords: checkin-needed
Comment 11•13 years ago
|
||
Status: NEW → RESOLVED
Closed: 13 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla19
You need to log in
before you can comment on or make changes to this bug.
Description
•