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

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

Issue 243133004: Check for class id overflow to exit rather than crash. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 6 years, 8 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
« runtime/vm/class_table.cc ('K') | « runtime/vm/class_table.cc ('k') | 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 #ifndef VM_OBJECT_H_ 5 #ifndef VM_OBJECT_H_
6 #define VM_OBJECT_H_ 6 #define VM_OBJECT_H_
7 7
8 #include "include/dart_api.h" 8 #include "include/dart_api.h"
9 #include "platform/assert.h" 9 #include "platform/assert.h"
10 #include "platform/utils.h" 10 #include "platform/utils.h"
(...skipping 673 matching lines...) Expand 10 before | Expand all | Expand 10 after
684 (!Utils::IsAligned((value * kWordSize), kObjectAlignment) && 684 (!Utils::IsAligned((value * kWordSize), kObjectAlignment) &&
685 ((value + 1) == raw_ptr()->instance_size_in_words_))); 685 ((value + 1) == raw_ptr()->instance_size_in_words_)));
686 raw_ptr()->next_field_offset_in_words_ = value; 686 raw_ptr()->next_field_offset_in_words_ = value;
687 } 687 }
688 688
689 cpp_vtable handle_vtable() const { return raw_ptr()->handle_vtable_; } 689 cpp_vtable handle_vtable() const { return raw_ptr()->handle_vtable_; }
690 void set_handle_vtable(cpp_vtable value) const { 690 void set_handle_vtable(cpp_vtable value) const {
691 raw_ptr()->handle_vtable_ = value; 691 raw_ptr()->handle_vtable_ = value;
692 } 692 }
693 693
694 static bool is_valid_id(intptr_t value) {
695 return RawObject::ClassIdTag::is_valid(value);
696 }
694 intptr_t id() const { return raw_ptr()->id_; } 697 intptr_t id() const { return raw_ptr()->id_; }
695 void set_id(intptr_t value) const { 698 void set_id(intptr_t value) const {
699 ASSERT(is_valid_id(value));
696 raw_ptr()->id_ = value; 700 raw_ptr()->id_ = value;
697 } 701 }
698 702
699 RawString* Name() const; 703 RawString* Name() const;
700 RawString* UserVisibleName() const; 704 RawString* UserVisibleName() const;
701 705
702 virtual RawString* DictionaryName() const { return Name(); } 706 virtual RawString* DictionaryName() const { return Name(); }
703 707
704 RawScript* script() const { return raw_ptr()->script_; } 708 RawScript* script() const { return raw_ptr()->script_; }
705 void set_script(const Script& value) const; 709 void set_script(const Script& value) const;
(...skipping 6124 matching lines...) Expand 10 before | Expand all | Expand 10 after
6830 6834
6831 6835
6832 RawObject* MegamorphicCache::GetTargetFunction(const Array& array, 6836 RawObject* MegamorphicCache::GetTargetFunction(const Array& array,
6833 intptr_t index) { 6837 intptr_t index) {
6834 return array.At((index * kEntryLength) + kTargetFunctionIndex); 6838 return array.At((index * kEntryLength) + kTargetFunctionIndex);
6835 } 6839 }
6836 6840
6837 } // namespace dart 6841 } // namespace dart
6838 6842
6839 #endif // VM_OBJECT_H_ 6843 #endif // VM_OBJECT_H_
OLDNEW
« runtime/vm/class_table.cc ('K') | « runtime/vm/class_table.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698