| OLD | NEW |
| 1 // Copyright 2013 the V8 project authors. All rights reserved. | 1 // Copyright 2013 the V8 project authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #if V8_TARGET_ARCH_X64 | 5 #if V8_TARGET_ARCH_X64 |
| 6 | 6 |
| 7 #include "src/code-stubs.h" | 7 #include "src/code-stubs.h" |
| 8 #include "src/api-arguments.h" | 8 #include "src/api-arguments.h" |
| 9 #include "src/bootstrapper.h" | 9 #include "src/bootstrapper.h" |
| 10 #include "src/codegen.h" | 10 #include "src/codegen.h" |
| (...skipping 2214 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2225 // rbx: instance type | 2225 // rbx: instance type |
| 2226 // rcx: sub string length (smi) | 2226 // rcx: sub string length (smi) |
| 2227 // rdx: from index (smi) | 2227 // rdx: from index (smi) |
| 2228 StringCharAtGenerator generator(rax, rdx, rcx, rax, &runtime, &runtime, | 2228 StringCharAtGenerator generator(rax, rdx, rcx, rax, &runtime, &runtime, |
| 2229 &runtime, RECEIVER_IS_STRING); | 2229 &runtime, RECEIVER_IS_STRING); |
| 2230 generator.GenerateFast(masm); | 2230 generator.GenerateFast(masm); |
| 2231 __ ret(SUB_STRING_ARGUMENT_COUNT * kPointerSize); | 2231 __ ret(SUB_STRING_ARGUMENT_COUNT * kPointerSize); |
| 2232 generator.SkipSlow(masm, &runtime); | 2232 generator.SkipSlow(masm, &runtime); |
| 2233 } | 2233 } |
| 2234 | 2234 |
| 2235 void ToStringStub::Generate(MacroAssembler* masm) { | |
| 2236 // The ToString stub takes one argument in rax. | |
| 2237 Label is_number; | |
| 2238 __ JumpIfSmi(rax, &is_number, Label::kNear); | |
| 2239 | |
| 2240 Label not_string; | |
| 2241 __ CmpObjectType(rax, FIRST_NONSTRING_TYPE, rdi); | |
| 2242 // rax: receiver | |
| 2243 // rdi: receiver map | |
| 2244 __ j(above_equal, ¬_string, Label::kNear); | |
| 2245 __ Ret(); | |
| 2246 __ bind(¬_string); | |
| 2247 | |
| 2248 Label not_heap_number; | |
| 2249 __ CompareRoot(rdi, Heap::kHeapNumberMapRootIndex); | |
| 2250 __ j(not_equal, ¬_heap_number, Label::kNear); | |
| 2251 __ bind(&is_number); | |
| 2252 NumberToStringStub stub(isolate()); | |
| 2253 __ TailCallStub(&stub); | |
| 2254 __ bind(¬_heap_number); | |
| 2255 | |
| 2256 Label not_oddball; | |
| 2257 __ CmpInstanceType(rdi, ODDBALL_TYPE); | |
| 2258 __ j(not_equal, ¬_oddball, Label::kNear); | |
| 2259 __ movp(rax, FieldOperand(rax, Oddball::kToStringOffset)); | |
| 2260 __ Ret(); | |
| 2261 __ bind(¬_oddball); | |
| 2262 | |
| 2263 __ PopReturnAddressTo(rcx); // Pop return address. | |
| 2264 __ Push(rax); // Push argument. | |
| 2265 __ PushReturnAddressFrom(rcx); // Push return address. | |
| 2266 __ TailCallRuntime(Runtime::kToString); | |
| 2267 } | |
| 2268 | |
| 2269 | 2235 |
| 2270 void StringHelper::GenerateFlatOneByteStringEquals(MacroAssembler* masm, | 2236 void StringHelper::GenerateFlatOneByteStringEquals(MacroAssembler* masm, |
| 2271 Register left, | 2237 Register left, |
| 2272 Register right, | 2238 Register right, |
| 2273 Register scratch1, | 2239 Register scratch1, |
| 2274 Register scratch2) { | 2240 Register scratch2) { |
| 2275 Register length = scratch1; | 2241 Register length = scratch1; |
| 2276 | 2242 |
| 2277 // Compare lengths. | 2243 // Compare lengths. |
| 2278 Label check_zero_length; | 2244 Label check_zero_length; |
| (...skipping 2882 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5161 kStackUnwindSpace, nullptr, return_value_operand, | 5127 kStackUnwindSpace, nullptr, return_value_operand, |
| 5162 NULL); | 5128 NULL); |
| 5163 } | 5129 } |
| 5164 | 5130 |
| 5165 #undef __ | 5131 #undef __ |
| 5166 | 5132 |
| 5167 } // namespace internal | 5133 } // namespace internal |
| 5168 } // namespace v8 | 5134 } // namespace v8 |
| 5169 | 5135 |
| 5170 #endif // V8_TARGET_ARCH_X64 | 5136 #endif // V8_TARGET_ARCH_X64 |
| OLD | NEW |