| OLD | NEW |
| 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, 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/compiler.h" | 9 #include "vm/compiler.h" |
| 10 #include "vm/dart_entry.h" | 10 #include "vm/dart_entry.h" |
| (...skipping 29 matching lines...) Expand all Loading... |
| 40 // EDX : number of arguments to the call. | 40 // EDX : number of arguments to the call. |
| 41 // Must preserve callee saved registers EDI and EBX. | 41 // Must preserve callee saved registers EDI and EBX. |
| 42 void StubCode::GenerateCallToRuntimeStub(Assembler* assembler) { | 42 void StubCode::GenerateCallToRuntimeStub(Assembler* assembler) { |
| 43 const intptr_t isolate_offset = NativeArguments::isolate_offset(); | 43 const intptr_t isolate_offset = NativeArguments::isolate_offset(); |
| 44 const intptr_t argc_tag_offset = NativeArguments::argc_tag_offset(); | 44 const intptr_t argc_tag_offset = NativeArguments::argc_tag_offset(); |
| 45 const intptr_t argv_offset = NativeArguments::argv_offset(); | 45 const intptr_t argv_offset = NativeArguments::argv_offset(); |
| 46 const intptr_t retval_offset = NativeArguments::retval_offset(); | 46 const intptr_t retval_offset = NativeArguments::retval_offset(); |
| 47 | 47 |
| 48 __ EnterFrame(0); | 48 __ EnterFrame(0); |
| 49 | 49 |
| 50 // Load current Isolate pointer from Context structure into EAX. | 50 __ LoadIsolate(EAX); |
| 51 __ movl(EAX, FieldAddress(CTX, Context::isolate_offset())); | |
| 52 | 51 |
| 53 // Save exit frame information to enable stack walking as we are about | 52 // Save exit frame information to enable stack walking as we are about |
| 54 // to transition to Dart VM C++ code. | 53 // to transition to Dart VM C++ code. |
| 55 __ movl(Address(EAX, Isolate::top_exit_frame_info_offset()), ESP); | 54 __ movl(Address(EAX, Isolate::top_exit_frame_info_offset()), ESP); |
| 56 | 55 |
| 57 #if defined(DEBUG) | 56 #if defined(DEBUG) |
| 58 if (FLAG_verify_incoming_contexts) { | 57 if (FLAG_verify_incoming_contexts) { |
| 59 Label ok; | 58 Label ok; |
| 60 // Check that the isolate's saved ctx is null. | 59 // Check that the isolate's saved ctx is null. |
| 61 const Immediate& raw_null = | 60 const Immediate& raw_null = |
| (...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 161 NativeArguments::isolate_offset() + native_args_struct_offset; | 160 NativeArguments::isolate_offset() + native_args_struct_offset; |
| 162 const intptr_t argc_tag_offset = | 161 const intptr_t argc_tag_offset = |
| 163 NativeArguments::argc_tag_offset() + native_args_struct_offset; | 162 NativeArguments::argc_tag_offset() + native_args_struct_offset; |
| 164 const intptr_t argv_offset = | 163 const intptr_t argv_offset = |
| 165 NativeArguments::argv_offset() + native_args_struct_offset; | 164 NativeArguments::argv_offset() + native_args_struct_offset; |
| 166 const intptr_t retval_offset = | 165 const intptr_t retval_offset = |
| 167 NativeArguments::retval_offset() + native_args_struct_offset; | 166 NativeArguments::retval_offset() + native_args_struct_offset; |
| 168 | 167 |
| 169 __ EnterFrame(0); | 168 __ EnterFrame(0); |
| 170 | 169 |
| 171 // Load current Isolate pointer from Context structure into EDI. | 170 __ LoadIsolate(EDI); |
| 172 __ movl(EDI, FieldAddress(CTX, Context::isolate_offset())); | |
| 173 | 171 |
| 174 // Save exit frame information to enable stack walking as we are about | 172 // Save exit frame information to enable stack walking as we are about |
| 175 // to transition to dart VM code. | 173 // to transition to dart VM code. |
| 176 __ movl(Address(EDI, Isolate::top_exit_frame_info_offset()), ESP); | 174 __ movl(Address(EDI, Isolate::top_exit_frame_info_offset()), ESP); |
| 177 | 175 |
| 178 #if defined(DEBUG) | 176 #if defined(DEBUG) |
| 179 if (FLAG_verify_incoming_contexts) { | 177 if (FLAG_verify_incoming_contexts) { |
| 180 Label ok; | 178 Label ok; |
| 181 // Check that the isolate's saved ctx is null. | 179 // Check that the isolate's saved ctx is null. |
| 182 const Immediate& raw_null = | 180 const Immediate& raw_null = |
| (...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 266 NativeArguments::isolate_offset() + native_args_struct_offset; | 264 NativeArguments::isolate_offset() + native_args_struct_offset; |
| 267 const intptr_t argc_tag_offset = | 265 const intptr_t argc_tag_offset = |
| 268 NativeArguments::argc_tag_offset() + native_args_struct_offset; | 266 NativeArguments::argc_tag_offset() + native_args_struct_offset; |
| 269 const intptr_t argv_offset = | 267 const intptr_t argv_offset = |
| 270 NativeArguments::argv_offset() + native_args_struct_offset; | 268 NativeArguments::argv_offset() + native_args_struct_offset; |
| 271 const intptr_t retval_offset = | 269 const intptr_t retval_offset = |
| 272 NativeArguments::retval_offset() + native_args_struct_offset; | 270 NativeArguments::retval_offset() + native_args_struct_offset; |
| 273 | 271 |
| 274 __ EnterFrame(0); | 272 __ EnterFrame(0); |
| 275 | 273 |
| 276 // Load current Isolate pointer from Context structure into EDI. | 274 __ LoadIsolate(EDI); |
| 277 __ movl(EDI, FieldAddress(CTX, Context::isolate_offset())); | |
| 278 | 275 |
| 279 // Save exit frame information to enable stack walking as we are about | 276 // Save exit frame information to enable stack walking as we are about |
| 280 // to transition to dart VM code. | 277 // to transition to dart VM code. |
| 281 __ movl(Address(EDI, Isolate::top_exit_frame_info_offset()), ESP); | 278 __ movl(Address(EDI, Isolate::top_exit_frame_info_offset()), ESP); |
| 282 | 279 |
| 283 #if defined(DEBUG) | 280 #if defined(DEBUG) |
| 284 if (FLAG_verify_incoming_contexts) { | 281 if (FLAG_verify_incoming_contexts) { |
| 285 Label ok; | 282 Label ok; |
| 286 // Check that the isolate's saved ctx is null. | 283 // Check that the isolate's saved ctx is null. |
| 287 const Immediate& raw_null = | 284 const Immediate& raw_null = |
| (...skipping 700 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 988 __ orl(EBX, | 985 __ orl(EBX, |
| 989 Immediate(RawObject::ClassIdTag::encode(cid))); | 986 Immediate(RawObject::ClassIdTag::encode(cid))); |
| 990 __ movl(FieldAddress(EAX, Context::tags_offset()), EBX); // Tags. | 987 __ movl(FieldAddress(EAX, Context::tags_offset()), EBX); // Tags. |
| 991 } | 988 } |
| 992 | 989 |
| 993 // Setup up number of context variables field. | 990 // Setup up number of context variables field. |
| 994 // EAX: new object. | 991 // EAX: new object. |
| 995 // EDX: number of context variables as integer value (not object). | 992 // EDX: number of context variables as integer value (not object). |
| 996 __ movl(FieldAddress(EAX, Context::num_variables_offset()), EDX); | 993 __ movl(FieldAddress(EAX, Context::num_variables_offset()), EDX); |
| 997 | 994 |
| 998 // Setup isolate field. | |
| 999 // Load Isolate pointer from Context structure into EBX. | |
| 1000 // EAX: new object. | |
| 1001 // EDX: number of context variables. | |
| 1002 __ movl(FieldAddress(EAX, Context::isolate_offset()), | |
| 1003 Immediate(reinterpret_cast<int32_t>(isolate))); | |
| 1004 | |
| 1005 const Immediate& raw_null = | 995 const Immediate& raw_null = |
| 1006 Immediate(reinterpret_cast<intptr_t>(Object::null())); | 996 Immediate(reinterpret_cast<intptr_t>(Object::null())); |
| 1007 // Setup the parent field. | 997 // Setup the parent field. |
| 1008 // EAX: new object. | 998 // EAX: new object. |
| 1009 // EDX: number of context variables. | 999 // EDX: number of context variables. |
| 1010 __ movl(FieldAddress(EAX, Context::parent_offset()), raw_null); | 1000 __ movl(FieldAddress(EAX, Context::parent_offset()), raw_null); |
| 1011 | 1001 |
| 1012 // Initialize the context variables. | 1002 // Initialize the context variables. |
| 1013 // EAX: new object. | 1003 // EAX: new object. |
| 1014 // EDX: number of context variables. | 1004 // EDX: number of context variables. |
| (...skipping 772 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1787 __ popl(EAX); // Address of original stub. | 1777 __ popl(EAX); // Address of original stub. |
| 1788 __ LeaveFrame(); | 1778 __ LeaveFrame(); |
| 1789 __ jmp(EAX); // Jump to original stub. | 1779 __ jmp(EAX); // Jump to original stub. |
| 1790 } | 1780 } |
| 1791 | 1781 |
| 1792 | 1782 |
| 1793 // Called only from unoptimized code. | 1783 // Called only from unoptimized code. |
| 1794 void StubCode::GenerateDebugStepCheckStub(Assembler* assembler) { | 1784 void StubCode::GenerateDebugStepCheckStub(Assembler* assembler) { |
| 1795 // Check single stepping. | 1785 // Check single stepping. |
| 1796 Label stepping, done_stepping; | 1786 Label stepping, done_stepping; |
| 1797 __ movl(EAX, FieldAddress(CTX, Context::isolate_offset())); | 1787 __ LoadIsolate(EAX); |
| 1798 __ movzxb(EAX, Address(EAX, Isolate::single_step_offset())); | 1788 __ movzxb(EAX, Address(EAX, Isolate::single_step_offset())); |
| 1799 __ cmpl(EAX, Immediate(0)); | 1789 __ cmpl(EAX, Immediate(0)); |
| 1800 __ j(NOT_EQUAL, &stepping, Assembler::kNearJump); | 1790 __ j(NOT_EQUAL, &stepping, Assembler::kNearJump); |
| 1801 __ Bind(&done_stepping); | 1791 __ Bind(&done_stepping); |
| 1802 __ ret(); | 1792 __ ret(); |
| 1803 | 1793 |
| 1804 __ Bind(&stepping); | 1794 __ Bind(&stepping); |
| 1805 __ EnterStubFrame(); | 1795 __ EnterStubFrame(); |
| 1806 __ CallRuntime(kSingleStepHandlerRuntimeEntry, 0); | 1796 __ CallRuntime(kSingleStepHandlerRuntimeEntry, 0); |
| 1807 __ LeaveFrame(); | 1797 __ LeaveFrame(); |
| (...skipping 241 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2049 | 2039 |
| 2050 // Called only from unoptimized code. All relevant registers have been saved. | 2040 // Called only from unoptimized code. All relevant registers have been saved. |
| 2051 // TOS + 0: return address | 2041 // TOS + 0: return address |
| 2052 // TOS + 1: right argument. | 2042 // TOS + 1: right argument. |
| 2053 // TOS + 2: left argument. | 2043 // TOS + 2: left argument. |
| 2054 // Returns ZF set. | 2044 // Returns ZF set. |
| 2055 void StubCode::GenerateUnoptimizedIdenticalWithNumberCheckStub( | 2045 void StubCode::GenerateUnoptimizedIdenticalWithNumberCheckStub( |
| 2056 Assembler* assembler) { | 2046 Assembler* assembler) { |
| 2057 // Check single stepping. | 2047 // Check single stepping. |
| 2058 Label stepping, done_stepping; | 2048 Label stepping, done_stepping; |
| 2059 __ movl(EAX, FieldAddress(CTX, Context::isolate_offset())); | 2049 __ LoadIsolate(EAX); |
| 2060 __ movzxb(EAX, Address(EAX, Isolate::single_step_offset())); | 2050 __ movzxb(EAX, Address(EAX, Isolate::single_step_offset())); |
| 2061 __ cmpl(EAX, Immediate(0)); | 2051 __ cmpl(EAX, Immediate(0)); |
| 2062 __ j(NOT_EQUAL, &stepping); | 2052 __ j(NOT_EQUAL, &stepping); |
| 2063 __ Bind(&done_stepping); | 2053 __ Bind(&done_stepping); |
| 2064 | 2054 |
| 2065 const Register left = EAX; | 2055 const Register left = EAX; |
| 2066 const Register right = EDX; | 2056 const Register right = EDX; |
| 2067 const Register temp = ECX; | 2057 const Register temp = ECX; |
| 2068 __ movl(left, Address(ESP, 2 * kWordSize)); | 2058 __ movl(left, Address(ESP, 2 * kWordSize)); |
| 2069 __ movl(right, Address(ESP, 1 * kWordSize)); | 2059 __ movl(right, Address(ESP, 1 * kWordSize)); |
| (...skipping 20 matching lines...) Expand all Loading... |
| 2090 const Register temp = ECX; | 2080 const Register temp = ECX; |
| 2091 __ movl(left, Address(ESP, 2 * kWordSize)); | 2081 __ movl(left, Address(ESP, 2 * kWordSize)); |
| 2092 __ movl(right, Address(ESP, 1 * kWordSize)); | 2082 __ movl(right, Address(ESP, 1 * kWordSize)); |
| 2093 GenerateIdenticalWithNumberCheckStub(assembler, left, right, temp); | 2083 GenerateIdenticalWithNumberCheckStub(assembler, left, right, temp); |
| 2094 __ ret(); | 2084 __ ret(); |
| 2095 } | 2085 } |
| 2096 | 2086 |
| 2097 } // namespace dart | 2087 } // namespace dart |
| 2098 | 2088 |
| 2099 #endif // defined TARGET_ARCH_IA32 | 2089 #endif // defined TARGET_ARCH_IA32 |
| OLD | NEW |