| 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_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 "vm/ast_printer.h" | 10 #include "vm/ast_printer.h" |
| (...skipping 356 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 367 // interfaces. | 367 // interfaces. |
| 368 // Bool interface can be implemented only by core class Bool. | 368 // Bool interface can be implemented only by core class Bool. |
| 369 if (type.IsBoolType()) { | 369 if (type.IsBoolType()) { |
| 370 __ cmpl(kClassIdReg, Immediate(kBoolCid)); | 370 __ cmpl(kClassIdReg, Immediate(kBoolCid)); |
| 371 __ j(EQUAL, is_instance_lbl); | 371 __ j(EQUAL, is_instance_lbl); |
| 372 __ jmp(is_not_instance_lbl); | 372 __ jmp(is_not_instance_lbl); |
| 373 return false; | 373 return false; |
| 374 } | 374 } |
| 375 if (type.IsFunctionType()) { | 375 if (type.IsFunctionType()) { |
| 376 // Check if instance is a closure. | 376 // Check if instance is a closure. |
| 377 __ LoadClassById(R13, kClassIdReg); | 377 __ LoadClassById(R13, kClassIdReg, PP); |
| 378 __ movq(R13, FieldAddress(R13, Class::signature_function_offset())); | 378 __ movq(R13, FieldAddress(R13, Class::signature_function_offset())); |
| 379 __ CompareObject(R13, Object::null_object(), PP); | 379 __ CompareObject(R13, Object::null_object(), PP); |
| 380 __ j(NOT_EQUAL, is_instance_lbl); | 380 __ j(NOT_EQUAL, is_instance_lbl); |
| 381 } | 381 } |
| 382 // Custom checking for numbers (Smi, Mint, Bigint and Double). | 382 // Custom checking for numbers (Smi, Mint, Bigint and Double). |
| 383 // Note that instance is not Smi (checked above). | 383 // Note that instance is not Smi (checked above). |
| 384 if (type.IsSubtypeOf(Type::Handle(Type::Number()), NULL)) { | 384 if (type.IsSubtypeOf(Type::Handle(Type::Number()), NULL)) { |
| 385 GenerateNumberTypeCheck( | 385 GenerateNumberTypeCheck( |
| 386 kClassIdReg, type, is_instance_lbl, is_not_instance_lbl); | 386 kClassIdReg, type, is_instance_lbl, is_not_instance_lbl); |
| 387 return false; | 387 return false; |
| (...skipping 14 matching lines...) Expand all Loading... |
| 402 // TODO(srdjan): Implement a quicker subtype check, as type test | 402 // TODO(srdjan): Implement a quicker subtype check, as type test |
| 403 // arrays can grow too high, but they may be useful when optimizing | 403 // arrays can grow too high, but they may be useful when optimizing |
| 404 // code (type-feedback). | 404 // code (type-feedback). |
| 405 RawSubtypeTestCache* FlowGraphCompiler::GenerateSubtype1TestCacheLookup( | 405 RawSubtypeTestCache* FlowGraphCompiler::GenerateSubtype1TestCacheLookup( |
| 406 intptr_t token_pos, | 406 intptr_t token_pos, |
| 407 const Class& type_class, | 407 const Class& type_class, |
| 408 Label* is_instance_lbl, | 408 Label* is_instance_lbl, |
| 409 Label* is_not_instance_lbl) { | 409 Label* is_not_instance_lbl) { |
| 410 __ Comment("Subtype1TestCacheLookup"); | 410 __ Comment("Subtype1TestCacheLookup"); |
| 411 const Register kInstanceReg = RAX; | 411 const Register kInstanceReg = RAX; |
| 412 __ LoadClass(R10, kInstanceReg); | 412 __ LoadClass(R10, kInstanceReg, PP); |
| 413 // R10: instance class. | 413 // R10: instance class. |
| 414 // Check immediate superclass equality. | 414 // Check immediate superclass equality. |
| 415 __ movq(R13, FieldAddress(R10, Class::super_type_offset())); | 415 __ movq(R13, FieldAddress(R10, Class::super_type_offset())); |
| 416 __ movq(R13, FieldAddress(R13, Type::type_class_offset())); | 416 __ movq(R13, FieldAddress(R13, Type::type_class_offset())); |
| 417 __ CompareObject(R13, type_class, PP); | 417 __ CompareObject(R13, type_class, PP); |
| 418 __ j(EQUAL, is_instance_lbl); | 418 __ j(EQUAL, is_instance_lbl); |
| 419 | 419 |
| 420 const Register kTypeArgumentsReg = kNoRegister; | 420 const Register kTypeArgumentsReg = kNoRegister; |
| 421 const Register kTempReg = R10; | 421 const Register kTempReg = R10; |
| 422 return GenerateCallSubtypeTestStub(kTestTypeOneArg, | 422 return GenerateCallSubtypeTestStub(kTestTypeOneArg, |
| (...skipping 1301 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1724 __ movups(reg, Address(RSP, 0)); | 1724 __ movups(reg, Address(RSP, 0)); |
| 1725 __ AddImmediate(RSP, Immediate(kFpuRegisterSize), PP); | 1725 __ AddImmediate(RSP, Immediate(kFpuRegisterSize), PP); |
| 1726 } | 1726 } |
| 1727 | 1727 |
| 1728 | 1728 |
| 1729 #undef __ | 1729 #undef __ |
| 1730 | 1730 |
| 1731 } // namespace dart | 1731 } // namespace dart |
| 1732 | 1732 |
| 1733 #endif // defined TARGET_ARCH_X64 | 1733 #endif // defined TARGET_ARCH_X64 |
| OLD | NEW |