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

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

Issue 1151573022: Fix for issue 192 in domokit/mojo (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: add comment Created 5 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
« no previous file with comments | « runtime/vm/object.h ('k') | runtime/vm/raw_object_snapshot.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 13842 matching lines...) Expand 10 before | Expand all | Expand 10 after
13853 const intptr_t constants_len = constants.Length(); 13853 const intptr_t constants_len = constants.Length();
13854 // Linear search to see whether this value is already present in the 13854 // Linear search to see whether this value is already present in the
13855 // list of canonicalized constants. 13855 // list of canonicalized constants.
13856 intptr_t index = 0; 13856 intptr_t index = 0;
13857 while (index < constants_len) { 13857 while (index < constants_len) {
13858 result ^= constants.At(index); 13858 result ^= constants.At(index);
13859 if (result.IsNull()) { 13859 if (result.IsNull()) {
13860 break; 13860 break;
13861 } 13861 }
13862 if (this->CanonicalizeEquals(result)) { 13862 if (this->CanonicalizeEquals(result)) {
13863 ASSERT(result.IsCanonical());
13863 return result.raw(); 13864 return result.raw();
13864 } 13865 }
13865 index++; 13866 index++;
13866 } 13867 }
13867 // The value needs to be added to the list. Grow the list if 13868 // The value needs to be added to the list. Grow the list if
13868 // it is full. 13869 // it is full.
13869 result ^= this->raw(); 13870 result ^= this->raw();
13870 if (result.IsNew()) { 13871 if (result.IsNew()) {
13871 // Create a canonical object in old space. 13872 // Create a canonical object in old space.
13872 result ^= Object::Clone(result, Heap::kOld); 13873 result ^= Object::Clone(result, Heap::kOld);
(...skipping 2666 matching lines...) Expand 10 before | Expand all | Expand 10 after
16539 // Linear search to see whether this value is already present in the 16540 // Linear search to see whether this value is already present in the
16540 // list of canonicalized constants. 16541 // list of canonicalized constants.
16541 Mint& canonical_value = Mint::Handle(); 16542 Mint& canonical_value = Mint::Handle();
16542 intptr_t index = 0; 16543 intptr_t index = 0;
16543 while (index < constants_len) { 16544 while (index < constants_len) {
16544 canonical_value ^= constants.At(index); 16545 canonical_value ^= constants.At(index);
16545 if (canonical_value.IsNull()) { 16546 if (canonical_value.IsNull()) {
16546 break; 16547 break;
16547 } 16548 }
16548 if (canonical_value.value() == value) { 16549 if (canonical_value.value() == value) {
16550 ASSERT(canonical_value.IsCanonical());
16549 return canonical_value.raw(); 16551 return canonical_value.raw();
16550 } 16552 }
16551 index++; 16553 index++;
16552 } 16554 }
16553 // The value needs to be added to the constants list. Grow the list if 16555 // The value needs to be added to the constants list. Grow the list if
16554 // it is full. 16556 // it is full.
16555 canonical_value = Mint::New(value, Heap::kOld); 16557 canonical_value = Mint::New(value, Heap::kOld);
16556 cls.InsertCanonicalConstant(index, canonical_value); 16558 cls.InsertCanonicalConstant(index, canonical_value);
16557 canonical_value.SetCanonical(); 16559 canonical_value.SetCanonical();
16558 return canonical_value.raw(); 16560 return canonical_value.raw();
(...skipping 4251 matching lines...) Expand 10 before | Expand all | Expand 10 after
20810 return tag_label.ToCString(); 20812 return tag_label.ToCString();
20811 } 20813 }
20812 20814
20813 20815
20814 void UserTag::PrintJSONImpl(JSONStream* stream, bool ref) const { 20816 void UserTag::PrintJSONImpl(JSONStream* stream, bool ref) const {
20815 Instance::PrintJSONImpl(stream, ref); 20817 Instance::PrintJSONImpl(stream, ref);
20816 } 20818 }
20817 20819
20818 20820
20819 } // namespace dart 20821 } // namespace dart
OLDNEW
« no previous file with comments | « runtime/vm/object.h ('k') | runtime/vm/raw_object_snapshot.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698