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

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

Issue 2549773002: Internalize strings in-place (Closed)
Patch Set: rebased 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 1404 matching lines...) Expand 10 before | Expand all | Expand 10 after
1415 // and go to (1). Otherwise bail out to runtime. 1415 // and go to (1). Otherwise bail out to runtime.
1416 // (4) Sequential string. Load regexp code according to encoding. 1416 // (4) Sequential string. Load regexp code according to encoding.
1417 // (E) Carry on. 1417 // (E) Carry on.
1418 /// [...] 1418 /// [...]
1419 1419
1420 // Deferred code at the end of the stub: 1420 // Deferred code at the end of the stub:
1421 // (5) Long external string? If not, go to (7). 1421 // (5) Long external string? If not, go to (7).
1422 // (6) External string. Make it, offset-wise, look like a sequential string. 1422 // (6) External string. Make it, offset-wise, look like a sequential string.
1423 // Go to (4). 1423 // Go to (4).
1424 // (7) Short external string or not a string? If yes, bail out to runtime. 1424 // (7) Short external string or not a string? If yes, bail out to runtime.
1425 // (8) Sliced string. Replace subject with parent. Go to (1). 1425 // (8) Sliced or thin string. Replace subject with parent. Go to (1).
1426 1426
1427 Label seq_string /* 4 */, external_string /* 6 */, check_underlying /* 1 */, 1427 Label seq_string /* 4 */, external_string /* 6 */, check_underlying /* 1 */,
1428 not_seq_nor_cons /* 5 */, not_long_external /* 7 */; 1428 not_seq_nor_cons /* 5 */, not_long_external /* 7 */;
1429 1429
1430 __ bind(&check_underlying); 1430 __ bind(&check_underlying);
1431 __ lw(a0, FieldMemOperand(subject, HeapObject::kMapOffset)); 1431 __ lw(a0, FieldMemOperand(subject, HeapObject::kMapOffset));
1432 __ lbu(a0, FieldMemOperand(a0, Map::kInstanceTypeOffset)); 1432 __ lbu(a0, FieldMemOperand(a0, 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 (5). 1441 __ Branch(&seq_string, eq, a1, Operand(zero_reg)); // Go to (5).
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(&not_seq_nor_cons, ge, a1, Operand(kExternalStringTag)); 1450 __ Branch(&not_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 __ lw(a0, FieldMemOperand(subject, ConsString::kSecondOffset)); 1454 __ lw(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 __ lw(subject, FieldMemOperand(subject, ConsString::kFirstOffset)); 1457 __ lw(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 __ lw(a1, MemOperand(sp, kPreviousIndexOffset)); 1467 __ lw(a1, MemOperand(sp, kPreviousIndexOffset));
1467 __ JumpIfNotSmi(a1, &runtime); 1468 __ JumpIfNotSmi(a1, &runtime);
1468 __ lw(a3, FieldMemOperand(a3, String::kLengthOffset)); 1469 __ lw(a3, FieldMemOperand(a3, String::kLengthOffset));
1469 __ Branch(&runtime, ls, a3, Operand(a1)); 1470 __ Branch(&runtime, ls, a3, Operand(a1));
1470 __ sra(a1, a1, kSmiTagSize); // Untag the Smi. 1471 __ sra(a1, a1, kSmiTagSize); // Untag the Smi.
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 __ lw(t9, FieldMemOperand(regexp_data, JSRegExp::kDataOneByteCodeOffset)); 1477 __ lw(t9, FieldMemOperand(regexp_data, JSRegExp::kDataOneByteCodeOffset));
1477 __ sra(a3, a0, 2); // a3 is 1 for ASCII, 0 for UC16 (used below). 1478 __ sra(a3, a0, 3); // a3 is 1 for ASCII, 0 for UC16 (used below).
1478 __ lw(t1, FieldMemOperand(regexp_data, JSRegExp::kDataUC16CodeOffset)); 1479 __ lw(t1, FieldMemOperand(regexp_data, JSRegExp::kDataUC16CodeOffset));
1479 __ 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.
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 224 matching lines...) Expand 10 before | Expand all | Expand 10 after
1712 subject, 1713 subject,
1713 SeqTwoByteString::kHeaderSize - kHeapObjectTag); 1714 SeqTwoByteString::kHeaderSize - kHeapObjectTag);
1714 __ jmp(&seq_string); // Go to (5). 1715 __ jmp(&seq_string); // Go to (5).
1715 1716
1716 // (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.
1717 __ bind(&not_long_external); 1718 __ bind(&not_long_external);
1718 STATIC_ASSERT(kNotStringTag != 0 && kShortExternalStringTag !=0); 1719 STATIC_ASSERT(kNotStringTag != 0 && kShortExternalStringTag !=0);
1719 __ And(at, a1, Operand(kIsNotStringMask | kShortExternalStringMask)); 1720 __ And(at, a1, Operand(kIsNotStringMask | kShortExternalStringMask));
1720 __ Branch(&runtime, ne, at, Operand(zero_reg)); 1721 __ Branch(&runtime, ne, at, Operand(zero_reg));
1721 1722
1722 // (8) Sliced string. Replace subject with parent. Go to (4). 1723 // (8) Sliced or thin string. Replace subject with parent. Go to (4).
1724 Label thin_string;
1725 __ Branch(&thin_string, eq, a1, Operand(kThinStringTag));
1723 // Load offset into t0 and replace subject string with parent. 1726 // Load offset into t0 and replace subject string with parent.
1724 __ lw(t0, FieldMemOperand(subject, SlicedString::kOffsetOffset)); 1727 __ lw(t0, FieldMemOperand(subject, SlicedString::kOffsetOffset));
1725 __ sra(t0, t0, kSmiTagSize); 1728 __ sra(t0, t0, kSmiTagSize);
1726 __ lw(subject, FieldMemOperand(subject, SlicedString::kParentOffset)); 1729 __ lw(subject, FieldMemOperand(subject, SlicedString::kParentOffset));
1727 __ jmp(&check_underlying); // Go to (4). 1730 __ jmp(&check_underlying); // Go to (4).
1731
1732 __ bind(&thin_string);
1733 __ lw(subject, FieldMemOperand(subject, ThinString::kActualOffset));
1734 __ jmp(&check_underlying); // Go to (4).
1728 #endif // V8_INTERPRETED_REGEXP 1735 #endif // V8_INTERPRETED_REGEXP
1729 } 1736 }
1730 1737
1731 1738
1732 static void CallStubInRecordCallTarget(MacroAssembler* masm, CodeStub* stub) { 1739 static void CallStubInRecordCallTarget(MacroAssembler* masm, CodeStub* stub) {
1733 // a0 : number of arguments to the construct function 1740 // a0 : number of arguments to the construct function
1734 // a2 : feedback vector 1741 // a2 : feedback vector
1735 // a3 : slot in feedback vector (Smi) 1742 // a3 : slot in feedback vector (Smi)
1736 // a1 : the function to call 1743 // a1 : the function to call
1737 FrameScope scope(masm, StackFrame::INTERNAL); 1744 FrameScope scope(masm, StackFrame::INTERNAL);
(...skipping 2547 matching lines...) Expand 10 before | Expand all | Expand 10 after
4285 kStackUnwindSpace, kInvalidStackOffset, 4292 kStackUnwindSpace, kInvalidStackOffset,
4286 return_value_operand, NULL); 4293 return_value_operand, NULL);
4287 } 4294 }
4288 4295
4289 #undef __ 4296 #undef __
4290 4297
4291 } // namespace internal 4298 } // namespace internal
4292 } // namespace v8 4299 } // namespace v8
4293 4300
4294 #endif // V8_TARGET_ARCH_MIPS 4301 #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