| 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 543 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 554 // - RDX: instantiator type arguments or raw_null. | 554 // - RDX: instantiator type arguments or raw_null. | 
| 555 // - RCX: instantiator or raw_null. | 555 // - RCX: instantiator or raw_null. | 
| 556 // Clobbers RCX and RDX. | 556 // Clobbers RCX and RDX. | 
| 557 // Returns: | 557 // Returns: | 
| 558 // - true or false in RAX. | 558 // - true or false in RAX. | 
| 559 void FlowGraphCompiler::GenerateInstanceOf(intptr_t token_pos, | 559 void FlowGraphCompiler::GenerateInstanceOf(intptr_t token_pos, | 
| 560                                            intptr_t deopt_id, | 560                                            intptr_t deopt_id, | 
| 561                                            const AbstractType& type, | 561                                            const AbstractType& type, | 
| 562                                            bool negate_result, | 562                                            bool negate_result, | 
| 563                                            LocationSummary* locs) { | 563                                            LocationSummary* locs) { | 
| 564   ASSERT(type.IsFinalized() && !type.IsMalformed() && !type.IsMalbounded()); | 564   ASSERT(type.IsFinalized() && !type.IsMalformedOrMalbounded()); | 
| 565 | 565 | 
| 566   Label is_instance, is_not_instance; | 566   Label is_instance, is_not_instance; | 
| 567   __ pushq(RCX);  // Store instantiator on stack. | 567   __ pushq(RCX);  // Store instantiator on stack. | 
| 568   __ pushq(RDX);  // Store instantiator type arguments. | 568   __ pushq(RDX);  // Store instantiator type arguments. | 
| 569   // If type is instantiated and non-parameterized, we can inline code | 569   // If type is instantiated and non-parameterized, we can inline code | 
| 570   // checking whether the tested instance is a Smi. | 570   // checking whether the tested instance is a Smi. | 
| 571   if (type.IsInstantiated()) { | 571   if (type.IsInstantiated()) { | 
| 572     // A null object is only an instance of Object and dynamic, which has | 572     // A null object is only an instance of Object and dynamic, which has | 
| 573     // already been checked above (if the type is instantiated). So we can | 573     // already been checked above (if the type is instantiated). So we can | 
| 574     // return false here if the instance is null (and if the type is | 574     // return false here if the instance is null (and if the type is | 
| (...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 643 // as they throw an exception. | 643 // as they throw an exception. | 
| 644 void FlowGraphCompiler::GenerateAssertAssignable(intptr_t token_pos, | 644 void FlowGraphCompiler::GenerateAssertAssignable(intptr_t token_pos, | 
| 645                                                  intptr_t deopt_id, | 645                                                  intptr_t deopt_id, | 
| 646                                                  const AbstractType& dst_type, | 646                                                  const AbstractType& dst_type, | 
| 647                                                  const String& dst_name, | 647                                                  const String& dst_name, | 
| 648                                                  LocationSummary* locs) { | 648                                                  LocationSummary* locs) { | 
| 649   ASSERT(token_pos >= 0); | 649   ASSERT(token_pos >= 0); | 
| 650   ASSERT(!dst_type.IsNull()); | 650   ASSERT(!dst_type.IsNull()); | 
| 651   ASSERT(dst_type.IsFinalized()); | 651   ASSERT(dst_type.IsFinalized()); | 
| 652   // Assignable check is skipped in FlowGraphBuilder, not here. | 652   // Assignable check is skipped in FlowGraphBuilder, not here. | 
| 653   ASSERT(dst_type.IsMalformed() || dst_type.IsMalbounded() || | 653   ASSERT(dst_type.IsMalformedOrMalbounded() || | 
| 654          (!dst_type.IsDynamicType() && !dst_type.IsObjectType())); | 654          (!dst_type.IsDynamicType() && !dst_type.IsObjectType())); | 
| 655   __ pushq(RCX);  // Store instantiator. | 655   __ pushq(RCX);  // Store instantiator. | 
| 656   __ pushq(RDX);  // Store instantiator type arguments. | 656   __ pushq(RDX);  // Store instantiator type arguments. | 
| 657   // A null object is always assignable and is returned as result. | 657   // A null object is always assignable and is returned as result. | 
| 658   Label is_assignable, runtime_call; | 658   Label is_assignable, runtime_call; | 
| 659   __ CompareObject(RAX, Object::null_object(), PP); | 659   __ CompareObject(RAX, Object::null_object(), PP); | 
| 660   __ j(EQUAL, &is_assignable); | 660   __ j(EQUAL, &is_assignable); | 
| 661 | 661 | 
| 662   if (!FLAG_eliminate_type_checks || dst_type.IsMalformed()) { | 662   if (!FLAG_eliminate_type_checks || dst_type.IsMalformed()) { | 
| 663     // If type checks are not eliminated during the graph building then | 663     // If type checks are not eliminated during the graph building then | 
| 664     // a transition sentinel can be seen here. | 664     // a transition sentinel can be seen here. | 
| 665     __ CompareObject(RAX, Object::transition_sentinel(), PP); | 665     __ CompareObject(RAX, Object::transition_sentinel(), PP); | 
| 666     __ j(EQUAL, &is_assignable); | 666     __ j(EQUAL, &is_assignable); | 
| 667   } | 667   } | 
| 668 | 668 | 
| 669   // Generate throw new TypeError() if the type is malformed or malbounded. | 669   // Generate throw new TypeError() if the type is malformed or malbounded. | 
| 670   if (dst_type.IsMalformed() || dst_type.IsMalbounded()) { | 670   if (dst_type.IsMalformedOrMalbounded()) { | 
| 671     __ PushObject(Object::ZoneHandle(), PP);  // Make room for the result. | 671     __ PushObject(Object::ZoneHandle(), PP);  // Make room for the result. | 
| 672     __ pushq(RAX);  // Push the source object. | 672     __ pushq(RAX);  // Push the source object. | 
| 673     __ PushObject(dst_name, PP);  // Push the name of the destination. | 673     __ PushObject(dst_name, PP);  // Push the name of the destination. | 
| 674     __ PushObject(dst_type, PP);  // Push the type of the destination. | 674     __ PushObject(dst_type, PP);  // Push the type of the destination. | 
| 675     GenerateRuntimeCall(token_pos, | 675     GenerateRuntimeCall(token_pos, | 
| 676                         deopt_id, | 676                         deopt_id, | 
| 677                         kBadTypeErrorRuntimeEntry, | 677                         kBadTypeErrorRuntimeEntry, | 
| 678                         3, | 678                         3, | 
| 679                         locs); | 679                         locs); | 
| 680     // We should never return here. | 680     // We should never return here. | 
| (...skipping 1217 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 1898   __ movups(reg, Address(RSP, 0)); | 1898   __ movups(reg, Address(RSP, 0)); | 
| 1899   __ AddImmediate(RSP, Immediate(kFpuRegisterSize), PP); | 1899   __ AddImmediate(RSP, Immediate(kFpuRegisterSize), PP); | 
| 1900 } | 1900 } | 
| 1901 | 1901 | 
| 1902 | 1902 | 
| 1903 #undef __ | 1903 #undef __ | 
| 1904 | 1904 | 
| 1905 }  // namespace dart | 1905 }  // namespace dart | 
| 1906 | 1906 | 
| 1907 #endif  // defined TARGET_ARCH_X64 | 1907 #endif  // defined TARGET_ARCH_X64 | 
| OLD | NEW | 
|---|