diff options
author | Jiho Choi <jray319@gmail.com> | 2016-02-20 20:44:06 -0600 |
---|---|---|
committer | Fedor Indutny <fedor@indutny.com> | 2016-02-21 14:59:35 -0500 |
commit | d5c04c34f1db0620d69369e593384b8f64cc4228 (patch) | |
tree | b1a3d6ab657a18d12283ada47d13a5387dc30dd0 /test/parallel/test-vm-cached-data.js | |
parent | 5c14efbbe91b69bf835d2d2cff0d0aa8d165edaa (diff) | |
download | android-node-v8-d5c04c34f1db0620d69369e593384b8f64cc4228.tar.gz android-node-v8-d5c04c34f1db0620d69369e593384b8f64cc4228.tar.bz2 android-node-v8-d5c04c34f1db0620d69369e593384b8f64cc4228.zip |
vm: fix `produceCachedData`
Fix segmentation faults when compiling the same code with
`produceCachedData` option. V8 ignores the option when the code is in
its compilation cache and does not return cached data. Added
`cachedDataProduced` property to `v8.Script` to denote whether the
cached data is produced successfully.
PR-URL: https://github.com/nodejs/node/pull/5343
Reviewed-By: Fedor Indutny <fedor@indutny.com>
Diffstat (limited to 'test/parallel/test-vm-cached-data.js')
-rw-r--r-- | test/parallel/test-vm-cached-data.js | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/test/parallel/test-vm-cached-data.js b/test/parallel/test-vm-cached-data.js index 549eeecf26..924f082684 100644 --- a/test/parallel/test-vm-cached-data.js +++ b/test/parallel/test-vm-cached-data.js @@ -12,7 +12,7 @@ function produce(source) { const script = new vm.Script(source, { produceCachedData: true }); - assert(script.cachedData instanceof Buffer); + assert(!script.cachedDataProduced || script.cachedData instanceof Buffer); return script.cachedData; } @@ -31,6 +31,15 @@ function testProduceConsume() { } testProduceConsume(); +function testProduceMultiple() { + const source = getSource('original'); + + produce(source); + produce(source); + produce(source); +} +testProduceMultiple(); + function testRejectInvalid() { const source = getSource('invalid'); |