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

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

Issue 8923002: Porting r10221 to ARM (avoid bailing out to runtime for short substrings). (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 9 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 | Annotate | Revision Log
« no previous file with comments | « src/arm/code-stubs-arm.cc ('k') | 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 6102 matching lines...) Expand 10 before | Expand all | Expand 10 after
6113 // edx: from index (smi) 6113 // edx: from index (smi)
6114 __ JumpIfInstanceTypeIsNotSequentialAscii(ebx, ebx, &runtime); 6114 __ JumpIfInstanceTypeIsNotSequentialAscii(ebx, ebx, &runtime);
6115 6115
6116 // Get the two characters forming the sub string. 6116 // Get the two characters forming the sub string.
6117 __ SmiUntag(edx); // From index is no longer smi. 6117 __ SmiUntag(edx); // From index is no longer smi.
6118 __ movzx_b(ebx, FieldOperand(eax, edx, times_1, SeqAsciiString::kHeaderSize)); 6118 __ movzx_b(ebx, FieldOperand(eax, edx, times_1, SeqAsciiString::kHeaderSize));
6119 __ movzx_b(ecx, 6119 __ movzx_b(ecx,
6120 FieldOperand(eax, edx, times_1, SeqAsciiString::kHeaderSize + 1)); 6120 FieldOperand(eax, edx, times_1, SeqAsciiString::kHeaderSize + 1));
6121 6121
6122 // Try to lookup two character string in symbol table. 6122 // Try to lookup two character string in symbol table.
6123 Label make_two_character_string; 6123 Label combine_two_char, save_two_char;
6124 StringHelper::GenerateTwoCharacterSymbolTableProbe( 6124 StringHelper::GenerateTwoCharacterSymbolTableProbe(
6125 masm, ebx, ecx, eax, edx, edi, 6125 masm, ebx, ecx, eax, edx, edi, &combine_two_char, &save_two_char);
6126 &make_two_character_string, &make_two_character_string);
6127 __ IncrementCounter(counters->sub_string_native(), 1); 6126 __ IncrementCounter(counters->sub_string_native(), 1);
6128 __ ret(3 * kPointerSize); 6127 __ ret(3 * kPointerSize);
6129 6128
6130 __ bind(&make_two_character_string); 6129 __ bind(&combine_two_char);
6131 // Setup registers for allocating the two character string. 6130 __ shl(ecx, kBitsPerByte);
6132 __ mov(eax, Operand(esp, 3 * kPointerSize)); 6131 __ or_(ebx, ecx);
6133 __ mov(ebx, FieldOperand(eax, HeapObject::kMapOffset)); 6132 __ bind(&save_two_char);
6134 __ movzx_b(ebx, FieldOperand(ebx, Map::kInstanceTypeOffset)); 6133 __ AllocateAsciiString(eax, 2, ecx, edx, &runtime);
6135 __ Set(ecx, Immediate(Smi::FromInt(2))); 6134 __ mov_w(FieldOperand(eax, SeqAsciiString::kHeaderSize), ebx);
6136 __ mov(edx, Operand(esp, 2 * kPointerSize)); // Load index. 6135 __ IncrementCounter(counters->sub_string_native(), 1);
6136 __ ret(3 * kPointerSize);
6137 6137
6138 __ bind(&result_longer_than_two); 6138 __ bind(&result_longer_than_two);
6139 // eax: string 6139 // eax: string
6140 // ebx: instance type 6140 // ebx: instance type
6141 // ecx: sub string length (smi) 6141 // ecx: sub string length (smi)
6142 // edx: from index (smi) 6142 // edx: from index (smi)
6143 // Deal with different string types: update the index if necessary 6143 // Deal with different string types: update the index if necessary
6144 // and put the underlying string into edi. 6144 // and put the underlying string into edi.
6145 Label underlying_unpacked, sliced_string, seq_or_external_string; 6145 Label underlying_unpacked, sliced_string, seq_or_external_string;
6146 // If the string is not indirect, it can only be sequential or external. 6146 // If the string is not indirect, it can only be sequential or external.
(...skipping 1163 matching lines...) Expand 10 before | Expand all | Expand 10 after
7310 false); 7310 false);
7311 __ pop(edx); 7311 __ pop(edx);
7312 __ ret(0); 7312 __ ret(0);
7313 } 7313 }
7314 7314
7315 #undef __ 7315 #undef __
7316 7316
7317 } } // namespace v8::internal 7317 } } // namespace v8::internal
7318 7318
7319 #endif // V8_TARGET_ARCH_IA32 7319 #endif // V8_TARGET_ARCH_IA32
OLDNEW
« no previous file with comments | « src/arm/code-stubs-arm.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698