54271c21e2
What will we get: - console would be included into snapshot and allow us to reduce time that we spent in contextCreated function (~5 times faster), - it allows us to make further small improvement of console methods, e.g. we can implement super quick return from console.assert if first argument is true, - console calls are ~ 15% faster. CQ_INCLUDE_TRYBOTS=master.tryserver.blink:linux_trusty_blink_rel;master.tryserver.chromium.linux:linux_chromium_rel_ng BUG=v8:6175 R=dgozman@chromium.org Review-Url: https://codereview.chromium.org/2785293002 Cr-Original-Original-Original-Commit-Position: refs/heads/master@{#44353} Committed:55905f85d6
Review-Url: https://codereview.chromium.org/2785293002 Cr-Original-Original-Commit-Position: refs/heads/master@{#44355} Committed:cc74ea0bc4
Review-Url: https://codereview.chromium.org/2785293002 Cr-Original-Commit-Position: refs/heads/master@{#44416} Committed:f5dc738cda
Review-Url: https://codereview.chromium.org/2785293002 Cr-Commit-Position: refs/heads/master@{#44702}
52 lines
1.8 KiB
JavaScript
52 lines
1.8 KiB
JavaScript
// Copyright 2017 the V8 project authors. All rights reserved.
|
|
// Use of this source code is governed by a BSD-style license that can be
|
|
// found in the LICENSE file.
|
|
|
|
InspectorTest.addScript(`
|
|
var self = this;
|
|
function checkPrototype() {
|
|
const prototype1 = Object.getPrototypeOf(console);
|
|
const prototype2 = Object.getPrototypeOf(prototype1);
|
|
if (Object.getOwnPropertyNames(prototype1).length !== 0)
|
|
return "false: The [[Prototype]] must have no properties";
|
|
if (prototype2 !== Object.prototype)
|
|
return "false: The [[Prototype]]'s [[Prototype]] must be %ObjectPrototype%";
|
|
return "true";
|
|
}
|
|
`);
|
|
|
|
InspectorTest.runAsyncTestSuite([
|
|
async function consoleExistsOnGlobal() {
|
|
let message = await Protocol.Runtime.evaluate({
|
|
expression: 'self.hasOwnProperty(\'console\')', returnByValue: true});
|
|
InspectorTest.log(message.result.result.value);
|
|
},
|
|
|
|
async function consoleHasRightPropertyDescriptor() {
|
|
let message = await Protocol.Runtime.evaluate({
|
|
expression: 'Object.getOwnPropertyDescriptor(self, \'console\')',
|
|
returnByValue: true});
|
|
let result = message.result.result.value;
|
|
result.value = '<value>';
|
|
InspectorTest.logObject(result);
|
|
},
|
|
|
|
async function ConsoleNotExistsOnGlobal() {
|
|
let message = await Protocol.Runtime.evaluate({
|
|
expression: '\'Console\' in self', returnByValue: true})
|
|
InspectorTest.log(message.result.result.value);
|
|
},
|
|
|
|
async function prototypeChainMustBeCorrect() {
|
|
let message = await Protocol.Runtime.evaluate({
|
|
expression: "checkPrototype()", returnByValue: true });
|
|
InspectorTest.log(message.result.result.value);
|
|
},
|
|
|
|
async function consoleToString() {
|
|
let message = await Protocol.Runtime.evaluate({
|
|
expression: 'console.toString()', returnByValue: true})
|
|
InspectorTest.log(message.result.result.value);
|
|
}
|
|
]);
|