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

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

Issue 10105026: Version 3.10.3 (Closed) Base URL: http://v8.googlecode.com/svn/trunk/
Patch Set: Created 8 years, 8 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 | « src/version.cc ('k') | src/x64/full-codegen-x64.cc » ('j') | 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 5094 matching lines...) Expand 10 before | Expand all | Expand 10 after
5105 __ movq(rax, Operand(rsp, kStringOffset)); 5105 __ movq(rax, Operand(rsp, kStringOffset));
5106 STATIC_ASSERT(kSmiTag == 0); 5106 STATIC_ASSERT(kSmiTag == 0);
5107 __ testl(rax, Immediate(kSmiTagMask)); 5107 __ testl(rax, Immediate(kSmiTagMask));
5108 __ j(zero, &runtime); 5108 __ j(zero, &runtime);
5109 Condition is_string = masm->IsObjectStringType(rax, rbx, rbx); 5109 Condition is_string = masm->IsObjectStringType(rax, rbx, rbx);
5110 __ j(NegateCondition(is_string), &runtime); 5110 __ j(NegateCondition(is_string), &runtime);
5111 5111
5112 // rax: string 5112 // rax: string
5113 // rbx: instance type 5113 // rbx: instance type
5114 // Calculate length of sub string using the smi values. 5114 // Calculate length of sub string using the smi values.
5115 Label result_longer_than_two;
5116 __ movq(rcx, Operand(rsp, kToOffset)); 5115 __ movq(rcx, Operand(rsp, kToOffset));
5117 __ movq(rdx, Operand(rsp, kFromOffset)); 5116 __ movq(rdx, Operand(rsp, kFromOffset));
5118 __ JumpUnlessBothNonNegativeSmi(rcx, rdx, &runtime); 5117 __ JumpUnlessBothNonNegativeSmi(rcx, rdx, &runtime);
5119 5118
5120 __ SmiSub(rcx, rcx, rdx); // Overflow doesn't happen. 5119 __ SmiSub(rcx, rcx, rdx); // Overflow doesn't happen.
5121 __ cmpq(FieldOperand(rax, String::kLengthOffset), rcx); 5120 __ cmpq(rcx, FieldOperand(rax, String::kLengthOffset));
5122 Label not_original_string; 5121 Label not_original_string;
5123 __ j(not_equal, &not_original_string, Label::kNear); 5122 // Shorter than original string's length: an actual substring.
5123 __ j(below, &not_original_string, Label::kNear);
5124 // Longer than original string's length or negative: unsafe arguments.
5125 __ j(above, &runtime);
5126 // Return original string.
5124 Counters* counters = masm->isolate()->counters(); 5127 Counters* counters = masm->isolate()->counters();
5125 __ IncrementCounter(counters->sub_string_native(), 1); 5128 __ IncrementCounter(counters->sub_string_native(), 1);
5126 __ ret(kArgumentsSize); 5129 __ ret(kArgumentsSize);
5127 __ bind(&not_original_string); 5130 __ bind(&not_original_string);
5128 // Special handling of sub-strings of length 1 and 2. One character strings
5129 // are handled in the runtime system (looked up in the single character
5130 // cache). Two character strings are looked for in the symbol cache.
5131 __ SmiToInteger32(rcx, rcx); 5131 __ SmiToInteger32(rcx, rcx);
5132 __ cmpl(rcx, Immediate(2));
5133 __ j(greater, &result_longer_than_two);
5134 __ j(less, &runtime);
5135 5132
5136 // Sub string of length 2 requested.
5137 // rax: string
5138 // rbx: instance type
5139 // rcx: sub string length (value is 2)
5140 // rdx: from index (smi)
5141 __ JumpIfInstanceTypeIsNotSequentialAscii(rbx, rbx, &runtime);
5142
5143 // Get the two characters forming the sub string.
5144 __ SmiToInteger32(rdx, rdx); // From index is no longer smi.
5145 __ movzxbq(rbx, FieldOperand(rax, rdx, times_1, SeqAsciiString::kHeaderSize));
5146 __ movzxbq(rdi,
5147 FieldOperand(rax, rdx, times_1, SeqAsciiString::kHeaderSize + 1));
5148
5149 // Try to lookup two character string in symbol table.
5150 Label make_two_character_string;
5151 StringHelper::GenerateTwoCharacterSymbolTableProbe(
5152 masm, rbx, rdi, r9, r11, r14, r15, &make_two_character_string);
5153 __ IncrementCounter(counters->sub_string_native(), 1);
5154 __ ret(3 * kPointerSize);
5155
5156 __ bind(&make_two_character_string);
5157 // Set up registers for allocating the two character string.
5158 __ movzxwq(rbx, FieldOperand(rax, rdx, times_1, SeqAsciiString::kHeaderSize));
5159 __ AllocateAsciiString(rax, rcx, r11, r14, r15, &runtime);
5160 __ movw(FieldOperand(rax, SeqAsciiString::kHeaderSize), rbx);
5161 __ IncrementCounter(counters->sub_string_native(), 1);
5162 __ ret(3 * kPointerSize);
5163
5164 __ bind(&result_longer_than_two);
5165 // rax: string 5133 // rax: string
5166 // rbx: instance type 5134 // rbx: instance type
5167 // rcx: sub string length 5135 // rcx: sub string length
5168 // rdx: from index (smi) 5136 // rdx: from index (smi)
5169 // Deal with different string types: update the index if necessary 5137 // Deal with different string types: update the index if necessary
5170 // and put the underlying string into edi. 5138 // and put the underlying string into edi.
5171 Label underlying_unpacked, sliced_string, seq_or_external_string; 5139 Label underlying_unpacked, sliced_string, seq_or_external_string;
5172 // If the string is not indirect, it can only be sequential or external. 5140 // If the string is not indirect, it can only be sequential or external.
5173 STATIC_ASSERT(kIsIndirectStringMask == (kSlicedStringTag & kConsStringTag)); 5141 STATIC_ASSERT(kIsIndirectStringMask == (kSlicedStringTag & kConsStringTag));
5174 STATIC_ASSERT(kIsIndirectStringMask != 0); 5142 STATIC_ASSERT(kIsIndirectStringMask != 0);
(...skipping 1171 matching lines...) Expand 10 before | Expand all | Expand 10 after
6346 xmm0, 6314 xmm0,
6347 &slow_elements); 6315 &slow_elements);
6348 __ ret(0); 6316 __ ret(0);
6349 } 6317 }
6350 6318
6351 #undef __ 6319 #undef __
6352 6320
6353 } } // namespace v8::internal 6321 } } // namespace v8::internal
6354 6322
6355 #endif // V8_TARGET_ARCH_X64 6323 #endif // V8_TARGET_ARCH_X64
OLDNEW
« no previous file with comments | « src/version.cc ('k') | src/x64/full-codegen-x64.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698