Chromium Code Reviews| 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 2134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2145 // Returns true if this function represents a local function. | 2145 // Returns true if this function represents a local function. |
| 2146 bool IsLocalFunction() const { | 2146 bool IsLocalFunction() const { |
| 2147 return parent_function() != Function::null(); | 2147 return parent_function() != Function::null(); |
| 2148 } | 2148 } |
| 2149 | 2149 |
| 2150 // Returns true if this function represents a signature function without code. | 2150 // Returns true if this function represents a signature function without code. |
| 2151 bool IsSignatureFunction() const { | 2151 bool IsSignatureFunction() const { |
| 2152 return kind() == RawFunction::kSignatureFunction; | 2152 return kind() == RawFunction::kSignatureFunction; |
| 2153 } | 2153 } |
| 2154 | 2154 |
| 2155 bool IsAsyncFunction() const { | 2155 bool IsAsyncFunction() const { |
|
Ivan Posva
2015/03/03 01:05:52
Can you please comment what these different functi
| |
| 2156 return modifier() == RawFunction::kAsync; | 2156 return modifier() == RawFunction::kAsync; |
| 2157 } | 2157 } |
| 2158 | 2158 |
| 2159 bool IsAsyncClosure() const { | 2159 bool IsAsyncClosure() const { |
| 2160 return is_generated_body() && | 2160 return is_generated_body() && |
| 2161 Function::Handle(parent_function()).IsAsyncFunction(); | 2161 Function::Handle(parent_function()).IsAsyncFunction(); |
| 2162 } | 2162 } |
| 2163 | 2163 |
| 2164 bool IsGenerator() const { | 2164 bool IsGenerator() const { |
| 2165 return (modifier() & RawFunction::kGeneratorBit) != 0; | 2165 return (modifier() & RawFunction::kGeneratorBit) != 0; |
| 2166 } | 2166 } |
| 2167 | 2167 |
| 2168 bool IsSyncGenerator() const { | 2168 bool IsSyncGenerator() const { |
| 2169 return modifier() == RawFunction::kSyncGen; | 2169 return modifier() == RawFunction::kSyncGen; |
| 2170 } | 2170 } |
| 2171 | 2171 |
| 2172 bool IsSyncGenClosure() const { | 2172 bool IsSyncGenClosure() const { |
| 2173 return is_generated_body() && | 2173 return is_generated_body() && |
| 2174 Function::Handle(parent_function()).IsSyncGenerator(); | 2174 Function::Handle(parent_function()).IsSyncGenerator(); |
| 2175 } | 2175 } |
| 2176 | 2176 |
| 2177 bool IsGeneratorClosure() const { | |
| 2178 return is_generated_body() && | |
| 2179 Function::Handle(parent_function()).IsGenerator(); | |
| 2180 } | |
| 2181 | |
| 2182 bool IsAsyncGenerator() const { | |
| 2183 return modifier() == RawFunction::kAsyncGen; | |
| 2184 } | |
| 2185 | |
| 2186 bool IsAsyncGenClosure() const { | |
| 2187 return is_generated_body() && | |
| 2188 Function::Handle(parent_function()).IsAsyncGenerator(); | |
| 2189 } | |
| 2190 | |
| 2177 bool IsAsyncOrGenerator() const { | 2191 bool IsAsyncOrGenerator() const { |
| 2178 return modifier() != RawFunction::kNoModifier; | 2192 return modifier() != RawFunction::kNoModifier; |
| 2179 } | 2193 } |
| 2180 | 2194 |
| 2181 static intptr_t InstanceSize() { | 2195 static intptr_t InstanceSize() { |
| 2182 return RoundedAllocationSize(sizeof(RawFunction)); | 2196 return RoundedAllocationSize(sizeof(RawFunction)); |
| 2183 } | 2197 } |
| 2184 | 2198 |
| 2185 static RawFunction* New(const String& name, | 2199 static RawFunction* New(const String& name, |
| 2186 RawFunction::Kind kind, | 2200 RawFunction::Kind kind, |
| (...skipping 5620 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 7807 | 7821 |
| 7808 | 7822 |
| 7809 RawObject* MegamorphicCache::GetTargetFunction(const Array& array, | 7823 RawObject* MegamorphicCache::GetTargetFunction(const Array& array, |
| 7810 intptr_t index) { | 7824 intptr_t index) { |
| 7811 return array.At((index * kEntryLength) + kTargetFunctionIndex); | 7825 return array.At((index * kEntryLength) + kTargetFunctionIndex); |
| 7812 } | 7826 } |
| 7813 | 7827 |
| 7814 } // namespace dart | 7828 } // namespace dart |
| 7815 | 7829 |
| 7816 #endif // VM_OBJECT_H_ | 7830 #endif // VM_OBJECT_H_ |
| OLD | NEW |