| OLD | NEW |
| 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file |
| 2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
| 3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
| 4 | 4 |
| 5 #include "vm/globals.h" | 5 #include "vm/globals.h" |
| 6 #if defined(TARGET_ARCH_IA32) | 6 #if defined(TARGET_ARCH_IA32) |
| 7 | 7 |
| 8 #include "vm/assembler.h" | 8 #include "vm/assembler.h" |
| 9 #include "vm/assembler_macros.h" | 9 #include "vm/assembler_macros.h" |
| 10 #include "vm/compiler.h" | 10 #include "vm/compiler.h" |
| (...skipping 757 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 768 __ Bind(&function_compiled); | 768 __ Bind(&function_compiled); |
| 769 // EAX: Code. | 769 // EAX: Code. |
| 770 // ECX: Function. | 770 // ECX: Function. |
| 771 // EDX: Arguments descriptor array. | 771 // EDX: Arguments descriptor array. |
| 772 | 772 |
| 773 __ movl(ECX, FieldAddress(EAX, Code::instructions_offset())); | 773 __ movl(ECX, FieldAddress(EAX, Code::instructions_offset())); |
| 774 __ addl(ECX, Immediate(Instructions::HeaderSize() - kHeapObjectTag)); | 774 __ addl(ECX, Immediate(Instructions::HeaderSize() - kHeapObjectTag)); |
| 775 __ jmp(ECX); | 775 __ jmp(ECX); |
| 776 | 776 |
| 777 __ Bind(¬_closure); | 777 __ Bind(¬_closure); |
| 778 // Call runtime to report that a closure call was attempted on a non-closure | 778 // Call runtime to attempt to resolve and invoke a call method on a |
| 779 // object, passing the non-closure object and its arguments array. | 779 // non-closure object, passing the non-closure object and its arguments array, |
| 780 // returning here. |
| 781 // If no call method exists, throw a NoSuchMethodError. |
| 780 // EDI: non-closure object. | 782 // EDI: non-closure object. |
| 781 // EDX: arguments descriptor array. | 783 // EDX: arguments descriptor array. |
| 782 | 784 |
| 783 // Create a stub frame as we are pushing some objects on the stack before | 785 // Create a stub frame as we are pushing some objects on the stack before |
| 784 // calling into the runtime. | 786 // calling into the runtime. |
| 785 AssemblerMacros::EnterStubFrame(assembler); | 787 AssemblerMacros::EnterStubFrame(assembler); |
| 786 | 788 |
| 787 __ pushl(raw_null); // Setup space on stack for result from error reporting. | 789 __ pushl(raw_null); // Setup space on stack for result from error reporting. |
| 788 __ pushl(EDI); // Non-closure object. | 790 __ pushl(EDI); // Non-closure object. |
| 791 __ pushl(EDX); // Arguments descriptor. |
| 789 // Load num_args. | 792 // Load num_args. |
| 790 __ movl(EDI, FieldAddress(EDX, ArgumentsDescriptor::count_offset())); | 793 __ movl(EDI, FieldAddress(EDX, ArgumentsDescriptor::count_offset())); |
| 791 __ SmiUntag(EDI); // Arguments array length, including the non-closure. | 794 __ SmiUntag(EDI); // Arguments array length, including the non-closure. |
| 792 // See stack layout below explaining "wordSize * 5" offset. | 795 // See stack layout below explaining "wordSize * 6" offset. |
| 793 PushArgumentsArray(assembler, (kWordSize * 5)); | 796 PushArgumentsArray(assembler, (kWordSize * 6)); |
| 794 | 797 |
| 795 // Stack: | 798 // Stack: |
| 796 // TOS + 0: Argument array. | 799 // TOS + 0: Argument array. |
| 797 // TOS + 1: Non-closure object. | 800 // TOS + 1: Arguments descriptor array. |
| 798 // TOS + 2: Place for result from reporting the error. | 801 // TOS + 2: Non-closure object. |
| 799 // TOS + 3: PC marker => RawInstruction object. | 802 // TOS + 3: Place for result from the call. |
| 800 // TOS + 4: Saved EBP of previous frame. <== EBP | 803 // TOS + 4: PC marker => RawInstruction object. |
| 801 // TOS + 5: Dart code return address | 804 // TOS + 5: Saved EBP of previous frame. <== EBP |
| 802 // TOS + 6: Last argument of caller. | 805 // TOS + 6: Dart code return address |
| 806 // TOS + 7: Last argument of caller. |
| 803 // .... | 807 // .... |
| 804 __ CallRuntime(kReportObjectNotClosureRuntimeEntry); | 808 __ CallRuntime(kInvokeNonClosureRuntimeEntry); |
| 805 __ Stop("runtime call throws an exception"); | 809 // Remove arguments. |
| 810 __ popl(EAX); |
| 811 __ popl(EAX); |
| 812 __ popl(EAX); |
| 813 __ popl(EAX); // Get result into EAX. |
| 814 |
| 815 // Remove the stub frame as we are about to return. |
| 816 __ LeaveFrame(); |
| 817 __ ret(); |
| 806 } | 818 } |
| 807 | 819 |
| 808 | 820 |
| 809 // Called when invoking dart code from C++ (VM code). | 821 // Called when invoking dart code from C++ (VM code). |
| 810 // Input parameters: | 822 // Input parameters: |
| 811 // ESP : points to return address. | 823 // ESP : points to return address. |
| 812 // ESP + 4 : entrypoint of the dart function to call. | 824 // ESP + 4 : entrypoint of the dart function to call. |
| 813 // ESP + 8 : arguments descriptor array. | 825 // ESP + 8 : arguments descriptor array. |
| 814 // ESP + 12 : pointer to the argument array. | 826 // ESP + 12 : pointer to the argument array. |
| 815 // ESP + 16 : new context containing the current isolate pointer. | 827 // ESP + 16 : new context containing the current isolate pointer. |
| (...skipping 1392 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2208 __ Bind(&done); | 2220 __ Bind(&done); |
| 2209 __ popl(temp); | 2221 __ popl(temp); |
| 2210 __ popl(right); | 2222 __ popl(right); |
| 2211 __ popl(left); | 2223 __ popl(left); |
| 2212 __ ret(); | 2224 __ ret(); |
| 2213 } | 2225 } |
| 2214 | 2226 |
| 2215 } // namespace dart | 2227 } // namespace dart |
| 2216 | 2228 |
| 2217 #endif // defined TARGET_ARCH_IA32 | 2229 #endif // defined TARGET_ARCH_IA32 |
| OLD | NEW |