OLD | NEW |
1 // Copyright 2016 the V8 project authors. All rights reserved. | 1 // Copyright 2016 the V8 project authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "src/builtins/builtins.h" | 5 #include "src/builtins/builtins.h" |
6 #include "src/builtins/builtins-utils.h" | 6 #include "src/builtins/builtins-utils.h" |
7 | 7 |
8 #include "src/code-factory.h" | 8 #include "src/code-factory.h" |
9 #include "src/regexp/regexp-utils.h" | 9 #include "src/regexp/regexp-utils.h" |
10 | 10 |
(...skipping 1362 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1373 assembler->Uint32LessThan(lead, assembler->Int32Constant(0xDC00))); | 1373 assembler->Uint32LessThan(lead, assembler->Int32Constant(0xDC00))); |
1374 assembler->Assert(assembler->Uint32GreaterThanOrEqual( | 1374 assembler->Assert(assembler->Uint32GreaterThanOrEqual( |
1375 trail, assembler->Int32Constant(0xDC00))); | 1375 trail, assembler->Int32Constant(0xDC00))); |
1376 assembler->Assert( | 1376 assembler->Assert( |
1377 assembler->Uint32LessThan(trail, assembler->Int32Constant(0xE000))); | 1377 assembler->Uint32LessThan(trail, assembler->Int32Constant(0xE000))); |
1378 #endif | 1378 #endif |
1379 | 1379 |
1380 switch (encoding) { | 1380 switch (encoding) { |
1381 case UnicodeEncoding::UTF16: | 1381 case UnicodeEncoding::UTF16: |
1382 var_result.Bind(assembler->WordOr( | 1382 var_result.Bind(assembler->WordOr( |
| 1383 // Need to swap the order for big-endian platforms |
| 1384 #if V8_TARGET_BIG_ENDIAN |
| 1385 assembler->WordShl(lead, assembler->Int32Constant(16)), trail)); |
| 1386 #else |
1383 assembler->WordShl(trail, assembler->Int32Constant(16)), lead)); | 1387 assembler->WordShl(trail, assembler->Int32Constant(16)), lead)); |
| 1388 #endif |
1384 break; | 1389 break; |
1385 | 1390 |
1386 case UnicodeEncoding::UTF32: { | 1391 case UnicodeEncoding::UTF32: { |
1387 // Convert UTF16 surrogate pair into |word32| code point, encoded as | 1392 // Convert UTF16 surrogate pair into |word32| code point, encoded as |
1388 // UTF32. | 1393 // UTF32. |
1389 Node* surrogate_offset = | 1394 Node* surrogate_offset = |
1390 assembler->Int32Constant(0x10000 - (0xD800 << 10) - 0xDC00); | 1395 assembler->Int32Constant(0x10000 - (0xD800 << 10) - 0xDC00); |
1391 | 1396 |
1392 // (lead << 10) + trail + SURROGATE_OFFSET | 1397 // (lead << 10) + trail + SURROGATE_OFFSET |
1393 var_result.Bind(assembler->Int32Add( | 1398 var_result.Bind(assembler->Int32Add( |
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1486 Runtime::kThrowIncompatibleMethodReceiver, context, | 1491 Runtime::kThrowIncompatibleMethodReceiver, context, |
1487 assembler->HeapConstant(assembler->factory()->NewStringFromAsciiChecked( | 1492 assembler->HeapConstant(assembler->factory()->NewStringFromAsciiChecked( |
1488 "String Iterator.prototype.next", TENURED)), | 1493 "String Iterator.prototype.next", TENURED)), |
1489 iterator); | 1494 iterator); |
1490 assembler->Return(result); // Never reached. | 1495 assembler->Return(result); // Never reached. |
1491 } | 1496 } |
1492 } | 1497 } |
1493 | 1498 |
1494 } // namespace internal | 1499 } // namespace internal |
1495 } // namespace v8 | 1500 } // namespace v8 |
OLD | NEW |