| 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 461 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 472 Immediate(isolate()->factory()->the_hole_value())); | 472 Immediate(isolate()->factory()->the_hole_value())); |
| 473 __ j(equal, &miss); | 473 __ j(equal, &miss); |
| 474 __ TryGetFunctionPrototype(receiver, eax, ebx, &miss); | 474 __ TryGetFunctionPrototype(receiver, eax, ebx, &miss); |
| 475 __ ret(0); | 475 __ ret(0); |
| 476 | 476 |
| 477 __ bind(&miss); | 477 __ bind(&miss); |
| 478 PropertyAccessCompiler::TailCallBuiltin( | 478 PropertyAccessCompiler::TailCallBuiltin( |
| 479 masm, PropertyAccessCompiler::MissBuiltin(Code::LOAD_IC)); | 479 masm, PropertyAccessCompiler::MissBuiltin(Code::LOAD_IC)); |
| 480 } | 480 } |
| 481 | 481 |
| 482 | |
| 483 void LoadIndexedStringStub::Generate(MacroAssembler* masm) { | |
| 484 // Return address is on the stack. | |
| 485 Label miss; | |
| 486 | |
| 487 Register receiver = LoadDescriptor::ReceiverRegister(); | |
| 488 Register index = LoadDescriptor::NameRegister(); | |
| 489 Register scratch = edi; | |
| 490 DCHECK(!scratch.is(receiver) && !scratch.is(index)); | |
| 491 Register result = eax; | |
| 492 DCHECK(!result.is(scratch)); | |
| 493 DCHECK(!scratch.is(LoadWithVectorDescriptor::VectorRegister()) && | |
| 494 result.is(LoadDescriptor::SlotRegister())); | |
| 495 | |
| 496 // StringCharAtGenerator doesn't use the result register until it's passed | |
| 497 // the different miss possibilities. If it did, we would have a conflict | |
| 498 // when FLAG_vector_ics is true. | |
| 499 StringCharAtGenerator char_at_generator(receiver, index, scratch, result, | |
| 500 &miss, // When not a string. | |
| 501 &miss, // When not a number. | |
| 502 &miss, // When index out of range. | |
| 503 RECEIVER_IS_STRING); | |
| 504 char_at_generator.GenerateFast(masm); | |
| 505 __ ret(0); | |
| 506 | |
| 507 StubRuntimeCallHelper call_helper; | |
| 508 char_at_generator.GenerateSlow(masm, PART_OF_IC_HANDLER, call_helper); | |
| 509 | |
| 510 __ bind(&miss); | |
| 511 PropertyAccessCompiler::TailCallBuiltin( | |
| 512 masm, PropertyAccessCompiler::MissBuiltin(Code::KEYED_LOAD_IC)); | |
| 513 } | |
| 514 | |
| 515 | |
| 516 void RegExpExecStub::Generate(MacroAssembler* masm) { | 482 void RegExpExecStub::Generate(MacroAssembler* masm) { |
| 517 // Just jump directly to runtime if native RegExp is not selected at compile | 483 // Just jump directly to runtime if native RegExp is not selected at compile |
| 518 // time or if regexp entry in generated code is turned off runtime switch or | 484 // time or if regexp entry in generated code is turned off runtime switch or |
| 519 // at compilation. | 485 // at compilation. |
| 520 #ifdef V8_INTERPRETED_REGEXP | 486 #ifdef V8_INTERPRETED_REGEXP |
| 521 __ TailCallRuntime(Runtime::kRegExpExec); | 487 __ TailCallRuntime(Runtime::kRegExpExec); |
| 522 #else // V8_INTERPRETED_REGEXP | 488 #else // V8_INTERPRETED_REGEXP |
| 523 | 489 |
| 524 // Stack frame on entry. | 490 // Stack frame on entry. |
| 525 // esp[0]: return address | 491 // esp[0]: return address |
| (...skipping 1248 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1774 __ CallRuntime(Runtime::kStringCharCodeAtRT); | 1740 __ CallRuntime(Runtime::kStringCharCodeAtRT); |
| 1775 if (!result_.is(eax)) { | 1741 if (!result_.is(eax)) { |
| 1776 __ mov(result_, eax); | 1742 __ mov(result_, eax); |
| 1777 } | 1743 } |
| 1778 call_helper.AfterCall(masm); | 1744 call_helper.AfterCall(masm); |
| 1779 __ jmp(&exit_); | 1745 __ jmp(&exit_); |
| 1780 | 1746 |
| 1781 __ Abort(kUnexpectedFallthroughFromCharCodeAtSlowCase); | 1747 __ Abort(kUnexpectedFallthroughFromCharCodeAtSlowCase); |
| 1782 } | 1748 } |
| 1783 | 1749 |
| 1784 | |
| 1785 // ------------------------------------------------------------------------- | |
| 1786 // StringCharFromCodeGenerator | |
| 1787 | |
| 1788 void StringCharFromCodeGenerator::GenerateFast(MacroAssembler* masm) { | |
| 1789 // Fast case of Heap::LookupSingleCharacterStringFromCode. | |
| 1790 STATIC_ASSERT(kSmiTag == 0); | |
| 1791 STATIC_ASSERT(kSmiShiftSize == 0); | |
| 1792 DCHECK(base::bits::IsPowerOfTwo32(String::kMaxOneByteCharCodeU + 1)); | |
| 1793 __ test(code_, Immediate(kSmiTagMask | | |
| 1794 ((~String::kMaxOneByteCharCodeU) << kSmiTagSize))); | |
| 1795 __ j(not_zero, &slow_case_); | |
| 1796 | |
| 1797 Factory* factory = masm->isolate()->factory(); | |
| 1798 __ Move(result_, Immediate(factory->single_character_string_cache())); | |
| 1799 STATIC_ASSERT(kSmiTag == 0); | |
| 1800 STATIC_ASSERT(kSmiTagSize == 1); | |
| 1801 STATIC_ASSERT(kSmiShiftSize == 0); | |
| 1802 // At this point code register contains smi tagged one byte char code. | |
| 1803 __ mov(result_, FieldOperand(result_, | |
| 1804 code_, times_half_pointer_size, | |
| 1805 FixedArray::kHeaderSize)); | |
| 1806 __ cmp(result_, factory->undefined_value()); | |
| 1807 __ j(equal, &slow_case_); | |
| 1808 __ bind(&exit_); | |
| 1809 } | |
| 1810 | |
| 1811 | |
| 1812 void StringCharFromCodeGenerator::GenerateSlow( | |
| 1813 MacroAssembler* masm, | |
| 1814 const RuntimeCallHelper& call_helper) { | |
| 1815 __ Abort(kUnexpectedFallthroughToCharFromCodeSlowCase); | |
| 1816 | |
| 1817 __ bind(&slow_case_); | |
| 1818 call_helper.BeforeCall(masm); | |
| 1819 __ push(code_); | |
| 1820 __ CallRuntime(Runtime::kStringCharFromCode); | |
| 1821 if (!result_.is(eax)) { | |
| 1822 __ mov(result_, eax); | |
| 1823 } | |
| 1824 call_helper.AfterCall(masm); | |
| 1825 __ jmp(&exit_); | |
| 1826 | |
| 1827 __ Abort(kUnexpectedFallthroughFromCharFromCodeSlowCase); | |
| 1828 } | |
| 1829 | |
| 1830 void StringHelper::GenerateFlatOneByteStringEquals(MacroAssembler* masm, | 1750 void StringHelper::GenerateFlatOneByteStringEquals(MacroAssembler* masm, |
| 1831 Register left, | 1751 Register left, |
| 1832 Register right, | 1752 Register right, |
| 1833 Register scratch1, | 1753 Register scratch1, |
| 1834 Register scratch2) { | 1754 Register scratch2) { |
| 1835 Register length = scratch1; | 1755 Register length = scratch1; |
| 1836 | 1756 |
| 1837 // Compare lengths. | 1757 // Compare lengths. |
| 1838 Label strings_not_equal, check_zero_length; | 1758 Label strings_not_equal, check_zero_length; |
| 1839 __ mov(length, FieldOperand(left, String::kLengthOffset)); | 1759 __ mov(length, FieldOperand(left, String::kLengthOffset)); |
| (...skipping 1601 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3441 kStackUnwindSpace, nullptr, return_value_operand, | 3361 kStackUnwindSpace, nullptr, return_value_operand, |
| 3442 NULL); | 3362 NULL); |
| 3443 } | 3363 } |
| 3444 | 3364 |
| 3445 #undef __ | 3365 #undef __ |
| 3446 | 3366 |
| 3447 } // namespace internal | 3367 } // namespace internal |
| 3448 } // namespace v8 | 3368 } // namespace v8 |
| 3449 | 3369 |
| 3450 #endif // V8_TARGET_ARCH_IA32 | 3370 #endif // V8_TARGET_ARCH_IA32 |
| OLD | NEW |