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

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

Issue 9382005: MIPS: Fixed several bugs in SubStringStub::Generate. (Closed)
Patch Set: Created 8 years, 10 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 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 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 6043 matching lines...) Expand 10 before | Expand all | Expand 10 after
6054 static const int kStringOffset = 2 * kPointerSize; 6054 static const int kStringOffset = 2 * kPointerSize;
6055 6055
6056 __ lw(a2, MemOperand(sp, kToOffset)); 6056 __ lw(a2, MemOperand(sp, kToOffset));
6057 __ lw(a3, MemOperand(sp, kFromOffset)); 6057 __ lw(a3, MemOperand(sp, kFromOffset));
6058 STATIC_ASSERT(kFromOffset == kToOffset + 4); 6058 STATIC_ASSERT(kFromOffset == kToOffset + 4);
6059 STATIC_ASSERT(kSmiTag == 0); 6059 STATIC_ASSERT(kSmiTag == 0);
6060 STATIC_ASSERT(kSmiTagSize + kSmiShiftSize == 1); 6060 STATIC_ASSERT(kSmiTagSize + kSmiShiftSize == 1);
6061 6061
6062 // Utilize delay slots. SmiUntag doesn't emit a jump, everything else is 6062 // Utilize delay slots. SmiUntag doesn't emit a jump, everything else is
6063 // safe in this case. 6063 // safe in this case.
6064 __ UntagAndJumpIfSmi(a2, a2, &runtime); 6064 __ UntagAndJumpIfNotSmi(a2, a2, &runtime);
6065 __ UntagAndJumpIfSmi(a3, a3, &runtime); 6065 __ UntagAndJumpIfNotSmi(a3, a3, &runtime);
6066
6067 // Both a2 and a3 are untagged integers. 6066 // Both a2 and a3 are untagged integers.
6068 6067
6069 __ Branch(&runtime, lt, a3, Operand(zero_reg)); // From < 0. 6068 __ Branch(&runtime, lt, a3, Operand(zero_reg)); // From < 0.
6070 6069
6071 __ subu(a2, t5, a3); 6070 __ Branch(&runtime, gt, a3, Operand(a2)); // Fail if from > to.
6072 __ Branch(&runtime, gt, a3, Operand(t5)); // Fail if from > to. 6071 __ Subu(a2, a2, a3);
6073 6072
6074 // Make sure first argument is a string. 6073 // Make sure first argument is a string.
6075 __ lw(v0, MemOperand(sp, kStringOffset)); 6074 __ lw(v0, MemOperand(sp, kStringOffset));
6076 __ Branch(&runtime, eq, v0, Operand(kSmiTagMask)); 6075 __ JumpIfSmi(v0, &runtime);
6077
6078 __ lw(a1, FieldMemOperand(v0, HeapObject::kMapOffset)); 6076 __ lw(a1, FieldMemOperand(v0, HeapObject::kMapOffset));
6079 __ lbu(a1, FieldMemOperand(a1, Map::kInstanceTypeOffset)); 6077 __ lbu(a1, FieldMemOperand(a1, Map::kInstanceTypeOffset));
6080 __ And(t4, v0, Operand(kIsNotStringMask)); 6078 __ And(t0, a1, Operand(kIsNotStringMask));
6081 6079
6082 __ Branch(&runtime, ne, t4, Operand(zero_reg)); 6080 __ Branch(&runtime, ne, t0, Operand(zero_reg));
6083 6081
6084 // Short-cut for the case of trivial substring. 6082 // Short-cut for the case of trivial substring.
6085 Label return_v0; 6083 Label return_v0;
6086 // v0: original string 6084 // v0: original string
6087 // a2: result string length 6085 // a2: result string length
6088 __ lw(t0, FieldMemOperand(v0, String::kLengthOffset)); 6086 __ lw(t0, FieldMemOperand(v0, String::kLengthOffset));
6089 __ sra(t0, t0, 1); 6087 __ sra(t0, t0, 1);
6090 __ Branch(&return_v0, eq, a2, Operand(t0)); 6088 __ Branch(&return_v0, eq, a2, Operand(t0));
6091 6089
6092 6090
(...skipping 1546 matching lines...) Expand 10 before | Expand all | Expand 10 after
7639 __ Ret(USE_DELAY_SLOT); 7637 __ Ret(USE_DELAY_SLOT);
7640 __ mov(v0, a0); 7638 __ mov(v0, a0);
7641 } 7639 }
7642 7640
7643 7641
7644 #undef __ 7642 #undef __
7645 7643
7646 } } // namespace v8::internal 7644 } } // namespace v8::internal
7647 7645
7648 #endif // V8_TARGET_ARCH_MIPS 7646 #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