| OLD | NEW |
| 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/native_entry.h" | 5 #include "vm/native_entry.h" |
| 6 #include "vm/object.h" | 6 #include "vm/object.h" |
| 7 #include "vm/object_store.h" | 7 #include "vm/object_store.h" |
| 8 #include "vm/snapshot.h" | 8 #include "vm/snapshot.h" |
| 9 #include "vm/stub_code.h" | 9 #include "vm/stub_code.h" |
| 10 #include "vm/symbols.h" | 10 #include "vm/symbols.h" |
| (...skipping 647 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 658 ASSERT(reader != NULL); | 658 ASSERT(reader != NULL); |
| 659 ASSERT((kind == Snapshot::kScript) || (kind == Snapshot::kFull)); | 659 ASSERT((kind == Snapshot::kScript) || (kind == Snapshot::kFull)); |
| 660 | 660 |
| 661 bool is_in_fullsnapshot = reader->Read<bool>(); | 661 bool is_in_fullsnapshot = reader->Read<bool>(); |
| 662 if ((kind == Snapshot::kFull) || !is_in_fullsnapshot) { | 662 if ((kind == Snapshot::kFull) || !is_in_fullsnapshot) { |
| 663 // Allocate function object. | 663 // Allocate function object. |
| 664 Function& func = Function::ZoneHandle( | 664 Function& func = Function::ZoneHandle( |
| 665 reader->zone(), NEW_OBJECT(Function)); | 665 reader->zone(), NEW_OBJECT(Function)); |
| 666 reader->AddBackRef(object_id, &func, kIsDeserialized); | 666 reader->AddBackRef(object_id, &func, kIsDeserialized); |
| 667 | 667 |
| 668 // Set all the non object fields. | 668 // Set all the non object fields. Read the token positions now but |
| 669 func.set_token_pos(reader->Read<int32_t>()); | 669 // don't set them until after setting the kind. |
| 670 func.set_end_token_pos(reader->Read<int32_t>()); | 670 const int32_t token_pos = reader->Read<int32_t>(); |
| 671 const int32_t end_token_pos = reader->Read<uint32_t>(); |
| 671 func.set_num_fixed_parameters(reader->Read<int16_t>()); | 672 func.set_num_fixed_parameters(reader->Read<int16_t>()); |
| 672 func.set_num_optional_parameters(reader->Read<int16_t>()); | 673 func.set_num_optional_parameters(reader->Read<int16_t>()); |
| 673 func.set_kind_tag(reader->Read<uint32_t>()); | 674 func.set_kind_tag(reader->Read<uint32_t>()); |
| 675 func.set_token_pos(token_pos); |
| 676 func.set_end_token_pos(end_token_pos); |
| 674 if (reader->snapshot_code()) { | 677 if (reader->snapshot_code()) { |
| 675 func.set_usage_counter(0); | 678 func.set_usage_counter(0); |
| 676 func.set_deoptimization_counter(0); | 679 func.set_deoptimization_counter(0); |
| 677 func.set_optimized_instruction_count(0); | 680 func.set_optimized_instruction_count(0); |
| 678 func.set_optimized_call_site_count(0); | 681 func.set_optimized_call_site_count(0); |
| 679 } else { | 682 } else { |
| 680 func.set_usage_counter(reader->Read<int32_t>()); | 683 func.set_usage_counter(reader->Read<int32_t>()); |
| 681 func.set_deoptimization_counter(reader->Read<int16_t>()); | 684 func.set_deoptimization_counter(reader->Read<int16_t>()); |
| 682 func.set_optimized_instruction_count(reader->Read<uint16_t>()); | 685 func.set_optimized_instruction_count(reader->Read<uint16_t>()); |
| 683 func.set_optimized_call_site_count(reader->Read<uint16_t>()); | 686 func.set_optimized_call_site_count(reader->Read<uint16_t>()); |
| (...skipping 2830 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3514 // We do not allow objects with native fields in an isolate message. | 3517 // We do not allow objects with native fields in an isolate message. |
| 3515 writer->SetWriteException(Exceptions::kArgument, | 3518 writer->SetWriteException(Exceptions::kArgument, |
| 3516 "Illegal argument in isolate message" | 3519 "Illegal argument in isolate message" |
| 3517 " : (object is a UserTag)"); | 3520 " : (object is a UserTag)"); |
| 3518 } else { | 3521 } else { |
| 3519 UNREACHABLE(); | 3522 UNREACHABLE(); |
| 3520 } | 3523 } |
| 3521 } | 3524 } |
| 3522 | 3525 |
| 3523 } // namespace dart | 3526 } // namespace dart |
| OLD | NEW |