| 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" // Needed here to get TARGET_ARCH_X64. | 5 #include "vm/globals.h" // Needed here to get TARGET_ARCH_X64. |
| 6 #if defined(TARGET_ARCH_X64) | 6 #if defined(TARGET_ARCH_X64) |
| 7 | 7 |
| 8 #include "vm/intermediate_language.h" | 8 #include "vm/intermediate_language.h" |
| 9 | 9 |
| 10 #include "lib/error.h" | 10 #include "lib/error.h" |
| (...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 78 ASSERT(result == RAX); | 78 ASSERT(result == RAX); |
| 79 #if defined(DEBUG) | 79 #if defined(DEBUG) |
| 80 // TODO(srdjan): Fix for functions with finally clause. | 80 // TODO(srdjan): Fix for functions with finally clause. |
| 81 // A finally clause may leave a previously pushed return value if it | 81 // A finally clause may leave a previously pushed return value if it |
| 82 // has its own return instruction. Method that have finally are currently | 82 // has its own return instruction. Method that have finally are currently |
| 83 // not optimized. | 83 // not optimized. |
| 84 if (!compiler->HasFinally()) { | 84 if (!compiler->HasFinally()) { |
| 85 __ Comment("Stack Check"); | 85 __ Comment("Stack Check"); |
| 86 Label done; | 86 Label done; |
| 87 const intptr_t fp_sp_dist = | 87 const intptr_t fp_sp_dist = |
| 88 (kFirstLocalSlotIndex + 1 - compiler->StackSize()) * kWordSize; | 88 (kFirstLocalSlotFromFp + 1 - compiler->StackSize()) * kWordSize; |
| 89 ASSERT(fp_sp_dist <= 0); | 89 ASSERT(fp_sp_dist <= 0); |
| 90 __ movq(RDI, RSP); | 90 __ movq(RDI, RSP); |
| 91 __ subq(RDI, RBP); | 91 __ subq(RDI, RBP); |
| 92 __ cmpq(RDI, Immediate(fp_sp_dist)); | 92 __ cmpq(RDI, Immediate(fp_sp_dist)); |
| 93 __ j(EQUAL, &done, Assembler::kNearJump); | 93 __ j(EQUAL, &done, Assembler::kNearJump); |
| 94 __ int3(); | 94 __ int3(); |
| 95 __ Bind(&done); | 95 __ Bind(&done); |
| 96 } | 96 } |
| 97 #endif | 97 #endif |
| 98 __ LeaveFrame(); | 98 __ LeaveFrame(); |
| (...skipping 953 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1052 void NativeCallInstr::EmitNativeCode(FlowGraphCompiler* compiler) { | 1052 void NativeCallInstr::EmitNativeCode(FlowGraphCompiler* compiler) { |
| 1053 ASSERT(locs()->temp(0).reg() == RAX); | 1053 ASSERT(locs()->temp(0).reg() == RAX); |
| 1054 ASSERT(locs()->temp(1).reg() == RBX); | 1054 ASSERT(locs()->temp(1).reg() == RBX); |
| 1055 ASSERT(locs()->temp(2).reg() == R10); | 1055 ASSERT(locs()->temp(2).reg() == R10); |
| 1056 Register result = locs()->out().reg(); | 1056 Register result = locs()->out().reg(); |
| 1057 | 1057 |
| 1058 // Push the result place holder initialized to NULL. | 1058 // Push the result place holder initialized to NULL. |
| 1059 __ PushObject(Object::ZoneHandle()); | 1059 __ PushObject(Object::ZoneHandle()); |
| 1060 // Pass a pointer to the first argument in RAX. | 1060 // Pass a pointer to the first argument in RAX. |
| 1061 if (!function().HasOptionalParameters()) { | 1061 if (!function().HasOptionalParameters()) { |
| 1062 __ leaq(RAX, Address(RBP, (kLastParamSlotIndex + | 1062 __ leaq(RAX, Address(RBP, (kParamEndSlotFromFp + |
| 1063 function().NumParameters() - 1) * kWordSize)); | 1063 function().NumParameters()) * kWordSize)); |
| 1064 } else { | 1064 } else { |
| 1065 __ leaq(RAX, | 1065 __ leaq(RAX, |
| 1066 Address(RBP, kFirstLocalSlotIndex * kWordSize)); | 1066 Address(RBP, kFirstLocalSlotFromFp * kWordSize)); |
| 1067 } | 1067 } |
| 1068 __ movq(RBX, Immediate(reinterpret_cast<uword>(native_c_function()))); | 1068 __ movq(RBX, Immediate(reinterpret_cast<uword>(native_c_function()))); |
| 1069 __ movq(R10, Immediate(NativeArguments::ComputeArgcTag(function()))); | 1069 __ movq(R10, Immediate(NativeArguments::ComputeArgcTag(function()))); |
| 1070 compiler->GenerateCall(token_pos(), | 1070 compiler->GenerateCall(token_pos(), |
| 1071 &StubCode::CallNativeCFunctionLabel(), | 1071 &StubCode::CallNativeCFunctionLabel(), |
| 1072 PcDescriptors::kOther, | 1072 PcDescriptors::kOther, |
| 1073 locs()); | 1073 locs()); |
| 1074 __ popq(result); | 1074 __ popq(result); |
| 1075 } | 1075 } |
| 1076 | 1076 |
| (...skipping 968 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2045 LocationSummary::kNoCall); | 2045 LocationSummary::kNoCall); |
| 2046 } | 2046 } |
| 2047 | 2047 |
| 2048 | 2048 |
| 2049 // Restore stack and initialize the two exception variables: | 2049 // Restore stack and initialize the two exception variables: |
| 2050 // exception and stack trace variables. | 2050 // exception and stack trace variables. |
| 2051 void CatchEntryInstr::EmitNativeCode(FlowGraphCompiler* compiler) { | 2051 void CatchEntryInstr::EmitNativeCode(FlowGraphCompiler* compiler) { |
| 2052 // Restore RSP from RBP as we are coming from a throw and the code for | 2052 // Restore RSP from RBP as we are coming from a throw and the code for |
| 2053 // popping arguments has not been run. | 2053 // popping arguments has not been run. |
| 2054 const intptr_t fp_sp_dist = | 2054 const intptr_t fp_sp_dist = |
| 2055 (kFirstLocalSlotIndex + 1 - compiler->StackSize()) * kWordSize; | 2055 (kFirstLocalSlotFromFp + 1 - compiler->StackSize()) * kWordSize; |
| 2056 ASSERT(fp_sp_dist <= 0); | 2056 ASSERT(fp_sp_dist <= 0); |
| 2057 __ leaq(RSP, Address(RBP, fp_sp_dist)); | 2057 __ leaq(RSP, Address(RBP, fp_sp_dist)); |
| 2058 | 2058 |
| 2059 ASSERT(!exception_var().is_captured()); | 2059 ASSERT(!exception_var().is_captured()); |
| 2060 ASSERT(!stacktrace_var().is_captured()); | 2060 ASSERT(!stacktrace_var().is_captured()); |
| 2061 __ movq(Address(RBP, exception_var().index() * kWordSize), | 2061 __ movq(Address(RBP, exception_var().index() * kWordSize), |
| 2062 kExceptionObjectReg); | 2062 kExceptionObjectReg); |
| 2063 __ movq(Address(RBP, stacktrace_var().index() * kWordSize), | 2063 __ movq(Address(RBP, stacktrace_var().index() * kWordSize), |
| 2064 kStackTraceObjectReg); | 2064 kStackTraceObjectReg); |
| 2065 } | 2065 } |
| (...skipping 1983 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4049 PcDescriptors::kOther, | 4049 PcDescriptors::kOther, |
| 4050 locs()); | 4050 locs()); |
| 4051 __ Drop(2); // Discard type arguments and receiver. | 4051 __ Drop(2); // Discard type arguments and receiver. |
| 4052 } | 4052 } |
| 4053 | 4053 |
| 4054 } // namespace dart | 4054 } // namespace dart |
| 4055 | 4055 |
| 4056 #undef __ | 4056 #undef __ |
| 4057 | 4057 |
| 4058 #endif // defined TARGET_ARCH_X64 | 4058 #endif // defined TARGET_ARCH_X64 |
| OLD | NEW |