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

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

Issue 2549773002: Internalize strings in-place (Closed)
Patch Set: forgot one Created 4 years 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
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 1402 matching lines...) Expand 10 before | Expand all | Expand 10 after
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 string. Replace subject with parent. Go to (1). 1423 // (8) Sliced or thin string. Replace subject with parent. Go to (1).
1424 1424
1425 Label seq_string /* 4 */, external_string /* 6 */, check_underlying /* 1 */, 1425 Label seq_string /* 4 */, external_string /* 6 */, check_underlying /* 1 */,
1426 not_seq_nor_cons /* 5 */, not_long_external /* 7 */; 1426 not_seq_nor_cons /* 5 */, not_long_external /* 7 */;
1427 1427
1428 __ bind(&check_underlying); 1428 __ bind(&check_underlying);
1429 __ lw(a0, FieldMemOperand(subject, HeapObject::kMapOffset)); 1429 __ lw(a0, FieldMemOperand(subject, HeapObject::kMapOffset));
1430 __ lbu(a0, FieldMemOperand(a0, Map::kInstanceTypeOffset)); 1430 __ lbu(a0, FieldMemOperand(a0, Map::kInstanceTypeOffset));
1431 1431
1432 // (1) Sequential string? If yes, go to (4). 1432 // (1) Sequential string? If yes, go to (4).
1433 __ And(a1, 1433 __ And(a1,
(...skipping 26 matching lines...) Expand all
1460 // a3: original subject string 1460 // a3: original subject string
1461 // Load previous index and check range before a3 is overwritten. We have to 1461 // Load previous index and check range before a3 is overwritten. We have to
1462 // use a3 instead of subject here because subject might have been only made 1462 // use a3 instead of subject here because subject might have been only made
1463 // to look like a sequential string when it actually is an external string. 1463 // to look like a sequential string when it actually is an external string.
1464 __ lw(a1, MemOperand(sp, kPreviousIndexOffset)); 1464 __ lw(a1, MemOperand(sp, kPreviousIndexOffset));
1465 __ JumpIfNotSmi(a1, &runtime); 1465 __ JumpIfNotSmi(a1, &runtime);
1466 __ lw(a3, FieldMemOperand(a3, String::kLengthOffset)); 1466 __ lw(a3, FieldMemOperand(a3, String::kLengthOffset));
1467 __ Branch(&runtime, ls, a3, Operand(a1)); 1467 __ Branch(&runtime, ls, a3, Operand(a1));
1468 __ sra(a1, a1, kSmiTagSize); // Untag the Smi. 1468 __ sra(a1, a1, kSmiTagSize); // Untag the Smi.
1469 1469
1470 STATIC_ASSERT(kStringEncodingMask == 4); 1470 STATIC_ASSERT(kStringEncodingMask == 8);
1471 STATIC_ASSERT(kOneByteStringTag == 4); 1471 STATIC_ASSERT(kOneByteStringTag == 8);
1472 STATIC_ASSERT(kTwoByteStringTag == 0); 1472 STATIC_ASSERT(kTwoByteStringTag == 0);
1473 __ And(a0, a0, Operand(kStringEncodingMask)); // Non-zero for one-byte. 1473 __ And(a0, a0, Operand(kStringEncodingMask)); // Non-zero for one-byte.
1474 __ lw(t9, FieldMemOperand(regexp_data, JSRegExp::kDataOneByteCodeOffset)); 1474 __ lw(t9, FieldMemOperand(regexp_data, JSRegExp::kDataOneByteCodeOffset));
1475 __ sra(a3, a0, 2); // a3 is 1 for ASCII, 0 for UC16 (used below). 1475 __ sra(a3, a0, 2); // a3 is 1 for ASCII, 0 for UC16 (used below).
1476 __ lw(t1, FieldMemOperand(regexp_data, JSRegExp::kDataUC16CodeOffset)); 1476 __ lw(t1, FieldMemOperand(regexp_data, JSRegExp::kDataUC16CodeOffset));
1477 __ Movz(t9, t1, a0); // If UC16 (a0 is 0), replace t9 w/kDataUC16CodeOffset. 1477 __ Movz(t9, t1, a0); // If UC16 (a0 is 0), replace t9 w/kDataUC16CodeOffset.
1478 1478
1479 // (E) Carry on. String handling is done. 1479 // (E) Carry on. String handling is done.
1480 // t9: irregexp code 1480 // t9: irregexp code
1481 // Check that the irregexp code has been generated for the actual string 1481 // Check that the irregexp code has been generated for the actual string
(...skipping 228 matching lines...) Expand 10 before | Expand all | Expand 10 after
1710 subject, 1710 subject,
1711 SeqTwoByteString::kHeaderSize - kHeapObjectTag); 1711 SeqTwoByteString::kHeaderSize - kHeapObjectTag);
1712 __ jmp(&seq_string); // Go to (5). 1712 __ jmp(&seq_string); // Go to (5).
1713 1713
1714 // (7) Short external string or not a string? If yes, bail out to runtime. 1714 // (7) Short external string or not a string? If yes, bail out to runtime.
1715 __ bind(&not_long_external); 1715 __ bind(&not_long_external);
1716 STATIC_ASSERT(kNotStringTag != 0 && kShortExternalStringTag !=0); 1716 STATIC_ASSERT(kNotStringTag != 0 && kShortExternalStringTag !=0);
1717 __ And(at, a1, Operand(kIsNotStringMask | kShortExternalStringMask)); 1717 __ And(at, a1, Operand(kIsNotStringMask | kShortExternalStringMask));
1718 __ Branch(&runtime, ne, at, Operand(zero_reg)); 1718 __ Branch(&runtime, ne, at, Operand(zero_reg));
1719 1719
1720 // (8) Sliced string. Replace subject with parent. Go to (4). 1720 // (8) Sliced or thin string. Replace subject with parent. Go to (4).
1721 Label thin_string;
1722 __ Branch(&thin_string, eq, a1, Operand(kThinStringTag));
1721 // Load offset into t0 and replace subject string with parent. 1723 // Load offset into t0 and replace subject string with parent.
1722 __ lw(t0, FieldMemOperand(subject, SlicedString::kOffsetOffset)); 1724 __ lw(t0, FieldMemOperand(subject, SlicedString::kOffsetOffset));
1723 __ sra(t0, t0, kSmiTagSize); 1725 __ sra(t0, t0, kSmiTagSize);
1724 __ lw(subject, FieldMemOperand(subject, SlicedString::kParentOffset)); 1726 __ lw(subject, FieldMemOperand(subject, SlicedString::kParentOffset));
1725 __ jmp(&check_underlying); // Go to (4). 1727 __ jmp(&check_underlying); // Go to (4).
1728
1729 __ bind(&thin_string);
1730 __ lw(subject, FieldMemOperand(subject, ThinString::kActualOffset));
1731 __ jmp(&check_underlying); // Go to (4).
1726 #endif // V8_INTERPRETED_REGEXP 1732 #endif // V8_INTERPRETED_REGEXP
1727 } 1733 }
1728 1734
1729 1735
1730 static void CallStubInRecordCallTarget(MacroAssembler* masm, CodeStub* stub) { 1736 static void CallStubInRecordCallTarget(MacroAssembler* masm, CodeStub* stub) {
1731 // a0 : number of arguments to the construct function 1737 // a0 : number of arguments to the construct function
1732 // a2 : feedback vector 1738 // a2 : feedback vector
1733 // a3 : slot in feedback vector (Smi) 1739 // a3 : slot in feedback vector (Smi)
1734 // a1 : the function to call 1740 // a1 : the function to call
1735 FrameScope scope(masm, StackFrame::INTERNAL); 1741 FrameScope scope(masm, StackFrame::INTERNAL);
(...skipping 2792 matching lines...) Expand 10 before | Expand all | Expand 10 after
4528 kStackUnwindSpace, kInvalidStackOffset, 4534 kStackUnwindSpace, kInvalidStackOffset,
4529 return_value_operand, NULL); 4535 return_value_operand, NULL);
4530 } 4536 }
4531 4537
4532 #undef __ 4538 #undef __
4533 4539
4534 } // namespace internal 4540 } // namespace internal
4535 } // namespace v8 4541 } // namespace v8
4536 4542
4537 #endif // V8_TARGET_ARCH_MIPS 4543 #endif // V8_TARGET_ARCH_MIPS
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698