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

Side by Side Diff: runtime/vm/object.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/object.h ('k') | runtime/vm/object_test.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) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, 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/object.h" 5 #include "vm/object.h"
6 6
7 #include "include/dart_api.h" 7 #include "include/dart_api.h"
8 #include "platform/assert.h" 8 #include "platform/assert.h"
9 #include "vm/assembler.h" 9 #include "vm/assembler.h"
10 #include "vm/cpu.h" 10 #include "vm/cpu.h"
(...skipping 12840 matching lines...) Expand 10 before | Expand all | Expand 10 after
12851 for (intptr_t i = 0; i < param_values.Length(); i++) { 12851 for (intptr_t i = 0; i < param_values.Length(); i++) {
12852 param = param_values.At(i); 12852 param = param_values.At(i);
12853 args.SetAt(i + 1, param); 12853 args.SetAt(i + 1, param);
12854 } 12854 }
12855 const Object& result = 12855 const Object& result =
12856 Object::Handle(DartEntry::InvokeFunction(eval_func, args)); 12856 Object::Handle(DartEntry::InvokeFunction(eval_func, args));
12857 return result.raw(); 12857 return result.raw();
12858 } 12858 }
12859 12859
12860 12860
12861 RawObject* Instance::HashCode() const {
12862 // TODO(koda): Optimize for all builtin classes and all classes
12863 // that do not override hashCode.
12864 return DartLibraryCalls::HashCode(*this);
12865 }
12866
12861 12867
12862 bool Instance::CanonicalizeEquals(const Instance& other) const { 12868 bool Instance::CanonicalizeEquals(const Instance& other) const {
12863 if (this->raw() == other.raw()) { 12869 if (this->raw() == other.raw()) {
12864 return true; // "===". 12870 return true; // "===".
12865 } 12871 }
12866 12872
12867 if (other.IsNull() || (this->clazz() != other.clazz())) { 12873 if (other.IsNull() || (this->clazz() != other.clazz())) {
12868 return false; 12874 return false;
12869 } 12875 }
12870 12876
(...skipping 6206 matching lines...) Expand 10 before | Expand all | Expand 10 after
19077 return tag_label.ToCString(); 19083 return tag_label.ToCString();
19078 } 19084 }
19079 19085
19080 19086
19081 void UserTag::PrintJSONImpl(JSONStream* stream, bool ref) const { 19087 void UserTag::PrintJSONImpl(JSONStream* stream, bool ref) const {
19082 Instance::PrintJSONImpl(stream, ref); 19088 Instance::PrintJSONImpl(stream, ref);
19083 } 19089 }
19084 19090
19085 19091
19086 } // namespace dart 19092 } // namespace dart
OLDNEW
« no previous file with comments | « runtime/vm/object.h ('k') | runtime/vm/object_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698