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

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

Issue 12310087: MIPS: Combine %_SubString and %_StringCharAt. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 7 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 | Annotate | Revision Log
« 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 5961 matching lines...) Expand 10 before | Expand all | Expand 10 after
5972 __ CallRuntime(Runtime::kCharFromCode, 1); 5972 __ CallRuntime(Runtime::kCharFromCode, 1);
5973 __ Move(result_, v0); 5973 __ Move(result_, v0);
5974 5974
5975 call_helper.AfterCall(masm); 5975 call_helper.AfterCall(masm);
5976 __ Branch(&exit_); 5976 __ Branch(&exit_);
5977 5977
5978 __ Abort("Unexpected fallthrough from CharFromCode slow case"); 5978 __ Abort("Unexpected fallthrough from CharFromCode slow case");
5979 } 5979 }
5980 5980
5981 5981
5982 // -------------------------------------------------------------------------
5983 // StringCharAtGenerator
5984
5985 void StringCharAtGenerator::GenerateFast(MacroAssembler* masm) {
5986 char_code_at_generator_.GenerateFast(masm);
5987 char_from_code_generator_.GenerateFast(masm);
5988 }
5989
5990
5991 void StringCharAtGenerator::GenerateSlow(
5992 MacroAssembler* masm,
5993 const RuntimeCallHelper& call_helper) {
5994 char_code_at_generator_.GenerateSlow(masm, call_helper);
5995 char_from_code_generator_.GenerateSlow(masm, call_helper);
5996 }
5997
5998
5999 void StringHelper::GenerateCopyCharacters(MacroAssembler* masm, 5982 void StringHelper::GenerateCopyCharacters(MacroAssembler* masm,
6000 Register dest, 5983 Register dest,
6001 Register src, 5984 Register src,
6002 Register count, 5985 Register count,
6003 Register scratch, 5986 Register scratch,
6004 bool ascii) { 5987 bool ascii) {
6005 Label loop; 5988 Label loop;
6006 Label done; 5989 Label done;
6007 // This loop just copies one character at a time, as it is only used for 5990 // This loop just copies one character at a time, as it is only used for
6008 // very short strings. 5991 // very short strings.
(...skipping 360 matching lines...) Expand 10 before | Expand all | Expand 10 after
6369 6352
6370 // Make sure first argument is a string. 6353 // Make sure first argument is a string.
6371 __ lw(v0, MemOperand(sp, kStringOffset)); 6354 __ lw(v0, MemOperand(sp, kStringOffset));
6372 __ JumpIfSmi(v0, &runtime); 6355 __ JumpIfSmi(v0, &runtime);
6373 __ lw(a1, FieldMemOperand(v0, HeapObject::kMapOffset)); 6356 __ lw(a1, FieldMemOperand(v0, HeapObject::kMapOffset));
6374 __ lbu(a1, FieldMemOperand(a1, Map::kInstanceTypeOffset)); 6357 __ lbu(a1, FieldMemOperand(a1, Map::kInstanceTypeOffset));
6375 __ And(t0, a1, Operand(kIsNotStringMask)); 6358 __ And(t0, a1, Operand(kIsNotStringMask));
6376 6359
6377 __ Branch(&runtime, ne, t0, Operand(zero_reg)); 6360 __ Branch(&runtime, ne, t0, Operand(zero_reg));
6378 6361
6362 Label single_char;
6363 __ Branch(&single_char, eq, a2, Operand(1));
6364
6379 // Short-cut for the case of trivial substring. 6365 // Short-cut for the case of trivial substring.
6380 Label return_v0; 6366 Label return_v0;
6381 // v0: original string 6367 // v0: original string
6382 // a2: result string length 6368 // a2: result string length
6383 __ lw(t0, FieldMemOperand(v0, String::kLengthOffset)); 6369 __ lw(t0, FieldMemOperand(v0, String::kLengthOffset));
6384 __ sra(t0, t0, 1); 6370 __ sra(t0, t0, 1);
6385 // Return original string. 6371 // Return original string.
6386 __ Branch(&return_v0, eq, a2, Operand(t0)); 6372 __ Branch(&return_v0, eq, a2, Operand(t0));
6387 // Longer than original string's length or negative: unsafe arguments. 6373 // Longer than original string's length or negative: unsafe arguments.
6388 __ Branch(&runtime, hi, a2, Operand(t0)); 6374 __ Branch(&runtime, hi, a2, Operand(t0));
(...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after
6529 masm, a1, t1, a2, a3, t0, t2, t3, t4, DEST_ALWAYS_ALIGNED); 6515 masm, a1, t1, a2, a3, t0, t2, t3, t4, DEST_ALWAYS_ALIGNED);
6530 6516
6531 __ bind(&return_v0); 6517 __ bind(&return_v0);
6532 Counters* counters = masm->isolate()->counters(); 6518 Counters* counters = masm->isolate()->counters();
6533 __ IncrementCounter(counters->sub_string_native(), 1, a3, t0); 6519 __ IncrementCounter(counters->sub_string_native(), 1, a3, t0);
6534 __ DropAndRet(3); 6520 __ DropAndRet(3);
6535 6521
6536 // Just jump to runtime to create the sub string. 6522 // Just jump to runtime to create the sub string.
6537 __ bind(&runtime); 6523 __ bind(&runtime);
6538 __ TailCallRuntime(Runtime::kSubString, 3, 1); 6524 __ TailCallRuntime(Runtime::kSubString, 3, 1);
6525
6526 __ bind(&single_char);
6527 // v0: original string
6528 // a1: instance type
6529 // a2: length
6530 // a3: from index (untagged)
6531 __ SmiTag(a3, a3);
6532 StringCharAtGenerator generator(
6533 v0, a3, a2, v0, &runtime, &runtime, &runtime, STRING_INDEX_IS_NUMBER);
6534 generator.GenerateFast(masm);
6535 __ DropAndRet(3);
6536 generator.SkipSlow(masm, &runtime);
6539 } 6537 }
6540 6538
6541 6539
6542 void StringCompareStub::GenerateFlatAsciiStringEquals(MacroAssembler* masm, 6540 void StringCompareStub::GenerateFlatAsciiStringEquals(MacroAssembler* masm,
6543 Register left, 6541 Register left,
6544 Register right, 6542 Register right,
6545 Register scratch1, 6543 Register scratch1,
6546 Register scratch2, 6544 Register scratch2,
6547 Register scratch3) { 6545 Register scratch3) {
6548 Register length = scratch1; 6546 Register length = scratch1;
(...skipping 1513 matching lines...) Expand 10 before | Expand all | Expand 10 after
8062 __ Pop(ra, t1, a1); 8060 __ Pop(ra, t1, a1);
8063 __ Ret(); 8061 __ Ret();
8064 } 8062 }
8065 8063
8066 8064
8067 #undef __ 8065 #undef __
8068 8066
8069 } } // namespace v8::internal 8067 } } // namespace v8::internal
8070 8068
8071 #endif // V8_TARGET_ARCH_MIPS 8069 #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