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_X87 | 5 #if V8_TARGET_ARCH_X87 |
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 351 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
362 result.is(LoadDescriptor::SlotRegister())); | 362 result.is(LoadDescriptor::SlotRegister())); |
363 | 363 |
364 // StringCharAtGenerator doesn't use the result register until it's passed | 364 // StringCharAtGenerator doesn't use the result register until it's passed |
365 // the different miss possibilities. If it did, we would have a conflict | 365 // the different miss possibilities. If it did, we would have a conflict |
366 // when FLAG_vector_ics is true. | 366 // when FLAG_vector_ics is true. |
367 | 367 |
368 StringCharAtGenerator char_at_generator(receiver, index, scratch, result, | 368 StringCharAtGenerator char_at_generator(receiver, index, scratch, result, |
369 &miss, // When not a string. | 369 &miss, // When not a string. |
370 &miss, // When not a number. | 370 &miss, // When not a number. |
371 &miss, // When index out of range. | 371 &miss, // When index out of range. |
372 STRING_INDEX_IS_ARRAY_INDEX, | |
373 RECEIVER_IS_STRING); | 372 RECEIVER_IS_STRING); |
374 char_at_generator.GenerateFast(masm); | 373 char_at_generator.GenerateFast(masm); |
375 __ ret(0); | 374 __ ret(0); |
376 | 375 |
377 StubRuntimeCallHelper call_helper; | 376 StubRuntimeCallHelper call_helper; |
378 char_at_generator.GenerateSlow(masm, PART_OF_IC_HANDLER, call_helper); | 377 char_at_generator.GenerateSlow(masm, PART_OF_IC_HANDLER, call_helper); |
379 | 378 |
380 __ bind(&miss); | 379 __ bind(&miss); |
381 PropertyAccessCompiler::TailCallBuiltin( | 380 PropertyAccessCompiler::TailCallBuiltin( |
382 masm, PropertyAccessCompiler::MissBuiltin(Code::KEYED_LOAD_IC)); | 381 masm, PropertyAccessCompiler::MissBuiltin(Code::KEYED_LOAD_IC)); |
(...skipping 1437 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1820 masm->isolate()->factory()->heap_number_map(), | 1819 masm->isolate()->factory()->heap_number_map(), |
1821 index_not_number_, | 1820 index_not_number_, |
1822 DONT_DO_SMI_CHECK); | 1821 DONT_DO_SMI_CHECK); |
1823 call_helper.BeforeCall(masm); | 1822 call_helper.BeforeCall(masm); |
1824 if (embed_mode == PART_OF_IC_HANDLER) { | 1823 if (embed_mode == PART_OF_IC_HANDLER) { |
1825 __ push(LoadWithVectorDescriptor::VectorRegister()); | 1824 __ push(LoadWithVectorDescriptor::VectorRegister()); |
1826 __ push(LoadDescriptor::SlotRegister()); | 1825 __ push(LoadDescriptor::SlotRegister()); |
1827 } | 1826 } |
1828 __ push(object_); | 1827 __ push(object_); |
1829 __ push(index_); // Consumed by runtime conversion function. | 1828 __ push(index_); // Consumed by runtime conversion function. |
1830 if (index_flags_ == STRING_INDEX_IS_NUMBER) { | 1829 __ CallRuntime(Runtime::kNumberToSmi); |
1831 __ CallRuntime(Runtime::kNumberToIntegerMapMinusZero); | |
1832 } else { | |
1833 DCHECK(index_flags_ == STRING_INDEX_IS_ARRAY_INDEX); | |
1834 // NumberToSmi discards numbers that are not exact integers. | |
1835 __ CallRuntime(Runtime::kNumberToSmi); | |
1836 } | |
1837 if (!index_.is(eax)) { | 1830 if (!index_.is(eax)) { |
1838 // Save the conversion result before the pop instructions below | 1831 // Save the conversion result before the pop instructions below |
1839 // have a chance to overwrite it. | 1832 // have a chance to overwrite it. |
1840 __ mov(index_, eax); | 1833 __ mov(index_, eax); |
1841 } | 1834 } |
1842 __ pop(object_); | 1835 __ pop(object_); |
1843 if (embed_mode == PART_OF_IC_HANDLER) { | 1836 if (embed_mode == PART_OF_IC_HANDLER) { |
1844 __ pop(LoadDescriptor::SlotRegister()); | 1837 __ pop(LoadDescriptor::SlotRegister()); |
1845 __ pop(LoadWithVectorDescriptor::VectorRegister()); | 1838 __ pop(LoadWithVectorDescriptor::VectorRegister()); |
1846 } | 1839 } |
(...skipping 312 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2159 // Just jump to runtime to create the sub string. | 2152 // Just jump to runtime to create the sub string. |
2160 __ bind(&runtime); | 2153 __ bind(&runtime); |
2161 __ TailCallRuntime(Runtime::kSubString); | 2154 __ TailCallRuntime(Runtime::kSubString); |
2162 | 2155 |
2163 __ bind(&single_char); | 2156 __ bind(&single_char); |
2164 // eax: string | 2157 // eax: string |
2165 // ebx: instance type | 2158 // ebx: instance type |
2166 // ecx: sub string length (smi) | 2159 // ecx: sub string length (smi) |
2167 // edx: from index (smi) | 2160 // edx: from index (smi) |
2168 StringCharAtGenerator generator(eax, edx, ecx, eax, &runtime, &runtime, | 2161 StringCharAtGenerator generator(eax, edx, ecx, eax, &runtime, &runtime, |
2169 &runtime, STRING_INDEX_IS_NUMBER, | 2162 &runtime, RECEIVER_IS_STRING); |
2170 RECEIVER_IS_STRING); | |
2171 generator.GenerateFast(masm); | 2163 generator.GenerateFast(masm); |
2172 __ ret(3 * kPointerSize); | 2164 __ ret(3 * kPointerSize); |
2173 generator.SkipSlow(masm, &runtime); | 2165 generator.SkipSlow(masm, &runtime); |
2174 } | 2166 } |
2175 | 2167 |
2176 | 2168 |
2177 void ToNumberStub::Generate(MacroAssembler* masm) { | 2169 void ToNumberStub::Generate(MacroAssembler* masm) { |
2178 // The ToNumber stub takes one argument in eax. | 2170 // The ToNumber stub takes one argument in eax. |
2179 Label not_smi; | 2171 Label not_smi; |
2180 __ JumpIfNotSmi(eax, ¬_smi, Label::kNear); | 2172 __ JumpIfNotSmi(eax, ¬_smi, Label::kNear); |
(...skipping 3212 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5393 kStackUnwindSpace, nullptr, return_value_operand, | 5385 kStackUnwindSpace, nullptr, return_value_operand, |
5394 NULL); | 5386 NULL); |
5395 } | 5387 } |
5396 | 5388 |
5397 #undef __ | 5389 #undef __ |
5398 | 5390 |
5399 } // namespace internal | 5391 } // namespace internal |
5400 } // namespace v8 | 5392 } // namespace v8 |
5401 | 5393 |
5402 #endif // V8_TARGET_ARCH_X87 | 5394 #endif // V8_TARGET_ARCH_X87 |
OLD | NEW |