| 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" // 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 945 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 956 break; | 956 break; |
| 957 } | 957 } |
| 958 | 958 |
| 959 default: | 959 default: |
| 960 UNREACHABLE(); | 960 UNREACHABLE(); |
| 961 break; | 961 break; |
| 962 } | 962 } |
| 963 } | 963 } |
| 964 | 964 |
| 965 | 965 |
| 966 LocationSummary* InstanceSetterComp::MakeLocationSummary() const { | |
| 967 return MakeCallSummary(); | |
| 968 } | |
| 969 | |
| 970 | |
| 971 void InstanceSetterComp::EmitNativeCode(FlowGraphCompiler* compiler) { | |
| 972 Label* deopt = NULL; | |
| 973 if (compiler->is_optimizing()) { | |
| 974 deopt = compiler->AddDeoptStub(cid(), | |
| 975 token_pos(), | |
| 976 try_index(), | |
| 977 kDeoptInstanceSetter); | |
| 978 } | |
| 979 if (HasICData() && (ic_data()->NumberOfChecks() > 0)) { | |
| 980 // No index-setter on Smi's. | |
| 981 ASSERT(ic_data()->GetReceiverClassIdAt(0) != kSmi); | |
| 982 // Load receiver into RAX. | |
| 983 const intptr_t kNumArguments = 2; | |
| 984 __ movq(RAX, Address(RSP, (kNumArguments - 1) * kWordSize)); | |
| 985 __ testq(RAX, Immediate(kSmiTagMask)); | |
| 986 __ j(ZERO, deopt); | |
| 987 __ LoadClassId(RDI, RAX); | |
| 988 compiler->EmitTestAndCall(*ic_data(), | |
| 989 RDI, // Class id register. | |
| 990 kNumArguments, | |
| 991 Array::Handle(), // No named arguments. | |
| 992 deopt, // Deoptimize target. | |
| 993 NULL, // Fallthrough when done. | |
| 994 cid(), | |
| 995 token_pos(), | |
| 996 try_index()); | |
| 997 | |
| 998 } else if (compiler->is_optimizing()) { | |
| 999 // Get some IC data then optimize again. | |
| 1000 __ jmp(deopt); | |
| 1001 } else { | |
| 1002 // Unoptimized code. | |
| 1003 const String& function_name = | |
| 1004 String::ZoneHandle(Field::SetterSymbol(field_name())); | |
| 1005 | |
| 1006 compiler->AddCurrentDescriptor(PcDescriptors::kDeopt, | |
| 1007 cid(), | |
| 1008 token_pos(), | |
| 1009 try_index()); | |
| 1010 const intptr_t kArgumentCount = 2; | |
| 1011 const intptr_t kCheckedArgumentCount = 1; | |
| 1012 compiler->GenerateInstanceCall(cid(), | |
| 1013 token_pos(), | |
| 1014 try_index(), | |
| 1015 function_name, | |
| 1016 kArgumentCount, | |
| 1017 Array::ZoneHandle(), | |
| 1018 kCheckedArgumentCount); | |
| 1019 } | |
| 1020 } | |
| 1021 | |
| 1022 | |
| 1023 LocationSummary* LoadInstanceFieldComp::MakeLocationSummary() const { | 966 LocationSummary* LoadInstanceFieldComp::MakeLocationSummary() const { |
| 1024 // TODO(fschneider): For this instruction the input register may be | 967 // TODO(fschneider): For this instruction the input register may be |
| 1025 // reused for the result (but is not required to) because the input | 968 // reused for the result (but is not required to) because the input |
| 1026 // is not used after the result is defined. We should consider adding | 969 // is not used after the result is defined. We should consider adding |
| 1027 // this information to the input policy. | 970 // this information to the input policy. |
| 1028 return LocationSummary::Make(1, | 971 return LocationSummary::Make(1, |
| 1029 Location::RequiresRegister(), | 972 Location::RequiresRegister(), |
| 1030 LocationSummary::kNoCall); | 973 LocationSummary::kNoCall); |
| 1031 } | 974 } |
| 1032 | 975 |
| (...skipping 1141 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2174 ASSERT(locs()->out().reg() == RAX); | 2117 ASSERT(locs()->out().reg() == RAX); |
| 2175 __ CompareObject(locs()->out().reg(), compiler->bool_true()); | 2118 __ CompareObject(locs()->out().reg(), compiler->bool_true()); |
| 2176 EmitBranchOnCondition(compiler, branch_condition); | 2119 EmitBranchOnCondition(compiler, branch_condition); |
| 2177 } | 2120 } |
| 2178 | 2121 |
| 2179 } // namespace dart | 2122 } // namespace dart |
| 2180 | 2123 |
| 2181 #undef __ | 2124 #undef __ |
| 2182 | 2125 |
| 2183 #endif // defined TARGET_ARCH_X64 | 2126 #endif // defined TARGET_ARCH_X64 |
| OLD | NEW |