Skip to content
Permalink
Browse files
[ARM64] static_cast<int32_t>() in BinaryOpNode::emitBytecode() preven…
…ts op_unsigned emission

https://bugs.webkit.org/show_bug.cgi?id=178379

Reviewed by Saam Barati.

We reuse jsNumber's checking mechanism here to precisely check the generated number is within uint32_t
in bytecode compiler. This is reasonable since the NumberNode will generate the exact this JSValue.

* bytecompiler/NodesCodegen.cpp:
(JSC::BinaryOpNode::emitBytecode):


Canonical link: https://commits.webkit.org/194757@main
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@223745 268f45cc-cd09-0410-ab3c-d52691b4dbfc
  • Loading branch information
Constellation committed Oct 20, 2017
1 parent 197cd09 commit 3c8d2441fb259b97ddf7e0e197d2f869252551a2
Showing 2 changed files with 15 additions and 2 deletions.
@@ -1,3 +1,16 @@
2017-10-20 Yusuke Suzuki <utatane.tea@gmail.com>

[ARM64] static_cast<int32_t>() in BinaryOpNode::emitBytecode() prevents op_unsigned emission
https://bugs.webkit.org/show_bug.cgi?id=178379

Reviewed by Saam Barati.

We reuse jsNumber's checking mechanism here to precisely check the generated number is within uint32_t
in bytecode compiler. This is reasonable since the NumberNode will generate the exact this JSValue.

* bytecompiler/NodesCodegen.cpp:
(JSC::BinaryOpNode::emitBytecode):

2017-10-20 Yusuke Suzuki <utatane.tea@gmail.com>

[JSC] ScriptFetcher should be notified directly from module pipeline
@@ -1993,8 +1993,8 @@ RegisterID* BinaryOpNode::emitBytecode(BytecodeGenerator& generator, RegisterID*
if (node->isBinaryOpNode() && static_cast<BinaryOpNode*>(node)->opcodeID() == op_urshift)
return UInt32Result::UInt32;
if (node->isNumber() && static_cast<NumberNode*>(node)->isIntegerNode()) {
int32_t value = static_cast<int32_t>(static_cast<IntegerNode*>(node)->value());
if (value >= 0)
auto value = jsNumber(static_cast<NumberNode*>(node)->value());
if (value.isInt32() && value.asInt32() >= 0)
return UInt32Result::Constant;
}
return std::nullopt;

0 comments on commit 3c8d244

Please sign in to comment.