| 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 "src/v8.h" | 5 #include "src/v8.h" |
| 6 | 6 |
| 7 #if V8_TARGET_ARCH_X87 | 7 #if V8_TARGET_ARCH_X87 |
| 8 | 8 |
| 9 #include "src/codegen.h" | 9 #include "src/codegen.h" |
| 10 #include "src/ic-inl.h" | 10 #include "src/ic-inl.h" |
| (...skipping 791 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 802 if (!miss->is_unused()) { | 802 if (!miss->is_unused()) { |
| 803 Label success; | 803 Label success; |
| 804 __ jmp(&success); | 804 __ jmp(&success); |
| 805 GenerateRestoreName(masm(), miss, name); | 805 GenerateRestoreName(masm(), miss, name); |
| 806 TailCallBuiltin(masm(), MissBuiltin(kind())); | 806 TailCallBuiltin(masm(), MissBuiltin(kind())); |
| 807 __ bind(&success); | 807 __ bind(&success); |
| 808 } | 808 } |
| 809 } | 809 } |
| 810 | 810 |
| 811 | 811 |
| 812 Register NamedLoadHandlerCompiler::CallbackFrontend(Register object_reg, | |
| 813 Handle<Name> name, | |
| 814 Handle<Object> callback) { | |
| 815 Label miss; | |
| 816 | |
| 817 Register reg = FrontendHeader(object_reg, name, &miss); | |
| 818 | |
| 819 if (!holder()->HasFastProperties()) { | |
| 820 DCHECK(!holder()->IsGlobalObject()); | |
| 821 DCHECK(!reg.is(scratch2())); | |
| 822 DCHECK(!reg.is(scratch3())); | |
| 823 Register dictionary = scratch1(); | |
| 824 bool must_preserve_dictionary_reg = reg.is(dictionary); | |
| 825 | |
| 826 // Load the properties dictionary. | |
| 827 if (must_preserve_dictionary_reg) { | |
| 828 __ push(dictionary); | |
| 829 } | |
| 830 __ mov(dictionary, FieldOperand(reg, JSObject::kPropertiesOffset)); | |
| 831 | |
| 832 // Probe the dictionary. | |
| 833 Label probe_done, pop_and_miss; | |
| 834 NameDictionaryLookupStub::GeneratePositiveLookup(masm(), | |
| 835 &pop_and_miss, | |
| 836 &probe_done, | |
| 837 dictionary, | |
| 838 this->name(), | |
| 839 scratch2(), | |
| 840 scratch3()); | |
| 841 __ bind(&pop_and_miss); | |
| 842 if (must_preserve_dictionary_reg) { | |
| 843 __ pop(dictionary); | |
| 844 } | |
| 845 __ jmp(&miss); | |
| 846 __ bind(&probe_done); | |
| 847 | |
| 848 // If probing finds an entry in the dictionary, scratch2 contains the | |
| 849 // index into the dictionary. Check that the value is the callback. | |
| 850 Register index = scratch2(); | |
| 851 const int kElementsStartOffset = | |
| 852 NameDictionary::kHeaderSize + | |
| 853 NameDictionary::kElementsStartIndex * kPointerSize; | |
| 854 const int kValueOffset = kElementsStartOffset + kPointerSize; | |
| 855 __ mov(scratch3(), | |
| 856 Operand(dictionary, index, times_4, kValueOffset - kHeapObjectTag)); | |
| 857 if (must_preserve_dictionary_reg) { | |
| 858 __ pop(dictionary); | |
| 859 } | |
| 860 __ cmp(scratch3(), callback); | |
| 861 __ j(not_equal, &miss); | |
| 862 } | |
| 863 | |
| 864 FrontendFooter(name, &miss); | |
| 865 return reg; | |
| 866 } | |
| 867 | |
| 868 | |
| 869 void NamedLoadHandlerCompiler::GenerateLoadField( | 812 void NamedLoadHandlerCompiler::GenerateLoadField( |
| 870 Register reg, FieldIndex field, Representation representation) { | 813 Register reg, FieldIndex field, Representation representation) { |
| 871 if (!reg.is(receiver())) __ mov(receiver(), reg); | 814 if (!reg.is(receiver())) __ mov(receiver(), reg); |
| 872 LoadFieldStub stub(isolate(), field); | 815 LoadFieldStub stub(isolate(), field); |
| 873 GenerateTailCall(masm(), stub.GetCode()); | 816 GenerateTailCall(masm(), stub.GetCode()); |
| 874 } | 817 } |
| 875 | 818 |
| 876 | 819 |
| 877 void NamedLoadHandlerCompiler::GenerateLoadCallback( | 820 void NamedLoadHandlerCompiler::GenerateLoadCallback( |
| 878 Register reg, Handle<ExecutableAccessorInfo> callback) { | 821 Register reg, Handle<ExecutableAccessorInfo> callback) { |
| (...skipping 475 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1354 // ----------------------------------- | 1297 // ----------------------------------- |
| 1355 TailCallBuiltin(masm, Builtins::kKeyedLoadIC_Miss); | 1298 TailCallBuiltin(masm, Builtins::kKeyedLoadIC_Miss); |
| 1356 } | 1299 } |
| 1357 | 1300 |
| 1358 | 1301 |
| 1359 #undef __ | 1302 #undef __ |
| 1360 | 1303 |
| 1361 } } // namespace v8::internal | 1304 } } // namespace v8::internal |
| 1362 | 1305 |
| 1363 #endif // V8_TARGET_ARCH_X87 | 1306 #endif // V8_TARGET_ARCH_X87 |
| OLD | NEW |