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 2112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2123 try_index(), | 2123 try_index(), |
2124 function_name, | 2124 function_name, |
2125 kNumArguments, | 2125 kNumArguments, |
2126 Array::ZoneHandle(), // No optional arguments. | 2126 Array::ZoneHandle(), // No optional arguments. |
2127 kNumArgsChecked, | 2127 kNumArgsChecked, |
2128 locs()->stack_bitmap()); | 2128 locs()->stack_bitmap()); |
2129 __ CompareObject(EAX, compiler->bool_true()); | 2129 __ CompareObject(EAX, compiler->bool_true()); |
2130 EmitBranchOnCondition(compiler, branch_condition); | 2130 EmitBranchOnCondition(compiler, branch_condition); |
2131 } | 2131 } |
2132 | 2132 |
| 2133 |
| 2134 LocationSummary* CheckClassComp::MakeLocationSummary() const { |
| 2135 const intptr_t kNumInputs = 1; |
| 2136 const intptr_t kNumTemps = 1; |
| 2137 LocationSummary* summary = |
| 2138 new LocationSummary(kNumInputs, kNumTemps, LocationSummary::kNoCall); |
| 2139 summary->set_in(0, Location::RequiresRegister()); |
| 2140 summary->set_temp(0, Location::RequiresRegister()); |
| 2141 return summary; |
| 2142 } |
| 2143 |
| 2144 |
| 2145 void CheckClassComp::EmitNativeCode(FlowGraphCompiler* compiler) { |
| 2146 Register value = locs()->in(0).reg(); |
| 2147 Register temp = locs()->temp(0).reg(); |
| 2148 Label* deopt = compiler->AddDeoptStub(deopt_id(), |
| 2149 try_index(), |
| 2150 kDeoptCheckClass, |
| 2151 value); |
| 2152 ASSERT(ic_data()->GetReceiverClassIdAt(0) != kSmiCid); |
| 2153 __ testl(value, Immediate(kSmiTagMask)); |
| 2154 __ j(ZERO, deopt); |
| 2155 __ LoadClassId(temp, value); |
| 2156 Label is_ok; |
| 2157 const intptr_t num_checks = ic_data()->NumberOfChecks(); |
| 2158 const bool use_near_jump = num_checks < 5; |
| 2159 for (intptr_t i = 0; i < num_checks; i++) { |
| 2160 __ cmpl(temp, Immediate(ic_data()->GetReceiverClassIdAt(i))); |
| 2161 if (i == (num_checks - 1)) { |
| 2162 __ j(NOT_EQUAL, deopt); |
| 2163 } else { |
| 2164 if (use_near_jump) { |
| 2165 __ j(EQUAL, &is_ok, Assembler::kNearJump); |
| 2166 } else { |
| 2167 __ j(EQUAL, &is_ok); |
| 2168 } |
| 2169 } |
| 2170 } |
| 2171 __ Bind(&is_ok); |
| 2172 } |
| 2173 |
2133 } // namespace dart | 2174 } // namespace dart |
2134 | 2175 |
2135 #undef __ | 2176 #undef __ |
2136 | 2177 |
2137 #endif // defined TARGET_ARCH_X64 | 2178 #endif // defined TARGET_ARCH_X64 |
OLD | NEW |