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

Commit

Permalink
deps: update ChakraCore to chakra-core/ChakraCore@5d123b4b51
Browse files Browse the repository at this point in the history
[1.8>1.9] [MERGE #4649 @MikeHolman] fix bad register use in asm.js thunk

Merge pull request #4649 from MikeHolman:asmthunk

OS: 15151031

Reviewed-By: chakrabot <chakrabot@users.noreply.github.com>
  • Loading branch information
MikeHolman authored and chakrabot committed Feb 8, 2018
1 parent 6bdbd08 commit 1a2c13c
Show file tree
Hide file tree
Showing 3 changed files with 39 additions and 5 deletions.
11 changes: 6 additions & 5 deletions deps/chakrashim/core/lib/Runtime/Library/JavascriptFunction.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1163,13 +1163,14 @@ namespace Js
__asm
{
mov savedEsp, esp;
mov eax, argsSize;
cmp eax, 0x1000;
mov ecx, argsSize;
cmp ecx, 0x1000;
jl allocate_stack;
// Use _chkstk to probe each page when using more then a page size
call _chkstk;
allocate_stack:
sub esp, eax;
mov eax, ecx;
call _chkstk; // _chkstk saves/restores ecx
allocate_stack:
sub esp, ecx;

mov edi, esp;
mov esi, argv;
Expand Down
28 changes: 28 additions & 0 deletions deps/chakrashim/core/test/AsmJs/manyargs.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
//-------------------------------------------------------------------------------------------------------
// Copyright (C) Microsoft. All rights reserved.
// Licensed under the MIT license. See LICENSE.txt file in the project root for full license information.
//-------------------------------------------------------------------------------------------------------

let str = `(function module() { "use asm";function foo(`;
// 550 double args exceeds 1 page
const totalArgs = 550
for (let i = 0; i < totalArgs; ++i)
{
str += `arg${i},`;
}
str += `arg${totalArgs}){`;

for (let i = 0; i <= totalArgs; ++i)
{
str += `arg${i}=+arg${i};`;
}
str += "return 10;}function bar(){return foo(";
for (let i = 0; i < totalArgs; ++i)
{
str += "0.0,";
}
str += "1.0)|0;}"
str += "return bar})()()";

const result = eval(str);
print(result == 10 ? "Pass" : `Fail: ${result}`);
5 changes: 5 additions & 0 deletions deps/chakrashim/core/test/AsmJs/rlexe.xml
Original file line number Diff line number Diff line change
Expand Up @@ -1043,6 +1043,11 @@
<files>argassignbug.js</files>
</default>
</test>
<test>
<default>
<files>manyargs.js</files>
</default>
</test>
<test>
<default>
<files>maybecallbug.js</files>
Expand Down

0 comments on commit 1a2c13c

Please sign in to comment.