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 #include <limits.h> // For LONG_MIN, LONG_MAX. | 5 #include <limits.h> // For LONG_MIN, LONG_MAX. |
6 | 6 |
7 #if V8_TARGET_ARCH_ARM | 7 #if V8_TARGET_ARCH_ARM |
8 | 8 |
9 #include "src/base/bits.h" | 9 #include "src/base/bits.h" |
10 #include "src/base/division-by-constant.h" | 10 #include "src/base/division-by-constant.h" |
(...skipping 1812 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1823 | 1823 |
1824 void MacroAssembler::PopStackHandler() { | 1824 void MacroAssembler::PopStackHandler() { |
1825 STATIC_ASSERT(StackHandlerConstants::kNextOffset == 0); | 1825 STATIC_ASSERT(StackHandlerConstants::kNextOffset == 0); |
1826 pop(r1); | 1826 pop(r1); |
1827 mov(ip, Operand(ExternalReference(Isolate::kHandlerAddress, isolate()))); | 1827 mov(ip, Operand(ExternalReference(Isolate::kHandlerAddress, isolate()))); |
1828 add(sp, sp, Operand(StackHandlerConstants::kSize - kPointerSize)); | 1828 add(sp, sp, Operand(StackHandlerConstants::kSize - kPointerSize)); |
1829 str(r1, MemOperand(ip)); | 1829 str(r1, MemOperand(ip)); |
1830 } | 1830 } |
1831 | 1831 |
1832 | 1832 |
1833 void MacroAssembler::CheckAccessGlobalProxy(Register holder_reg, | |
1834 Register scratch, | |
1835 Label* miss) { | |
1836 Label same_contexts; | |
1837 | |
1838 DCHECK(!holder_reg.is(scratch)); | |
1839 DCHECK(!holder_reg.is(ip)); | |
1840 DCHECK(!scratch.is(ip)); | |
1841 | |
1842 // Load current lexical context from the active StandardFrame, which | |
1843 // may require crawling past STUB frames. | |
1844 Label load_context; | |
1845 Label has_context; | |
1846 DCHECK(!ip.is(scratch)); | |
1847 mov(ip, fp); | |
1848 bind(&load_context); | |
1849 ldr(scratch, MemOperand(ip, CommonFrameConstants::kContextOrFrameTypeOffset)); | |
1850 JumpIfNotSmi(scratch, &has_context); | |
1851 ldr(ip, MemOperand(ip, CommonFrameConstants::kCallerFPOffset)); | |
1852 b(&load_context); | |
1853 bind(&has_context); | |
1854 | |
1855 // In debug mode, make sure the lexical context is set. | |
1856 #ifdef DEBUG | |
1857 cmp(scratch, Operand::Zero()); | |
1858 Check(ne, kWeShouldNotHaveAnEmptyLexicalContext); | |
1859 #endif | |
1860 | |
1861 // Load the native context of the current context. | |
1862 ldr(scratch, ContextMemOperand(scratch, Context::NATIVE_CONTEXT_INDEX)); | |
1863 | |
1864 // Check the context is a native context. | |
1865 if (emit_debug_code()) { | |
1866 // Cannot use ip as a temporary in this verification code. Due to the fact | |
1867 // that ip is clobbered as part of cmp with an object Operand. | |
1868 push(holder_reg); // Temporarily save holder on the stack. | |
1869 // Read the first word and compare to the native_context_map. | |
1870 ldr(holder_reg, FieldMemOperand(scratch, HeapObject::kMapOffset)); | |
1871 LoadRoot(ip, Heap::kNativeContextMapRootIndex); | |
1872 cmp(holder_reg, ip); | |
1873 Check(eq, kJSGlobalObjectNativeContextShouldBeANativeContext); | |
1874 pop(holder_reg); // Restore holder. | |
1875 } | |
1876 | |
1877 // Check if both contexts are the same. | |
1878 ldr(ip, FieldMemOperand(holder_reg, JSGlobalProxy::kNativeContextOffset)); | |
1879 cmp(scratch, Operand(ip)); | |
1880 b(eq, &same_contexts); | |
1881 | |
1882 // Check the context is a native context. | |
1883 if (emit_debug_code()) { | |
1884 // Cannot use ip as a temporary in this verification code. Due to the fact | |
1885 // that ip is clobbered as part of cmp with an object Operand. | |
1886 push(holder_reg); // Temporarily save holder on the stack. | |
1887 mov(holder_reg, ip); // Move ip to its holding place. | |
1888 LoadRoot(ip, Heap::kNullValueRootIndex); | |
1889 cmp(holder_reg, ip); | |
1890 Check(ne, kJSGlobalProxyContextShouldNotBeNull); | |
1891 | |
1892 ldr(holder_reg, FieldMemOperand(holder_reg, HeapObject::kMapOffset)); | |
1893 LoadRoot(ip, Heap::kNativeContextMapRootIndex); | |
1894 cmp(holder_reg, ip); | |
1895 Check(eq, kJSGlobalObjectNativeContextShouldBeANativeContext); | |
1896 // Restore ip is not needed. ip is reloaded below. | |
1897 pop(holder_reg); // Restore holder. | |
1898 // Restore ip to holder's context. | |
1899 ldr(ip, FieldMemOperand(holder_reg, JSGlobalProxy::kNativeContextOffset)); | |
1900 } | |
1901 | |
1902 // Check that the security token in the calling global object is | |
1903 // compatible with the security token in the receiving global | |
1904 // object. | |
1905 int token_offset = Context::kHeaderSize + | |
1906 Context::SECURITY_TOKEN_INDEX * kPointerSize; | |
1907 | |
1908 ldr(scratch, FieldMemOperand(scratch, token_offset)); | |
1909 ldr(ip, FieldMemOperand(ip, token_offset)); | |
1910 cmp(scratch, Operand(ip)); | |
1911 b(ne, miss); | |
1912 | |
1913 bind(&same_contexts); | |
1914 } | |
1915 | |
1916 | |
1917 // Compute the hash code from the untagged key. This must be kept in sync with | 1833 // Compute the hash code from the untagged key. This must be kept in sync with |
1918 // ComputeIntegerHash in utils.h and KeyedLoadGenericStub in | 1834 // ComputeIntegerHash in utils.h and KeyedLoadGenericStub in |
1919 // code-stub-hydrogen.cc | 1835 // code-stub-hydrogen.cc |
1920 void MacroAssembler::GetNumberHash(Register t0, Register scratch) { | 1836 void MacroAssembler::GetNumberHash(Register t0, Register scratch) { |
1921 // First of all we assign the hash seed to scratch. | 1837 // First of all we assign the hash seed to scratch. |
1922 LoadRoot(scratch, Heap::kHashSeedRootIndex); | 1838 LoadRoot(scratch, Heap::kHashSeedRootIndex); |
1923 SmiUntag(scratch); | 1839 SmiUntag(scratch); |
1924 | 1840 |
1925 // Xor original key with a seed. | 1841 // Xor original key with a seed. |
1926 eor(t0, t0, Operand(scratch)); | 1842 eor(t0, t0, Operand(scratch)); |
(...skipping 2154 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4081 } | 3997 } |
4082 } | 3998 } |
4083 if (mag.shift > 0) mov(result, Operand(result, ASR, mag.shift)); | 3999 if (mag.shift > 0) mov(result, Operand(result, ASR, mag.shift)); |
4084 add(result, result, Operand(dividend, LSR, 31)); | 4000 add(result, result, Operand(dividend, LSR, 31)); |
4085 } | 4001 } |
4086 | 4002 |
4087 } // namespace internal | 4003 } // namespace internal |
4088 } // namespace v8 | 4004 } // namespace v8 |
4089 | 4005 |
4090 #endif // V8_TARGET_ARCH_ARM | 4006 #endif // V8_TARGET_ARCH_ARM |
OLD | NEW |