| 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 1402 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1413 // and go to (1). Otherwise bail out to runtime. | 1413 // and go to (1). Otherwise bail out to runtime. |
| 1414 // (4) Sequential string. Load regexp code according to encoding. | 1414 // (4) Sequential string. Load regexp code according to encoding. |
| 1415 // (E) Carry on. | 1415 // (E) Carry on. |
| 1416 /// [...] | 1416 /// [...] |
| 1417 | 1417 |
| 1418 // Deferred code at the end of the stub: | 1418 // Deferred code at the end of the stub: |
| 1419 // (5) Long external string? If not, go to (7). | 1419 // (5) Long external string? If not, go to (7). |
| 1420 // (6) External string. Make it, offset-wise, look like a sequential string. | 1420 // (6) External string. Make it, offset-wise, look like a sequential string. |
| 1421 // Go to (4). | 1421 // Go to (4). |
| 1422 // (7) Short external string or not a string? If yes, bail out to runtime. | 1422 // (7) Short external string or not a string? If yes, bail out to runtime. |
| 1423 // (8) Sliced or thin string. Replace subject with parent. Go to (1). | 1423 // (8) Sliced string. Replace subject with parent. Go to (1). |
| 1424 | 1424 |
| 1425 Label check_underlying; // (1) | 1425 Label check_underlying; // (1) |
| 1426 Label seq_string; // (4) | 1426 Label seq_string; // (4) |
| 1427 Label not_seq_nor_cons; // (5) | 1427 Label not_seq_nor_cons; // (5) |
| 1428 Label external_string; // (6) | 1428 Label external_string; // (6) |
| 1429 Label not_long_external; // (7) | 1429 Label not_long_external; // (7) |
| 1430 | 1430 |
| 1431 __ bind(&check_underlying); | 1431 __ bind(&check_underlying); |
| 1432 __ ld(a2, FieldMemOperand(subject, HeapObject::kMapOffset)); | 1432 __ ld(a2, FieldMemOperand(subject, HeapObject::kMapOffset)); |
| 1433 __ lbu(a0, FieldMemOperand(a2, Map::kInstanceTypeOffset)); | 1433 __ lbu(a0, FieldMemOperand(a2, Map::kInstanceTypeOffset)); |
| 1434 | 1434 |
| 1435 // (1) Sequential string? If yes, go to (4). | 1435 // (1) Sequential string? If yes, go to (4). |
| 1436 __ And(a1, | 1436 __ And(a1, |
| 1437 a0, | 1437 a0, |
| 1438 Operand(kIsNotStringMask | | 1438 Operand(kIsNotStringMask | |
| 1439 kStringRepresentationMask | | 1439 kStringRepresentationMask | |
| 1440 kShortExternalStringMask)); | 1440 kShortExternalStringMask)); |
| 1441 STATIC_ASSERT((kStringTag | kSeqStringTag) == 0); | 1441 STATIC_ASSERT((kStringTag | kSeqStringTag) == 0); |
| 1442 __ Branch(&seq_string, eq, a1, Operand(zero_reg)); // Go to (4). | 1442 __ Branch(&seq_string, eq, a1, Operand(zero_reg)); // Go to (4). |
| 1443 | 1443 |
| 1444 // (2) Sequential or cons? If not, go to (5). | 1444 // (2) Sequential or cons? If not, go to (5). |
| 1445 STATIC_ASSERT(kConsStringTag < kExternalStringTag); | 1445 STATIC_ASSERT(kConsStringTag < kExternalStringTag); |
| 1446 STATIC_ASSERT(kSlicedStringTag > kExternalStringTag); | 1446 STATIC_ASSERT(kSlicedStringTag > kExternalStringTag); |
| 1447 STATIC_ASSERT(kThinStringTag > kExternalStringTag); | |
| 1448 STATIC_ASSERT(kIsNotStringMask > kExternalStringTag); | 1447 STATIC_ASSERT(kIsNotStringMask > kExternalStringTag); |
| 1449 STATIC_ASSERT(kShortExternalStringTag > kExternalStringTag); | 1448 STATIC_ASSERT(kShortExternalStringTag > kExternalStringTag); |
| 1450 // Go to (5). | 1449 // Go to (5). |
| 1451 __ Branch(¬_seq_nor_cons, ge, a1, Operand(kExternalStringTag)); | 1450 __ Branch(¬_seq_nor_cons, ge, a1, Operand(kExternalStringTag)); |
| 1452 | 1451 |
| 1453 // (3) Cons string. Check that it's flat. | 1452 // (3) Cons string. Check that it's flat. |
| 1454 // Replace subject with first string and reload instance type. | 1453 // Replace subject with first string and reload instance type. |
| 1455 __ ld(a0, FieldMemOperand(subject, ConsString::kSecondOffset)); | 1454 __ ld(a0, FieldMemOperand(subject, ConsString::kSecondOffset)); |
| 1456 __ LoadRoot(a1, Heap::kempty_stringRootIndex); | 1455 __ LoadRoot(a1, Heap::kempty_stringRootIndex); |
| 1457 __ Branch(&runtime, ne, a0, Operand(a1)); | 1456 __ Branch(&runtime, ne, a0, Operand(a1)); |
| 1458 __ ld(subject, FieldMemOperand(subject, ConsString::kFirstOffset)); | 1457 __ ld(subject, FieldMemOperand(subject, ConsString::kFirstOffset)); |
| 1459 __ jmp(&check_underlying); | 1458 __ jmp(&check_underlying); |
| 1460 | 1459 |
| 1461 // (4) Sequential string. Load regexp code according to encoding. | 1460 // (4) Sequential string. Load regexp code according to encoding. |
| 1462 __ bind(&seq_string); | 1461 __ bind(&seq_string); |
| 1463 // subject: sequential subject string (or look-alike, external string) | 1462 // subject: sequential subject string (or look-alike, external string) |
| 1464 // a3: original subject string | 1463 // a3: original subject string |
| 1465 // 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 |
| 1466 // 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 |
| 1467 // 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. |
| 1468 __ ld(a1, MemOperand(sp, kPreviousIndexOffset)); | 1467 __ ld(a1, MemOperand(sp, kPreviousIndexOffset)); |
| 1469 __ JumpIfNotSmi(a1, &runtime); | 1468 __ JumpIfNotSmi(a1, &runtime); |
| 1470 __ ld(a3, FieldMemOperand(a3, String::kLengthOffset)); | 1469 __ ld(a3, FieldMemOperand(a3, String::kLengthOffset)); |
| 1471 __ Branch(&runtime, ls, a3, Operand(a1)); | 1470 __ Branch(&runtime, ls, a3, Operand(a1)); |
| 1472 __ SmiUntag(a1); | 1471 __ SmiUntag(a1); |
| 1473 | 1472 |
| 1474 STATIC_ASSERT(kStringEncodingMask == 8); | 1473 STATIC_ASSERT(kStringEncodingMask == 4); |
| 1475 STATIC_ASSERT(kOneByteStringTag == 8); | 1474 STATIC_ASSERT(kOneByteStringTag == 4); |
| 1476 STATIC_ASSERT(kTwoByteStringTag == 0); | 1475 STATIC_ASSERT(kTwoByteStringTag == 0); |
| 1477 __ And(a0, a0, Operand(kStringEncodingMask)); // Non-zero for one_byte. | 1476 __ And(a0, a0, Operand(kStringEncodingMask)); // Non-zero for one_byte. |
| 1478 __ ld(t9, FieldMemOperand(regexp_data, JSRegExp::kDataOneByteCodeOffset)); | 1477 __ ld(t9, FieldMemOperand(regexp_data, JSRegExp::kDataOneByteCodeOffset)); |
| 1479 __ dsra(a3, a0, 2); // a3 is 1 for one_byte, 0 for UC16 (used below). | 1478 __ dsra(a3, a0, 2); // a3 is 1 for one_byte, 0 for UC16 (used below). |
| 1480 __ ld(a5, FieldMemOperand(regexp_data, JSRegExp::kDataUC16CodeOffset)); | 1479 __ ld(a5, FieldMemOperand(regexp_data, JSRegExp::kDataUC16CodeOffset)); |
| 1481 __ 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. |
| 1482 | 1481 |
| 1483 // (E) Carry on. String handling is done. | 1482 // (E) Carry on. String handling is done. |
| 1484 // t9: irregexp code | 1483 // t9: irregexp code |
| 1485 // 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 |
| (...skipping 229 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1715 subject, | 1714 subject, |
| 1716 SeqTwoByteString::kHeaderSize - kHeapObjectTag); | 1715 SeqTwoByteString::kHeaderSize - kHeapObjectTag); |
| 1717 __ jmp(&seq_string); // Go to (4). | 1716 __ jmp(&seq_string); // Go to (4). |
| 1718 | 1717 |
| 1719 // (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. |
| 1720 __ bind(¬_long_external); | 1719 __ bind(¬_long_external); |
| 1721 STATIC_ASSERT(kNotStringTag != 0 && kShortExternalStringTag !=0); | 1720 STATIC_ASSERT(kNotStringTag != 0 && kShortExternalStringTag !=0); |
| 1722 __ And(at, a1, Operand(kIsNotStringMask | kShortExternalStringMask)); | 1721 __ And(at, a1, Operand(kIsNotStringMask | kShortExternalStringMask)); |
| 1723 __ Branch(&runtime, ne, at, Operand(zero_reg)); | 1722 __ Branch(&runtime, ne, at, Operand(zero_reg)); |
| 1724 | 1723 |
| 1725 // (8) Sliced or thin string. Replace subject with parent. Go to (4). | 1724 // (8) Sliced string. Replace subject with parent. Go to (4). |
| 1726 Label thin_string; | |
| 1727 __ Branch(&thin_string, eq, a1, Operand(kThinStringTag)); | |
| 1728 // Load offset into t0 and replace subject string with parent. | 1725 // Load offset into t0 and replace subject string with parent. |
| 1729 __ ld(t0, FieldMemOperand(subject, SlicedString::kOffsetOffset)); | 1726 __ ld(t0, FieldMemOperand(subject, SlicedString::kOffsetOffset)); |
| 1730 __ SmiUntag(t0); | 1727 __ SmiUntag(t0); |
| 1731 __ ld(subject, FieldMemOperand(subject, SlicedString::kParentOffset)); | 1728 __ ld(subject, FieldMemOperand(subject, SlicedString::kParentOffset)); |
| 1732 __ jmp(&check_underlying); // Go to (1). | 1729 __ jmp(&check_underlying); // Go to (1). |
| 1733 | |
| 1734 __ bind(&thin_string); | |
| 1735 __ ld(subject, FieldMemOperand(subject, ThinString::kActualOffset)); | |
| 1736 __ jmp(&check_underlying); // Go to (1). | |
| 1737 #endif // V8_INTERPRETED_REGEXP | 1730 #endif // V8_INTERPRETED_REGEXP |
| 1738 } | 1731 } |
| 1739 | 1732 |
| 1740 | 1733 |
| 1741 static void CallStubInRecordCallTarget(MacroAssembler* masm, CodeStub* stub) { | 1734 static void CallStubInRecordCallTarget(MacroAssembler* masm, CodeStub* stub) { |
| 1742 // a0 : number of arguments to the construct function | 1735 // a0 : number of arguments to the construct function |
| 1743 // a2 : feedback vector | 1736 // a2 : feedback vector |
| 1744 // a3 : slot in feedback vector (Smi) | 1737 // a3 : slot in feedback vector (Smi) |
| 1745 // a1 : the function to call | 1738 // a1 : the function to call |
| 1746 FrameScope scope(masm, StackFrame::INTERNAL); | 1739 FrameScope scope(masm, StackFrame::INTERNAL); |
| (...skipping 2649 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4396 kStackUnwindSpace, kInvalidStackOffset, | 4389 kStackUnwindSpace, kInvalidStackOffset, |
| 4397 return_value_operand, NULL); | 4390 return_value_operand, NULL); |
| 4398 } | 4391 } |
| 4399 | 4392 |
| 4400 #undef __ | 4393 #undef __ |
| 4401 | 4394 |
| 4402 } // namespace internal | 4395 } // namespace internal |
| 4403 } // namespace v8 | 4396 } // namespace v8 |
| 4404 | 4397 |
| 4405 #endif // V8_TARGET_ARCH_MIPS64 | 4398 #endif // V8_TARGET_ARCH_MIPS64 |
| OLD | NEW |