| 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/flow_graph_compiler.h" | 8 #include "vm/flow_graph_compiler.h" |
| 9 | 9 |
| 10 #include "lib/error.h" | 10 #include "lib/error.h" |
| (...skipping 223 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 234 __ j(EQUAL, is_instance_lbl); | 234 __ j(EQUAL, is_instance_lbl); |
| 235 } | 235 } |
| 236 // Bool interface can be implemented only by core class Bool. | 236 // Bool interface can be implemented only by core class Bool. |
| 237 // (see ClassFinalizer::ResolveInterfaces for list of restricted interfaces). | 237 // (see ClassFinalizer::ResolveInterfaces for list of restricted interfaces). |
| 238 if (type.IsBoolInterface()) { | 238 if (type.IsBoolInterface()) { |
| 239 __ cmpl(kClassIdReg, Immediate(kBoolCid)); | 239 __ cmpl(kClassIdReg, Immediate(kBoolCid)); |
| 240 __ j(EQUAL, is_instance_lbl); | 240 __ j(EQUAL, is_instance_lbl); |
| 241 __ jmp(is_not_instance_lbl); | 241 __ jmp(is_not_instance_lbl); |
| 242 return false; | 242 return false; |
| 243 } | 243 } |
| 244 if (type.IsFunctionInterface()) { | 244 if (type.IsFunctionType()) { |
| 245 // Check if instance is a closure. | 245 // Check if instance is a closure. |
| 246 const Immediate raw_null = | 246 const Immediate raw_null = |
| 247 Immediate(reinterpret_cast<intptr_t>(Object::null())); | 247 Immediate(reinterpret_cast<intptr_t>(Object::null())); |
| 248 __ LoadClassById(R13, kClassIdReg); | 248 __ LoadClassById(R13, kClassIdReg); |
| 249 __ movq(R13, FieldAddress(R13, Class::signature_function_offset())); | 249 __ movq(R13, FieldAddress(R13, Class::signature_function_offset())); |
| 250 __ cmpq(R13, raw_null); | 250 __ cmpq(R13, raw_null); |
| 251 __ j(NOT_EQUAL, is_instance_lbl); | 251 __ j(NOT_EQUAL, is_instance_lbl); |
| 252 __ jmp(is_not_instance_lbl); | 252 __ jmp(is_not_instance_lbl); |
| 253 return false; | 253 return false; |
| 254 } | 254 } |
| 255 // Custom checking for numbers (Smi, Mint, Bigint and Double). | 255 // Custom checking for numbers (Smi, Mint, Bigint and Double). |
| 256 // Note that instance is not Smi (checked above). | 256 // Note that instance is not Smi (checked above). |
| 257 if (type.IsSubtypeOf(Type::Handle(Type::NumberInterface()), NULL)) { | 257 if (type.IsSubtypeOf(Type::Handle(Type::Number()), NULL)) { |
| 258 GenerateNumberTypeCheck( | 258 GenerateNumberTypeCheck( |
| 259 kClassIdReg, type, is_instance_lbl, is_not_instance_lbl); | 259 kClassIdReg, type, is_instance_lbl, is_not_instance_lbl); |
| 260 return false; | 260 return false; |
| 261 } | 261 } |
| 262 if (type.IsStringInterface()) { | 262 if (type.IsStringInterface()) { |
| 263 GenerateStringTypeCheck(kClassIdReg, is_instance_lbl, is_not_instance_lbl); | 263 GenerateStringTypeCheck(kClassIdReg, is_instance_lbl, is_not_instance_lbl); |
| 264 return false; | 264 return false; |
| 265 } | 265 } |
| 266 // Otherwise fallthrough. | 266 // Otherwise fallthrough. |
| 267 return true; | 267 return true; |
| (...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 336 const Type& object_type = Type::ZoneHandle(Type::ObjectType()); | 336 const Type& object_type = Type::ZoneHandle(Type::ObjectType()); |
| 337 __ CompareObject(RDI, object_type); | 337 __ CompareObject(RDI, object_type); |
| 338 __ j(EQUAL, is_instance_lbl); | 338 __ j(EQUAL, is_instance_lbl); |
| 339 | 339 |
| 340 // For Smi check quickly against int and num interfaces. | 340 // For Smi check quickly against int and num interfaces. |
| 341 Label not_smi; | 341 Label not_smi; |
| 342 __ testq(RAX, Immediate(kSmiTagMask)); // Value is Smi? | 342 __ testq(RAX, Immediate(kSmiTagMask)); // Value is Smi? |
| 343 __ j(NOT_ZERO, ¬_smi, Assembler::kNearJump); | 343 __ j(NOT_ZERO, ¬_smi, Assembler::kNearJump); |
| 344 __ CompareObject(RDI, Type::ZoneHandle(Type::IntInterface())); | 344 __ CompareObject(RDI, Type::ZoneHandle(Type::IntInterface())); |
| 345 __ j(EQUAL, is_instance_lbl); | 345 __ j(EQUAL, is_instance_lbl); |
| 346 __ CompareObject(RDI, Type::ZoneHandle(Type::NumberInterface())); | 346 __ CompareObject(RDI, Type::ZoneHandle(Type::Number())); |
| 347 __ j(EQUAL, is_instance_lbl); | 347 __ j(EQUAL, is_instance_lbl); |
| 348 // Smi must be handled in runtime. | 348 // Smi must be handled in runtime. |
| 349 __ jmp(&fall_through); | 349 __ jmp(&fall_through); |
| 350 | 350 |
| 351 __ Bind(¬_smi); | 351 __ Bind(¬_smi); |
| 352 // RDX: instantiator type arguments. | 352 // RDX: instantiator type arguments. |
| 353 // RAX: instance. | 353 // RAX: instance. |
| 354 const Register kInstanceReg = RAX; | 354 const Register kInstanceReg = RAX; |
| 355 const Register kTypeArgumentsReg = RDX; | 355 const Register kTypeArgumentsReg = RDX; |
| 356 const Register kTempReg = R10; | 356 const Register kTempReg = R10; |
| (...skipping 863 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1220 void ParallelMoveResolver::Exchange(const Address& mem1, const Address& mem2) { | 1220 void ParallelMoveResolver::Exchange(const Address& mem1, const Address& mem2) { |
| 1221 __ Exchange(mem1, mem2); | 1221 __ Exchange(mem1, mem2); |
| 1222 } | 1222 } |
| 1223 | 1223 |
| 1224 | 1224 |
| 1225 #undef __ | 1225 #undef __ |
| 1226 | 1226 |
| 1227 } // namespace dart | 1227 } // namespace dart |
| 1228 | 1228 |
| 1229 #endif // defined TARGET_ARCH_X64 | 1229 #endif // defined TARGET_ARCH_X64 |
| OLD | NEW |