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

Side by Side Diff: vm/object.h

Issue 12035087: Adapt operator= and operator^= of Smi to be similar to other internal VM classes. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/runtime/
Patch Set: Created 7 years, 11 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 | « no previous file | 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 3702 matching lines...) Expand 10 before | Expand all | Expand 10 after
3713 static bool IsValid(intptr_t value) { 3713 static bool IsValid(intptr_t value) {
3714 return (value >= kMinValue) && (value <= kMaxValue); 3714 return (value >= kMinValue) && (value <= kMaxValue);
3715 } 3715 }
3716 3716
3717 static bool IsValid64(int64_t value) { 3717 static bool IsValid64(int64_t value) {
3718 return (value >= kMinValue) && (value <= kMaxValue); 3718 return (value >= kMinValue) && (value <= kMaxValue);
3719 } 3719 }
3720 3720
3721 RawInteger* ShiftOp(Token::Kind kind, const Smi& other) const; 3721 RawInteger* ShiftOp(Token::Kind kind, const Smi& other) const;
3722 3722
3723 void operator=(RawSmi* value) {
3724 raw_ = value;
3725 CHECK_HANDLE();
3726 }
3727 void operator^=(RawObject* value) {
3728 raw_ = value;
3729 CHECK_HANDLE();
3730 }
3731
3723 private: 3732 private:
3724 static intptr_t ValueFromRaw(uword raw_value) { 3733 static intptr_t ValueFromRaw(uword raw_value) {
3725 intptr_t value = raw_value; 3734 intptr_t value = raw_value;
3726 ASSERT((value & kSmiTagMask) == kSmiTag); 3735 ASSERT((value & kSmiTagMask) == kSmiTag);
3727 return (value >> kSmiTagShift); 3736 return (value >> kSmiTagShift);
3728 } 3737 }
3729 static cpp_vtable handle_vtable_; 3738 static cpp_vtable handle_vtable_;
3730 3739
3731 OBJECT_IMPLEMENTATION(Smi, Integer); 3740 Smi() : Integer() {}
3741 BASE_OBJECT_IMPLEMENTATION(Smi, Integer);
3742
3732 friend class Api; // For ValueFromRaw 3743 friend class Api; // For ValueFromRaw
3733 friend class Class; 3744 friend class Class;
3734 friend class Object; 3745 friend class Object;
3735 }; 3746 };
3736 3747
3737 3748
3738 class Mint : public Integer { 3749 class Mint : public Integer {
3739 public: 3750 public:
3740 static const intptr_t kBits = 63; // 64-th bit is sign. 3751 static const intptr_t kBits = 63; // 64-th bit is sign.
3741 static const int64_t kMaxValue = 3752 static const int64_t kMaxValue =
(...skipping 2568 matching lines...) Expand 10 before | Expand all | Expand 10 after
6310 6321
6311 6322
6312 RawObject* MegamorphicCache::GetTargetFunction(const Array& array, 6323 RawObject* MegamorphicCache::GetTargetFunction(const Array& array,
6313 intptr_t index) { 6324 intptr_t index) {
6314 return array.At((index * kEntryLength) + kTargetFunctionIndex); 6325 return array.At((index * kEntryLength) + kTargetFunctionIndex);
6315 } 6326 }
6316 6327
6317 } // namespace dart 6328 } // namespace dart
6318 6329
6319 #endif // VM_OBJECT_H_ 6330 #endif // VM_OBJECT_H_
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698