OLD | NEW |
1 // Copyright 2014 the V8 project authors. All rights reserved. | 1 // Copyright 2014 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 #if V8_TARGET_ARCH_S390 | 5 #if V8_TARGET_ARCH_S390 |
6 | 6 |
7 #include "src/code-stubs.h" | 7 #include "src/code-stubs.h" |
8 #include "src/api-arguments.h" | 8 #include "src/api-arguments.h" |
9 #include "src/base/bits.h" | 9 #include "src/base/bits.h" |
10 #include "src/bootstrapper.h" | 10 #include "src/bootstrapper.h" |
(...skipping 1352 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1363 // and go to (1). Otherwise bail out to runtime. | 1363 // and go to (1). Otherwise bail out to runtime. |
1364 // (4) Sequential string. Load regexp code according to encoding. | 1364 // (4) Sequential string. Load regexp code according to encoding. |
1365 // (E) Carry on. | 1365 // (E) Carry on. |
1366 /// [...] | 1366 /// [...] |
1367 | 1367 |
1368 // Deferred code at the end of the stub: | 1368 // Deferred code at the end of the stub: |
1369 // (5) Long external string? If not, go to (7). | 1369 // (5) Long external string? If not, go to (7). |
1370 // (6) External string. Make it, offset-wise, look like a sequential string. | 1370 // (6) External string. Make it, offset-wise, look like a sequential string. |
1371 // Go to (4). | 1371 // Go to (4). |
1372 // (7) Short external string or not a string? If yes, bail out to runtime. | 1372 // (7) Short external string or not a string? If yes, bail out to runtime. |
1373 // (8) Sliced string. Replace subject with parent. Go to (1). | 1373 // (8) Sliced or thin string. Replace subject with parent. Go to (1). |
1374 | 1374 |
1375 Label seq_string /* 4 */, external_string /* 6 */, check_underlying /* 1 */, | 1375 Label seq_string /* 4 */, external_string /* 6 */, check_underlying /* 1 */, |
1376 not_seq_nor_cons /* 5 */, not_long_external /* 7 */; | 1376 not_seq_nor_cons /* 5 */, not_long_external /* 7 */; |
1377 | 1377 |
1378 __ bind(&check_underlying); | 1378 __ bind(&check_underlying); |
1379 __ LoadP(r2, FieldMemOperand(subject, HeapObject::kMapOffset)); | 1379 __ LoadP(r2, FieldMemOperand(subject, HeapObject::kMapOffset)); |
1380 __ LoadlB(r2, FieldMemOperand(r2, Map::kInstanceTypeOffset)); | 1380 __ LoadlB(r2, FieldMemOperand(r2, Map::kInstanceTypeOffset)); |
1381 | 1381 |
1382 // (1) Sequential string? If yes, go to (4). | 1382 // (1) Sequential string? If yes, go to (4). |
1383 | 1383 |
1384 STATIC_ASSERT((kIsNotStringMask | kStringRepresentationMask | | 1384 STATIC_ASSERT((kIsNotStringMask | kStringRepresentationMask | |
1385 kShortExternalStringMask) == 0x93); | 1385 kShortExternalStringMask) == 0xa7); |
1386 __ mov(r3, Operand(kIsNotStringMask | kStringRepresentationMask | | 1386 __ mov(r3, Operand(kIsNotStringMask | kStringRepresentationMask | |
1387 kShortExternalStringMask)); | 1387 kShortExternalStringMask)); |
1388 __ AndP(r3, r2); | 1388 __ AndP(r3, r2); |
1389 STATIC_ASSERT((kStringTag | kSeqStringTag) == 0); | 1389 STATIC_ASSERT((kStringTag | kSeqStringTag) == 0); |
1390 __ beq(&seq_string, Label::kNear); // Go to (4). | 1390 __ beq(&seq_string, Label::kNear); // Go to (4). |
1391 | 1391 |
1392 // (2) Sequential or cons? If not, go to (5). | 1392 // (2) Sequential or cons? If not, go to (5). |
1393 STATIC_ASSERT(kConsStringTag < kExternalStringTag); | 1393 STATIC_ASSERT(kConsStringTag < kExternalStringTag); |
1394 STATIC_ASSERT(kSlicedStringTag > kExternalStringTag); | 1394 STATIC_ASSERT(kSlicedStringTag > kExternalStringTag); |
| 1395 STATIC_ASSERT(kThinStringTag > kExternalStringTag); |
1395 STATIC_ASSERT(kIsNotStringMask > kExternalStringTag); | 1396 STATIC_ASSERT(kIsNotStringMask > kExternalStringTag); |
1396 STATIC_ASSERT(kShortExternalStringTag > kExternalStringTag); | 1397 STATIC_ASSERT(kShortExternalStringTag > kExternalStringTag); |
1397 STATIC_ASSERT(kExternalStringTag < 0xffffu); | 1398 STATIC_ASSERT(kExternalStringTag < 0xffffu); |
1398 __ CmpP(r3, Operand(kExternalStringTag)); | 1399 __ CmpP(r3, Operand(kExternalStringTag)); |
1399 __ bge(¬_seq_nor_cons); // Go to (5). | 1400 __ bge(¬_seq_nor_cons); // Go to (5). |
1400 | 1401 |
1401 // (3) Cons string. Check that it's flat. | 1402 // (3) Cons string. Check that it's flat. |
1402 // Replace subject with first string and reload instance type. | 1403 // Replace subject with first string and reload instance type. |
1403 __ LoadP(r2, FieldMemOperand(subject, ConsString::kSecondOffset)); | 1404 __ LoadP(r2, FieldMemOperand(subject, ConsString::kSecondOffset)); |
1404 __ CompareRoot(r2, Heap::kempty_stringRootIndex); | 1405 __ CompareRoot(r2, Heap::kempty_stringRootIndex); |
1405 __ bne(&runtime); | 1406 __ bne(&runtime); |
1406 __ LoadP(subject, FieldMemOperand(subject, ConsString::kFirstOffset)); | 1407 __ LoadP(subject, FieldMemOperand(subject, ConsString::kFirstOffset)); |
1407 __ b(&check_underlying); | 1408 __ b(&check_underlying); |
1408 | 1409 |
1409 // (4) Sequential string. Load regexp code according to encoding. | 1410 // (4) Sequential string. Load regexp code according to encoding. |
1410 __ bind(&seq_string); | 1411 __ bind(&seq_string); |
1411 // subject: sequential subject string (or look-alike, external string) | 1412 // subject: sequential subject string (or look-alike, external string) |
1412 // r5: original subject string | 1413 // r5: original subject string |
1413 // Load previous index and check range before r5 is overwritten. We have to | 1414 // Load previous index and check range before r5 is overwritten. We have to |
1414 // use r5 instead of subject here because subject might have been only made | 1415 // use r5 instead of subject here because subject might have been only made |
1415 // to look like a sequential string when it actually is an external string. | 1416 // to look like a sequential string when it actually is an external string. |
1416 __ LoadP(r3, MemOperand(sp, kPreviousIndexOffset)); | 1417 __ LoadP(r3, MemOperand(sp, kPreviousIndexOffset)); |
1417 __ JumpIfNotSmi(r3, &runtime); | 1418 __ JumpIfNotSmi(r3, &runtime); |
1418 __ LoadP(r5, FieldMemOperand(r5, String::kLengthOffset)); | 1419 __ LoadP(r5, FieldMemOperand(r5, String::kLengthOffset)); |
1419 __ CmpLogicalP(r5, r3); | 1420 __ CmpLogicalP(r5, r3); |
1420 __ ble(&runtime); | 1421 __ ble(&runtime); |
1421 __ SmiUntag(r3); | 1422 __ SmiUntag(r3); |
1422 | 1423 |
1423 STATIC_ASSERT(4 == kOneByteStringTag); | 1424 STATIC_ASSERT(8 == kOneByteStringTag); |
1424 STATIC_ASSERT(kTwoByteStringTag == 0); | 1425 STATIC_ASSERT(kTwoByteStringTag == 0); |
1425 STATIC_ASSERT(kStringEncodingMask == 4); | 1426 STATIC_ASSERT(kStringEncodingMask == 8); |
1426 __ ExtractBitMask(r5, r2, kStringEncodingMask, SetRC); | 1427 __ ExtractBitMask(r5, r2, kStringEncodingMask, SetRC); |
1427 __ beq(&encoding_type_UC16, Label::kNear); | 1428 __ beq(&encoding_type_UC16, Label::kNear); |
1428 __ LoadP(code, | 1429 __ LoadP(code, |
1429 FieldMemOperand(regexp_data, JSRegExp::kDataOneByteCodeOffset)); | 1430 FieldMemOperand(regexp_data, JSRegExp::kDataOneByteCodeOffset)); |
1430 __ b(&br_over, Label::kNear); | 1431 __ b(&br_over, Label::kNear); |
1431 __ bind(&encoding_type_UC16); | 1432 __ bind(&encoding_type_UC16); |
1432 __ LoadP(code, FieldMemOperand(regexp_data, JSRegExp::kDataUC16CodeOffset)); | 1433 __ LoadP(code, FieldMemOperand(regexp_data, JSRegExp::kDataUC16CodeOffset)); |
1433 __ bind(&br_over); | 1434 __ bind(&br_over); |
1434 | 1435 |
1435 // (E) Carry on. String handling is done. | 1436 // (E) Carry on. String handling is done. |
(...skipping 236 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1672 Operand(SeqTwoByteString::kHeaderSize - kHeapObjectTag)); | 1673 Operand(SeqTwoByteString::kHeaderSize - kHeapObjectTag)); |
1673 __ b(&seq_string); // Go to (4). | 1674 __ b(&seq_string); // Go to (4). |
1674 | 1675 |
1675 // (7) Short external string or not a string? If yes, bail out to runtime. | 1676 // (7) Short external string or not a string? If yes, bail out to runtime. |
1676 __ bind(¬_long_external); | 1677 __ bind(¬_long_external); |
1677 STATIC_ASSERT(kNotStringTag != 0 && kShortExternalStringTag != 0); | 1678 STATIC_ASSERT(kNotStringTag != 0 && kShortExternalStringTag != 0); |
1678 __ mov(r0, Operand(kIsNotStringMask | kShortExternalStringMask)); | 1679 __ mov(r0, Operand(kIsNotStringMask | kShortExternalStringMask)); |
1679 __ AndP(r0, r3); | 1680 __ AndP(r0, r3); |
1680 __ bne(&runtime); | 1681 __ bne(&runtime); |
1681 | 1682 |
1682 // (8) Sliced string. Replace subject with parent. Go to (4). | 1683 // (8) Sliced or thin string. Replace subject with parent. Go to (4). |
| 1684 Label thin_string; |
| 1685 __ CmpP(r3, Operand(kThinStringTag)); |
| 1686 __ beq(&thin_string); |
1683 // Load offset into ip and replace subject string with parent. | 1687 // Load offset into ip and replace subject string with parent. |
1684 __ LoadP(ip, FieldMemOperand(subject, SlicedString::kOffsetOffset)); | 1688 __ LoadP(ip, FieldMemOperand(subject, SlicedString::kOffsetOffset)); |
1685 __ SmiUntag(ip); | 1689 __ SmiUntag(ip); |
1686 __ LoadP(subject, FieldMemOperand(subject, SlicedString::kParentOffset)); | 1690 __ LoadP(subject, FieldMemOperand(subject, SlicedString::kParentOffset)); |
1687 __ b(&check_underlying); // Go to (4). | 1691 __ b(&check_underlying); // Go to (4). |
| 1692 |
| 1693 __ bind(&thin_string); |
| 1694 __ LoadP(subject, FieldMemOperand(subject, ThinString::kActualOffset)); |
| 1695 __ b(&check_underlying); // Go to (4). |
1688 #endif // V8_INTERPRETED_REGEXP | 1696 #endif // V8_INTERPRETED_REGEXP |
1689 } | 1697 } |
1690 | 1698 |
1691 static void CallStubInRecordCallTarget(MacroAssembler* masm, CodeStub* stub) { | 1699 static void CallStubInRecordCallTarget(MacroAssembler* masm, CodeStub* stub) { |
1692 // r2 : number of arguments to the construct function | 1700 // r2 : number of arguments to the construct function |
1693 // r3 : the function to call | 1701 // r3 : the function to call |
1694 // r4 : feedback vector | 1702 // r4 : feedback vector |
1695 // r5 : slot in feedback vector (Smi) | 1703 // r5 : slot in feedback vector (Smi) |
1696 FrameScope scope(masm, StackFrame::INTERNAL); | 1704 FrameScope scope(masm, StackFrame::INTERNAL); |
1697 | 1705 |
(...skipping 2575 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4273 CallApiFunctionAndReturn(masm, api_function_address, thunk_ref, | 4281 CallApiFunctionAndReturn(masm, api_function_address, thunk_ref, |
4274 kStackUnwindSpace, NULL, return_value_operand, NULL); | 4282 kStackUnwindSpace, NULL, return_value_operand, NULL); |
4275 } | 4283 } |
4276 | 4284 |
4277 #undef __ | 4285 #undef __ |
4278 | 4286 |
4279 } // namespace internal | 4287 } // namespace internal |
4280 } // namespace v8 | 4288 } // namespace v8 |
4281 | 4289 |
4282 #endif // V8_TARGET_ARCH_S390 | 4290 #endif // V8_TARGET_ARCH_S390 |
OLD | NEW |