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

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

Issue 266723012: Move the double isNegative test back to double.cc as it seems to cause some compile issues when it … (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 6 years, 7 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/lib/double.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 <math.h>
9
10 #include "include/dart_api.h" 8 #include "include/dart_api.h"
11 #include "platform/assert.h" 9 #include "platform/assert.h"
12 #include "platform/utils.h" 10 #include "platform/utils.h"
13 #include "vm/json_stream.h" 11 #include "vm/json_stream.h"
14 #include "vm/bitmap.h" 12 #include "vm/bitmap.h"
15 #include "vm/dart.h" 13 #include "vm/dart.h"
16 #include "vm/globals.h" 14 #include "vm/globals.h"
17 #include "vm/handles.h" 15 #include "vm/handles.h"
18 #include "vm/heap.h" 16 #include "vm/heap.h"
19 #include "vm/isolate.h" 17 #include "vm/isolate.h"
(...skipping 4770 matching lines...) Expand 10 before | Expand all | Expand 10 after
4790 static RawMixinAppType* New(); 4788 static RawMixinAppType* New();
4791 4789
4792 FINAL_HEAP_OBJECT_IMPLEMENTATION(MixinAppType, AbstractType); 4790 FINAL_HEAP_OBJECT_IMPLEMENTATION(MixinAppType, AbstractType);
4793 friend class Class; 4791 friend class Class;
4794 }; 4792 };
4795 4793
4796 4794
4797 class Number : public Instance { 4795 class Number : public Instance {
4798 public: 4796 public:
4799 // TODO(iposva): Fill in a useful Number interface. 4797 // TODO(iposva): Fill in a useful Number interface.
4800 virtual bool IsNegative() const {
4801 // Number is an abstract class.
4802 UNREACHABLE();
4803 return false;
4804 }
4805 4798
4806 private: 4799 private:
4807 OBJECT_IMPLEMENTATION(Number, Instance); 4800 OBJECT_IMPLEMENTATION(Number, Instance);
4808 friend class Class; 4801 friend class Class;
4809 }; 4802 };
4810 4803
4811 4804
4812 class Integer : public Number { 4805 class Integer : public Number {
4813 public: 4806 public:
4814 static RawInteger* New(const String& str, Heap::Space space = Heap::kNew); 4807 static RawInteger* New(const String& str, Heap::Space space = Heap::kNew);
4815 static RawInteger* NewFromUint64( 4808 static RawInteger* NewFromUint64(
4816 uint64_t value, Heap::Space space = Heap::kNew); 4809 uint64_t value, Heap::Space space = Heap::kNew);
4817 4810
4818 // Returns a canonical Integer object allocated in the old gen space. 4811 // Returns a canonical Integer object allocated in the old gen space.
4819 static RawInteger* NewCanonical(const String& str); 4812 static RawInteger* NewCanonical(const String& str);
4820 4813
4821 // Do not throw JavascriptIntegerOverflow if 'silent' is true. 4814 // Do not throw JavascriptIntegerOverflow if 'silent' is true.
4822 static RawInteger* New(int64_t value, 4815 static RawInteger* New(int64_t value,
4823 Heap::Space space = Heap::kNew, 4816 Heap::Space space = Heap::kNew,
4824 const bool silent = false); 4817 const bool silent = false);
4825 4818
4826 // Integer is an abstract class. 4819 // Integer is an abstract class.
4827 virtual bool IsZero() const { 4820 virtual bool IsZero() const {
4828 UNREACHABLE(); 4821 UNREACHABLE();
4829 return false; 4822 return false;
4830 } 4823 }
4824 virtual bool IsNegative() const {
4825 // Number is an abstract class.
4826 UNREACHABLE();
4827 return false;
4828 }
4831 virtual double AsDoubleValue() const; 4829 virtual double AsDoubleValue() const;
4832 virtual int64_t AsInt64Value() const; 4830 virtual int64_t AsInt64Value() const;
4833 virtual uint32_t AsTruncatedUint32Value() const; 4831 virtual uint32_t AsTruncatedUint32Value() const;
4834 4832
4835 // Returns 0, -1 or 1. 4833 // Returns 0, -1 or 1.
4836 virtual int CompareWith(const Integer& other) const; 4834 virtual int CompareWith(const Integer& other) const;
4837 4835
4838 // Return the most compact presentation of an integer. 4836 // Return the most compact presentation of an integer.
4839 RawInteger* AsValidInteger() const; 4837 RawInteger* AsValidInteger() const;
4840 4838
(...skipping 236 matching lines...) Expand 10 before | Expand all | Expand 10 after
5077 // Class Double represents class Double in corelib_impl, which implements 5075 // Class Double represents class Double in corelib_impl, which implements
5078 // abstract class double in corelib. 5076 // abstract class double in corelib.
5079 class Double : public Number { 5077 class Double : public Number {
5080 public: 5078 public:
5081 double value() const { 5079 double value() const {
5082 return raw_ptr()->value_; 5080 return raw_ptr()->value_;
5083 } 5081 }
5084 5082
5085 bool EqualsToDouble(double value) const; 5083 bool EqualsToDouble(double value) const;
5086 virtual bool Equals(const Instance& other) const; 5084 virtual bool Equals(const Instance& other) const;
5087 virtual bool IsNegative() const {
5088 double dval = value();
5089 return (signbit(dval) && !isnan(dval));
5090 }
5091 5085
5092 static RawDouble* New(double d, Heap::Space space = Heap::kNew); 5086 static RawDouble* New(double d, Heap::Space space = Heap::kNew);
5093 5087
5094 static RawDouble* New(const String& str, Heap::Space space = Heap::kNew); 5088 static RawDouble* New(const String& str, Heap::Space space = Heap::kNew);
5095 5089
5096 // Returns a canonical double object allocated in the old gen space. 5090 // Returns a canonical double object allocated in the old gen space.
5097 static RawDouble* NewCanonical(double d); 5091 static RawDouble* NewCanonical(double d);
5098 5092
5099 // Returns a canonical double object (allocated in the old gen space) or 5093 // Returns a canonical double object (allocated in the old gen space) or
5100 // Double::null() if str points to a string that does not convert to a 5094 // Double::null() if str points to a string that does not convert to a
(...skipping 1883 matching lines...) Expand 10 before | Expand all | Expand 10 after
6984 6978
6985 6979
6986 RawObject* MegamorphicCache::GetTargetFunction(const Array& array, 6980 RawObject* MegamorphicCache::GetTargetFunction(const Array& array,
6987 intptr_t index) { 6981 intptr_t index) {
6988 return array.At((index * kEntryLength) + kTargetFunctionIndex); 6982 return array.At((index * kEntryLength) + kTargetFunctionIndex);
6989 } 6983 }
6990 6984
6991 } // namespace dart 6985 } // namespace dart
6992 6986
6993 #endif // VM_OBJECT_H_ 6987 #endif // VM_OBJECT_H_
OLDNEW
« no previous file with comments | « runtime/lib/double.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698