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

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

Issue 1391433002: When a snapshot is generated on a 64 bit architecture and then read into a 32 bit architecture, val… (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 5 years, 2 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 | « no previous file | no next file » | 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 14437 matching lines...) Expand 10 before | Expand all | Expand 10 after
14448 14448
14449 14449
14450 RawInstance* Instance::CheckAndCanonicalize(const char** error_str) const { 14450 RawInstance* Instance::CheckAndCanonicalize(const char** error_str) const {
14451 ASSERT(!IsNull()); 14451 ASSERT(!IsNull());
14452 if (this->IsCanonical()) { 14452 if (this->IsCanonical()) {
14453 return this->raw(); 14453 return this->raw();
14454 } 14454 }
14455 if (!CheckAndCanonicalizeFields(error_str)) { 14455 if (!CheckAndCanonicalizeFields(error_str)) {
14456 return Instance::null(); 14456 return Instance::null();
14457 } 14457 }
14458 Instance& result = Instance::Handle(); 14458 Thread* thread = Thread::Current();
14459 const Class& cls = Class::Handle(this->clazz()); 14459 Zone* zone = thread->zone();
14460 Array& constants = Array::Handle(cls.constants()); 14460 Isolate* isolate = thread->isolate();
14461 Instance& result = Instance::Handle(zone);
14462 const Class& cls = Class::Handle(zone, this->clazz());
14463 Array& constants = Array::Handle(zone, cls.constants());
14461 const intptr_t constants_len = constants.Length(); 14464 const intptr_t constants_len = constants.Length();
14462 // Linear search to see whether this value is already present in the 14465 // Linear search to see whether this value is already present in the
14463 // list of canonicalized constants. 14466 // list of canonicalized constants.
14464 intptr_t index = 0; 14467 intptr_t index = 0;
14465 while (index < constants_len) { 14468 while (index < constants_len) {
14466 result ^= constants.At(index); 14469 result ^= constants.At(index);
14467 if (result.IsNull()) { 14470 if (result.IsNull()) {
14468 break; 14471 break;
14469 } 14472 }
14470 if (this->CanonicalizeEquals(result)) { 14473 if (this->CanonicalizeEquals(result)) {
14471 ASSERT(result.IsCanonical()); 14474 ASSERT(result.IsCanonical());
14472 return result.raw(); 14475 return result.raw();
14473 } 14476 }
14474 index++; 14477 index++;
14475 } 14478 }
14476 // The value needs to be added to the list. Grow the list if 14479 // The value needs to be added to the list. Grow the list if
14477 // it is full. 14480 // it is full.
14478 result ^= this->raw(); 14481 result ^= this->raw();
14479 if (result.IsNew()) { 14482 if (result.IsNew() ||
14483 (result.InVMHeap() && (isolate != Dart::vm_isolate()))) {
14480 // Create a canonical object in old space. 14484 // Create a canonical object in old space.
srdjan 2015/10/05 18:06:36 Maybe comment here briefly why this is necessary.
siva 2015/10/05 21:51:05 Done.
14481 result ^= Object::Clone(result, Heap::kOld); 14485 result ^= Object::Clone(result, Heap::kOld);
14482 } 14486 }
14483 ASSERT(result.IsOld()); 14487 ASSERT(result.IsOld());
14484 cls.InsertCanonicalConstant(index, result); 14488 cls.InsertCanonicalConstant(index, result);
14485 result.SetCanonical(); 14489 result.SetCanonical();
14486 return result.raw(); 14490 return result.raw();
14487 } 14491 }
14488 14492
14489 14493
14490 RawType* Instance::GetType() const { 14494 RawType* Instance::GetType() const {
(...skipping 7000 matching lines...) Expand 10 before | Expand all | Expand 10 after
21491 return tag_label.ToCString(); 21495 return tag_label.ToCString();
21492 } 21496 }
21493 21497
21494 21498
21495 void UserTag::PrintJSONImpl(JSONStream* stream, bool ref) const { 21499 void UserTag::PrintJSONImpl(JSONStream* stream, bool ref) const {
21496 Instance::PrintJSONImpl(stream, ref); 21500 Instance::PrintJSONImpl(stream, ref);
21497 } 21501 }
21498 21502
21499 21503
21500 } // namespace dart 21504 } // namespace dart
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698