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 #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 1908 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1919 Function* target) const; | 1919 Function* target) const; |
1920 // Only for 'num_args_checked == 1'. | 1920 // Only for 'num_args_checked == 1'. |
1921 intptr_t GetCidAt(intptr_t index) const; | 1921 intptr_t GetCidAt(intptr_t index) const; |
1922 | 1922 |
1923 intptr_t GetReceiverClassIdAt(intptr_t index) const; | 1923 intptr_t GetReceiverClassIdAt(intptr_t index) const; |
1924 intptr_t GetClassIdAt(intptr_t index, intptr_t arg_nr) const; | 1924 intptr_t GetClassIdAt(intptr_t index, intptr_t arg_nr) const; |
1925 | 1925 |
1926 RawFunction* GetTargetAt(intptr_t index) const; | 1926 RawFunction* GetTargetAt(intptr_t index) const; |
1927 RawFunction* GetTargetForReceiverClassId(intptr_t class_id) const; | 1927 RawFunction* GetTargetForReceiverClassId(intptr_t class_id) const; |
1928 | 1928 |
| 1929 RawObject* GetTargetOrCodeAt(intptr_t index) const; |
| 1930 void SetCodeAt(intptr_t index, const Code& value) const; |
| 1931 void SetEntryPointAt(intptr_t index, const Smi& value) const; |
| 1932 |
1929 void IncrementCountAt(intptr_t index, intptr_t value) const; | 1933 void IncrementCountAt(intptr_t index, intptr_t value) const; |
1930 void SetCountAt(intptr_t index, intptr_t value) const; | 1934 void SetCountAt(intptr_t index, intptr_t value) const; |
1931 intptr_t GetCountAt(intptr_t index) const; | 1935 intptr_t GetCountAt(intptr_t index) const; |
1932 intptr_t AggregateCount() const; | 1936 intptr_t AggregateCount() const; |
1933 | 1937 |
1934 // Returns this->raw() if num_args_tested == 1 and arg_nr == 1, otherwise | 1938 // Returns this->raw() if num_args_tested == 1 and arg_nr == 1, otherwise |
1935 // returns a new ICData object containing only unique arg_nr checks. | 1939 // returns a new ICData object containing only unique arg_nr checks. |
1936 // Returns only used entries. | 1940 // Returns only used entries. |
1937 RawICData* AsUnaryClassChecksForArgNr(intptr_t arg_nr) const; | 1941 RawICData* AsUnaryClassChecksForArgNr(intptr_t arg_nr) const; |
1938 RawICData* AsUnaryClassChecks() const { | 1942 RawICData* AsUnaryClassChecks() const { |
(...skipping 16 matching lines...) Expand all Loading... |
1955 static RawICData* NewFrom(const ICData& from, intptr_t num_args_tested); | 1959 static RawICData* NewFrom(const ICData& from, intptr_t num_args_tested); |
1956 | 1960 |
1957 // Generates a new ICData with descriptor and data array copied (deep clone). | 1961 // Generates a new ICData with descriptor and data array copied (deep clone). |
1958 static RawICData* Clone(const ICData& from); | 1962 static RawICData* Clone(const ICData& from); |
1959 | 1963 |
1960 static intptr_t TestEntryLengthFor(intptr_t num_args); | 1964 static intptr_t TestEntryLengthFor(intptr_t num_args); |
1961 | 1965 |
1962 static intptr_t TargetIndexFor(intptr_t num_args) { | 1966 static intptr_t TargetIndexFor(intptr_t num_args) { |
1963 return num_args; | 1967 return num_args; |
1964 } | 1968 } |
| 1969 static intptr_t CodeIndexFor(intptr_t num_args) { |
| 1970 return num_args; |
| 1971 } |
1965 | 1972 |
1966 static intptr_t CountIndexFor(intptr_t num_args) { | 1973 static intptr_t CountIndexFor(intptr_t num_args) { |
1967 return (num_args + 1); | 1974 return (num_args + 1); |
1968 } | 1975 } |
| 1976 static intptr_t EntryPointIndexFor(intptr_t num_args) { |
| 1977 return (num_args + 1); |
| 1978 } |
1969 | 1979 |
1970 bool IsUsedAt(intptr_t i) const; | 1980 bool IsUsedAt(intptr_t i) const; |
1971 | 1981 |
1972 void GetUsedCidsForTwoArgs(GrowableArray<intptr_t>* first, | 1982 void GetUsedCidsForTwoArgs(GrowableArray<intptr_t>* first, |
1973 GrowableArray<intptr_t>* second) const; | 1983 GrowableArray<intptr_t>* second) const; |
1974 | 1984 |
1975 // Range feedback tracking functionality. | 1985 // Range feedback tracking functionality. |
1976 | 1986 |
1977 // For arithmetic operations we store range information for inputs and the | 1987 // For arithmetic operations we store range information for inputs and the |
1978 // result. The goal is to discover: | 1988 // result. The goal is to discover: |
(...skipping 4108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6087 virtual int CompareWith(const Integer& other) const; | 6097 virtual int CompareWith(const Integer& other) const; |
6088 | 6098 |
6089 static intptr_t InstanceSize() { return 0; } | 6099 static intptr_t InstanceSize() { return 0; } |
6090 | 6100 |
6091 static RawSmi* New(intptr_t value) { | 6101 static RawSmi* New(intptr_t value) { |
6092 intptr_t raw_smi = (value << kSmiTagShift) | kSmiTag; | 6102 intptr_t raw_smi = (value << kSmiTagShift) | kSmiTag; |
6093 ASSERT(ValueFromRaw(raw_smi) == value); | 6103 ASSERT(ValueFromRaw(raw_smi) == value); |
6094 return reinterpret_cast<RawSmi*>(raw_smi); | 6104 return reinterpret_cast<RawSmi*>(raw_smi); |
6095 } | 6105 } |
6096 | 6106 |
| 6107 static RawSmi* FromAlignedAddress(uword address) { |
| 6108 ASSERT((address & kSmiTagMask) == kSmiTag); |
| 6109 return reinterpret_cast<RawSmi*>(address); |
| 6110 } |
| 6111 |
6097 static RawClass* Class(); | 6112 static RawClass* Class(); |
6098 | 6113 |
6099 static intptr_t Value(const RawSmi* raw_smi) { | 6114 static intptr_t Value(const RawSmi* raw_smi) { |
6100 return ValueFromRaw(reinterpret_cast<uword>(raw_smi)); | 6115 return ValueFromRaw(reinterpret_cast<uword>(raw_smi)); |
6101 } | 6116 } |
6102 | 6117 |
6103 static intptr_t RawValue(intptr_t value) { | 6118 static intptr_t RawValue(intptr_t value) { |
6104 return reinterpret_cast<intptr_t>(New(value)); | 6119 return reinterpret_cast<intptr_t>(New(value)); |
6105 } | 6120 } |
6106 | 6121 |
(...skipping 2383 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
8490 | 8505 |
8491 | 8506 |
8492 RawObject* MegamorphicCache::GetTargetFunction(const Array& array, | 8507 RawObject* MegamorphicCache::GetTargetFunction(const Array& array, |
8493 intptr_t index) { | 8508 intptr_t index) { |
8494 return array.At((index * kEntryLength) + kTargetFunctionIndex); | 8509 return array.At((index * kEntryLength) + kTargetFunctionIndex); |
8495 } | 8510 } |
8496 | 8511 |
8497 } // namespace dart | 8512 } // namespace dart |
8498 | 8513 |
8499 #endif // VM_OBJECT_H_ | 8514 #endif // VM_OBJECT_H_ |
OLD | NEW |