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 517 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
528 DCHECK(!scratch.is(LoadWithVectorDescriptor::VectorRegister()) && | 528 DCHECK(!scratch.is(LoadWithVectorDescriptor::VectorRegister()) && |
529 result.is(LoadDescriptor::SlotRegister())); | 529 result.is(LoadDescriptor::SlotRegister())); |
530 | 530 |
531 // StringCharAtGenerator doesn't use the result register until it's passed | 531 // StringCharAtGenerator doesn't use the result register until it's passed |
532 // the different miss possibilities. If it did, we would have a conflict | 532 // the different miss possibilities. If it did, we would have a conflict |
533 // when FLAG_vector_ics is true. | 533 // when FLAG_vector_ics is true. |
534 StringCharAtGenerator char_at_generator(receiver, index, scratch, result, | 534 StringCharAtGenerator char_at_generator(receiver, index, scratch, result, |
535 &miss, // When not a string. | 535 &miss, // When not a string. |
536 &miss, // When not a number. | 536 &miss, // When not a number. |
537 &miss, // When index out of range. | 537 &miss, // When index out of range. |
538 STRING_INDEX_IS_ARRAY_INDEX, | |
539 RECEIVER_IS_STRING); | 538 RECEIVER_IS_STRING); |
540 char_at_generator.GenerateFast(masm); | 539 char_at_generator.GenerateFast(masm); |
541 __ ret(0); | 540 __ ret(0); |
542 | 541 |
543 StubRuntimeCallHelper call_helper; | 542 StubRuntimeCallHelper call_helper; |
544 char_at_generator.GenerateSlow(masm, PART_OF_IC_HANDLER, call_helper); | 543 char_at_generator.GenerateSlow(masm, PART_OF_IC_HANDLER, call_helper); |
545 | 544 |
546 __ bind(&miss); | 545 __ bind(&miss); |
547 PropertyAccessCompiler::TailCallBuiltin( | 546 PropertyAccessCompiler::TailCallBuiltin( |
548 masm, PropertyAccessCompiler::MissBuiltin(Code::KEYED_LOAD_IC)); | 547 masm, PropertyAccessCompiler::MissBuiltin(Code::KEYED_LOAD_IC)); |
(...skipping 1500 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2049 factory->heap_number_map(), | 2048 factory->heap_number_map(), |
2050 index_not_number_, | 2049 index_not_number_, |
2051 DONT_DO_SMI_CHECK); | 2050 DONT_DO_SMI_CHECK); |
2052 call_helper.BeforeCall(masm); | 2051 call_helper.BeforeCall(masm); |
2053 if (embed_mode == PART_OF_IC_HANDLER) { | 2052 if (embed_mode == PART_OF_IC_HANDLER) { |
2054 __ Push(LoadWithVectorDescriptor::VectorRegister()); | 2053 __ Push(LoadWithVectorDescriptor::VectorRegister()); |
2055 __ Push(LoadDescriptor::SlotRegister()); | 2054 __ Push(LoadDescriptor::SlotRegister()); |
2056 } | 2055 } |
2057 __ Push(object_); | 2056 __ Push(object_); |
2058 __ Push(index_); // Consumed by runtime conversion function. | 2057 __ Push(index_); // Consumed by runtime conversion function. |
2059 if (index_flags_ == STRING_INDEX_IS_NUMBER) { | 2058 __ CallRuntime(Runtime::kNumberToSmi); |
2060 __ CallRuntime(Runtime::kNumberToIntegerMapMinusZero); | |
2061 } else { | |
2062 DCHECK(index_flags_ == STRING_INDEX_IS_ARRAY_INDEX); | |
2063 // NumberToSmi discards numbers that are not exact integers. | |
2064 __ CallRuntime(Runtime::kNumberToSmi); | |
2065 } | |
2066 if (!index_.is(rax)) { | 2059 if (!index_.is(rax)) { |
2067 // Save the conversion result before the pop instructions below | 2060 // Save the conversion result before the pop instructions below |
2068 // have a chance to overwrite it. | 2061 // have a chance to overwrite it. |
2069 __ movp(index_, rax); | 2062 __ movp(index_, rax); |
2070 } | 2063 } |
2071 __ Pop(object_); | 2064 __ Pop(object_); |
2072 if (embed_mode == PART_OF_IC_HANDLER) { | 2065 if (embed_mode == PART_OF_IC_HANDLER) { |
2073 __ Pop(LoadDescriptor::SlotRegister()); | 2066 __ Pop(LoadDescriptor::SlotRegister()); |
2074 __ Pop(LoadWithVectorDescriptor::VectorRegister()); | 2067 __ Pop(LoadWithVectorDescriptor::VectorRegister()); |
2075 } | 2068 } |
(...skipping 300 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2376 // Just jump to runtime to create the sub string. | 2369 // Just jump to runtime to create the sub string. |
2377 __ bind(&runtime); | 2370 __ bind(&runtime); |
2378 __ TailCallRuntime(Runtime::kSubString); | 2371 __ TailCallRuntime(Runtime::kSubString); |
2379 | 2372 |
2380 __ bind(&single_char); | 2373 __ bind(&single_char); |
2381 // rax: string | 2374 // rax: string |
2382 // rbx: instance type | 2375 // rbx: instance type |
2383 // rcx: sub string length (smi) | 2376 // rcx: sub string length (smi) |
2384 // rdx: from index (smi) | 2377 // rdx: from index (smi) |
2385 StringCharAtGenerator generator(rax, rdx, rcx, rax, &runtime, &runtime, | 2378 StringCharAtGenerator generator(rax, rdx, rcx, rax, &runtime, &runtime, |
2386 &runtime, STRING_INDEX_IS_NUMBER, | 2379 &runtime, RECEIVER_IS_STRING); |
2387 RECEIVER_IS_STRING); | |
2388 generator.GenerateFast(masm); | 2380 generator.GenerateFast(masm); |
2389 __ ret(SUB_STRING_ARGUMENT_COUNT * kPointerSize); | 2381 __ ret(SUB_STRING_ARGUMENT_COUNT * kPointerSize); |
2390 generator.SkipSlow(masm, &runtime); | 2382 generator.SkipSlow(masm, &runtime); |
2391 } | 2383 } |
2392 | 2384 |
2393 | 2385 |
2394 void ToNumberStub::Generate(MacroAssembler* masm) { | 2386 void ToNumberStub::Generate(MacroAssembler* masm) { |
2395 // The ToNumber stub takes one argument in rax. | 2387 // The ToNumber stub takes one argument in rax. |
2396 Label not_smi; | 2388 Label not_smi; |
2397 __ JumpIfNotSmi(rax, ¬_smi, Label::kNear); | 2389 __ JumpIfNotSmi(rax, ¬_smi, Label::kNear); |
(...skipping 3053 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5451 kStackUnwindSpace, nullptr, return_value_operand, | 5443 kStackUnwindSpace, nullptr, return_value_operand, |
5452 NULL); | 5444 NULL); |
5453 } | 5445 } |
5454 | 5446 |
5455 #undef __ | 5447 #undef __ |
5456 | 5448 |
5457 } // namespace internal | 5449 } // namespace internal |
5458 } // namespace v8 | 5450 } // namespace v8 |
5459 | 5451 |
5460 #endif // V8_TARGET_ARCH_X64 | 5452 #endif // V8_TARGET_ARCH_X64 |
OLD | NEW |