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 RUNTIME_VM_OBJECT_H_ | 5 #ifndef RUNTIME_VM_OBJECT_H_ |
6 #define RUNTIME_VM_OBJECT_H_ | 6 #define RUNTIME_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 2275 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2286 intptr_t* function_level) const; | 2286 intptr_t* function_level) const; |
2287 | 2287 |
2288 // Return true if this function declares type parameters. | 2288 // Return true if this function declares type parameters. |
2289 bool IsGeneric() const { return NumTypeParameters(Thread::Current()) > 0; } | 2289 bool IsGeneric() const { return NumTypeParameters(Thread::Current()) > 0; } |
2290 | 2290 |
2291 // Return true if any parent function of this function is generic. | 2291 // Return true if any parent function of this function is generic. |
2292 bool HasGenericParent() const; | 2292 bool HasGenericParent() const; |
2293 | 2293 |
2294 // Not thread-safe; must be called in the main thread. | 2294 // Not thread-safe; must be called in the main thread. |
2295 // Sets function's code and code's function. | 2295 // Sets function's code and code's function. |
2296 void InstallOptimizedCode(const Code& code, bool is_osr) const; | 2296 void InstallOptimizedCode(const Code& code) const; |
2297 void AttachCode(const Code& value) const; | 2297 void AttachCode(const Code& value) const; |
2298 void SetInstructions(const Code& value) const; | 2298 void SetInstructions(const Code& value) const; |
2299 void ClearCode() const; | 2299 void ClearCode() const; |
2300 | 2300 |
2301 // Disables optimized code and switches to unoptimized code. | 2301 // Disables optimized code and switches to unoptimized code. |
2302 void SwitchToUnoptimizedCode() const; | 2302 void SwitchToUnoptimizedCode() const; |
2303 | 2303 |
| 2304 // Ensures that the function has code. If there is no code it compiles the |
| 2305 // unoptimized version of the code. If the code contains errors, it calls |
| 2306 // Exceptions::PropagateError and does not return. Normally returns the |
| 2307 // current code, whether it is optimized or unoptimized. |
| 2308 RawCode* EnsureHasCode() const; |
| 2309 |
2304 // Disables optimized code and switches to unoptimized code (or the lazy | 2310 // Disables optimized code and switches to unoptimized code (or the lazy |
2305 // compilation stub). | 2311 // compilation stub). |
2306 void SwitchToLazyCompiledUnoptimizedCode() const; | 2312 void SwitchToLazyCompiledUnoptimizedCode() const; |
2307 | 2313 |
2308 // Compiles unoptimized code (if necessary) and attaches it to the function. | 2314 // Compiles unoptimized code (if necessary) and attaches it to the function. |
2309 void EnsureHasCompiledUnoptimizedCode() const; | 2315 void EnsureHasCompiledUnoptimizedCode() const; |
2310 | 2316 |
2311 // Return the most recently compiled and installed code for this function. | 2317 // Return the most recently compiled and installed code for this function. |
2312 // It is not the only Code object that points to this function. | 2318 // It is not the only Code object that points to this function. |
2313 RawCode* CurrentCode() const { return raw_ptr()->code_; } | 2319 RawCode* CurrentCode() const { return raw_ptr()->code_; } |
(...skipping 6636 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
8950 | 8956 |
8951 inline void TypeArguments::SetHash(intptr_t value) const { | 8957 inline void TypeArguments::SetHash(intptr_t value) const { |
8952 // This is only safe because we create a new Smi, which does not cause | 8958 // This is only safe because we create a new Smi, which does not cause |
8953 // heap allocation. | 8959 // heap allocation. |
8954 StoreSmi(&raw_ptr()->hash_, Smi::New(value)); | 8960 StoreSmi(&raw_ptr()->hash_, Smi::New(value)); |
8955 } | 8961 } |
8956 | 8962 |
8957 } // namespace dart | 8963 } // namespace dart |
8958 | 8964 |
8959 #endif // RUNTIME_VM_OBJECT_H_ | 8965 #endif // RUNTIME_VM_OBJECT_H_ |
OLD | NEW |