Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(93)

Side by Side Diff: runtime/vm/code_generator.cc

Issue 2119633002: Remove support for pretenuring as it is not fully implemented and is currently turned on for a very… (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Address self review changes. Created 4 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « runtime/vm/assembler_x64.cc ('k') | runtime/vm/flag_list.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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/code_patcher.h" 9 #include "vm/code_patcher.h"
10 #include "vm/compiler.h" 10 #include "vm/compiler.h"
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after
102 // Throw: new ArgumentError.value(length, "length", "is not an integer"); 102 // Throw: new ArgumentError.value(length, "length", "is not an integer");
103 const Array& args = Array::Handle(Array::New(3)); 103 const Array& args = Array::Handle(Array::New(3));
104 args.SetAt(0, length); 104 args.SetAt(0, length);
105 args.SetAt(1, Symbols::Length()); 105 args.SetAt(1, Symbols::Length());
106 args.SetAt(2, String::Handle(String::New("is not an integer"))); 106 args.SetAt(2, String::Handle(String::New("is not an integer")));
107 Exceptions::ThrowByType(Exceptions::kArgumentValue, args); 107 Exceptions::ThrowByType(Exceptions::kArgumentValue, args);
108 } 108 }
109 if (length.IsSmi()) { 109 if (length.IsSmi()) {
110 const intptr_t len = Smi::Cast(length).Value(); 110 const intptr_t len = Smi::Cast(length).Value();
111 if ((len >= 0) && (len <= Array::kMaxElements)) { 111 if ((len >= 0) && (len <= Array::kMaxElements)) {
112 Heap::Space space = isolate->heap()->SpaceForAllocation(kArrayCid); 112 const Array& array = Array::Handle(Array::New(len, Heap::kNew));
113 const Array& array = Array::Handle(Array::New(len, space));
114 arguments.SetReturn(array); 113 arguments.SetReturn(array);
115 TypeArguments& element_type = 114 TypeArguments& element_type =
116 TypeArguments::CheckedHandle(arguments.ArgAt(1)); 115 TypeArguments::CheckedHandle(arguments.ArgAt(1));
117 // An Array is raw or takes one type argument. However, its type argument 116 // An Array is raw or takes one type argument. However, its type argument
118 // vector may be longer than 1 due to a type optimization reusing the type 117 // vector may be longer than 1 due to a type optimization reusing the type
119 // argument vector of the instantiator. 118 // argument vector of the instantiator.
120 ASSERT(element_type.IsNull() || 119 ASSERT(element_type.IsNull() ||
121 ((element_type.Length() >= 1) && element_type.IsInstantiated())); 120 ((element_type.Length() >= 1) && element_type.IsInstantiated()));
122 array.SetTypeArguments(element_type); // May be null. 121 array.SetTypeArguments(element_type); // May be null.
123 return; 122 return;
(...skipping 28 matching lines...) Expand all
152 #ifdef DEBUG 151 #ifdef DEBUG
153 if (FLAG_gc_at_instance_allocation != NULL) { 152 if (FLAG_gc_at_instance_allocation != NULL) {
154 const String& name = String::Handle(cls.Name()); 153 const String& name = String::Handle(cls.Name());
155 if (String::EqualsIgnoringPrivateKey( 154 if (String::EqualsIgnoringPrivateKey(
156 name, 155 name,
157 String::Handle(String::New(FLAG_gc_at_instance_allocation)))) { 156 String::Handle(String::New(FLAG_gc_at_instance_allocation)))) {
158 Isolate::Current()->heap()->CollectAllGarbage(); 157 Isolate::Current()->heap()->CollectAllGarbage();
159 } 158 }
160 } 159 }
161 #endif 160 #endif
162 Heap::Space space = isolate->heap()->SpaceForAllocation(cls.id()); 161 Heap::Space space = Heap::kNew;
163 const Instance& instance = Instance::Handle(Instance::New(cls, space)); 162 const Instance& instance = Instance::Handle(Instance::New(cls, space));
164 163
165 arguments.SetReturn(instance); 164 arguments.SetReturn(instance);
166 if (cls.NumTypeArguments() == 0) { 165 if (cls.NumTypeArguments() == 0) {
167 // No type arguments required for a non-parameterized type. 166 // No type arguments required for a non-parameterized type.
168 ASSERT(Instance::CheckedHandle(arguments.ArgAt(1)).IsNull()); 167 ASSERT(Instance::CheckedHandle(arguments.ArgAt(1)).IsNull());
169 return; 168 return;
170 } 169 }
171 TypeArguments& type_arguments = 170 TypeArguments& type_arguments =
172 TypeArguments::CheckedHandle(arguments.ArgAt(1)); 171 TypeArguments::CheckedHandle(arguments.ArgAt(1));
(...skipping 1706 matching lines...) Expand 10 before | Expand all | Expand 10 after
1879 const intptr_t elm_size = old_data.ElementSizeInBytes(); 1878 const intptr_t elm_size = old_data.ElementSizeInBytes();
1880 const TypedData& new_data = 1879 const TypedData& new_data =
1881 TypedData::Handle(TypedData::New(cid, new_size, Heap::kOld)); 1880 TypedData::Handle(TypedData::New(cid, new_size, Heap::kOld));
1882 TypedData::Copy(new_data, 0, old_data, 0, old_size * elm_size); 1881 TypedData::Copy(new_data, 0, old_data, 0, old_size * elm_size);
1883 typed_data_cell.SetAt(0, new_data); 1882 typed_data_cell.SetAt(0, new_data);
1884 arguments.SetReturn(new_data); 1883 arguments.SetReturn(new_data);
1885 } 1884 }
1886 1885
1887 1886
1888 } // namespace dart 1887 } // namespace dart
OLDNEW
« no previous file with comments | « runtime/vm/assembler_x64.cc ('k') | runtime/vm/flag_list.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698