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

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

Issue 17501003: Minor cleanups to use null_array(), null_object() and null_string() handles. (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 | « runtime/vm/dart_api_impl.cc ('k') | runtime/vm/flow_graph_compiler.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 218 matching lines...) Expand 10 before | Expand all | Expand 10 after
229 previous_pos ^= descriptor.At(previous_index + kPositionOffset); 229 previous_pos ^= descriptor.At(previous_index + kPositionOffset);
230 descriptor.SetAt(insert_index + kNameOffset, previous_name); 230 descriptor.SetAt(insert_index + kNameOffset, previous_name);
231 descriptor.SetAt(insert_index + kPositionOffset, previous_pos); 231 descriptor.SetAt(insert_index + kPositionOffset, previous_pos);
232 insert_index = previous_index; 232 insert_index = previous_index;
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::null_object());
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.CheckAndCanonicalize(NULL); 243 descriptor ^= descriptor.CheckAndCanonicalize(NULL);
244 ASSERT(!descriptor.IsNull()); 244 ASSERT(!descriptor.IsNull());
245 return descriptor.raw(); 245 return descriptor.raw();
246 } 246 }
247 247
248 248
249 RawArray* ArgumentsDescriptor::New(intptr_t num_arguments) { 249 RawArray* ArgumentsDescriptor::New(intptr_t num_arguments) {
(...skipping 14 matching lines...) Expand all
264 Array& descriptor = Array::Handle(Array::New(descriptor_len, Heap::kOld)); 264 Array& descriptor = Array::Handle(Array::New(descriptor_len, Heap::kOld));
265 const Smi& arg_count = Smi::Handle(Smi::New(num_arguments)); 265 const Smi& arg_count = Smi::Handle(Smi::New(num_arguments));
266 266
267 // Set total number of passed arguments. 267 // Set total number of passed arguments.
268 descriptor.SetAt(kCountIndex, arg_count); 268 descriptor.SetAt(kCountIndex, arg_count);
269 269
270 // Set number of positional arguments. 270 // Set number of positional arguments.
271 descriptor.SetAt(kPositionalCountIndex, arg_count); 271 descriptor.SetAt(kPositionalCountIndex, arg_count);
272 272
273 // Set terminating null. 273 // Set terminating null.
274 descriptor.SetAt((descriptor_len - 1), Object::Handle()); 274 descriptor.SetAt((descriptor_len - 1), Object::null_object());
275 275
276 // Share the immutable descriptor when possible by canonicalizing it. 276 // Share the immutable descriptor when possible by canonicalizing it.
277 descriptor.MakeImmutable(); 277 descriptor.MakeImmutable();
278 if (canonicalize) { 278 if (canonicalize) {
279 descriptor ^= descriptor.CheckAndCanonicalize(NULL); 279 descriptor ^= descriptor.CheckAndCanonicalize(NULL);
280 } 280 }
281 ASSERT(!descriptor.IsNull()); 281 ASSERT(!descriptor.IsNull());
282 return descriptor.raw(); 282 return descriptor.raw();
283 } 283 }
284 284
(...skipping 192 matching lines...) Expand 10 before | Expand all | Expand 10 after
477 String::Handle(Field::GetterName(Symbols::_id())))); 477 String::Handle(Field::GetterName(Symbols::_id()))));
478 const Function& func = Function::Handle(cls.LookupDynamicFunction(func_name)); 478 const Function& func = Function::Handle(cls.LookupDynamicFunction(func_name));
479 ASSERT(!func.IsNull()); 479 ASSERT(!func.IsNull());
480 const Array& args = Array::Handle(Array::New(1)); 480 const Array& args = Array::Handle(Array::New(1));
481 args.SetAt(0, port); 481 args.SetAt(0, port);
482 return DartEntry::InvokeFunction(func, args); 482 return DartEntry::InvokeFunction(func, args);
483 } 483 }
484 484
485 485
486 } // namespace dart 486 } // namespace dart
OLDNEW
« no previous file with comments | « runtime/vm/dart_api_impl.cc ('k') | runtime/vm/flow_graph_compiler.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698