| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent 2b12bca commit e21b873
4 files changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -23,6 +23,11 @@ const args = { | |||
| 23 | 23 | 'false-primitive': true, | |
| 24 | 24 | 'false-object': int32Array, | |
| 25 | 25 | }, | |
| 26 | + DataView: { | ||
| 27 | + 'true': dataView, | ||
| 28 | + 'false-primitive': true, | ||
| 29 | + 'false-object': uint8Array, | ||
| 30 | + }, | ||
| 26 | 31 | }; | |
| 27 | 32 | ||
| 28 | 33 | const bench = common.createBenchmark(main, { | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -6,6 +6,10 @@ const { | |||
| 6 | 6 | TypedArrayPrototypeGetSymbolToStringTag, | |
| 7 | 7 | } = primordials; | |
| 8 | 8 | ||
| 9 | + function isDataView(value) { | ||
| 10 | + return ArrayBufferIsView(value) && TypedArrayPrototypeGetSymbolToStringTag(value) === undefined; | ||
| 11 | + } | ||
| 12 | + | ||
| 9 | 13 | function isTypedArray(value) { | |
| 10 | 14 | return TypedArrayPrototypeGetSymbolToStringTag(value) !== undefined; | |
| 11 | 15 | } | |
@@ -61,6 +65,7 @@ function isBigUint64Array(value) { | |||
| 61 | 65 | module.exports = { | |
| 62 | 66 | ...internalBinding('types'), | |
| 63 | 67 | isArrayBufferView: ArrayBufferIsView, | |
| 68 | + isDataView, | ||
| 64 | 69 | isTypedArray, | |
| 65 | 70 | isUint8Array, | |
| 66 | 71 | isUint8ClampedArray, | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -19,7 +19,6 @@ namespace { | |||
| 19 | 19 | V(AsyncFunction) \ | |
| 20 | 20 | V(BigIntObject) \ | |
| 21 | 21 | V(BooleanObject) \ | |
| 22 | - V(DataView) \ | ||
| 23 | 22 | V(Date) \ | |
| 24 | 23 | V(External) \ | |
| 25 | 24 | V(GeneratorFunction) \ | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -650,23 +650,6 @@ for (const [ value, _method ] of [ | |||
| 650 | 650 | } | |
| 651 | 651 | } | |
| 652 | 652 | ||
| 653 | - { | ||
| 654 | - function testIsDataView(input) { | ||
| 655 | - return types.isDataView(input); | ||
| 656 | - } | ||
| 657 | - | ||
| 658 | - eval('%PrepareFunctionForOptimization(testIsDataView)'); | ||
| 659 | - testIsDataView(new DataView(new ArrayBuffer())); | ||
| 660 | - eval('%OptimizeFunctionOnNextCall(testIsDataView)'); | ||
| 661 | - assert.strictEqual(testIsDataView(new DataView(new ArrayBuffer())), true); | ||
| 662 | - assert.strictEqual(testIsDataView(Math.random()), false); | ||
| 663 | - | ||
| 664 | - if (common.isDebug) { | ||
| 665 | - const { getV8FastApiCallCount } = internalBinding('debug'); | ||
| 666 | - assert.strictEqual(getV8FastApiCallCount('types.isDataView'), 2); | ||
| 667 | - } | ||
| 668 | - } | ||
| 669 | - | ||
| 670 | 653 | { | |
| 671 | 654 | function testIsSharedArrayBuffer(input) { | |
| 672 | 655 | return types.isSharedArrayBuffer(input); | |
| Back | FazBrowse Home | New Git URL |
0 commit comments