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" |
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
102 } | 102 } |
103 | 103 |
104 | 104 |
105 // Allocate a new object. | 105 // Allocate a new object. |
106 // Arg0: class of the object that needs to be allocated. | 106 // Arg0: class of the object that needs to be allocated. |
107 // Arg1: type arguments of the object that needs to be allocated. | 107 // Arg1: type arguments of the object that needs to be allocated. |
108 // Arg2: type arguments of the instantiator or kNoInstantiator. | 108 // Arg2: type arguments of the instantiator or kNoInstantiator. |
109 // Return value: newly allocated object. | 109 // Return value: newly allocated object. |
110 DEFINE_RUNTIME_ENTRY(AllocateObject, 3) { | 110 DEFINE_RUNTIME_ENTRY(AllocateObject, 3) { |
111 const Class& cls = Class::CheckedHandle(arguments.ArgAt(0)); | 111 const Class& cls = Class::CheckedHandle(arguments.ArgAt(0)); |
| 112 // Report allocate to heap class stats. |
| 113 isolate->class_table()->AllocateClassNewSpace(cls.id(), cls.instance_size()); |
112 const Instance& instance = Instance::Handle(Instance::New(cls)); | 114 const Instance& instance = Instance::Handle(Instance::New(cls)); |
113 arguments.SetReturn(instance); | 115 arguments.SetReturn(instance); |
114 if (cls.NumTypeArguments() == 0) { | 116 if (cls.NumTypeArguments() == 0) { |
115 // No type arguments required for a non-parameterized type. | 117 // No type arguments required for a non-parameterized type. |
116 ASSERT(Instance::CheckedHandle(arguments.ArgAt(1)).IsNull()); | 118 ASSERT(Instance::CheckedHandle(arguments.ArgAt(1)).IsNull()); |
117 return; | 119 return; |
118 } | 120 } |
119 AbstractTypeArguments& type_arguments = | 121 AbstractTypeArguments& type_arguments = |
120 AbstractTypeArguments::CheckedHandle(arguments.ArgAt(1)); | 122 AbstractTypeArguments::CheckedHandle(arguments.ArgAt(1)); |
121 // If no instantiator is provided, set the type arguments and return. | 123 // If no instantiator is provided, set the type arguments and return. |
(...skipping 1579 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1701 // of the given value. | 1703 // of the given value. |
1702 // Arg0: Field object; | 1704 // Arg0: Field object; |
1703 // Arg1: Value that is being stored. | 1705 // Arg1: Value that is being stored. |
1704 DEFINE_RUNTIME_ENTRY(UpdateFieldCid, 2) { | 1706 DEFINE_RUNTIME_ENTRY(UpdateFieldCid, 2) { |
1705 const Field& field = Field::CheckedHandle(arguments.ArgAt(0)); | 1707 const Field& field = Field::CheckedHandle(arguments.ArgAt(0)); |
1706 const Object& value = Object::Handle(arguments.ArgAt(1)); | 1708 const Object& value = Object::Handle(arguments.ArgAt(1)); |
1707 field.UpdateGuardedCidAndLength(value); | 1709 field.UpdateGuardedCidAndLength(value); |
1708 } | 1710 } |
1709 | 1711 |
1710 } // namespace dart | 1712 } // namespace dart |
OLD | NEW |