Commit f2d278a9 authored by bjaideep's avatar bjaideep Committed by Commit bot

[builtins] fix load of surrogate pair for BE platform

Swaping the order when loading surrogate pairs on big endian
platform. This fixes testcase string-iterator.js on big
endian.

BUG=
R=bmeurer@chromium.org, mstarzinger@chromium.org, jkummerow@chromium.org

Review-Url: https://codereview.chromium.org/2431223010
Cr-Commit-Position: refs/heads/master@{#40535}
parent 6dd0587b
......@@ -1380,7 +1380,12 @@ compiler::Node* LoadSurrogatePairInternal(CodeStubAssembler* assembler,
switch (encoding) {
case UnicodeEncoding::UTF16:
var_result.Bind(assembler->WordOr(
// Need to swap the order for big-endian platforms
#if V8_TARGET_BIG_ENDIAN
assembler->WordShl(lead, assembler->Int32Constant(16)), trail));
#else
assembler->WordShl(trail, assembler->Int32Constant(16)), lead));
#endif
break;
case UnicodeEncoding::UTF32: {
......
......@@ -1141,9 +1141,16 @@ Reduction JSBuiltinReducer::ReduceStringIteratorNext(Node* node) {
{
vtrue3 = graph()->NewNode(
simplified()->NumberBitwiseOr(),
// Need to swap the order for big-endian platforms
#if V8_TARGET_BIG_ENDIAN
graph()->NewNode(simplified()->NumberShiftLeft(), lead,
jsgraph()->Int32Constant(16)),
trail);
#else
graph()->NewNode(simplified()->NumberShiftLeft(), trail,
jsgraph()->Int32Constant(16)),
lead);
#endif
}
Node* if_false3 = graph()->NewNode(common()->IfFalse(), branch3);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment