OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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_MIPS64 | 5 #if V8_TARGET_ARCH_MIPS64 |
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/bootstrapper.h" | 9 #include "src/bootstrapper.h" |
10 #include "src/codegen.h" | 10 #include "src/codegen.h" |
(...skipping 1401 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1412 // and go to (1). Otherwise bail out to runtime. | 1412 // and go to (1). Otherwise bail out to runtime. |
1413 // (4) Sequential string. Load regexp code according to encoding. | 1413 // (4) Sequential string. Load regexp code according to encoding. |
1414 // (E) Carry on. | 1414 // (E) Carry on. |
1415 /// [...] | 1415 /// [...] |
1416 | 1416 |
1417 // Deferred code at the end of the stub: | 1417 // Deferred code at the end of the stub: |
1418 // (5) Long external string? If not, go to (7). | 1418 // (5) Long external string? If not, go to (7). |
1419 // (6) External string. Make it, offset-wise, look like a sequential string. | 1419 // (6) External string. Make it, offset-wise, look like a sequential string. |
1420 // Go to (4). | 1420 // Go to (4). |
1421 // (7) Short external string or not a string? If yes, bail out to runtime. | 1421 // (7) Short external string or not a string? If yes, bail out to runtime. |
1422 // (8) Sliced string. Replace subject with parent. Go to (1). | 1422 // (8) Sliced or thin string. Replace subject with parent. Go to (1). |
1423 | 1423 |
1424 Label check_underlying; // (1) | 1424 Label check_underlying; // (1) |
1425 Label seq_string; // (4) | 1425 Label seq_string; // (4) |
1426 Label not_seq_nor_cons; // (5) | 1426 Label not_seq_nor_cons; // (5) |
1427 Label external_string; // (6) | 1427 Label external_string; // (6) |
1428 Label not_long_external; // (7) | 1428 Label not_long_external; // (7) |
1429 | 1429 |
1430 __ bind(&check_underlying); | 1430 __ bind(&check_underlying); |
1431 __ ld(a2, FieldMemOperand(subject, HeapObject::kMapOffset)); | 1431 __ ld(a2, FieldMemOperand(subject, HeapObject::kMapOffset)); |
1432 __ lbu(a0, FieldMemOperand(a2, Map::kInstanceTypeOffset)); | 1432 __ lbu(a0, FieldMemOperand(a2, Map::kInstanceTypeOffset)); |
1433 | 1433 |
1434 // (1) Sequential string? If yes, go to (4). | 1434 // (1) Sequential string? If yes, go to (4). |
1435 __ And(a1, | 1435 __ And(a1, |
1436 a0, | 1436 a0, |
1437 Operand(kIsNotStringMask | | 1437 Operand(kIsNotStringMask | |
1438 kStringRepresentationMask | | 1438 kStringRepresentationMask | |
1439 kShortExternalStringMask)); | 1439 kShortExternalStringMask)); |
1440 STATIC_ASSERT((kStringTag | kSeqStringTag) == 0); | 1440 STATIC_ASSERT((kStringTag | kSeqStringTag) == 0); |
1441 __ Branch(&seq_string, eq, a1, Operand(zero_reg)); // Go to (4). | 1441 __ Branch(&seq_string, eq, a1, Operand(zero_reg)); // Go to (4). |
1442 | 1442 |
1443 // (2) Sequential or cons? If not, go to (5). | 1443 // (2) Sequential or cons? If not, go to (5). |
1444 STATIC_ASSERT(kConsStringTag < kExternalStringTag); | 1444 STATIC_ASSERT(kConsStringTag < kExternalStringTag); |
1445 STATIC_ASSERT(kSlicedStringTag > kExternalStringTag); | 1445 STATIC_ASSERT(kSlicedStringTag > kExternalStringTag); |
| 1446 STATIC_ASSERT(kThinStringTag > kExternalStringTag); |
1446 STATIC_ASSERT(kIsNotStringMask > kExternalStringTag); | 1447 STATIC_ASSERT(kIsNotStringMask > kExternalStringTag); |
1447 STATIC_ASSERT(kShortExternalStringTag > kExternalStringTag); | 1448 STATIC_ASSERT(kShortExternalStringTag > kExternalStringTag); |
1448 // Go to (5). | 1449 // Go to (5). |
1449 __ Branch(¬_seq_nor_cons, ge, a1, Operand(kExternalStringTag)); | 1450 __ Branch(¬_seq_nor_cons, ge, a1, Operand(kExternalStringTag)); |
1450 | 1451 |
1451 // (3) Cons string. Check that it's flat. | 1452 // (3) Cons string. Check that it's flat. |
1452 // Replace subject with first string and reload instance type. | 1453 // Replace subject with first string and reload instance type. |
1453 __ ld(a0, FieldMemOperand(subject, ConsString::kSecondOffset)); | 1454 __ ld(a0, FieldMemOperand(subject, ConsString::kSecondOffset)); |
1454 __ LoadRoot(a1, Heap::kempty_stringRootIndex); | 1455 __ LoadRoot(a1, Heap::kempty_stringRootIndex); |
1455 __ Branch(&runtime, ne, a0, Operand(a1)); | 1456 __ Branch(&runtime, ne, a0, Operand(a1)); |
1456 __ ld(subject, FieldMemOperand(subject, ConsString::kFirstOffset)); | 1457 __ ld(subject, FieldMemOperand(subject, ConsString::kFirstOffset)); |
1457 __ jmp(&check_underlying); | 1458 __ jmp(&check_underlying); |
1458 | 1459 |
1459 // (4) Sequential string. Load regexp code according to encoding. | 1460 // (4) Sequential string. Load regexp code according to encoding. |
1460 __ bind(&seq_string); | 1461 __ bind(&seq_string); |
1461 // subject: sequential subject string (or look-alike, external string) | 1462 // subject: sequential subject string (or look-alike, external string) |
1462 // a3: original subject string | 1463 // a3: original subject string |
1463 // Load previous index and check range before a3 is overwritten. We have to | 1464 // Load previous index and check range before a3 is overwritten. We have to |
1464 // use a3 instead of subject here because subject might have been only made | 1465 // use a3 instead of subject here because subject might have been only made |
1465 // to look like a sequential string when it actually is an external string. | 1466 // to look like a sequential string when it actually is an external string. |
1466 __ ld(a1, MemOperand(sp, kPreviousIndexOffset)); | 1467 __ ld(a1, MemOperand(sp, kPreviousIndexOffset)); |
1467 __ JumpIfNotSmi(a1, &runtime); | 1468 __ JumpIfNotSmi(a1, &runtime); |
1468 __ ld(a3, FieldMemOperand(a3, String::kLengthOffset)); | 1469 __ ld(a3, FieldMemOperand(a3, String::kLengthOffset)); |
1469 __ Branch(&runtime, ls, a3, Operand(a1)); | 1470 __ Branch(&runtime, ls, a3, Operand(a1)); |
1470 __ SmiUntag(a1); | 1471 __ SmiUntag(a1); |
1471 | 1472 |
1472 STATIC_ASSERT(kStringEncodingMask == 4); | 1473 STATIC_ASSERT(kStringEncodingMask == 8); |
1473 STATIC_ASSERT(kOneByteStringTag == 4); | 1474 STATIC_ASSERT(kOneByteStringTag == 8); |
1474 STATIC_ASSERT(kTwoByteStringTag == 0); | 1475 STATIC_ASSERT(kTwoByteStringTag == 0); |
1475 __ And(a0, a0, Operand(kStringEncodingMask)); // Non-zero for one_byte. | 1476 __ And(a0, a0, Operand(kStringEncodingMask)); // Non-zero for one_byte. |
1476 __ ld(t9, FieldMemOperand(regexp_data, JSRegExp::kDataOneByteCodeOffset)); | 1477 __ ld(t9, FieldMemOperand(regexp_data, JSRegExp::kDataOneByteCodeOffset)); |
1477 __ dsra(a3, a0, 2); // a3 is 1 for one_byte, 0 for UC16 (used below). | 1478 __ dsra(a3, a0, 3); // a3 is 1 for one_byte, 0 for UC16 (used below). |
1478 __ ld(a5, FieldMemOperand(regexp_data, JSRegExp::kDataUC16CodeOffset)); | 1479 __ ld(a5, FieldMemOperand(regexp_data, JSRegExp::kDataUC16CodeOffset)); |
1479 __ Movz(t9, a5, a0); // If UC16 (a0 is 0), replace t9 w/kDataUC16CodeOffset. | 1480 __ Movz(t9, a5, a0); // If UC16 (a0 is 0), replace t9 w/kDataUC16CodeOffset. |
1480 | 1481 |
1481 // (E) Carry on. String handling is done. | 1482 // (E) Carry on. String handling is done. |
1482 // t9: irregexp code | 1483 // t9: irregexp code |
1483 // Check that the irregexp code has been generated for the actual string | 1484 // Check that the irregexp code has been generated for the actual string |
1484 // encoding. If it has, the field contains a code object otherwise it contains | 1485 // encoding. If it has, the field contains a code object otherwise it contains |
1485 // a smi (code flushing support). | 1486 // a smi (code flushing support). |
1486 __ JumpIfSmi(t9, &runtime); | 1487 __ JumpIfSmi(t9, &runtime); |
1487 | 1488 |
(...skipping 225 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1713 subject, | 1714 subject, |
1714 SeqTwoByteString::kHeaderSize - kHeapObjectTag); | 1715 SeqTwoByteString::kHeaderSize - kHeapObjectTag); |
1715 __ jmp(&seq_string); // Go to (4). | 1716 __ jmp(&seq_string); // Go to (4). |
1716 | 1717 |
1717 // (7) Short external string or not a string? If yes, bail out to runtime. | 1718 // (7) Short external string or not a string? If yes, bail out to runtime. |
1718 __ bind(¬_long_external); | 1719 __ bind(¬_long_external); |
1719 STATIC_ASSERT(kNotStringTag != 0 && kShortExternalStringTag !=0); | 1720 STATIC_ASSERT(kNotStringTag != 0 && kShortExternalStringTag !=0); |
1720 __ And(at, a1, Operand(kIsNotStringMask | kShortExternalStringMask)); | 1721 __ And(at, a1, Operand(kIsNotStringMask | kShortExternalStringMask)); |
1721 __ Branch(&runtime, ne, at, Operand(zero_reg)); | 1722 __ Branch(&runtime, ne, at, Operand(zero_reg)); |
1722 | 1723 |
1723 // (8) Sliced string. Replace subject with parent. Go to (4). | 1724 // (8) Sliced or thin string. Replace subject with parent. Go to (4). |
| 1725 Label thin_string; |
| 1726 __ Branch(&thin_string, eq, a1, Operand(kThinStringTag)); |
1724 // Load offset into t0 and replace subject string with parent. | 1727 // Load offset into t0 and replace subject string with parent. |
1725 __ ld(t0, FieldMemOperand(subject, SlicedString::kOffsetOffset)); | 1728 __ ld(t0, FieldMemOperand(subject, SlicedString::kOffsetOffset)); |
1726 __ SmiUntag(t0); | 1729 __ SmiUntag(t0); |
1727 __ ld(subject, FieldMemOperand(subject, SlicedString::kParentOffset)); | 1730 __ ld(subject, FieldMemOperand(subject, SlicedString::kParentOffset)); |
1728 __ jmp(&check_underlying); // Go to (1). | 1731 __ jmp(&check_underlying); // Go to (1). |
| 1732 |
| 1733 __ bind(&thin_string); |
| 1734 __ ld(subject, FieldMemOperand(subject, ThinString::kActualOffset)); |
| 1735 __ jmp(&check_underlying); // Go to (1). |
1729 #endif // V8_INTERPRETED_REGEXP | 1736 #endif // V8_INTERPRETED_REGEXP |
1730 } | 1737 } |
1731 | 1738 |
1732 | 1739 |
1733 static void CallStubInRecordCallTarget(MacroAssembler* masm, CodeStub* stub) { | 1740 static void CallStubInRecordCallTarget(MacroAssembler* masm, CodeStub* stub) { |
1734 // a0 : number of arguments to the construct function | 1741 // a0 : number of arguments to the construct function |
1735 // a2 : feedback vector | 1742 // a2 : feedback vector |
1736 // a3 : slot in feedback vector (Smi) | 1743 // a3 : slot in feedback vector (Smi) |
1737 // a1 : the function to call | 1744 // a1 : the function to call |
1738 FrameScope scope(masm, StackFrame::INTERNAL); | 1745 FrameScope scope(masm, StackFrame::INTERNAL); |
(...skipping 2571 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4310 kStackUnwindSpace, kInvalidStackOffset, | 4317 kStackUnwindSpace, kInvalidStackOffset, |
4311 return_value_operand, NULL); | 4318 return_value_operand, NULL); |
4312 } | 4319 } |
4313 | 4320 |
4314 #undef __ | 4321 #undef __ |
4315 | 4322 |
4316 } // namespace internal | 4323 } // namespace internal |
4317 } // namespace v8 | 4324 } // namespace v8 |
4318 | 4325 |
4319 #endif // V8_TARGET_ARCH_MIPS64 | 4326 #endif // V8_TARGET_ARCH_MIPS64 |
OLD | NEW |