| 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/bigint_operations.h" | 9 #include "vm/bigint_operations.h" |
| 10 #include "vm/code_patcher.h" | 10 #include "vm/code_patcher.h" |
| (...skipping 12 matching lines...) Expand all Loading... |
| 23 #include "vm/runtime_entry.h" | 23 #include "vm/runtime_entry.h" |
| 24 #include "vm/stack_frame.h" | 24 #include "vm/stack_frame.h" |
| 25 #include "vm/symbols.h" | 25 #include "vm/symbols.h" |
| 26 #include "vm/verifier.h" | 26 #include "vm/verifier.h" |
| 27 | 27 |
| 28 namespace dart { | 28 namespace dart { |
| 29 | 29 |
| 30 DEFINE_FLAG(bool, deoptimize_alot, false, | 30 DEFINE_FLAG(bool, deoptimize_alot, false, |
| 31 "Deoptimizes all live frames when we are about to return to Dart code from" | 31 "Deoptimizes all live frames when we are about to return to Dart code from" |
| 32 " native entries."); | 32 " native entries."); |
| 33 DEFINE_FLAG(bool, inline_cache, true, "Enable inline caches"); | |
| 34 DEFINE_FLAG(bool, trace_deoptimization, false, "Trace deoptimization"); | 33 DEFINE_FLAG(bool, trace_deoptimization, false, "Trace deoptimization"); |
| 35 DEFINE_FLAG(bool, trace_deoptimization_verbose, false, | 34 DEFINE_FLAG(bool, trace_deoptimization_verbose, false, |
| 36 "Trace deoptimization verbose"); | 35 "Trace deoptimization verbose"); |
| 37 DEFINE_FLAG(bool, trace_ic, false, "Trace IC handling"); | 36 DEFINE_FLAG(bool, trace_ic, false, "Trace IC handling"); |
| 38 DEFINE_FLAG(bool, trace_ic_miss_in_optimized, false, | 37 DEFINE_FLAG(bool, trace_ic_miss_in_optimized, false, |
| 39 "Trace IC miss in optimized code"); | 38 "Trace IC miss in optimized code"); |
| 40 DEFINE_FLAG(bool, trace_patching, false, "Trace patching of code."); | 39 DEFINE_FLAG(bool, trace_patching, false, "Trace patching of code."); |
| 41 DEFINE_FLAG(bool, trace_runtime_calls, false, "Trace runtime calls"); | 40 DEFINE_FLAG(bool, trace_runtime_calls, false, "Trace runtime calls"); |
| 42 DEFINE_FLAG(int, optimization_counter_threshold, 3000, | 41 DEFINE_FLAG(int, optimization_counter_threshold, 3000, |
| 43 "Function's usage-counter value before it is optimized, -1 means never"); | 42 "Function's usage-counter value before it is optimized, -1 means never"); |
| (...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 153 ASSERT(type_arguments.IsInstantiated()); | 152 ASSERT(type_arguments.IsInstantiated()); |
| 154 instance.SetTypeArguments(type_arguments); | 153 instance.SetTypeArguments(type_arguments); |
| 155 } | 154 } |
| 156 | 155 |
| 157 | 156 |
| 158 // Helper returning the token position of the Dart caller. | 157 // Helper returning the token position of the Dart caller. |
| 159 static intptr_t GetCallerLocation() { | 158 static intptr_t GetCallerLocation() { |
| 160 DartFrameIterator iterator; | 159 DartFrameIterator iterator; |
| 161 StackFrame* caller_frame = iterator.NextFrame(); | 160 StackFrame* caller_frame = iterator.NextFrame(); |
| 162 ASSERT(caller_frame != NULL); | 161 ASSERT(caller_frame != NULL); |
| 163 const Code& code = Code::Handle(caller_frame->LookupDartCode()); | 162 return caller_frame->GetTokenPos(); |
| 164 const PcDescriptors& descriptors = | |
| 165 PcDescriptors::Handle(code.pc_descriptors()); | |
| 166 ASSERT(!descriptors.IsNull()); | |
| 167 for (int i = 0; i < descriptors.Length(); i++) { | |
| 168 if (static_cast<uword>(descriptors.PC(i)) == caller_frame->pc()) { | |
| 169 return descriptors.TokenPos(i); | |
| 170 } | |
| 171 } | |
| 172 return -1; | |
| 173 } | 163 } |
| 174 | 164 |
| 175 | 165 |
| 176 // Allocate a new object of a generic type and check that the instantiated type | 166 // Allocate a new object of a generic type and check that the instantiated type |
| 177 // arguments are within the declared bounds or throw a dynamic type error. | 167 // arguments are within the declared bounds or throw a dynamic type error. |
| 178 // Arg0: class of the object that needs to be allocated. | 168 // Arg0: class of the object that needs to be allocated. |
| 179 // Arg1: type arguments of the object that needs to be allocated. | 169 // Arg1: type arguments of the object that needs to be allocated. |
| 180 // Arg2: type arguments of the instantiator or kNoInstantiator. | 170 // Arg2: type arguments of the instantiator or kNoInstantiator. |
| 181 // Return value: newly allocated object. | 171 // Return value: newly allocated object. |
| 182 DEFINE_RUNTIME_ENTRY(AllocateObjectWithBoundsCheck, 3) { | 172 DEFINE_RUNTIME_ENTRY(AllocateObjectWithBoundsCheck, 3) { |
| (...skipping 1616 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1799 return; | 1789 return; |
| 1800 } | 1790 } |
| 1801 HeapTrace* heap_trace = Isolate::Current()->heap()->trace(); | 1791 HeapTrace* heap_trace = Isolate::Current()->heap()->trace(); |
| 1802 heap_trace->TraceStoreIntoObject(RawObject::ToAddr(object), | 1792 heap_trace->TraceStoreIntoObject(RawObject::ToAddr(object), |
| 1803 field_addr, | 1793 field_addr, |
| 1804 RawObject::ToAddr(value)); | 1794 RawObject::ToAddr(value)); |
| 1805 } | 1795 } |
| 1806 END_LEAF_RUNTIME_ENTRY | 1796 END_LEAF_RUNTIME_ENTRY |
| 1807 | 1797 |
| 1808 } // namespace dart | 1798 } // namespace dart |
| OLD | NEW |