OLD | NEW |
---|---|
1 // Copyright 2010 the V8 project authors. All rights reserved. | 1 // Copyright 2010 the V8 project authors. All rights reserved. |
2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
4 // met: | 4 // met: |
5 // | 5 // |
6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
(...skipping 1819 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1830 void LCodeGen::DoLoadNamedGeneric(LLoadNamedGeneric* instr) { | 1830 void LCodeGen::DoLoadNamedGeneric(LLoadNamedGeneric* instr) { |
1831 ASSERT(ToRegister(instr->object()).is(eax)); | 1831 ASSERT(ToRegister(instr->object()).is(eax)); |
1832 ASSERT(ToRegister(instr->result()).is(eax)); | 1832 ASSERT(ToRegister(instr->result()).is(eax)); |
1833 | 1833 |
1834 __ mov(ecx, instr->name()); | 1834 __ mov(ecx, instr->name()); |
1835 Handle<Code> ic(Builtins::builtin(Builtins::LoadIC_Initialize)); | 1835 Handle<Code> ic(Builtins::builtin(Builtins::LoadIC_Initialize)); |
1836 CallCode(ic, RelocInfo::CODE_TARGET, instr); | 1836 CallCode(ic, RelocInfo::CODE_TARGET, instr); |
1837 } | 1837 } |
1838 | 1838 |
1839 | 1839 |
1840 void LCodeGen::DoLoadFunctionPrototype(LLoadFunctionPrototype* instr) { | |
1841 Register function = ToRegister(instr->function()); | |
1842 Register temp = ToRegister(instr->temporary()); | |
1843 Register result = ToRegister(instr->result()); | |
1844 | |
1845 // Check that the function really is a function. | |
1846 __ CmpObjectType(function, JS_FUNCTION_TYPE, result); | |
1847 DeoptimizeIf(not_equal, instr->environment()); | |
1848 | |
1849 // Check whether the function has an instance prototype. | |
1850 NearLabel non_instance; | |
1851 __ test_b(FieldOperand(result, Map::kBitFieldOffset), | |
1852 1 << Map::kHasNonInstancePrototype); | |
1853 __ j(not_zero, &non_instance); | |
1854 | |
1855 // Get the prototype or initial map from the function. | |
1856 __ mov(result, | |
1857 FieldOperand(function, JSFunction::kPrototypeOrInitialMapOffset)); | |
1858 | |
1859 // If the prototype or initial map is the hole, don't return it and | |
1860 // simply miss the cache instead. This will allow us to allocate a | |
fschneider
2010/12/21 17:57:52
This comment is not 100% up-to-date, since we deop
Vitaly Repeshko
2010/12/22 15:43:41
Updated.
| |
1861 // prototype object on-demand in the runtime system. | |
1862 __ cmp(Operand(result), Immediate(Factory::the_hole_value())); | |
1863 DeoptimizeIf(equal, instr->environment()); | |
1864 | |
1865 // If the function does not have an initial map, we're done. | |
1866 NearLabel done; | |
1867 __ CmpObjectType(result, MAP_TYPE, temp); | |
1868 __ j(not_equal, &done); | |
1869 | |
1870 // Get the prototype from the initial map. | |
1871 __ mov(result, FieldOperand(result, Map::kPrototypeOffset)); | |
1872 __ jmp(&done); | |
1873 | |
1874 // Non-instance prototype: Fetch prototype from constructor field | |
1875 // in the function's map. | |
1876 __ bind(&non_instance); | |
1877 __ mov(result, FieldOperand(result, Map::kConstructorOffset)); | |
1878 | |
1879 // All done. | |
1880 __ bind(&done); | |
1881 } | |
1882 | |
1883 | |
1840 void LCodeGen::DoLoadElements(LLoadElements* instr) { | 1884 void LCodeGen::DoLoadElements(LLoadElements* instr) { |
1841 ASSERT(instr->result()->Equals(instr->input())); | 1885 ASSERT(instr->result()->Equals(instr->input())); |
1842 Register reg = ToRegister(instr->input()); | 1886 Register reg = ToRegister(instr->input()); |
1843 __ mov(reg, FieldOperand(reg, JSObject::kElementsOffset)); | 1887 __ mov(reg, FieldOperand(reg, JSObject::kElementsOffset)); |
1844 if (FLAG_debug_code) { | 1888 if (FLAG_debug_code) { |
1845 NearLabel done; | 1889 NearLabel done; |
1846 __ cmp(FieldOperand(reg, HeapObject::kMapOffset), | 1890 __ cmp(FieldOperand(reg, HeapObject::kMapOffset), |
1847 Immediate(Factory::fixed_array_map())); | 1891 Immediate(Factory::fixed_array_map())); |
1848 __ j(equal, &done); | 1892 __ j(equal, &done); |
1849 __ cmp(FieldOperand(reg, HeapObject::kMapOffset), | 1893 __ cmp(FieldOperand(reg, HeapObject::kMapOffset), |
(...skipping 1417 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
3267 ASSERT(!environment->HasBeenRegistered()); | 3311 ASSERT(!environment->HasBeenRegistered()); |
3268 RegisterEnvironmentForDeoptimization(environment); | 3312 RegisterEnvironmentForDeoptimization(environment); |
3269 ASSERT(osr_pc_offset_ == -1); | 3313 ASSERT(osr_pc_offset_ == -1); |
3270 osr_pc_offset_ = masm()->pc_offset(); | 3314 osr_pc_offset_ = masm()->pc_offset(); |
3271 } | 3315 } |
3272 | 3316 |
3273 | 3317 |
3274 #undef __ | 3318 #undef __ |
3275 | 3319 |
3276 } } // namespace v8::internal | 3320 } } // namespace v8::internal |
OLD | NEW |