| 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_ARM. | 5 #include "vm/globals.h" // Needed here to get TARGET_ARCH_ARM. |
| 6 #if defined(TARGET_ARCH_ARM) | 6 #if defined(TARGET_ARCH_ARM) |
| 7 | 7 |
| 8 #include "vm/intermediate_language.h" | 8 #include "vm/intermediate_language.h" |
| 9 | 9 |
| 10 #include "vm/compiler.h" | 10 #include "vm/compiler.h" |
| (...skipping 6051 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6062 } | 6062 } |
| 6063 } else { | 6063 } else { |
| 6064 const Register length = length_loc.reg(); | 6064 const Register length = length_loc.reg(); |
| 6065 const Register index = index_loc.reg(); | 6065 const Register index = index_loc.reg(); |
| 6066 __ cmp(index, Operand(length)); | 6066 __ cmp(index, Operand(length)); |
| 6067 __ b(deopt, CS); | 6067 __ b(deopt, CS); |
| 6068 } | 6068 } |
| 6069 } | 6069 } |
| 6070 | 6070 |
| 6071 | 6071 |
| 6072 static void EmitJavascriptIntOverflowCheck(FlowGraphCompiler* compiler, | |
| 6073 Label* overflow, | |
| 6074 Register result_lo, | |
| 6075 Register result_hi) { | |
| 6076 // Compare upper half. | |
| 6077 Label check_lower; | |
| 6078 __ CompareImmediate(result_hi, 0x00200000); | |
| 6079 __ b(overflow, GT); | |
| 6080 __ b(&check_lower, NE); | |
| 6081 | |
| 6082 __ CompareImmediate(result_lo, 0); | |
| 6083 __ b(overflow, HI); | |
| 6084 | |
| 6085 __ Bind(&check_lower); | |
| 6086 __ CompareImmediate(result_hi, -0x00200000); | |
| 6087 __ b(overflow, LT); | |
| 6088 // Anything in the lower part would make the number bigger than the lower | |
| 6089 // bound, so we are done. | |
| 6090 } | |
| 6091 | |
| 6092 | |
| 6093 LocationSummary* BinaryMintOpInstr::MakeLocationSummary(Zone* zone, | 6072 LocationSummary* BinaryMintOpInstr::MakeLocationSummary(Zone* zone, |
| 6094 bool opt) const { | 6073 bool opt) const { |
| 6095 const intptr_t kNumInputs = 2; | 6074 const intptr_t kNumInputs = 2; |
| 6096 const intptr_t kNumTemps = 0; | 6075 const intptr_t kNumTemps = 0; |
| 6097 LocationSummary* summary = new(zone) LocationSummary( | 6076 LocationSummary* summary = new(zone) LocationSummary( |
| 6098 zone, kNumInputs, kNumTemps, LocationSummary::kNoCall); | 6077 zone, kNumInputs, kNumTemps, LocationSummary::kNoCall); |
| 6099 summary->set_in(0, Location::Pair(Location::RequiresRegister(), | 6078 summary->set_in(0, Location::Pair(Location::RequiresRegister(), |
| 6100 Location::RequiresRegister())); | 6079 Location::RequiresRegister())); |
| 6101 summary->set_in(1, Location::Pair(Location::RequiresRegister(), | 6080 summary->set_in(1, Location::Pair(Location::RequiresRegister(), |
| 6102 Location::RequiresRegister())); | 6081 Location::RequiresRegister())); |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6160 // TODO(regis): Range analysis may eliminate the deopt check. | 6139 // TODO(regis): Range analysis may eliminate the deopt check. |
| 6161 __ cmp(left_hi, Operand(left_lo, ASR, 31)); | 6140 __ cmp(left_hi, Operand(left_lo, ASR, 31)); |
| 6162 __ cmp(right_hi, Operand(right_lo, ASR, 31), EQ); | 6141 __ cmp(right_hi, Operand(right_lo, ASR, 31), EQ); |
| 6163 __ b(deopt, NE); | 6142 __ b(deopt, NE); |
| 6164 __ smull(out_lo, out_hi, left_lo, right_lo); | 6143 __ smull(out_lo, out_hi, left_lo, right_lo); |
| 6165 break; | 6144 break; |
| 6166 } | 6145 } |
| 6167 default: | 6146 default: |
| 6168 UNREACHABLE(); | 6147 UNREACHABLE(); |
| 6169 } | 6148 } |
| 6170 if (FLAG_throw_on_javascript_int_overflow) { | |
| 6171 EmitJavascriptIntOverflowCheck(compiler, deopt, out_lo, out_hi); | |
| 6172 } | |
| 6173 } | 6149 } |
| 6174 | 6150 |
| 6175 | 6151 |
| 6176 LocationSummary* ShiftMintOpInstr::MakeLocationSummary(Zone* zone, | 6152 LocationSummary* ShiftMintOpInstr::MakeLocationSummary(Zone* zone, |
| 6177 bool opt) const { | 6153 bool opt) const { |
| 6178 const intptr_t kNumInputs = 2; | 6154 const intptr_t kNumInputs = 2; |
| 6179 const intptr_t kNumTemps = 0; | 6155 const intptr_t kNumTemps = 0; |
| 6180 LocationSummary* summary = new(zone) LocationSummary( | 6156 LocationSummary* summary = new(zone) LocationSummary( |
| 6181 zone, kNumInputs, kNumTemps, LocationSummary::kNoCall); | 6157 zone, kNumInputs, kNumTemps, LocationSummary::kNoCall); |
| 6182 summary->set_in(0, Location::Pair(Location::RequiresRegister(), | 6158 summary->set_in(0, Location::Pair(Location::RequiresRegister(), |
| (...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6308 __ cmp(left_hi, Operand(out_hi, ASR, shift), EQ); | 6284 __ cmp(left_hi, Operand(out_hi, ASR, shift), EQ); |
| 6309 // Overflow if they aren't equal. | 6285 // Overflow if they aren't equal. |
| 6310 __ b(deopt, NE); | 6286 __ b(deopt, NE); |
| 6311 } | 6287 } |
| 6312 break; | 6288 break; |
| 6313 } | 6289 } |
| 6314 default: | 6290 default: |
| 6315 UNREACHABLE(); | 6291 UNREACHABLE(); |
| 6316 } | 6292 } |
| 6317 } | 6293 } |
| 6318 | |
| 6319 if (FLAG_throw_on_javascript_int_overflow) { | |
| 6320 EmitJavascriptIntOverflowCheck(compiler, deopt, out_lo, out_hi); | |
| 6321 } | |
| 6322 } | 6294 } |
| 6323 | 6295 |
| 6324 | 6296 |
| 6325 LocationSummary* UnaryMintOpInstr::MakeLocationSummary(Zone* zone, | 6297 LocationSummary* UnaryMintOpInstr::MakeLocationSummary(Zone* zone, |
| 6326 bool opt) const { | 6298 bool opt) const { |
| 6327 const intptr_t kNumInputs = 1; | 6299 const intptr_t kNumInputs = 1; |
| 6328 const intptr_t kNumTemps = 0; | 6300 const intptr_t kNumTemps = 0; |
| 6329 LocationSummary* summary = new(zone) LocationSummary( | 6301 LocationSummary* summary = new(zone) LocationSummary( |
| 6330 zone, kNumInputs, kNumTemps, LocationSummary::kNoCall); | 6302 zone, kNumInputs, kNumTemps, LocationSummary::kNoCall); |
| 6331 summary->set_in(0, Location::Pair(Location::RequiresRegister(), | 6303 summary->set_in(0, Location::Pair(Location::RequiresRegister(), |
| 6332 Location::RequiresRegister())); | 6304 Location::RequiresRegister())); |
| 6333 summary->set_out(0, Location::Pair(Location::RequiresRegister(), | 6305 summary->set_out(0, Location::Pair(Location::RequiresRegister(), |
| 6334 Location::RequiresRegister())); | 6306 Location::RequiresRegister())); |
| 6335 return summary; | 6307 return summary; |
| 6336 } | 6308 } |
| 6337 | 6309 |
| 6338 | 6310 |
| 6339 void UnaryMintOpInstr::EmitNativeCode(FlowGraphCompiler* compiler) { | 6311 void UnaryMintOpInstr::EmitNativeCode(FlowGraphCompiler* compiler) { |
| 6340 ASSERT(op_kind() == Token::kBIT_NOT); | 6312 ASSERT(op_kind() == Token::kBIT_NOT); |
| 6341 PairLocation* left_pair = locs()->in(0).AsPairLocation(); | 6313 PairLocation* left_pair = locs()->in(0).AsPairLocation(); |
| 6342 Register left_lo = left_pair->At(0).reg(); | 6314 Register left_lo = left_pair->At(0).reg(); |
| 6343 Register left_hi = left_pair->At(1).reg(); | 6315 Register left_hi = left_pair->At(1).reg(); |
| 6344 | 6316 |
| 6345 PairLocation* out_pair = locs()->out(0).AsPairLocation(); | 6317 PairLocation* out_pair = locs()->out(0).AsPairLocation(); |
| 6346 Register out_lo = out_pair->At(0).reg(); | 6318 Register out_lo = out_pair->At(0).reg(); |
| 6347 Register out_hi = out_pair->At(1).reg(); | 6319 Register out_hi = out_pair->At(1).reg(); |
| 6348 | |
| 6349 Label* deopt = NULL; | |
| 6350 | |
| 6351 if (FLAG_throw_on_javascript_int_overflow) { | |
| 6352 deopt = compiler->AddDeoptStub(deopt_id(), ICData::kDeoptUnaryMintOp); | |
| 6353 } | |
| 6354 __ mvn(out_lo, Operand(left_lo)); | 6320 __ mvn(out_lo, Operand(left_lo)); |
| 6355 __ mvn(out_hi, Operand(left_hi)); | 6321 __ mvn(out_hi, Operand(left_hi)); |
| 6356 if (FLAG_throw_on_javascript_int_overflow) { | |
| 6357 EmitJavascriptIntOverflowCheck(compiler, deopt, out_lo, out_hi); | |
| 6358 } | |
| 6359 } | 6322 } |
| 6360 | 6323 |
| 6361 | 6324 |
| 6362 CompileType BinaryUint32OpInstr::ComputeType() const { | 6325 CompileType BinaryUint32OpInstr::ComputeType() const { |
| 6363 return CompileType::Int(); | 6326 return CompileType::Int(); |
| 6364 } | 6327 } |
| 6365 | 6328 |
| 6366 | 6329 |
| 6367 CompileType ShiftUint32OpInstr::ComputeType() const { | 6330 CompileType ShiftUint32OpInstr::ComputeType() const { |
| 6368 return CompileType::Int(); | 6331 return CompileType::Int(); |
| (...skipping 492 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6861 1, | 6824 1, |
| 6862 locs()); | 6825 locs()); |
| 6863 __ Drop(1); | 6826 __ Drop(1); |
| 6864 __ Pop(result); | 6827 __ Pop(result); |
| 6865 } | 6828 } |
| 6866 | 6829 |
| 6867 | 6830 |
| 6868 } // namespace dart | 6831 } // namespace dart |
| 6869 | 6832 |
| 6870 #endif // defined TARGET_ARCH_ARM | 6833 #endif // defined TARGET_ARCH_ARM |
| OLD | NEW |