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

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

Issue 10796004: Consolidate a few fields in RawFunction using bitfields. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 8 years, 4 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 | Annotate | Revision Log
« no previous file with comments | « runtime/vm/raw_object.h ('k') | runtime/vm/runtime_entry_test.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/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/symbols.h" 9 #include "vm/symbols.h"
10 #include "vm/visitor.h" 10 #include "vm/visitor.h"
(...skipping 416 matching lines...) Expand 10 before | Expand all | Expand 10 after
427 func.set_end_token_pos(reader->ReadIntptrValue()); 427 func.set_end_token_pos(reader->ReadIntptrValue());
428 func.set_num_fixed_parameters(reader->ReadIntptrValue()); 428 func.set_num_fixed_parameters(reader->ReadIntptrValue());
429 func.set_num_optional_parameters(reader->ReadIntptrValue()); 429 func.set_num_optional_parameters(reader->ReadIntptrValue());
430 func.set_usage_counter(reader->ReadIntptrValue()); 430 func.set_usage_counter(reader->ReadIntptrValue());
431 func.set_deoptimization_counter(reader->ReadIntptrValue()); 431 func.set_deoptimization_counter(reader->ReadIntptrValue());
432 func.set_kind(static_cast<RawFunction::Kind >(reader->ReadIntptrValue())); 432 func.set_kind(static_cast<RawFunction::Kind >(reader->ReadIntptrValue()));
433 func.set_is_static(reader->Read<bool>()); 433 func.set_is_static(reader->Read<bool>());
434 func.set_is_const(reader->Read<bool>()); 434 func.set_is_const(reader->Read<bool>());
435 func.set_is_optimizable(reader->Read<bool>()); 435 func.set_is_optimizable(reader->Read<bool>());
436 func.set_is_native(reader->Read<bool>()); 436 func.set_is_native(reader->Read<bool>());
437 func.set_is_abstract(reader->Read<bool>());
437 438
438 // Set all the object fields. 439 // Set all the object fields.
439 // TODO(5411462): Need to assert No GC can happen here, even though 440 // TODO(5411462): Need to assert No GC can happen here, even though
440 // allocations may happen. 441 // allocations may happen.
441 intptr_t num_flds = (func.raw()->to() - func.raw()->from()); 442 intptr_t num_flds = (func.raw()->to() - func.raw()->from());
442 for (intptr_t i = 0; i <= num_flds; i++) { 443 for (intptr_t i = 0; i <= num_flds; i++) {
443 *(func.raw()->from() + i) = reader->ReadObjectRef(); 444 *(func.raw()->from() + i) = reader->ReadObjectRef();
444 } 445 }
445 446
446 return func.raw(); 447 return func.raw();
(...skipping 14 matching lines...) Expand all
461 writer->WriteObjectHeader(Object::kFunctionClass, 462 writer->WriteObjectHeader(Object::kFunctionClass,
462 writer->GetObjectTags(this)); 463 writer->GetObjectTags(this));
463 464
464 // Write out all the non object fields. 465 // Write out all the non object fields.
465 writer->WriteIntptrValue(ptr()->token_pos_); 466 writer->WriteIntptrValue(ptr()->token_pos_);
466 writer->WriteIntptrValue(ptr()->end_token_pos_); 467 writer->WriteIntptrValue(ptr()->end_token_pos_);
467 writer->WriteIntptrValue(ptr()->num_fixed_parameters_); 468 writer->WriteIntptrValue(ptr()->num_fixed_parameters_);
468 writer->WriteIntptrValue(ptr()->num_optional_parameters_); 469 writer->WriteIntptrValue(ptr()->num_optional_parameters_);
469 writer->WriteIntptrValue(ptr()->usage_counter_); 470 writer->WriteIntptrValue(ptr()->usage_counter_);
470 writer->WriteIntptrValue(ptr()->deoptimization_counter_); 471 writer->WriteIntptrValue(ptr()->deoptimization_counter_);
471 writer->WriteIntptrValue(ptr()->kind_); 472 writer->WriteIntptrValue(GetKind());
472 writer->Write<bool>(ptr()->is_static_); 473 writer->Write<bool>(IsStatic());
473 writer->Write<bool>(ptr()->is_const_); 474 writer->Write<bool>(IsConst());
474 writer->Write<bool>(ptr()->is_optimizable_); 475 writer->Write<bool>(IsOptimizable());
475 writer->Write<bool>(ptr()->is_native_); 476 writer->Write<bool>(IsNative());
477 writer->Write<bool>(IsAbstract());
476 478
477 // Write out all the object pointer fields. 479 // Write out all the object pointer fields.
478 SnapshotWriterVisitor visitor(writer); 480 SnapshotWriterVisitor visitor(writer);
479 visitor.VisitPointers(from(), to()); 481 visitor.VisitPointers(from(), to());
480 } 482 }
481 483
482 484
483 RawField* Field::ReadFrom(SnapshotReader* reader, 485 RawField* Field::ReadFrom(SnapshotReader* reader,
484 intptr_t object_id, 486 intptr_t object_id,
485 intptr_t tags, 487 intptr_t tags,
(...skipping 1503 matching lines...) Expand 10 before | Expand all | Expand 10 after
1989 writer->Write<RawObject*>(ptr()->num_bracket_expressions_); 1991 writer->Write<RawObject*>(ptr()->num_bracket_expressions_);
1990 writer->WriteObjectImpl(ptr()->pattern_); 1992 writer->WriteObjectImpl(ptr()->pattern_);
1991 writer->WriteIntptrValue(ptr()->type_); 1993 writer->WriteIntptrValue(ptr()->type_);
1992 writer->WriteIntptrValue(ptr()->flags_); 1994 writer->WriteIntptrValue(ptr()->flags_);
1993 1995
1994 // Do not write out the data part which is native. 1996 // Do not write out the data part which is native.
1995 } 1997 }
1996 1998
1997 1999
1998 } // namespace dart 2000 } // namespace dart
OLDNEW
« no previous file with comments | « runtime/vm/raw_object.h ('k') | runtime/vm/runtime_entry_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698