Chromium Code Reviews| 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/bigint_operations.h" | 5 #include "vm/bigint_operations.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/visitor.h" | 9 #include "vm/visitor.h" |
| 10 | 10 |
| (...skipping 415 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 426 func.set_end_token_pos(reader->ReadIntptrValue()); | 426 func.set_end_token_pos(reader->ReadIntptrValue()); |
| 427 func.set_num_fixed_parameters(reader->ReadIntptrValue()); | 427 func.set_num_fixed_parameters(reader->ReadIntptrValue()); |
| 428 func.set_num_optional_parameters(reader->ReadIntptrValue()); | 428 func.set_num_optional_parameters(reader->ReadIntptrValue()); |
| 429 func.set_usage_counter(reader->ReadIntptrValue()); | 429 func.set_usage_counter(reader->ReadIntptrValue()); |
| 430 func.set_deoptimization_counter(reader->ReadIntptrValue()); | 430 func.set_deoptimization_counter(reader->ReadIntptrValue()); |
| 431 func.set_kind(static_cast<RawFunction::Kind >(reader->ReadIntptrValue())); | 431 func.set_kind(static_cast<RawFunction::Kind >(reader->ReadIntptrValue())); |
| 432 func.set_is_static(reader->Read<bool>()); | 432 func.set_is_static(reader->Read<bool>()); |
| 433 func.set_is_const(reader->Read<bool>()); | 433 func.set_is_const(reader->Read<bool>()); |
| 434 func.set_is_optimizable(reader->Read<bool>()); | 434 func.set_is_optimizable(reader->Read<bool>()); |
| 435 func.set_is_native(reader->Read<bool>()); | 435 func.set_is_native(reader->Read<bool>()); |
| 436 func.set_is_abstract(reader->Read<bool>()); | |
| 436 | 437 |
| 437 // Set all the object fields. | 438 // Set all the object fields. |
| 438 // TODO(5411462): Need to assert No GC can happen here, even though | 439 // TODO(5411462): Need to assert No GC can happen here, even though |
| 439 // allocations may happen. | 440 // allocations may happen. |
| 440 intptr_t num_flds = (func.raw()->to() - func.raw()->from()); | 441 intptr_t num_flds = (func.raw()->to() - func.raw()->from()); |
| 441 for (intptr_t i = 0; i <= num_flds; i++) { | 442 for (intptr_t i = 0; i <= num_flds; i++) { |
| 442 *(func.raw()->from() + i) = reader->ReadObjectRef(); | 443 *(func.raw()->from() + i) = reader->ReadObjectRef(); |
| 443 } | 444 } |
| 444 | 445 |
| 445 return func.raw(); | 446 return func.raw(); |
| (...skipping 14 matching lines...) Expand all Loading... | |
| 460 writer->WriteObjectHeader(Object::kFunctionClass, | 461 writer->WriteObjectHeader(Object::kFunctionClass, |
| 461 writer->GetObjectTags(this)); | 462 writer->GetObjectTags(this)); |
| 462 | 463 |
| 463 // Write out all the non object fields. | 464 // Write out all the non object fields. |
| 464 writer->WriteIntptrValue(ptr()->token_pos_); | 465 writer->WriteIntptrValue(ptr()->token_pos_); |
| 465 writer->WriteIntptrValue(ptr()->end_token_pos_); | 466 writer->WriteIntptrValue(ptr()->end_token_pos_); |
| 466 writer->WriteIntptrValue(ptr()->num_fixed_parameters_); | 467 writer->WriteIntptrValue(ptr()->num_fixed_parameters_); |
| 467 writer->WriteIntptrValue(ptr()->num_optional_parameters_); | 468 writer->WriteIntptrValue(ptr()->num_optional_parameters_); |
| 468 writer->WriteIntptrValue(ptr()->usage_counter_); | 469 writer->WriteIntptrValue(ptr()->usage_counter_); |
| 469 writer->WriteIntptrValue(ptr()->deoptimization_counter_); | 470 writer->WriteIntptrValue(ptr()->deoptimization_counter_); |
| 470 writer->WriteIntptrValue(ptr()->kind_); | 471 writer->WriteIntptrValue(GetKind()); |
|
turnidge
2012/07/18 04:57:15
Or... I could just write out kind_tag_ directly as
| |
| 471 writer->Write<bool>(ptr()->is_static_); | 472 writer->Write<bool>(IsStatic()); |
| 472 writer->Write<bool>(ptr()->is_const_); | 473 writer->Write<bool>(IsConst()); |
| 473 writer->Write<bool>(ptr()->is_optimizable_); | 474 writer->Write<bool>(IsOptimizable()); |
| 474 writer->Write<bool>(ptr()->is_native_); | 475 writer->Write<bool>(IsNative()); |
| 476 writer->Write<bool>(IsAbstract()); | |
| 475 | 477 |
| 476 // Write out all the object pointer fields. | 478 // Write out all the object pointer fields. |
| 477 SnapshotWriterVisitor visitor(writer); | 479 SnapshotWriterVisitor visitor(writer); |
| 478 visitor.VisitPointers(from(), to()); | 480 visitor.VisitPointers(from(), to()); |
| 479 } | 481 } |
| 480 | 482 |
| 481 | 483 |
| 482 RawField* Field::ReadFrom(SnapshotReader* reader, | 484 RawField* Field::ReadFrom(SnapshotReader* reader, |
| 483 intptr_t object_id, | 485 intptr_t object_id, |
| 484 intptr_t tags, | 486 intptr_t tags, |
| (...skipping 1501 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1986 writer->Write<RawObject*>(ptr()->num_bracket_expressions_); | 1988 writer->Write<RawObject*>(ptr()->num_bracket_expressions_); |
| 1987 writer->WriteObjectImpl(ptr()->pattern_); | 1989 writer->WriteObjectImpl(ptr()->pattern_); |
| 1988 writer->WriteIntptrValue(ptr()->type_); | 1990 writer->WriteIntptrValue(ptr()->type_); |
| 1989 writer->WriteIntptrValue(ptr()->flags_); | 1991 writer->WriteIntptrValue(ptr()->flags_); |
| 1990 | 1992 |
| 1991 // Do not write out the data part which is native. | 1993 // Do not write out the data part which is native. |
| 1992 } | 1994 } |
| 1993 | 1995 |
| 1994 | 1996 |
| 1995 } // namespace dart | 1997 } // namespace dart |
| OLD | NEW |