OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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_IA32 | 5 #if V8_TARGET_ARCH_IA32 |
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/base/bits.h" | 9 #include "src/base/bits.h" |
10 #include "src/bootstrapper.h" | 10 #include "src/bootstrapper.h" |
(...skipping 650 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
661 DCHECK(!scratch.is(LoadWithVectorDescriptor::VectorRegister()) && | 661 DCHECK(!scratch.is(LoadWithVectorDescriptor::VectorRegister()) && |
662 result.is(LoadDescriptor::SlotRegister())); | 662 result.is(LoadDescriptor::SlotRegister())); |
663 | 663 |
664 // StringCharAtGenerator doesn't use the result register until it's passed | 664 // StringCharAtGenerator doesn't use the result register until it's passed |
665 // the different miss possibilities. If it did, we would have a conflict | 665 // the different miss possibilities. If it did, we would have a conflict |
666 // when FLAG_vector_ics is true. | 666 // when FLAG_vector_ics is true. |
667 StringCharAtGenerator char_at_generator(receiver, index, scratch, result, | 667 StringCharAtGenerator char_at_generator(receiver, index, scratch, result, |
668 &miss, // When not a string. | 668 &miss, // When not a string. |
669 &miss, // When not a number. | 669 &miss, // When not a number. |
670 &miss, // When index out of range. | 670 &miss, // When index out of range. |
671 STRING_INDEX_IS_ARRAY_INDEX, | |
672 RECEIVER_IS_STRING); | 671 RECEIVER_IS_STRING); |
673 char_at_generator.GenerateFast(masm); | 672 char_at_generator.GenerateFast(masm); |
674 __ ret(0); | 673 __ ret(0); |
675 | 674 |
676 StubRuntimeCallHelper call_helper; | 675 StubRuntimeCallHelper call_helper; |
677 char_at_generator.GenerateSlow(masm, PART_OF_IC_HANDLER, call_helper); | 676 char_at_generator.GenerateSlow(masm, PART_OF_IC_HANDLER, call_helper); |
678 | 677 |
679 __ bind(&miss); | 678 __ bind(&miss); |
680 PropertyAccessCompiler::TailCallBuiltin( | 679 PropertyAccessCompiler::TailCallBuiltin( |
681 masm, PropertyAccessCompiler::MissBuiltin(Code::KEYED_LOAD_IC)); | 680 masm, PropertyAccessCompiler::MissBuiltin(Code::KEYED_LOAD_IC)); |
(...skipping 1416 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2098 masm->isolate()->factory()->heap_number_map(), | 2097 masm->isolate()->factory()->heap_number_map(), |
2099 index_not_number_, | 2098 index_not_number_, |
2100 DONT_DO_SMI_CHECK); | 2099 DONT_DO_SMI_CHECK); |
2101 call_helper.BeforeCall(masm); | 2100 call_helper.BeforeCall(masm); |
2102 if (embed_mode == PART_OF_IC_HANDLER) { | 2101 if (embed_mode == PART_OF_IC_HANDLER) { |
2103 __ push(LoadWithVectorDescriptor::VectorRegister()); | 2102 __ push(LoadWithVectorDescriptor::VectorRegister()); |
2104 __ push(LoadDescriptor::SlotRegister()); | 2103 __ push(LoadDescriptor::SlotRegister()); |
2105 } | 2104 } |
2106 __ push(object_); | 2105 __ push(object_); |
2107 __ push(index_); // Consumed by runtime conversion function. | 2106 __ push(index_); // Consumed by runtime conversion function. |
2108 if (index_flags_ == STRING_INDEX_IS_NUMBER) { | 2107 __ CallRuntime(Runtime::kNumberToSmi); |
2109 __ CallRuntime(Runtime::kNumberToIntegerMapMinusZero); | |
2110 } else { | |
2111 DCHECK(index_flags_ == STRING_INDEX_IS_ARRAY_INDEX); | |
2112 // NumberToSmi discards numbers that are not exact integers. | |
2113 __ CallRuntime(Runtime::kNumberToSmi); | |
2114 } | |
2115 if (!index_.is(eax)) { | 2108 if (!index_.is(eax)) { |
2116 // Save the conversion result before the pop instructions below | 2109 // Save the conversion result before the pop instructions below |
2117 // have a chance to overwrite it. | 2110 // have a chance to overwrite it. |
2118 __ mov(index_, eax); | 2111 __ mov(index_, eax); |
2119 } | 2112 } |
2120 __ pop(object_); | 2113 __ pop(object_); |
2121 if (embed_mode == PART_OF_IC_HANDLER) { | 2114 if (embed_mode == PART_OF_IC_HANDLER) { |
2122 __ pop(LoadDescriptor::SlotRegister()); | 2115 __ pop(LoadDescriptor::SlotRegister()); |
2123 __ pop(LoadWithVectorDescriptor::VectorRegister()); | 2116 __ pop(LoadWithVectorDescriptor::VectorRegister()); |
2124 } | 2117 } |
(...skipping 312 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2437 // Just jump to runtime to create the sub string. | 2430 // Just jump to runtime to create the sub string. |
2438 __ bind(&runtime); | 2431 __ bind(&runtime); |
2439 __ TailCallRuntime(Runtime::kSubString); | 2432 __ TailCallRuntime(Runtime::kSubString); |
2440 | 2433 |
2441 __ bind(&single_char); | 2434 __ bind(&single_char); |
2442 // eax: string | 2435 // eax: string |
2443 // ebx: instance type | 2436 // ebx: instance type |
2444 // ecx: sub string length (smi) | 2437 // ecx: sub string length (smi) |
2445 // edx: from index (smi) | 2438 // edx: from index (smi) |
2446 StringCharAtGenerator generator(eax, edx, ecx, eax, &runtime, &runtime, | 2439 StringCharAtGenerator generator(eax, edx, ecx, eax, &runtime, &runtime, |
2447 &runtime, STRING_INDEX_IS_NUMBER, | 2440 &runtime, RECEIVER_IS_STRING); |
2448 RECEIVER_IS_STRING); | |
2449 generator.GenerateFast(masm); | 2441 generator.GenerateFast(masm); |
2450 __ ret(3 * kPointerSize); | 2442 __ ret(3 * kPointerSize); |
2451 generator.SkipSlow(masm, &runtime); | 2443 generator.SkipSlow(masm, &runtime); |
2452 } | 2444 } |
2453 | 2445 |
2454 | 2446 |
2455 void ToNumberStub::Generate(MacroAssembler* masm) { | 2447 void ToNumberStub::Generate(MacroAssembler* masm) { |
2456 // The ToNumber stub takes one argument in eax. | 2448 // The ToNumber stub takes one argument in eax. |
2457 Label not_smi; | 2449 Label not_smi; |
2458 __ JumpIfNotSmi(eax, ¬_smi, Label::kNear); | 2450 __ JumpIfNotSmi(eax, ¬_smi, Label::kNear); |
(...skipping 3266 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5725 kStackUnwindSpace, nullptr, return_value_operand, | 5717 kStackUnwindSpace, nullptr, return_value_operand, |
5726 NULL); | 5718 NULL); |
5727 } | 5719 } |
5728 | 5720 |
5729 #undef __ | 5721 #undef __ |
5730 | 5722 |
5731 } // namespace internal | 5723 } // namespace internal |
5732 } // namespace v8 | 5724 } // namespace v8 |
5733 | 5725 |
5734 #endif // V8_TARGET_ARCH_IA32 | 5726 #endif // V8_TARGET_ARCH_IA32 |
OLD | NEW |