| 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_IA32. | 5 #include "vm/globals.h" // Needed here to get TARGET_ARCH_IA32. |
| 6 #if defined(TARGET_ARCH_IA32) | 6 #if defined(TARGET_ARCH_IA32) |
| 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 931 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 942 break; | 942 break; |
| 943 } | 943 } |
| 944 | 944 |
| 945 default: | 945 default: |
| 946 UNREACHABLE(); | 946 UNREACHABLE(); |
| 947 break; | 947 break; |
| 948 } | 948 } |
| 949 } | 949 } |
| 950 | 950 |
| 951 | 951 |
| 952 LocationSummary* InstanceSetterComp::MakeLocationSummary() const { | |
| 953 return MakeCallSummary(); | |
| 954 } | |
| 955 | |
| 956 | |
| 957 void InstanceSetterComp::EmitNativeCode(FlowGraphCompiler* compiler) { | |
| 958 Label* deopt = NULL; | |
| 959 if (compiler->is_optimizing()) { | |
| 960 deopt = compiler->AddDeoptStub(cid(), | |
| 961 token_pos(), | |
| 962 try_index(), | |
| 963 kDeoptInstanceSetter); | |
| 964 } | |
| 965 if (HasICData() && (ic_data()->NumberOfChecks() > 0)) { | |
| 966 // No index-setter on Smi's. | |
| 967 ASSERT(ic_data()->GetReceiverClassIdAt(0) != kSmi); | |
| 968 // Load receiver into EAX. | |
| 969 const intptr_t kNumArguments = 2; | |
| 970 __ movl(EAX, Address(ESP, (kNumArguments - 1) * kWordSize)); | |
| 971 __ testl(EAX, Immediate(kSmiTagMask)); | |
| 972 __ j(ZERO, deopt); | |
| 973 __ LoadClassId(EDI, EAX); | |
| 974 compiler->EmitTestAndCall(*ic_data(), | |
| 975 EDI, // Class id register. | |
| 976 kNumArguments, | |
| 977 Array::Handle(), // No named arguments. | |
| 978 deopt, // Deoptimize target. | |
| 979 NULL, // Fallthrough when done. | |
| 980 cid(), | |
| 981 token_pos(), | |
| 982 try_index()); | |
| 983 | |
| 984 } else if (compiler->is_optimizing()) { | |
| 985 // Get some IC data then optimize again. | |
| 986 __ jmp(deopt); | |
| 987 } else { | |
| 988 // Unoptimized code. | |
| 989 const String& function_name = | |
| 990 String::ZoneHandle(Field::SetterSymbol(field_name())); | |
| 991 | |
| 992 compiler->AddCurrentDescriptor(PcDescriptors::kDeopt, | |
| 993 cid(), | |
| 994 token_pos(), | |
| 995 try_index()); | |
| 996 const intptr_t kArgumentCount = 2; | |
| 997 const intptr_t kCheckedArgumentCount = 1; | |
| 998 compiler->GenerateInstanceCall(cid(), | |
| 999 token_pos(), | |
| 1000 try_index(), | |
| 1001 function_name, | |
| 1002 kArgumentCount, | |
| 1003 Array::ZoneHandle(), | |
| 1004 kCheckedArgumentCount); | |
| 1005 } | |
| 1006 } | |
| 1007 | |
| 1008 | |
| 1009 LocationSummary* LoadInstanceFieldComp::MakeLocationSummary() const { | 952 LocationSummary* LoadInstanceFieldComp::MakeLocationSummary() const { |
| 1010 // TODO(fschneider): For this instruction the input register may be | 953 // TODO(fschneider): For this instruction the input register may be |
| 1011 // reused for the result (but is not required to) because the input | 954 // reused for the result (but is not required to) because the input |
| 1012 // is not used after the result is defined. We should consider adding | 955 // is not used after the result is defined. We should consider adding |
| 1013 // this information to the input policy. | 956 // this information to the input policy. |
| 1014 return LocationSummary::Make(1, | 957 return LocationSummary::Make(1, |
| 1015 Location::RequiresRegister(), | 958 Location::RequiresRegister(), |
| 1016 LocationSummary::kNoCall); | 959 LocationSummary::kNoCall); |
| 1017 } | 960 } |
| 1018 | 961 |
| (...skipping 1148 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2167 ASSERT(locs()->out().reg() == EAX); | 2110 ASSERT(locs()->out().reg() == EAX); |
| 2168 __ CompareObject(locs()->out().reg(), compiler->bool_true()); | 2111 __ CompareObject(locs()->out().reg(), compiler->bool_true()); |
| 2169 EmitBranchOnCondition(compiler, branch_condition); | 2112 EmitBranchOnCondition(compiler, branch_condition); |
| 2170 } | 2113 } |
| 2171 | 2114 |
| 2172 } // namespace dart | 2115 } // namespace dart |
| 2173 | 2116 |
| 2174 #undef __ | 2117 #undef __ |
| 2175 | 2118 |
| 2176 #endif // defined TARGET_ARCH_X64 | 2119 #endif // defined TARGET_ARCH_X64 |
| OLD | NEW |