| 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/code_generator.h" | 5 #include "vm/code_generator.h" |
| 6 | 6 |
| 7 #include "vm/assembler.h" | 7 #include "vm/assembler.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" |
| 11 #include "vm/compiler.h" | 11 #include "vm/compiler.h" |
| 12 #include "vm/dart_api_impl.h" | 12 #include "vm/dart_api_impl.h" |
| 13 #include "vm/dart_entry.h" | 13 #include "vm/dart_entry.h" |
| 14 #include "vm/debugger.h" | 14 #include "vm/debugger.h" |
| 15 #include "vm/deopt_instructions.h" | 15 #include "vm/deopt_instructions.h" |
| 16 #include "vm/exceptions.h" | 16 #include "vm/exceptions.h" |
| 17 #include "vm/heap_class_stats.h" |
| 17 #include "vm/intermediate_language.h" | 18 #include "vm/intermediate_language.h" |
| 18 #include "vm/object_store.h" | 19 #include "vm/object_store.h" |
| 19 #include "vm/message.h" | 20 #include "vm/message.h" |
| 20 #include "vm/message_handler.h" | 21 #include "vm/message_handler.h" |
| 21 #include "vm/parser.h" | 22 #include "vm/parser.h" |
| 22 #include "vm/resolver.h" | 23 #include "vm/resolver.h" |
| 23 #include "vm/runtime_entry.h" | 24 #include "vm/runtime_entry.h" |
| 24 #include "vm/stack_frame.h" | 25 #include "vm/stack_frame.h" |
| 25 #include "vm/symbols.h" | 26 #include "vm/symbols.h" |
| 26 #include "vm/verifier.h" | 27 #include "vm/verifier.h" |
| (...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 102 } | 103 } |
| 103 | 104 |
| 104 | 105 |
| 105 // Allocate a new object. | 106 // Allocate a new object. |
| 106 // Arg0: class of the object that needs to be allocated. | 107 // Arg0: class of the object that needs to be allocated. |
| 107 // Arg1: type arguments of the object that needs to be allocated. | 108 // Arg1: type arguments of the object that needs to be allocated. |
| 108 // Arg2: type arguments of the instantiator or kNoInstantiator. | 109 // Arg2: type arguments of the instantiator or kNoInstantiator. |
| 109 // Return value: newly allocated object. | 110 // Return value: newly allocated object. |
| 110 DEFINE_RUNTIME_ENTRY(AllocateObject, 3) { | 111 DEFINE_RUNTIME_ENTRY(AllocateObject, 3) { |
| 111 const Class& cls = Class::CheckedHandle(arguments.ArgAt(0)); | 112 const Class& cls = Class::CheckedHandle(arguments.ArgAt(0)); |
| 113 // Report allocate to heap class stats. |
| 114 isolate->heap_class_stats()->AllocateClass(cls.id()); |
| 112 const Instance& instance = Instance::Handle(Instance::New(cls)); | 115 const Instance& instance = Instance::Handle(Instance::New(cls)); |
| 113 arguments.SetReturn(instance); | 116 arguments.SetReturn(instance); |
| 114 if (cls.NumTypeArguments() == 0) { | 117 if (cls.NumTypeArguments() == 0) { |
| 115 // No type arguments required for a non-parameterized type. | 118 // No type arguments required for a non-parameterized type. |
| 116 ASSERT(Instance::CheckedHandle(arguments.ArgAt(1)).IsNull()); | 119 ASSERT(Instance::CheckedHandle(arguments.ArgAt(1)).IsNull()); |
| 117 return; | 120 return; |
| 118 } | 121 } |
| 119 AbstractTypeArguments& type_arguments = | 122 AbstractTypeArguments& type_arguments = |
| 120 AbstractTypeArguments::CheckedHandle(arguments.ArgAt(1)); | 123 AbstractTypeArguments::CheckedHandle(arguments.ArgAt(1)); |
| 121 // If no instantiator is provided, set the type arguments and return. | 124 // If no instantiator is provided, set the type arguments and return. |
| (...skipping 1608 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1730 field.UpdateCid(cid); | 1733 field.UpdateCid(cid); |
| 1731 intptr_t list_length = Field::kNoFixedLength; | 1734 intptr_t list_length = Field::kNoFixedLength; |
| 1732 if ((field.guarded_cid() != kDynamicCid) && | 1735 if ((field.guarded_cid() != kDynamicCid) && |
| 1733 field.is_final() && RawObject::IsBuiltinListClassId(cid)) { | 1736 field.is_final() && RawObject::IsBuiltinListClassId(cid)) { |
| 1734 list_length = GetListLength(value); | 1737 list_length = GetListLength(value); |
| 1735 } | 1738 } |
| 1736 field.UpdateLength(list_length); | 1739 field.UpdateLength(list_length); |
| 1737 } | 1740 } |
| 1738 | 1741 |
| 1739 } // namespace dart | 1742 } // namespace dart |
| OLD | NEW |