| 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_IA32. | 5 #include "vm/globals.h" // Needed here to get TARGET_ARCH_IA32. |
| 6 #if defined(TARGET_ARCH_IA32) | 6 #if defined(TARGET_ARCH_IA32) |
| 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 362 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 373 if (type.IsBoolType()) { | 373 if (type.IsBoolType()) { |
| 374 __ cmpl(kClassIdReg, Immediate(kBoolCid)); | 374 __ cmpl(kClassIdReg, Immediate(kBoolCid)); |
| 375 __ j(EQUAL, is_instance_lbl); | 375 __ j(EQUAL, is_instance_lbl); |
| 376 __ jmp(is_not_instance_lbl); | 376 __ jmp(is_not_instance_lbl); |
| 377 return false; | 377 return false; |
| 378 } | 378 } |
| 379 if (type.IsFunctionType()) { | 379 if (type.IsFunctionType()) { |
| 380 // Check if instance is a closure. | 380 // Check if instance is a closure. |
| 381 const Immediate& raw_null = | 381 const Immediate& raw_null = |
| 382 Immediate(reinterpret_cast<intptr_t>(Object::null())); | 382 Immediate(reinterpret_cast<intptr_t>(Object::null())); |
| 383 __ LoadClassById(EDI, kClassIdReg); | 383 __ LoadClassById(EDI, kClassIdReg, isolate()); |
| 384 __ movl(EDI, FieldAddress(EDI, Class::signature_function_offset())); | 384 __ movl(EDI, FieldAddress(EDI, Class::signature_function_offset())); |
| 385 __ cmpl(EDI, raw_null); | 385 __ cmpl(EDI, raw_null); |
| 386 __ j(NOT_EQUAL, is_instance_lbl); | 386 __ j(NOT_EQUAL, is_instance_lbl); |
| 387 } | 387 } |
| 388 // Custom checking for numbers (Smi, Mint, Bigint and Double). | 388 // Custom checking for numbers (Smi, Mint, Bigint and Double). |
| 389 // Note that instance is not Smi (checked above). | 389 // Note that instance is not Smi (checked above). |
| 390 if (type.IsSubtypeOf(Type::Handle(Type::Number()), NULL)) { | 390 if (type.IsSubtypeOf(Type::Handle(Type::Number()), NULL)) { |
| 391 GenerateNumberTypeCheck( | 391 GenerateNumberTypeCheck( |
| 392 kClassIdReg, type, is_instance_lbl, is_not_instance_lbl); | 392 kClassIdReg, type, is_instance_lbl, is_not_instance_lbl); |
| 393 return false; | 393 return false; |
| (...skipping 14 matching lines...) Expand all Loading... |
| 408 // TODO(srdjan): Implement a quicker subtype check, as type test | 408 // TODO(srdjan): Implement a quicker subtype check, as type test |
| 409 // arrays can grow too high, but they may be useful when optimizing | 409 // arrays can grow too high, but they may be useful when optimizing |
| 410 // code (type-feedback). | 410 // code (type-feedback). |
| 411 RawSubtypeTestCache* FlowGraphCompiler::GenerateSubtype1TestCacheLookup( | 411 RawSubtypeTestCache* FlowGraphCompiler::GenerateSubtype1TestCacheLookup( |
| 412 intptr_t token_pos, | 412 intptr_t token_pos, |
| 413 const Class& type_class, | 413 const Class& type_class, |
| 414 Label* is_instance_lbl, | 414 Label* is_instance_lbl, |
| 415 Label* is_not_instance_lbl) { | 415 Label* is_not_instance_lbl) { |
| 416 __ Comment("Subtype1TestCacheLookup"); | 416 __ Comment("Subtype1TestCacheLookup"); |
| 417 const Register kInstanceReg = EAX; | 417 const Register kInstanceReg = EAX; |
| 418 __ LoadClass(ECX, kInstanceReg, EDI); | 418 __ LoadClass(ECX, kInstanceReg, EDI, isolate()); |
| 419 // ECX: instance class. | 419 // ECX: instance class. |
| 420 // Check immediate superclass equality. | 420 // Check immediate superclass equality. |
| 421 __ movl(EDI, FieldAddress(ECX, Class::super_type_offset())); | 421 __ movl(EDI, FieldAddress(ECX, Class::super_type_offset())); |
| 422 __ movl(EDI, FieldAddress(EDI, Type::type_class_offset())); | 422 __ movl(EDI, FieldAddress(EDI, Type::type_class_offset())); |
| 423 __ CompareObject(EDI, type_class); | 423 __ CompareObject(EDI, type_class); |
| 424 __ j(EQUAL, is_instance_lbl); | 424 __ j(EQUAL, is_instance_lbl); |
| 425 | 425 |
| 426 const Register kTypeArgumentsReg = kNoRegister; | 426 const Register kTypeArgumentsReg = kNoRegister; |
| 427 const Register kTempReg = EDI; | 427 const Register kTempReg = EDI; |
| 428 return GenerateCallSubtypeTestStub(kTestTypeOneArg, | 428 return GenerateCallSubtypeTestStub(kTestTypeOneArg, |
| (...skipping 1339 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1768 __ movups(reg, Address(ESP, 0)); | 1768 __ movups(reg, Address(ESP, 0)); |
| 1769 __ addl(ESP, Immediate(kFpuRegisterSize)); | 1769 __ addl(ESP, Immediate(kFpuRegisterSize)); |
| 1770 } | 1770 } |
| 1771 | 1771 |
| 1772 | 1772 |
| 1773 #undef __ | 1773 #undef __ |
| 1774 | 1774 |
| 1775 } // namespace dart | 1775 } // namespace dart |
| 1776 | 1776 |
| 1777 #endif // defined TARGET_ARCH_IA32 | 1777 #endif // defined TARGET_ARCH_IA32 |
| OLD | NEW |