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

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

Issue 358723002: Add Instance::HashCode that matches hashCode. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 6 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 | Annotate | Revision Log
« no previous file with comments | « runtime/vm/dart_entry.h ('k') | runtime/vm/object.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) 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/class_finalizer.h" 7 #include "vm/class_finalizer.h"
8 #include "vm/code_generator.h" 8 #include "vm/code_generator.h"
9 #include "vm/compiler.h" 9 #include "vm/compiler.h"
10 #include "vm/debugger.h" 10 #include "vm/debugger.h"
(...skipping 344 matching lines...) Expand 10 before | Expand all | Expand 10 after
355 ASSERT(!function.IsNull()); 355 ASSERT(!function.IsNull());
356 const Array& args = Array::Handle(Array::New(kNumArguments)); 356 const Array& args = Array::Handle(Array::New(kNumArguments));
357 args.SetAt(0, receiver); 357 args.SetAt(0, receiver);
358 const Object& result = Object::Handle(DartEntry::InvokeFunction(function, 358 const Object& result = Object::Handle(DartEntry::InvokeFunction(function,
359 args)); 359 args));
360 ASSERT(result.IsInstance() || result.IsError()); 360 ASSERT(result.IsInstance() || result.IsError());
361 return result.raw(); 361 return result.raw();
362 } 362 }
363 363
364 364
365 RawObject* DartLibraryCalls::HashCode(const Instance& receiver) {
366 const int kNumArguments = 1; // Receiver.
367 ArgumentsDescriptor args_desc(
368 Array::Handle(ArgumentsDescriptor::New(kNumArguments)));
369 const Function& function = Function::Handle(
370 Resolver::ResolveDynamic(receiver,
371 Symbols::hashCode(),
372 args_desc));
373 ASSERT(!function.IsNull());
374 const Array& args = Array::Handle(Array::New(kNumArguments));
375 args.SetAt(0, receiver);
376 const Object& result = Object::Handle(DartEntry::InvokeFunction(function,
377 args));
378 ASSERT(result.IsInstance() || result.IsError());
379 return result.raw();
380 }
381
382
365 RawObject* DartLibraryCalls::Equals(const Instance& left, 383 RawObject* DartLibraryCalls::Equals(const Instance& left,
366 const Instance& right) { 384 const Instance& right) {
367 const int kNumArguments = 2; 385 const int kNumArguments = 2;
368 ArgumentsDescriptor args_desc( 386 ArgumentsDescriptor args_desc(
369 Array::Handle(ArgumentsDescriptor::New(kNumArguments))); 387 Array::Handle(ArgumentsDescriptor::New(kNumArguments)));
370 const Function& function = Function::Handle( 388 const Function& function = Function::Handle(
371 Resolver::ResolveDynamic(left, 389 Resolver::ResolveDynamic(left,
372 Symbols::EqualOperator(), 390 Symbols::EqualOperator(),
373 args_desc)); 391 args_desc));
374 ASSERT(!function.IsNull()); 392 ASSERT(!function.IsNull());
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after
463 const Array& args = Array::Handle(Array::New(kNumArguments)); 481 const Array& args = Array::Handle(Array::New(kNumArguments));
464 args.SetAt(0, map); 482 args.SetAt(0, map);
465 args.SetAt(1, key); 483 args.SetAt(1, key);
466 args.SetAt(2, value); 484 args.SetAt(2, value);
467 const Object& result = Object::Handle(DartEntry::InvokeFunction(function, 485 const Object& result = Object::Handle(DartEntry::InvokeFunction(function,
468 args)); 486 args));
469 return result.raw(); 487 return result.raw();
470 } 488 }
471 489
472 } // namespace dart 490 } // namespace dart
OLDNEW
« no previous file with comments | « runtime/vm/dart_entry.h ('k') | runtime/vm/object.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698