Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enabling async functions by default #1691

Merged
merged 1 commit into from
Oct 5, 2016
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
12 changes: 2 additions & 10 deletions lib/Common/ConfigFlagsList.h
Original file line number Diff line number Diff line change
Expand Up @@ -565,12 +565,7 @@ PHASE(All)
#else
#define DEFAULT_CONFIG_ArrayBufferTransfer (false)
#endif
#ifdef COMPILE_DISABLE_ES7AsyncAwait
// If ES7AsyncAwait needs to be disabled by compile flag, DEFAULT_CONFIG_ES7AsyncAwait should be false
#define DEFAULT_CONFIG_ES7AsyncAwait (false)
#else
#define DEFAULT_CONFIG_ES7AsyncAwait (false)
#endif
#define DEFAULT_CONFIG_ES7AsyncAwait (true)
#define DEFAULT_CONFIG_ES7ExponentionOperator (true)
#define DEFAULT_CONFIG_ES7TrailingComma (true)
#define DEFAULT_CONFIG_ES7ValuesEntries (true)
Expand Down Expand Up @@ -943,10 +938,7 @@ FLAGNRC(Boolean, ES6Experimental , "Enable all experimental features",

FLAGPR (Boolean, ES6, ES6Species , "Enable ES6 '@@species' properties and built-in behaviors" , DEFAULT_CONFIG_ES6Species)

#ifndef COMPILE_DISABLE_ES7AsyncAwait
#define COMPILE_DISABLE_ES7AsyncAwait 0
#endif
FLAGPR_REGOVR_EXP(Boolean, ES6, ES7AsyncAwait , "Enable ES7 'async' and 'await' keywords" , DEFAULT_CONFIG_ES7AsyncAwait)
FLAGPR (Boolean, ES6, ES7AsyncAwait , "Enable ES7 'async' and 'await' keywords" , DEFAULT_CONFIG_ES7AsyncAwait)
FLAGPR (Boolean, ES6, ES6Classes , "Enable ES6 'class' and 'extends' keywords" , DEFAULT_CONFIG_ES6Classes)
FLAGPR (Boolean, ES6, ES6DateParseFix , "Enable ES6 Date.parse fixes" , DEFAULT_CONFIG_ES6DateParseFix)
FLAGPR (Boolean, ES6, ES6DefaultArgs , "Enable ES6 Default Arguments" , DEFAULT_CONFIG_ES6DefaultArgs)
Expand Down
32 changes: 32 additions & 0 deletions test/DebuggerCommon/async.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
//-------------------------------------------------------------------------------------------------------
// Copyright (C) Microsoft. All rights reserved.
// Licensed under the MIT license. See LICENSE.txt file in the project root for full license information.
//-------------------------------------------------------------------------------------------------------

function foo() {
return this.x; /**bp:locals(1);stack()**/
}

async function af1(a) {
await a;
return await foo.call({ x : 100 }); /**bp:locals();stack()**/
}

async function af2() {
return await af1(10);
}

var p = af2();/**bp:
resume('step_into');stack();
resume('step_into');stack();
resume('step_into');stack();
**/
p.then(result => {
if (result === 100) {
print("PASS");
}
},
error => {
print("Failed : " + error);
}
);
109 changes: 109 additions & 0 deletions test/DebuggerCommon/async.js.dbg.baseline
Original file line number Diff line number Diff line change
@@ -0,0 +1,109 @@
[
{
"callStack": [
{
"line": 15,
"column": 4,
"sourceText": "return await af1(10)",
"function": "af2"
},
{
Copy link
Collaborator

Choose a reason for hiding this comment

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

In PDM based debugger baselines I see a frame here "Generator.prototype.next" why is it not here?

Copy link
Collaborator

Choose a reason for hiding this comment

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

Ok, it seems PDM enables library stack frames and our default value is false so ChakraCore doesn't give it. For now its fine but we may need to expose a functionality to enable this in ChakraCore in future.

Copy link
Contributor

Choose a reason for hiding this comment

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

Yes, nice to have that...


In reply to: 82048419 [](ancestors = 82048419)

"line": 18,
"column": 0,
"sourceText": "var p = af2()",
"function": "Global code"
}
]
},
{
"callStack": [
{
"line": 10,
"column": 4,
"sourceText": "await a",
"function": "af1"
},
{
"line": 15,
"column": 4,
"sourceText": "return await af1(10)",
"function": "af2"
},
{
"line": 18,
"column": 0,
"sourceText": "var p = af2()",
"function": "Global code"
}
]
},
{
"callStack": [
{
"line": 15,
"column": 4,
"sourceText": "return await af1(10)",
"function": "af2"
},
{
"line": 18,
"column": 0,
"sourceText": "var p = af2()",
"function": "Global code"
}
]
},
{
"this": "Object {...}",
"arguments": "Object {...}",
"locals": {
"a": "number 10"
}
},
{
"callStack": [
{
"line": 11,
"column": 4,
"sourceText": "return await foo.call({ x : 100 })",
"function": "af1"
}
]
},
{
"this": {
"x": "number 100"
},
"arguments": {
"#__proto__": "Object {...}",
"length": "number 0",
"callee": "function <large string>",
"Symbol.iterator": "function <large string>"
},
"globals": {
"WScript": "Object {...}",
"print": "function print",
"console": "Object {...}",
"foo": "function <large string>",
"af1": "function <large string>",
"af2": "function <large string>",
"p": "Promise [...]"
}
},
{
"callStack": [
{
"line": 6,
"column": 4,
"sourceText": "return this.x",
"function": "foo"
},
{
"line": 11,
"column": 4,
"sourceText": "return await foo.call({ x : 100 })",
"function": "af1"
}
]
}
]
36 changes: 36 additions & 0 deletions test/DebuggerCommon/async_step_out.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
//-------------------------------------------------------------------------------------------------------
// Copyright (C) Microsoft. All rights reserved.
// Licensed under the MIT license. See LICENSE.txt file in the project root for full license information.
//-------------------------------------------------------------------------------------------------------

function foo() {
return 100;
}

async function af1(a) {
return await foo();
}

async function af2() {
return await af1(10);
}

var p = 1;/**bp:
resume('step_over');
resume('step_into');
resume('step_into');
resume('step_out');stack();
resume('step_out');stack();**/
// If we put the break point in the below line after stepping out from af2 we will execute the same break
// point again which will add more break points. To avoid this adding the break point to a dummy statement.
p = af2();

p.then(result => {
if (result === 100) {
print("PASS");
}
},
error => {
print("Failed : " + error);
}
);
28 changes: 28 additions & 0 deletions test/DebuggerCommon/async_step_out.js.dbg.baseline
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
[
{
"callStack": [
{
"line": 14,
"column": 4,
"sourceText": "return await af1(10)",
"function": "af2"
},
{
"line": 25,
"column": 0,
"sourceText": "p = af2()",
"function": "Global code"
}
]
},
{
"callStack": [
{
"line": 25,
"column": 0,
"sourceText": "p = af2()",
"function": "Global code"
}
]
}
]
42 changes: 42 additions & 0 deletions test/DebuggerCommon/async_step_over.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
//-------------------------------------------------------------------------------------------------------
// Copyright (C) Microsoft. All rights reserved.
// Licensed under the MIT license. See LICENSE.txt file in the project root for full license information.
//-------------------------------------------------------------------------------------------------------

function foo() {
return 100;
}

async function af1(a) {
return await foo();
}

async function af2() {
return await af1(10);
}

var p = af2();/**bp:
resume('step_into');
resume('step_into');
resume('step_over');stack();
**/
p.then(result => {
if (result === 100) {
print("PASS");
}
},
error => {
print("Failed : " + error);
}
);

p = af2();/**bp:resume('step_over');stack();**/
p.then(result => {
if (result === 100) {
print("PASS");
}
},
error => {
print("Failed : " + error);
}
);
28 changes: 28 additions & 0 deletions test/DebuggerCommon/async_step_over.js.dbg.baseline
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
[
{
"callStack": [
{
"line": 14,
"column": 4,
"sourceText": "return await af1(10)",
"function": "af2"
},
{
"line": 17,
"column": 0,
"sourceText": "var p = af2()",
"function": "Global code"
}
]
},
{
"callStack": [
{
"line": 33,
"column": 0,
"sourceText": "p.then(result => {\r\n if (result === 100) {\r\n print(\"PASS\");\r\n }\r\n },\r\n error => {\r\n print(\"Failed : \" + error);\r\n } \r\n)",
Copy link
Contributor

Choose a reason for hiding this comment

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

curious why it is not truncated. Did we change the default, or ch has different default?

Copy link
Collaborator

Choose a reason for hiding this comment

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

sourceText is not truncated, same as PDM (callstack text) baseline behavior.

"function": "Global code"
}
]
}
]
18 changes: 18 additions & 0 deletions test/DebuggerCommon/rlexe.xml
Original file line number Diff line number Diff line change
Expand Up @@ -1356,6 +1356,24 @@
<compile-flags>-debuglaunch -dbgbaseline:generators.js.dbg.baseline -ES6Generators -InspectMaxStringLength:200</compile-flags>
</default>
</test>
<test>
<default>
<files>async.js</files>
<compile-flags>-debuglaunch -dbgbaseline:async.js.dbg.baseline</compile-flags>
</default>
</test>
<test>
<default>
<files>async_step_out.js</files>
<compile-flags>-debuglaunch -dbgbaseline:async_step_out.js.dbg.baseline</compile-flags>
</default>
</test>
<test>
<default>
<files>async_step_over.js</files>
<compile-flags>-debuglaunch -dbgbaseline:async_step_over.js.dbg.baseline</compile-flags>
</default>
</test>
<test>
<default>
<files>TypedArray.js</files>
Expand Down
4 changes: 2 additions & 2 deletions test/es6/es6_stable.baseline
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ FLAG ES6 = 1 - setting child flag Simdjs = 0
FLAG Simdjs = 0
FLAG ES6 = 1 - setting child flag ES6Species = 1
FLAG ES6Species = 1
FLAG ES6 = 1 - setting child flag ES7AsyncAwait = 0
FLAG ES7AsyncAwait = 0
FLAG ES6 = 1 - setting child flag ES7AsyncAwait = 1
FLAG ES7AsyncAwait = 1
FLAG ES6 = 1 - setting child flag ES6Classes = 1
FLAG ES6Classes = 1
FLAG ES6 = 1 - setting child flag ES6DateParseFix = 1
Expand Down
4 changes: 2 additions & 2 deletions test/es6/es6_stable.enable_disable.baseline
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ FLAG ES6 = 1 - setting child flag Simdjs = 0
FLAG Simdjs = 0
FLAG ES6 = 1 - setting child flag ES6Species = 1
FLAG ES6Species = 1
FLAG ES6 = 1 - setting child flag ES7AsyncAwait = 0
FLAG ES7AsyncAwait = 0
FLAG ES6 = 1 - setting child flag ES7AsyncAwait = 1
FLAG ES7AsyncAwait = 1
FLAG ES6 = 1 - setting child flag ES6Classes = 1
FLAG ES6Classes = 1
FLAG ES6 = 1 - setting child flag ES6DateParseFix = 1
Expand Down
Loading