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

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

Issue 8585041: MIPS: Change generated code for substring not to bail out to runtime system. (Closed)
Patch Set: Created 9 years, 1 month 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 6008 matching lines...) Expand 10 before | Expand all | Expand 10 after
6019 __ jmp(&return_v0); 6019 __ jmp(&return_v0);
6020 6020
6021 if (FLAG_string_slices) { 6021 if (FLAG_string_slices) {
6022 __ bind(&create_slice); 6022 __ bind(&create_slice);
6023 // v0: original string 6023 // v0: original string
6024 // a1: instance type 6024 // a1: instance type
6025 // a2: length 6025 // a2: length
6026 // a3: from index (untagged smi) 6026 // a3: from index (untagged smi)
6027 // t2 (a.k.a. to): to (smi) 6027 // t2 (a.k.a. to): to (smi)
6028 // t3 (a.k.a. from): from offset (smi) 6028 // t3 (a.k.a. from): from offset (smi)
6029 Label allocate_slice, sliced_string, seq_string; 6029 Label allocate_slice, sliced_string, seq_or_external_string;
6030 STATIC_ASSERT(kSeqStringTag == 0); 6030 // If the string is not indirect, it can only be sequential or external.
6031 __ And(t4, a1, Operand(kStringRepresentationMask));
6032 __ Branch(&seq_string, eq, t4, Operand(zero_reg));
6033 STATIC_ASSERT(kIsIndirectStringMask == (kSlicedStringTag & kConsStringTag)); 6031 STATIC_ASSERT(kIsIndirectStringMask == (kSlicedStringTag & kConsStringTag));
6034 STATIC_ASSERT(kIsIndirectStringMask != 0); 6032 STATIC_ASSERT(kIsIndirectStringMask != 0);
6035 __ And(t4, a1, Operand(kIsIndirectStringMask)); 6033 __ And(t4, a1, Operand(kIsIndirectStringMask));
6036 // External string. Jump to runtime. 6034 // External string. Jump to runtime.
6037 __ Branch(&sub_string_runtime, eq, t4, Operand(zero_reg)); 6035 __ Branch(&seq_or_external_string, eq, t4, Operand(zero_reg));
6038 6036
6039 __ And(t4, a1, Operand(kSlicedNotConsMask)); 6037 __ And(t4, a1, Operand(kSlicedNotConsMask));
6040 __ Branch(&sliced_string, ne, t4, Operand(zero_reg)); 6038 __ Branch(&sliced_string, ne, t4, Operand(zero_reg));
6041 // Cons string. Check whether it is flat, then fetch first part. 6039 // Cons string. Check whether it is flat, then fetch first part.
6042 __ lw(t1, FieldMemOperand(v0, ConsString::kSecondOffset)); 6040 __ lw(t1, FieldMemOperand(v0, ConsString::kSecondOffset));
6043 __ LoadRoot(t5, Heap::kEmptyStringRootIndex); 6041 __ LoadRoot(t5, Heap::kEmptyStringRootIndex);
6044 __ Branch(&sub_string_runtime, ne, t1, Operand(t5)); 6042 __ Branch(&sub_string_runtime, ne, t1, Operand(t5));
6045 __ lw(t1, FieldMemOperand(v0, ConsString::kFirstOffset)); 6043 __ lw(t1, FieldMemOperand(v0, ConsString::kFirstOffset));
6046 __ jmp(&allocate_slice); 6044 __ jmp(&allocate_slice);
6047 6045
6048 __ bind(&sliced_string); 6046 __ bind(&sliced_string);
6049 // Sliced string. Fetch parent and correct start index by offset. 6047 // Sliced string. Fetch parent and correct start index by offset.
6050 __ lw(t1, FieldMemOperand(v0, SlicedString::kOffsetOffset)); 6048 __ lw(t1, FieldMemOperand(v0, SlicedString::kOffsetOffset));
6051 __ addu(t3, t3, t1); 6049 __ addu(t3, t3, t1);
6052 __ lw(t1, FieldMemOperand(v0, SlicedString::kParentOffset)); 6050 __ lw(t1, FieldMemOperand(v0, SlicedString::kParentOffset));
6053 __ jmp(&allocate_slice); 6051 __ jmp(&allocate_slice);
6054 6052
6055 __ bind(&seq_string); 6053 __ bind(&seq_or_external_string);
6056 // Sequential string. Just move string to the right register. 6054 // Sequential or external string. Just move string to the correct register.
6057 __ mov(t1, v0); 6055 __ mov(t1, v0);
6058 6056
6059 __ bind(&allocate_slice); 6057 __ bind(&allocate_slice);
6060 // a1: instance type of original string 6058 // a1: instance type of original string
6061 // a2: length 6059 // a2: length
6062 // t1: underlying subject string 6060 // t1: underlying subject string
6063 // t3 (a.k.a. from): from offset (smi) 6061 // t3 (a.k.a. from): from offset (smi)
6064 // Allocate new sliced string. At this point we do not reload the instance 6062 // Allocate new sliced string. At this point we do not reload the instance
6065 // type including the string encoding because we simply rely on the info 6063 // type including the string encoding because we simply rely on the info
6066 // provided by the original string. It does not matter if the original 6064 // provided by the original string. It does not matter if the original
(...skipping 1394 matching lines...) Expand 10 before | Expand all | Expand 10 after
7461 &slow_elements); 7459 &slow_elements);
7462 __ Ret(); 7460 __ Ret();
7463 } 7461 }
7464 7462
7465 7463
7466 #undef __ 7464 #undef __
7467 7465
7468 } } // namespace v8::internal 7466 } } // namespace v8::internal
7469 7467
7470 #endif // V8_TARGET_ARCH_MIPS 7468 #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