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 2125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2136 try_index(), | 2136 try_index(), |
2137 function_name, | 2137 function_name, |
2138 kNumArguments, | 2138 kNumArguments, |
2139 Array::ZoneHandle(), // No optional arguments. | 2139 Array::ZoneHandle(), // No optional arguments. |
2140 kNumArgsChecked, | 2140 kNumArgsChecked, |
2141 locs()->stack_bitmap()); | 2141 locs()->stack_bitmap()); |
2142 __ CompareObject(RAX, compiler->bool_true()); | 2142 __ CompareObject(RAX, compiler->bool_true()); |
2143 EmitBranchOnCondition(compiler, branch_condition); | 2143 EmitBranchOnCondition(compiler, branch_condition); |
2144 } | 2144 } |
2145 | 2145 |
2146 | |
2147 LocationSummary* CheckClassComp::MakeLocationSummary() const { | |
2148 const intptr_t kNumInputs = 1; | |
2149 const intptr_t kNumTemps = 1; | |
2150 LocationSummary* summary = | |
2151 new LocationSummary(kNumInputs, kNumTemps, LocationSummary::kNoCall); | |
2152 summary->set_in(0, Location::RequiresRegister()); | |
2153 summary->set_temp(0, Location::RequiresRegister()); | |
2154 return summary; | |
2155 } | |
2156 | |
2157 | |
2158 void CheckClassComp::EmitNativeCode(FlowGraphCompiler* compiler) { | |
srdjan
2012/08/17 22:30:22
Maybe make this code more generic so that it can h
Florian Schneider
2012/08/20 12:09:37
CheckSmi would fit in here, but for CheckNonSmi we
| |
2159 Register value = locs()->in(0).reg(); | |
2160 Register temp = locs()->temp(0).reg(); | |
2161 Label* deopt = compiler->AddDeoptStub(deopt_id(), | |
2162 try_index(), | |
2163 kDeoptCheckClass, | |
2164 value); | |
2165 ASSERT(ic_data()->GetReceiverClassIdAt(0) != kSmiCid); | |
2166 __ testq(value, Immediate(kSmiTagMask)); | |
2167 __ j(ZERO, deopt); | |
2168 __ LoadClassId(temp, value); | |
2169 Label is_ok; | |
2170 const intptr_t num_checks = ic_data()->NumberOfChecks(); | |
2171 const bool use_near_jump = num_checks < 5; | |
2172 for (intptr_t i = 0; i < num_checks; i++) { | |
2173 __ cmpl(temp, Immediate(ic_data()->GetReceiverClassIdAt(i))); | |
2174 if (i == (num_checks - 1)) { | |
2175 __ j(NOT_EQUAL, deopt); | |
2176 } else { | |
2177 if (use_near_jump) { | |
2178 __ j(EQUAL, &is_ok, Assembler::kNearJump); | |
2179 } else { | |
2180 __ j(EQUAL, &is_ok); | |
2181 } | |
2182 } | |
2183 } | |
2184 __ Bind(&is_ok); | |
2185 } | |
2186 | |
2146 } // namespace dart | 2187 } // namespace dart |
2147 | 2188 |
2148 #undef __ | 2189 #undef __ |
2149 | 2190 |
2150 #endif // defined TARGET_ARCH_X64 | 2191 #endif // defined TARGET_ARCH_X64 |
OLD | NEW |