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

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

Issue 16780009: When canonicalize instances check if all fields are canonical. If a field is a non-canonical number… (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 7 years, 6 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | runtime/vm/flow_graph_optimizer.cc » ('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) 2011, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2011, 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/dart_entry.h" 5 #include "vm/dart_entry.h"
6 6
7 #include "vm/code_generator.h" 7 #include "vm/code_generator.h"
8 #include "vm/compiler.h" 8 #include "vm/compiler.h"
9 #include "vm/object_store.h" 9 #include "vm/object_store.h"
10 #include "vm/resolver.h" 10 #include "vm/resolver.h"
(...skipping 222 matching lines...) Expand 10 before | Expand all | Expand 10 after
233 } 233 }
234 // Insert pair in descriptor array. 234 // Insert pair in descriptor array.
235 descriptor.SetAt(insert_index + kNameOffset, name); 235 descriptor.SetAt(insert_index + kNameOffset, name);
236 descriptor.SetAt(insert_index + kPositionOffset, pos); 236 descriptor.SetAt(insert_index + kPositionOffset, pos);
237 } 237 }
238 // Set terminating null. 238 // Set terminating null.
239 descriptor.SetAt(descriptor_len - 1, Object::Handle()); 239 descriptor.SetAt(descriptor_len - 1, Object::Handle());
240 240
241 // Share the immutable descriptor when possible by canonicalizing it. 241 // Share the immutable descriptor when possible by canonicalizing it.
242 descriptor.MakeImmutable(); 242 descriptor.MakeImmutable();
243 descriptor ^= descriptor.Canonicalize(); 243 descriptor ^= descriptor.CheckAndCanonicalize(NULL);
244 ASSERT(!descriptor.IsNull());
244 return descriptor.raw(); 245 return descriptor.raw();
245 } 246 }
246 247
247 248
248 RawArray* ArgumentsDescriptor::New(intptr_t num_arguments) { 249 RawArray* ArgumentsDescriptor::New(intptr_t num_arguments) {
249 ASSERT(num_arguments >= 0); 250 ASSERT(num_arguments >= 0);
250 if (num_arguments < kCachedDescriptorCount) { 251 if (num_arguments < kCachedDescriptorCount) {
251 return cached_args_descriptors_[num_arguments]; 252 return cached_args_descriptors_[num_arguments];
252 } 253 }
253 return NewNonCached(num_arguments); 254 return NewNonCached(num_arguments);
(...skipping 14 matching lines...) Expand all
268 269
269 // Set number of positional arguments. 270 // Set number of positional arguments.
270 descriptor.SetAt(kPositionalCountIndex, arg_count); 271 descriptor.SetAt(kPositionalCountIndex, arg_count);
271 272
272 // Set terminating null. 273 // Set terminating null.
273 descriptor.SetAt((descriptor_len - 1), Object::Handle()); 274 descriptor.SetAt((descriptor_len - 1), Object::Handle());
274 275
275 // Share the immutable descriptor when possible by canonicalizing it. 276 // Share the immutable descriptor when possible by canonicalizing it.
276 descriptor.MakeImmutable(); 277 descriptor.MakeImmutable();
277 if (canonicalize) { 278 if (canonicalize) {
278 descriptor ^= descriptor.Canonicalize(); 279 descriptor ^= descriptor.CheckAndCanonicalize(NULL);
279 } 280 }
281 ASSERT(!descriptor.IsNull());
280 return descriptor.raw(); 282 return descriptor.raw();
281 } 283 }
282 284
283 285
284 void ArgumentsDescriptor::InitOnce() { 286 void ArgumentsDescriptor::InitOnce() {
285 for (int i = 0; i < kCachedDescriptorCount; i++) { 287 for (int i = 0; i < kCachedDescriptorCount; i++) {
286 cached_args_descriptors_[i] = ArgumentsDescriptor::NewNonCached(i, false); 288 cached_args_descriptors_[i] = ArgumentsDescriptor::NewNonCached(i, false);
287 } 289 }
288 } 290 }
289 291
(...skipping 185 matching lines...) Expand 10 before | Expand all | Expand 10 after
475 String::Handle(Field::GetterName(Symbols::_id())))); 477 String::Handle(Field::GetterName(Symbols::_id()))));
476 const Function& func = Function::Handle(cls.LookupDynamicFunction(func_name)); 478 const Function& func = Function::Handle(cls.LookupDynamicFunction(func_name));
477 ASSERT(!func.IsNull()); 479 ASSERT(!func.IsNull());
478 const Array& args = Array::Handle(Array::New(1)); 480 const Array& args = Array::Handle(Array::New(1));
479 args.SetAt(0, port); 481 args.SetAt(0, port);
480 return DartEntry::InvokeFunction(func, args); 482 return DartEntry::InvokeFunction(func, args);
481 } 483 }
482 484
483 485
484 } // namespace dart 486 } // namespace dart
OLDNEW
« no previous file with comments | « no previous file | runtime/vm/flow_graph_optimizer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698