Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(710)

Side by Side Diff: src/mips/code-stubs-mips.cc

Issue 2621913002: Revert of Internalize strings in-place (Closed)
Patch Set: Created 3 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/ic/keyed-store-generic.cc ('k') | src/mips/codegen-mips.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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_MIPS 5 #if V8_TARGET_ARCH_MIPS
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 1405 matching lines...) Expand 10 before | Expand all | Expand 10 after
1416 // and go to (1). Otherwise bail out to runtime. 1416 // and go to (1). Otherwise bail out to runtime.
1417 // (4) Sequential string. Load regexp code according to encoding. 1417 // (4) Sequential string. Load regexp code according to encoding.
1418 // (E) Carry on. 1418 // (E) Carry on.
1419 /// [...] 1419 /// [...]
1420 1420
1421 // Deferred code at the end of the stub: 1421 // Deferred code at the end of the stub:
1422 // (5) Long external string? If not, go to (7). 1422 // (5) Long external string? If not, go to (7).
1423 // (6) External string. Make it, offset-wise, look like a sequential string. 1423 // (6) External string. Make it, offset-wise, look like a sequential string.
1424 // Go to (4). 1424 // Go to (4).
1425 // (7) Short external string or not a string? If yes, bail out to runtime. 1425 // (7) Short external string or not a string? If yes, bail out to runtime.
1426 // (8) Sliced or thin string. Replace subject with parent. Go to (1). 1426 // (8) Sliced string. Replace subject with parent. Go to (1).
1427 1427
1428 Label seq_string /* 4 */, external_string /* 6 */, check_underlying /* 1 */, 1428 Label seq_string /* 4 */, external_string /* 6 */, check_underlying /* 1 */,
1429 not_seq_nor_cons /* 5 */, not_long_external /* 7 */; 1429 not_seq_nor_cons /* 5 */, not_long_external /* 7 */;
1430 1430
1431 __ bind(&check_underlying); 1431 __ bind(&check_underlying);
1432 __ lw(a0, FieldMemOperand(subject, HeapObject::kMapOffset)); 1432 __ lw(a0, FieldMemOperand(subject, HeapObject::kMapOffset));
1433 __ lbu(a0, FieldMemOperand(a0, Map::kInstanceTypeOffset)); 1433 __ lbu(a0, FieldMemOperand(a0, 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 (5). 1442 __ Branch(&seq_string, eq, a1, Operand(zero_reg)); // Go to (5).
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(&not_seq_nor_cons, ge, a1, Operand(kExternalStringTag)); 1450 __ Branch(&not_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 __ lw(a0, FieldMemOperand(subject, ConsString::kSecondOffset)); 1454 __ lw(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 __ lw(subject, FieldMemOperand(subject, ConsString::kFirstOffset)); 1457 __ lw(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 __ lw(a1, MemOperand(sp, kPreviousIndexOffset)); 1467 __ lw(a1, MemOperand(sp, kPreviousIndexOffset));
1469 __ JumpIfNotSmi(a1, &runtime); 1468 __ JumpIfNotSmi(a1, &runtime);
1470 __ lw(a3, FieldMemOperand(a3, String::kLengthOffset)); 1469 __ lw(a3, FieldMemOperand(a3, String::kLengthOffset));
1471 __ Branch(&runtime, ls, a3, Operand(a1)); 1470 __ Branch(&runtime, ls, a3, Operand(a1));
1472 __ sra(a1, a1, kSmiTagSize); // Untag the Smi. 1471 __ sra(a1, a1, kSmiTagSize); // Untag the Smi.
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 __ lw(t9, FieldMemOperand(regexp_data, JSRegExp::kDataOneByteCodeOffset)); 1477 __ lw(t9, FieldMemOperand(regexp_data, JSRegExp::kDataOneByteCodeOffset));
1479 __ sra(a3, a0, 2); // a3 is 1 for ASCII, 0 for UC16 (used below). 1478 __ sra(a3, a0, 2); // a3 is 1 for ASCII, 0 for UC16 (used below).
1480 __ lw(t1, FieldMemOperand(regexp_data, JSRegExp::kDataUC16CodeOffset)); 1479 __ lw(t1, FieldMemOperand(regexp_data, JSRegExp::kDataUC16CodeOffset));
1481 __ Movz(t9, t1, a0); // If UC16 (a0 is 0), replace t9 w/kDataUC16CodeOffset. 1480 __ Movz(t9, t1, 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 228 matching lines...) Expand 10 before | Expand all | Expand 10 after
1714 subject, 1713 subject,
1715 SeqTwoByteString::kHeaderSize - kHeapObjectTag); 1714 SeqTwoByteString::kHeaderSize - kHeapObjectTag);
1716 __ jmp(&seq_string); // Go to (5). 1715 __ jmp(&seq_string); // Go to (5).
1717 1716
1718 // (7) Short external string or not a string? If yes, bail out to runtime. 1717 // (7) Short external string or not a string? If yes, bail out to runtime.
1719 __ bind(&not_long_external); 1718 __ bind(&not_long_external);
1720 STATIC_ASSERT(kNotStringTag != 0 && kShortExternalStringTag !=0); 1719 STATIC_ASSERT(kNotStringTag != 0 && kShortExternalStringTag !=0);
1721 __ And(at, a1, Operand(kIsNotStringMask | kShortExternalStringMask)); 1720 __ And(at, a1, Operand(kIsNotStringMask | kShortExternalStringMask));
1722 __ Branch(&runtime, ne, at, Operand(zero_reg)); 1721 __ Branch(&runtime, ne, at, Operand(zero_reg));
1723 1722
1724 // (8) Sliced or thin string. Replace subject with parent. Go to (4). 1723 // (8) Sliced string. Replace subject with parent. Go to (4).
1725 Label thin_string;
1726 __ Branch(&thin_string, eq, a1, Operand(kThinStringTag));
1727 // Load offset into t0 and replace subject string with parent. 1724 // Load offset into t0 and replace subject string with parent.
1728 __ lw(t0, FieldMemOperand(subject, SlicedString::kOffsetOffset)); 1725 __ lw(t0, FieldMemOperand(subject, SlicedString::kOffsetOffset));
1729 __ sra(t0, t0, kSmiTagSize); 1726 __ sra(t0, t0, kSmiTagSize);
1730 __ lw(subject, FieldMemOperand(subject, SlicedString::kParentOffset)); 1727 __ lw(subject, FieldMemOperand(subject, SlicedString::kParentOffset));
1731 __ jmp(&check_underlying); // Go to (4). 1728 __ jmp(&check_underlying); // Go to (4).
1732
1733 __ bind(&thin_string);
1734 __ lw(subject, FieldMemOperand(subject, ThinString::kActualOffset));
1735 __ jmp(&check_underlying); // Go to (4).
1736 #endif // V8_INTERPRETED_REGEXP 1729 #endif // V8_INTERPRETED_REGEXP
1737 } 1730 }
1738 1731
1739 1732
1740 static void CallStubInRecordCallTarget(MacroAssembler* masm, CodeStub* stub) { 1733 static void CallStubInRecordCallTarget(MacroAssembler* masm, CodeStub* stub) {
1741 // a0 : number of arguments to the construct function 1734 // a0 : number of arguments to the construct function
1742 // a2 : feedback vector 1735 // a2 : feedback vector
1743 // a3 : slot in feedback vector (Smi) 1736 // a3 : slot in feedback vector (Smi)
1744 // a1 : the function to call 1737 // a1 : the function to call
1745 FrameScope scope(masm, StackFrame::INTERNAL); 1738 FrameScope scope(masm, StackFrame::INTERNAL);
(...skipping 2626 matching lines...) Expand 10 before | Expand all | Expand 10 after
4372 kStackUnwindSpace, kInvalidStackOffset, 4365 kStackUnwindSpace, kInvalidStackOffset,
4373 return_value_operand, NULL); 4366 return_value_operand, NULL);
4374 } 4367 }
4375 4368
4376 #undef __ 4369 #undef __
4377 4370
4378 } // namespace internal 4371 } // namespace internal
4379 } // namespace v8 4372 } // namespace v8
4380 4373
4381 #endif // V8_TARGET_ARCH_MIPS 4374 #endif // V8_TARGET_ARCH_MIPS
OLDNEW
« no previous file with comments | « src/ic/keyed-store-generic.cc ('k') | src/mips/codegen-mips.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698