| 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/code_generator.h" | 5 #include "vm/code_generator.h" |
| 6 | 6 |
| 7 #include "vm/assembler_macros.h" | 7 #include "vm/assembler_macros.h" |
| 8 #include "vm/ast.h" | 8 #include "vm/ast.h" |
| 9 #include "vm/code_patcher.h" | 9 #include "vm/code_patcher.h" |
| 10 #include "vm/compiler.h" | 10 #include "vm/compiler.h" |
| (...skipping 856 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 867 // closure calls. | 867 // closure calls. |
| 868 if (FLAG_trace_ic) { | 868 if (FLAG_trace_ic) { |
| 869 OS::Print("InlineCacheMissHandler NULL code for receiver: %s\n", | 869 OS::Print("InlineCacheMissHandler NULL code for receiver: %s\n", |
| 870 receiver.ToCString()); | 870 receiver.ToCString()); |
| 871 } | 871 } |
| 872 return Function::null(); | 872 return Function::null(); |
| 873 } | 873 } |
| 874 const Function& target_function = | 874 const Function& target_function = |
| 875 Function::Handle(target_code.function()); | 875 Function::Handle(target_code.function()); |
| 876 ASSERT(!target_function.IsNull()); | 876 ASSERT(!target_function.IsNull()); |
| 877 if (receiver.IsNull()) { | |
| 878 // Null dispatch is slow (e.g., (null).toCString()). The only | |
| 879 // fast execution with null receiver is the "==" operator. | |
| 880 // Special handling so that we do not pollute the inline cache with null | |
| 881 // classes. | |
| 882 if (FLAG_trace_ic) { | |
| 883 OS::Print("InlineCacheMissHandler Null receiver target %s\n", | |
| 884 target_function.ToCString()); | |
| 885 } | |
| 886 return target_function.raw(); | |
| 887 } | |
| 888 DartFrameIterator iterator; | 877 DartFrameIterator iterator; |
| 889 StackFrame* caller_frame = iterator.NextFrame(); | 878 StackFrame* caller_frame = iterator.NextFrame(); |
| 890 ASSERT(caller_frame != NULL); | 879 ASSERT(caller_frame != NULL); |
| 891 ICData& ic_data = ICData::Handle( | 880 ICData& ic_data = ICData::Handle( |
| 892 CodePatcher::GetInstanceCallIcDataAt(caller_frame->pc())); | 881 CodePatcher::GetInstanceCallIcDataAt(caller_frame->pc())); |
| 893 #if defined(DEBUG) | 882 #if defined(DEBUG) |
| 894 for (intptr_t i = 0; i < ic_data.NumberOfChecks(); i++) { | 883 for (intptr_t i = 0; i < ic_data.NumberOfChecks(); i++) { |
| 895 GrowableArray<intptr_t> class_ids; | 884 GrowableArray<intptr_t> class_ids; |
| 896 Function& target = Function::Handle(); | 885 Function& target = Function::Handle(); |
| 897 ic_data.GetCheckAt(i, &class_ids, &target); | 886 ic_data.GetCheckAt(i, &class_ids, &target); |
| (...skipping 729 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1627 } | 1616 } |
| 1628 } | 1617 } |
| 1629 } | 1618 } |
| 1630 // The cache is null terminated, therefore the loop above should never | 1619 // The cache is null terminated, therefore the loop above should never |
| 1631 // terminate by itself. | 1620 // terminate by itself. |
| 1632 UNREACHABLE(); | 1621 UNREACHABLE(); |
| 1633 return Code::null(); | 1622 return Code::null(); |
| 1634 } | 1623 } |
| 1635 | 1624 |
| 1636 } // namespace dart | 1625 } // namespace dart |
| OLD | NEW |