Skip to content

Commit

Permalink
[1.8>1.9] [MERGE #4598 @sigatrev] OS#15490382: assign string value ty…
Browse files Browse the repository at this point in the history
…pe to the result of TypeofElem

Merge pull request #4598 from sigatrev:typeOfElem
  • Loading branch information
sigatrev committed Jan 29, 2018
2 parents acd7454 + 3e52c09 commit abd18d0
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 0 deletions.
1 change: 1 addition & 0 deletions lib/Backend/GlobOpt.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5195,6 +5195,7 @@ GlobOpt::ValueNumberDst(IR::Instr **pInstr, Value *src1Val, Value *src2Val)
break;

case Js::OpCode::Typeof:
case Js::OpCode::TypeofElem:
return this->NewGenericValue(ValueType::String, dst);
case Js::OpCode::InitLocalClosure:
Assert(instr->GetDst());
Expand Down
23 changes: 23 additions & 0 deletions test/Bugs/bug15490382.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
//-------------------------------------------------------------------------------------------------------
// Copyright (C) Microsoft. All rights reserved.
// Licensed under the MIT license. See LICENSE.txt file in the project root for full license information.
//-------------------------------------------------------------------------------------------------------

function bar(x)
{
if (x != x)
{
return;
}
}

function foo()
{
bar(typeof arguments[0]);
};

foo();
foo();
foo();

WScript.Echo("Passed");
5 changes: 5 additions & 0 deletions test/Bugs/rlexe.xml
Original file line number Diff line number Diff line change
Expand Up @@ -428,4 +428,9 @@
<baseline>bug13830477.baseline</baseline>
</default>
</test>
<test>
<default>
<files>bug15490382.js</files>
</default>
</test>
</regress-exe>

0 comments on commit abd18d0

Please sign in to comment.