| 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 195 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 206 locs->set_in(0, Location::RegisterLocation(RAX)); | 206 locs->set_in(0, Location::RegisterLocation(RAX)); |
| 207 locs->set_out(Location::RegisterLocation(RAX)); | 207 locs->set_out(Location::RegisterLocation(RAX)); |
| 208 return locs; | 208 return locs; |
| 209 } | 209 } |
| 210 | 210 |
| 211 | 211 |
| 212 void AssertBooleanComp::EmitNativeCode(FlowGraphCompiler* compiler) { | 212 void AssertBooleanComp::EmitNativeCode(FlowGraphCompiler* compiler) { |
| 213 Register obj = locs()->in(0).reg(); | 213 Register obj = locs()->in(0).reg(); |
| 214 Register result = locs()->out().reg(); | 214 Register result = locs()->out().reg(); |
| 215 | 215 |
| 216 // Check that the type of the value is allowed in conditional context. | 216 if (!IsEliminated()) { |
| 217 // Call the runtime if the object is not bool::true or bool::false. | 217 // Check that the type of the value is allowed in conditional context. |
| 218 Label done; | 218 // Call the runtime if the object is not bool::true or bool::false. |
| 219 __ CompareObject(obj, compiler->bool_true()); | 219 Label done; |
| 220 __ j(EQUAL, &done, Assembler::kNearJump); | 220 __ CompareObject(obj, compiler->bool_true()); |
| 221 __ CompareObject(obj, compiler->bool_false()); | 221 __ j(EQUAL, &done, Assembler::kNearJump); |
| 222 __ j(EQUAL, &done, Assembler::kNearJump); | 222 __ CompareObject(obj, compiler->bool_false()); |
| 223 __ j(EQUAL, &done, Assembler::kNearJump); |
| 223 | 224 |
| 224 __ pushq(obj); // Push the source object. | 225 __ pushq(obj); // Push the source object. |
| 225 compiler->GenerateCallRuntime(deopt_id(), | 226 compiler->GenerateCallRuntime(deopt_id(), |
| 226 token_pos(), | 227 token_pos(), |
| 227 try_index(), | 228 try_index(), |
| 228 kConditionTypeErrorRuntimeEntry); | 229 kConditionTypeErrorRuntimeEntry); |
| 229 // We should never return here. | 230 // We should never return here. |
| 230 __ int3(); | 231 __ int3(); |
| 231 | 232 |
| 232 __ Bind(&done); | 233 __ Bind(&done); |
| 234 } |
| 233 ASSERT(obj == result); | 235 ASSERT(obj == result); |
| 234 } | 236 } |
| 235 | 237 |
| 236 | 238 |
| 237 static Condition TokenKindToSmiCondition(Token::Kind kind) { | 239 static Condition TokenKindToSmiCondition(Token::Kind kind) { |
| 238 switch (kind) { | 240 switch (kind) { |
| 239 case Token::kEQ: return EQUAL; | 241 case Token::kEQ: return EQUAL; |
| 240 case Token::kNE: return NOT_EQUAL; | 242 case Token::kNE: return NOT_EQUAL; |
| 241 case Token::kLT: return LESS; | 243 case Token::kLT: return LESS; |
| 242 case Token::kGT: return GREATER; | 244 case Token::kGT: return GREATER; |
| (...skipping 1860 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2103 kNumArgsChecked); | 2105 kNumArgsChecked); |
| 2104 __ CompareObject(RAX, compiler->bool_true()); | 2106 __ CompareObject(RAX, compiler->bool_true()); |
| 2105 EmitBranchOnCondition(compiler, branch_condition); | 2107 EmitBranchOnCondition(compiler, branch_condition); |
| 2106 } | 2108 } |
| 2107 | 2109 |
| 2108 } // namespace dart | 2110 } // namespace dart |
| 2109 | 2111 |
| 2110 #undef __ | 2112 #undef __ |
| 2111 | 2113 |
| 2112 #endif // defined TARGET_ARCH_X64 | 2114 #endif // defined TARGET_ARCH_X64 |
| OLD | NEW |