Skip to content
This repository has been archived by the owner on Oct 15, 2020. It is now read-only.

src,test: fix V8 engine issues #519

Merged
merged 1 commit into from
Apr 23, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 0 additions & 7 deletions node.gyp
Original file line number Diff line number Diff line change
Expand Up @@ -1014,13 +1014,6 @@
'include_dirs': [
'deps/v8/include'
],
'conditions' : [
['node_use_v8_platform=="true"', {
'dependencies': [
'deps/v8/src/v8.gyp:v8_libplatform',
],
}],
]
}],
['node_engine=="chakracore"', {
'include_dirs': [
Expand Down
2 changes: 2 additions & 0 deletions src/node.cc
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,9 @@
#if NODE_USE_V8_PLATFORM
#include "libplatform/libplatform.h"
#endif // NODE_USE_V8_PLATFORM
#ifdef NODE_ENGINE_CHAKRACORE
#include "v8-debug.h"
#endif
#include "v8-profiler.h"
#include "zlib.h"

Expand Down
35 changes: 27 additions & 8 deletions test/common/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -605,16 +605,22 @@ exports.nodeProcessAborted = function nodeProcessAborted(exitCode, signal) {
};

function areAllValuesStringEqual(obj) {
let exemplar;
for (const key of Object.keys(obj)) {
if (exemplar === undefined) {
exemplar = obj[key].toString();
} else if (exemplar !== obj[key].toString()) {
return false;
try {
let exemplar;
for (const key of Object.keys(obj)) {
if (exemplar === undefined) {
exemplar = obj[key].toString();
} else if (exemplar !== obj[key].toString()) {
return false;
}
}
}

return true;
return true;
} catch (e) {
// If any exceptions are thrown just return false. They are likely due to
// symbols being used in the message object.
return false;
}
}

exports.engineSpecificMessage = function(messageObject) {
Expand All @@ -635,6 +641,19 @@ exports.engineSpecificMessage = function(messageObject) {
return undefined;
};

exports.requireInternalV8 = function() {
if (exports.isChakraEngine) {
return {
previewMapIterator: function() { return []; },
previewSetIterator: function() { return []; },
previewWeakMap: function() { return []; },
previewWeakSet: function() { return []; }
};
} else {
return require('internal/v8');
}
};

exports.busyLoop = function busyLoop(time) {
const startTime = Timer.now();
const stopTime = startTime + time;
Expand Down
1 change: 0 additions & 1 deletion test/es-module/es-module.status
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ test-esm-loader-modulemap : SKIP
test-esm-main-lookup : SKIP
test-esm-named-exports : SKIP
test-esm-namespace : SKIP
test-esm-ok : SKIP
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Was this test just removed?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like it was moved in fddcd62.

test-esm-preserve-symlinks : SKIP
test-esm-preserve-symlinks-not-found : SKIP
test-esm-preserve-symlinks-not-found-plain : SKIP
Expand Down
1 change: 0 additions & 1 deletion test/parallel/parallel.status
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,6 @@ test-util : SKIP
test-util-format-shared-arraybuffer : SKIP
test-util-inspect-proxy : SKIP
test-v8-serdes : SKIP
test-v8-serdes-sharedarraybuffer : SKIP
test-vm-attributes-property-not-on-sandbox : SKIP
test-vm-cached-data : SKIP
test-vm-codegen : SKIP
Expand Down
6 changes: 2 additions & 4 deletions test/parallel/test-assert.js
Original file line number Diff line number Diff line change
Expand Up @@ -636,8 +636,7 @@ common.expectsError(
type: assert.AssertionError,
generatedMessage: !common.isChakraEngine,
message: engineSpecificAssert(
`The expression evaluated to a falsy value:${EOL}${EOL} ` +
`assert.ok(null)${EOL}`,
`assert.ok(null)${EOL}`,
'null == true')
}
);
Expand All @@ -648,8 +647,7 @@ common.expectsError(
type: assert.AssertionError,
generatedMessage: !common.isChakraEngine,
message: engineSpecificAssert(
`The expression evaluated to a falsy value:${EOL}${EOL} ` +
`assert(typeof 123 === 'string')${EOL}`,
`assert(typeof 123 === 'string')${EOL}`,
'false == true')
}
);
Expand Down
6 changes: 1 addition & 5 deletions test/parallel/test-util-inspect.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,7 @@ const assert = require('assert');
const JSStream = process.binding('js_stream').JSStream;
const util = require('util');
const vm = require('vm');
if (!common.isChakraEngine) {
// eslint-disable-next-line no-unused-vars
const { previewMapIterator } = require('internal/v8');
}
const { previewMapIterator } = common.requireInternalV8();

assert.strictEqual(util.inspect(1), '1');
assert.strictEqual(util.inspect(false), 'false');
Expand Down Expand Up @@ -460,7 +457,6 @@ assert.strictEqual(util.inspect(-5e-324), '-5e-324');
if (!common.isChakraEngine) {
const map = new Map();
map.set(1, 2);
// eslint-disable-next-line no-undef
const vals = previewMapIterator(map.entries());
const valsOutput = [];
for (const o of vals) {
Expand Down