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

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

Issue 7794020: MIPS: Fix implementation of string slices. (Closed)
Patch Set: Created 9 years, 3 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 | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2011 the V8 project authors. All rights reserved. 1 // Copyright 2011 the V8 project authors. All rights reserved.
2 // Redistribution and use in source and binary forms, with or without 2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are 3 // modification, are permitted provided that the following conditions are
4 // met: 4 // met:
5 // 5 //
6 // * Redistributions of source code must retain the above copyright 6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer. 7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above 8 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following 9 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided 10 // disclaimer in the documentation and/or other materials provided
(...skipping 4509 matching lines...) Expand 10 before | Expand all | Expand 10 after
4520 4520
4521 // Reset offset for possibly sliced string. 4521 // Reset offset for possibly sliced string.
4522 __ mov(t0, zero_reg); 4522 __ mov(t0, zero_reg);
4523 // subject: Subject string 4523 // subject: Subject string
4524 // regexp_data: RegExp data (FixedArray) 4524 // regexp_data: RegExp data (FixedArray)
4525 // Check the representation and encoding of the subject string. 4525 // Check the representation and encoding of the subject string.
4526 Label seq_string; 4526 Label seq_string;
4527 __ lw(a0, FieldMemOperand(subject, HeapObject::kMapOffset)); 4527 __ lw(a0, FieldMemOperand(subject, HeapObject::kMapOffset));
4528 __ lbu(a0, FieldMemOperand(a0, Map::kInstanceTypeOffset)); 4528 __ lbu(a0, FieldMemOperand(a0, Map::kInstanceTypeOffset));
4529 // First check for flat string. 4529 // First check for flat string.
4530 __ And(at, a0, Operand(kIsNotStringMask | kStringRepresentationMask)); 4530 __ And(a1, a0, Operand(kIsNotStringMask | kStringRepresentationMask));
4531 STATIC_ASSERT((kStringTag | kSeqStringTag) == 0); 4531 STATIC_ASSERT((kStringTag | kSeqStringTag) == 0);
4532 __ Branch(&seq_string, eq, at, Operand(zero_reg)); 4532 __ Branch(&seq_string, eq, a1, Operand(zero_reg));
4533 4533
4534 // subject: Subject string 4534 // subject: Subject string
4535 // a0: instance type if Subject string 4535 // a0: instance type if Subject string
4536 // regexp_data: RegExp data (FixedArray) 4536 // regexp_data: RegExp data (FixedArray)
4537 // Check for flat cons string or sliced string. 4537 // Check for flat cons string or sliced string.
4538 // A flat cons string is a cons string where the second part is the empty 4538 // A flat cons string is a cons string where the second part is the empty
4539 // string. In that case the subject string is just the first part of the cons 4539 // string. In that case the subject string is just the first part of the cons
4540 // string. Also in this case the first part of the cons string is known to be 4540 // string. Also in this case the first part of the cons string is known to be
4541 // a sequential string or an external string. 4541 // a sequential string or an external string.
4542 // In the case of a sliced string its offset has to be taken into account. 4542 // In the case of a sliced string its offset has to be taken into account.
4543 Label cons_string, check_encoding; 4543 Label cons_string, check_encoding;
4544 STATIC_ASSERT(kConsStringTag < kExternalStringTag); 4544 STATIC_ASSERT(kConsStringTag < kExternalStringTag);
4545 STATIC_ASSERT(kSlicedStringTag > kExternalStringTag); 4545 STATIC_ASSERT(kSlicedStringTag > kExternalStringTag);
4546 __ Branch(&cons_string, lt, at, Operand(kExternalStringTag)); 4546 __ Branch(&cons_string, lt, a1, Operand(kExternalStringTag));
4547 __ Branch(&runtime, eq, at, Operand(kExternalStringTag)); 4547 __ Branch(&runtime, eq, a1, Operand(kExternalStringTag));
4548 4548
4549 // String is sliced. 4549 // String is sliced.
4550 __ lw(t0, FieldMemOperand(subject, SlicedString::kOffsetOffset)); 4550 __ lw(t0, FieldMemOperand(subject, SlicedString::kOffsetOffset));
4551 __ sra(t0, t0, kSmiTagSize); 4551 __ sra(t0, t0, kSmiTagSize);
4552 __ lw(subject, FieldMemOperand(subject, SlicedString::kParentOffset)); 4552 __ lw(subject, FieldMemOperand(subject, SlicedString::kParentOffset));
4553 // t5: offset of sliced string, smi-tagged. 4553 // t5: offset of sliced string, smi-tagged.
4554 __ jmp(&check_encoding); 4554 __ jmp(&check_encoding);
4555 // String is a cons string, check whether it is flat. 4555 // String is a cons string, check whether it is flat.
4556 __ bind(&cons_string); 4556 __ bind(&cons_string);
4557 __ lw(a0, FieldMemOperand(subject, ConsString::kSecondOffset)); 4557 __ lw(a0, FieldMemOperand(subject, ConsString::kSecondOffset));
(...skipping 2310 matching lines...) Expand 10 before | Expand all | Expand 10 after
6868 __ mov(result, zero_reg); 6868 __ mov(result, zero_reg);
6869 __ Ret(); 6869 __ Ret();
6870 } 6870 }
6871 6871
6872 6872
6873 #undef __ 6873 #undef __
6874 6874
6875 } } // namespace v8::internal 6875 } } // namespace v8::internal
6876 6876
6877 #endif // V8_TARGET_ARCH_MIPS 6877 #endif // V8_TARGET_ARCH_MIPS
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698