forked from nodejs/node
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
adding support to test nextTick() by reading int values from a javasc…
…ript array, as opposed to returning a new v8::Integer each time
- Loading branch information
1 parent
7f2d1b3
commit 6086ed7
Showing
7 changed files
with
156 additions
and
24 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
'use strict'; | ||
|
||
const async_wrap = process.binding('async_wrap'); | ||
|
||
const nextIdArray = async_wrap.getNextAsyncId2(); | ||
const currentIdArray = async_wrap.getCurrentAsyncId2(); | ||
|
||
function getLittleEndian(a) { | ||
if (a[0] === 0xffffffff) { | ||
a[0] = 0; | ||
a[1]++; | ||
} | ||
return a[0] + a[1] * 0x100000000; | ||
} | ||
|
||
function getBigEndian(a) { | ||
if (a[1] === 0xffffffff) { | ||
a[1] = 0; | ||
a[0]++; | ||
} | ||
return a[1] + a[0] * 0x100000000; | ||
} | ||
|
||
function getCurrentIdLittleEndian() { | ||
return getLittleEndian(currentIdArray); | ||
} | ||
|
||
function getCurrentIdBigEndian() { | ||
return getBigEndian(currentIdArray); | ||
} | ||
|
||
function getNextIdLittleEndian() { | ||
return getLittleEndian(nextIdArray); | ||
} | ||
|
||
function getNextIdBigEndian() { | ||
return getBigEndian(nextIdArray); | ||
} | ||
|
||
module.exports.getCurrentAsyncWrapId = async_wrap.getCurrentAsyncId; | ||
module.exports.getNextAsyncWrapId = async_wrap.getNextAsyncId; | ||
|
||
module.exports.getCurrentAsyncWrapId2 = | ||
process.binding('os').isBigEndian ? getCurrentIdBigEndian : getCurrentIdLittleEndian; | ||
|
||
module.exports.getNextAsyncWrapId2 = | ||
process.binding('os').isBigEndian ? getNextIdBigEndian : getNextIdLittleEndian; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters