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_PPC | 5 #if V8_TARGET_ARCH_PPC |
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 1355 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1366 // and go to (1). Otherwise bail out to runtime. | 1366 // and go to (1). Otherwise bail out to runtime. |
1367 // (4) Sequential string. Load regexp code according to encoding. | 1367 // (4) Sequential string. Load regexp code according to encoding. |
1368 // (E) Carry on. | 1368 // (E) Carry on. |
1369 /// [...] | 1369 /// [...] |
1370 | 1370 |
1371 // Deferred code at the end of the stub: | 1371 // Deferred code at the end of the stub: |
1372 // (5) Long external string? If not, go to (7). | 1372 // (5) Long external string? If not, go to (7). |
1373 // (6) External string. Make it, offset-wise, look like a sequential string. | 1373 // (6) External string. Make it, offset-wise, look like a sequential string. |
1374 // Go to (4). | 1374 // Go to (4). |
1375 // (7) Short external string or not a string? If yes, bail out to runtime. | 1375 // (7) Short external string or not a string? If yes, bail out to runtime. |
1376 // (8) Sliced string. Replace subject with parent. Go to (1). | 1376 // (8) Sliced or thin string. Replace subject with parent. Go to (1). |
1377 | 1377 |
1378 Label seq_string /* 4 */, external_string /* 6 */, check_underlying /* 1 */, | 1378 Label seq_string /* 4 */, external_string /* 6 */, check_underlying /* 1 */, |
1379 not_seq_nor_cons /* 5 */, not_long_external /* 7 */; | 1379 not_seq_nor_cons /* 5 */, not_long_external /* 7 */; |
1380 | 1380 |
1381 __ bind(&check_underlying); | 1381 __ bind(&check_underlying); |
1382 __ LoadP(r3, FieldMemOperand(subject, HeapObject::kMapOffset)); | 1382 __ LoadP(r3, FieldMemOperand(subject, HeapObject::kMapOffset)); |
1383 __ lbz(r3, FieldMemOperand(r3, Map::kInstanceTypeOffset)); | 1383 __ lbz(r3, FieldMemOperand(r3, Map::kInstanceTypeOffset)); |
1384 | 1384 |
1385 // (1) Sequential string? If yes, go to (4). | 1385 // (1) Sequential string? If yes, go to (4). |
1386 | 1386 |
1387 STATIC_ASSERT((kIsNotStringMask | kStringRepresentationMask | | 1387 STATIC_ASSERT((kIsNotStringMask | kStringRepresentationMask | |
1388 kShortExternalStringMask) == 0x93); | 1388 kShortExternalStringMask) == 0xa7); |
1389 __ andi(r4, r3, Operand(kIsNotStringMask | kStringRepresentationMask | | 1389 __ andi(r4, r3, Operand(kIsNotStringMask | kStringRepresentationMask | |
1390 kShortExternalStringMask)); | 1390 kShortExternalStringMask)); |
1391 STATIC_ASSERT((kStringTag | kSeqStringTag) == 0); | 1391 STATIC_ASSERT((kStringTag | kSeqStringTag) == 0); |
1392 __ beq(&seq_string, cr0); // Go to (4). | 1392 __ beq(&seq_string, cr0); // Go to (4). |
1393 | 1393 |
1394 // (2) Sequential or cons? If not, go to (5). | 1394 // (2) Sequential or cons? If not, go to (5). |
1395 STATIC_ASSERT(kConsStringTag < kExternalStringTag); | 1395 STATIC_ASSERT(kConsStringTag < kExternalStringTag); |
1396 STATIC_ASSERT(kSlicedStringTag > kExternalStringTag); | 1396 STATIC_ASSERT(kSlicedStringTag > kExternalStringTag); |
| 1397 STATIC_ASSERT(kThinStringTag > kExternalStringTag); |
1397 STATIC_ASSERT(kIsNotStringMask > kExternalStringTag); | 1398 STATIC_ASSERT(kIsNotStringMask > kExternalStringTag); |
1398 STATIC_ASSERT(kShortExternalStringTag > kExternalStringTag); | 1399 STATIC_ASSERT(kShortExternalStringTag > kExternalStringTag); |
1399 STATIC_ASSERT(kExternalStringTag < 0xffffu); | 1400 STATIC_ASSERT(kExternalStringTag < 0xffffu); |
1400 __ cmpi(r4, Operand(kExternalStringTag)); | 1401 __ cmpi(r4, Operand(kExternalStringTag)); |
1401 __ bge(¬_seq_nor_cons); // Go to (5). | 1402 __ bge(¬_seq_nor_cons); // Go to (5). |
1402 | 1403 |
1403 // (3) Cons string. Check that it's flat. | 1404 // (3) Cons string. Check that it's flat. |
1404 // Replace subject with first string and reload instance type. | 1405 // Replace subject with first string and reload instance type. |
1405 __ LoadP(r3, FieldMemOperand(subject, ConsString::kSecondOffset)); | 1406 __ LoadP(r3, FieldMemOperand(subject, ConsString::kSecondOffset)); |
1406 __ CompareRoot(r3, Heap::kempty_stringRootIndex); | 1407 __ CompareRoot(r3, Heap::kempty_stringRootIndex); |
1407 __ bne(&runtime); | 1408 __ bne(&runtime); |
1408 __ LoadP(subject, FieldMemOperand(subject, ConsString::kFirstOffset)); | 1409 __ LoadP(subject, FieldMemOperand(subject, ConsString::kFirstOffset)); |
1409 __ b(&check_underlying); | 1410 __ b(&check_underlying); |
1410 | 1411 |
1411 // (4) Sequential string. Load regexp code according to encoding. | 1412 // (4) Sequential string. Load regexp code according to encoding. |
1412 __ bind(&seq_string); | 1413 __ bind(&seq_string); |
1413 // subject: sequential subject string (or look-alike, external string) | 1414 // subject: sequential subject string (or look-alike, external string) |
1414 // r6: original subject string | 1415 // r6: original subject string |
1415 // Load previous index and check range before r6 is overwritten. We have to | 1416 // Load previous index and check range before r6 is overwritten. We have to |
1416 // use r6 instead of subject here because subject might have been only made | 1417 // use r6 instead of subject here because subject might have been only made |
1417 // to look like a sequential string when it actually is an external string. | 1418 // to look like a sequential string when it actually is an external string. |
1418 __ LoadP(r4, MemOperand(sp, kPreviousIndexOffset)); | 1419 __ LoadP(r4, MemOperand(sp, kPreviousIndexOffset)); |
1419 __ JumpIfNotSmi(r4, &runtime); | 1420 __ JumpIfNotSmi(r4, &runtime); |
1420 __ LoadP(r6, FieldMemOperand(r6, String::kLengthOffset)); | 1421 __ LoadP(r6, FieldMemOperand(r6, String::kLengthOffset)); |
1421 __ cmpl(r6, r4); | 1422 __ cmpl(r6, r4); |
1422 __ ble(&runtime); | 1423 __ ble(&runtime); |
1423 __ SmiUntag(r4); | 1424 __ SmiUntag(r4); |
1424 | 1425 |
1425 STATIC_ASSERT(4 == kOneByteStringTag); | 1426 STATIC_ASSERT(8 == kOneByteStringTag); |
1426 STATIC_ASSERT(kTwoByteStringTag == 0); | 1427 STATIC_ASSERT(kTwoByteStringTag == 0); |
1427 STATIC_ASSERT(kStringEncodingMask == 4); | 1428 STATIC_ASSERT(kStringEncodingMask == 8); |
1428 __ ExtractBitMask(r6, r3, kStringEncodingMask, SetRC); | 1429 __ ExtractBitMask(r6, r3, kStringEncodingMask, SetRC); |
1429 __ beq(&encoding_type_UC16, cr0); | 1430 __ beq(&encoding_type_UC16, cr0); |
1430 __ LoadP(code, | 1431 __ LoadP(code, |
1431 FieldMemOperand(regexp_data, JSRegExp::kDataOneByteCodeOffset)); | 1432 FieldMemOperand(regexp_data, JSRegExp::kDataOneByteCodeOffset)); |
1432 __ b(&br_over); | 1433 __ b(&br_over); |
1433 __ bind(&encoding_type_UC16); | 1434 __ bind(&encoding_type_UC16); |
1434 __ LoadP(code, FieldMemOperand(regexp_data, JSRegExp::kDataUC16CodeOffset)); | 1435 __ LoadP(code, FieldMemOperand(regexp_data, JSRegExp::kDataUC16CodeOffset)); |
1435 __ bind(&br_over); | 1436 __ bind(&br_over); |
1436 | 1437 |
1437 // (E) Carry on. String handling is done. | 1438 // (E) Carry on. String handling is done. |
(...skipping 225 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1663 __ subi(subject, subject, | 1664 __ subi(subject, subject, |
1664 Operand(SeqTwoByteString::kHeaderSize - kHeapObjectTag)); | 1665 Operand(SeqTwoByteString::kHeaderSize - kHeapObjectTag)); |
1665 __ b(&seq_string); // Go to (4). | 1666 __ b(&seq_string); // Go to (4). |
1666 | 1667 |
1667 // (7) Short external string or not a string? If yes, bail out to runtime. | 1668 // (7) Short external string or not a string? If yes, bail out to runtime. |
1668 __ bind(¬_long_external); | 1669 __ bind(¬_long_external); |
1669 STATIC_ASSERT(kNotStringTag != 0 && kShortExternalStringTag != 0); | 1670 STATIC_ASSERT(kNotStringTag != 0 && kShortExternalStringTag != 0); |
1670 __ andi(r0, r4, Operand(kIsNotStringMask | kShortExternalStringMask)); | 1671 __ andi(r0, r4, Operand(kIsNotStringMask | kShortExternalStringMask)); |
1671 __ bne(&runtime, cr0); | 1672 __ bne(&runtime, cr0); |
1672 | 1673 |
1673 // (8) Sliced string. Replace subject with parent. Go to (4). | 1674 // (8) Sliced or thin string. Replace subject with parent. Go to (4). |
| 1675 Label thin_string; |
| 1676 __ cmpi(r4, Operand(kThinStringTag)); |
| 1677 __ beq(&thin_string); |
1674 // Load offset into r11 and replace subject string with parent. | 1678 // Load offset into r11 and replace subject string with parent. |
1675 __ LoadP(r11, FieldMemOperand(subject, SlicedString::kOffsetOffset)); | 1679 __ LoadP(r11, FieldMemOperand(subject, SlicedString::kOffsetOffset)); |
1676 __ SmiUntag(r11); | 1680 __ SmiUntag(r11); |
1677 __ LoadP(subject, FieldMemOperand(subject, SlicedString::kParentOffset)); | 1681 __ LoadP(subject, FieldMemOperand(subject, SlicedString::kParentOffset)); |
1678 __ b(&check_underlying); // Go to (4). | 1682 __ b(&check_underlying); // Go to (4). |
| 1683 |
| 1684 __ bind(&thin_string); |
| 1685 __ LoadP(subject, FieldMemOperand(subject, ThinString::kActualOffset)); |
| 1686 __ b(&check_underlying); // Go to (4). |
1679 #endif // V8_INTERPRETED_REGEXP | 1687 #endif // V8_INTERPRETED_REGEXP |
1680 } | 1688 } |
1681 | 1689 |
1682 | 1690 |
1683 static void CallStubInRecordCallTarget(MacroAssembler* masm, CodeStub* stub) { | 1691 static void CallStubInRecordCallTarget(MacroAssembler* masm, CodeStub* stub) { |
1684 // r3 : number of arguments to the construct function | 1692 // r3 : number of arguments to the construct function |
1685 // r4 : the function to call | 1693 // r4 : the function to call |
1686 // r5 : feedback vector | 1694 // r5 : feedback vector |
1687 // r6 : slot in feedback vector (Smi) | 1695 // r6 : slot in feedback vector (Smi) |
1688 FrameAndConstantPoolScope scope(masm, StackFrame::INTERNAL); | 1696 FrameAndConstantPoolScope scope(masm, StackFrame::INTERNAL); |
(...skipping 2654 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4343 fp, (PropertyCallbackArguments::kReturnValueOffset + 3) * kPointerSize); | 4351 fp, (PropertyCallbackArguments::kReturnValueOffset + 3) * kPointerSize); |
4344 CallApiFunctionAndReturn(masm, api_function_address, thunk_ref, | 4352 CallApiFunctionAndReturn(masm, api_function_address, thunk_ref, |
4345 kStackUnwindSpace, NULL, return_value_operand, NULL); | 4353 kStackUnwindSpace, NULL, return_value_operand, NULL); |
4346 } | 4354 } |
4347 | 4355 |
4348 #undef __ | 4356 #undef __ |
4349 } // namespace internal | 4357 } // namespace internal |
4350 } // namespace v8 | 4358 } // namespace v8 |
4351 | 4359 |
4352 #endif // V8_TARGET_ARCH_PPC | 4360 #endif // V8_TARGET_ARCH_PPC |
OLD | NEW |