| 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/code_patcher.h" | 8 #include "vm/code_patcher.h" |
| 9 #include "vm/compiler.h" | 9 #include "vm/compiler.h" |
| 10 #include "vm/dart_api_impl.h" | 10 #include "vm/dart_api_impl.h" |
| (...skipping 923 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 934 } | 934 } |
| 935 return target_function.raw(); | 935 return target_function.raw(); |
| 936 } | 936 } |
| 937 DartFrameIterator iterator; | 937 DartFrameIterator iterator; |
| 938 StackFrame* caller_frame = iterator.NextFrame(); | 938 StackFrame* caller_frame = iterator.NextFrame(); |
| 939 ASSERT(caller_frame != NULL); | 939 ASSERT(caller_frame != NULL); |
| 940 ICData& ic_data = ICData::Handle( | 940 ICData& ic_data = ICData::Handle( |
| 941 CodePatcher::GetInstanceCallIcDataAt(caller_frame->pc())); | 941 CodePatcher::GetInstanceCallIcDataAt(caller_frame->pc())); |
| 942 #if defined(DEBUG) | 942 #if defined(DEBUG) |
| 943 for (intptr_t i = 0; i < ic_data.NumberOfChecks(); i++) { | 943 for (intptr_t i = 0; i < ic_data.NumberOfChecks(); i++) { |
| 944 GrowableArray<const Class*> classes; | 944 GrowableArray<intptr_t> class_ids; |
| 945 Function& target = Function::Handle(); | 945 Function& target = Function::Handle(); |
| 946 ic_data.GetCheckAt(i, &classes, &target); | 946 ic_data.GetCheckAt(i, &class_ids, &target); |
| 947 bool matches = true; | 947 bool matches = true; |
| 948 for (intptr_t k = 0; k < classes.length(); k++) { | 948 for (intptr_t k = 0; k < class_ids.length(); k++) { |
| 949 if (classes[k]->raw() != args[k]->clazz()) { | 949 if (class_ids[k] != Class::Handle(args[k]->clazz()).id()) { |
| 950 matches = false; | 950 matches = false; |
| 951 break; | 951 break; |
| 952 } | 952 } |
| 953 } | 953 } |
| 954 // Do not add an entry twice! | 954 // Do not add an entry twice! |
| 955 ASSERT(!matches); | 955 ASSERT(!matches); |
| 956 } | 956 } |
| 957 #endif // DEBUG | 957 #endif // DEBUG |
| 958 | 958 |
| 959 GrowableArray<const Class*> classes; | 959 GrowableArray<intptr_t> class_ids; |
| 960 ASSERT(ic_data.num_args_tested() == args.length()); | 960 ASSERT(ic_data.num_args_tested() == args.length()); |
| 961 for (intptr_t i = 0; i < args.length(); i++) { | 961 for (intptr_t i = 0; i < args.length(); i++) { |
| 962 classes.Add(&Class::ZoneHandle(args[i]->clazz())); | 962 class_ids.Add(Class::Handle(args[i]->clazz()).id()); |
| 963 } | 963 } |
| 964 ic_data.AddCheck(classes, target_function); | 964 ic_data.AddCheck(class_ids, target_function); |
| 965 if (FLAG_trace_ic) { | 965 if (FLAG_trace_ic) { |
| 966 OS::Print("InlineCacheMissHandler %d call at 0x%x' adding <%s> -> <%s>\n", | 966 OS::Print("InlineCacheMissHandler %d call at 0x%x' " |
| 967 "adding <%s> id:%d -> <%s>\n", |
| 967 args.length(), | 968 args.length(), |
| 968 caller_frame->pc(), | 969 caller_frame->pc(), |
| 969 Class::Handle(receiver.clazz()).ToCString(), | 970 Class::Handle(receiver.clazz()).ToCString(), |
| 971 Class::Handle(receiver.clazz()).id(), |
| 970 target_function.ToCString()); | 972 target_function.ToCString()); |
| 971 } | 973 } |
| 972 return target_function.raw(); | 974 return target_function.raw(); |
| 973 } | 975 } |
| 974 | 976 |
| 975 | 977 |
| 976 // Handles inline cache misses by updating the IC data array of the call | 978 // Handles inline cache misses by updating the IC data array of the call |
| 977 // site. | 979 // site. |
| 978 // Arg0: Receiver object. | 980 // Arg0: Receiver object. |
| 979 // Returns: target function with compiled code or null. | 981 // Returns: target function with compiled code or null. |
| (...skipping 606 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1586 // Adds a pointer to the store buffer. | 1588 // Adds a pointer to the store buffer. |
| 1587 // Arg0: the address of a field being stored into | 1589 // Arg0: the address of a field being stored into |
| 1588 DEFINE_LEAF_RUNTIME_ENTRY(StoreBuffer, 1) { | 1590 DEFINE_LEAF_RUNTIME_ENTRY(StoreBuffer, 1) { |
| 1589 ASSERT(args.Count() == kStoreBufferRuntimeEntry.argument_count()); | 1591 ASSERT(args.Count() == kStoreBufferRuntimeEntry.argument_count()); |
| 1590 uword ptr = reinterpret_cast<uword>(args.At(0)); | 1592 uword ptr = reinterpret_cast<uword>(args.At(0)); |
| 1591 isolate->store_buffer()->AddPointer(ptr); | 1593 isolate->store_buffer()->AddPointer(ptr); |
| 1592 return Smi::New(0); // Just an arbitrary RawObject* value. | 1594 return Smi::New(0); // Just an arbitrary RawObject* value. |
| 1593 } | 1595 } |
| 1594 | 1596 |
| 1595 } // namespace dart | 1597 } // namespace dart |
| OLD | NEW |