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

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

Issue 1944213002: Support for taking full snapshots from 'dart', not just 'dart_bootstrap'. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 4 years, 7 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/dart_api_message.h ('k') | runtime/vm/object.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/dart_api_message.h" 5 #include "vm/dart_api_message.h"
6 #include "vm/object.h" 6 #include "vm/object.h"
7 #include "vm/snapshot_ids.h" 7 #include "vm/snapshot_ids.h"
8 #include "vm/symbols.h" 8 #include "vm/symbols.h"
9 #include "vm/unicode.h" 9 #include "vm/unicode.h"
10 10
(...skipping 398 matching lines...) Expand 10 before | Expand all | Expand 10 after
409 for (int i = 0; i < len; i++) { 409 for (int i = 0; i < len; i++) {
410 value->value.as_array.values[i] = ReadObjectRef(); 410 value->value.as_array.values[i] = ReadObjectRef();
411 } 411 }
412 return value; 412 return value;
413 } 413 }
414 414
415 return ReadInternalVMObject(class_id, object_id); 415 return ReadInternalVMObject(class_id, object_id);
416 } 416 }
417 417
418 418
419 Dart_CObject* ApiMessageReader::ReadVMSymbol(intptr_t object_id) { 419 Dart_CObject* ApiMessageReader::ReadPredefinedSymbol(intptr_t object_id) {
420 ASSERT(Symbols::IsVMSymbolId(object_id)); 420 ASSERT(Symbols::IsPredefinedSymbolId(object_id));
421 intptr_t symbol_id = object_id - kMaxPredefinedObjectIds; 421 intptr_t symbol_id = object_id - kMaxPredefinedObjectIds;
422 Dart_CObject* object; 422 Dart_CObject* object;
423 if (vm_symbol_references_ != NULL && 423 if (vm_symbol_references_ != NULL &&
424 (object = vm_symbol_references_[symbol_id]) != NULL) { 424 (object = vm_symbol_references_[symbol_id]) != NULL) {
425 return object; 425 return object;
426 } 426 }
427 427
428 if (vm_symbol_references_ == NULL) { 428 if (vm_symbol_references_ == NULL) {
429 intptr_t size = 429 intptr_t size =
430 (sizeof(*vm_symbol_references_) * Symbols::kMaxPredefinedId); 430 (sizeof(*vm_symbol_references_) * Symbols::kMaxPredefinedId);
431 vm_symbol_references_ = 431 vm_symbol_references_ =
432 reinterpret_cast<Dart_CObject**>(allocator(size)); 432 reinterpret_cast<Dart_CObject**>(allocator(size));
433 memset(vm_symbol_references_, 0, size); 433 memset(vm_symbol_references_, 0, size);
434 } 434 }
435 435
436 object = CreateDartCObjectString(Symbols::GetVMSymbol(object_id)); 436 object = CreateDartCObjectString(Symbols::GetPredefinedSymbol(object_id));
437 ASSERT(vm_symbol_references_[symbol_id] == NULL); 437 ASSERT(vm_symbol_references_[symbol_id] == NULL);
438 vm_symbol_references_[symbol_id] = object; 438 vm_symbol_references_[symbol_id] = object;
439 return object; 439 return object;
440 } 440 }
441 441
442 442
443 intptr_t ApiMessageReader::NextAvailableObjectId() const { 443 intptr_t ApiMessageReader::NextAvailableObjectId() const {
444 return backward_references_.length() + kMaxPredefinedObjectIds; 444 return backward_references_.length() + kMaxPredefinedObjectIds;
445 } 445 }
446 446
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after
540 } 540 }
541 if (object_id == kTrueValue) { 541 if (object_id == kTrueValue) {
542 return AllocateDartCObjectBool(true); 542 return AllocateDartCObjectBool(true);
543 } 543 }
544 if (object_id == kFalseValue) { 544 if (object_id == kFalseValue) {
545 return AllocateDartCObjectBool(false); 545 return AllocateDartCObjectBool(false);
546 } 546 }
547 if (object_id == kDoubleObject) { 547 if (object_id == kDoubleObject) {
548 return AllocateDartCObjectDouble(ReadDouble()); 548 return AllocateDartCObjectDouble(ReadDouble());
549 } 549 }
550 if (Symbols::IsVMSymbolId(object_id)) { 550 if (Symbols::IsPredefinedSymbolId(object_id)) {
551 return ReadVMSymbol(object_id); 551 return ReadPredefinedSymbol(object_id);
552 } 552 }
553 // No other VM isolate objects are supported. 553 // No other VM isolate objects are supported.
554 return AllocateDartCObjectNull(); 554 return AllocateDartCObjectNull();
555 } 555 }
556 556
557 557
558 Dart_CObject* ApiMessageReader::ReadInternalVMObject(intptr_t class_id, 558 Dart_CObject* ApiMessageReader::ReadInternalVMObject(intptr_t class_id,
559 intptr_t object_id) { 559 intptr_t object_id) {
560 switch (class_id) { 560 switch (class_id) {
561 case kClassCid: { 561 case kClassCid: {
(...skipping 775 matching lines...) Expand 10 before | Expand all | Expand 10 after
1337 if (!success) { 1337 if (!success) {
1338 UnmarkAllCObjects(object); 1338 UnmarkAllCObjects(object);
1339 return false; 1339 return false;
1340 } 1340 }
1341 } 1341 }
1342 UnmarkAllCObjects(object); 1342 UnmarkAllCObjects(object);
1343 return true; 1343 return true;
1344 } 1344 }
1345 1345
1346 } // namespace dart 1346 } // namespace dart
OLDNEW
« no previous file with comments | « runtime/vm/dart_api_message.h ('k') | runtime/vm/object.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698