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 1214 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1225 RawAbstractType* ParameterTypeAt(intptr_t index) const; | 1225 RawAbstractType* ParameterTypeAt(intptr_t index) const; |
1226 void SetParameterTypeAt(intptr_t index, const AbstractType& value) const; | 1226 void SetParameterTypeAt(intptr_t index, const AbstractType& value) const; |
1227 void set_parameter_types(const Array& value) const; | 1227 void set_parameter_types(const Array& value) const; |
1228 | 1228 |
1229 // Parameter names are valid for all valid parameter indices, and are not | 1229 // Parameter names are valid for all valid parameter indices, and are not |
1230 // limited to named optional parameters. | 1230 // limited to named optional parameters. |
1231 RawString* ParameterNameAt(intptr_t index) const; | 1231 RawString* ParameterNameAt(intptr_t index) const; |
1232 void SetParameterNameAt(intptr_t index, const String& value) const; | 1232 void SetParameterNameAt(intptr_t index, const String& value) const; |
1233 void set_parameter_names(const Array& value) const; | 1233 void set_parameter_names(const Array& value) const; |
1234 | 1234 |
1235 RawCode* code() const { return raw_ptr()->code_; } | |
1236 // Sets function's code and code's function. | 1235 // Sets function's code and code's function. |
1237 void SetCode(const Code& value) const; | 1236 void SetCode(const Code& value) const; |
| 1237 |
| 1238 // Return the most recently compiled and installed code for this function. |
| 1239 // It is not the only Code object that points to this function. |
| 1240 RawCode* CurrentCode() const { return raw_ptr()->code_; } |
| 1241 |
1238 RawCode* unoptimized_code() const { return raw_ptr()->unoptimized_code_; } | 1242 RawCode* unoptimized_code() const { return raw_ptr()->unoptimized_code_; } |
1239 void set_unoptimized_code(const Code& value) const; | 1243 void set_unoptimized_code(const Code& value) const; |
1240 static intptr_t code_offset() { return OFFSET_OF(RawFunction, code_); } | 1244 static intptr_t code_offset() { return OFFSET_OF(RawFunction, code_); } |
1241 inline bool HasCode() const; | 1245 inline bool HasCode() const; |
1242 | 1246 |
1243 RawContextScope* context_scope() const { return raw_ptr()->context_scope_; } | 1247 RawContextScope* context_scope() const { return raw_ptr()->context_scope_; } |
1244 void set_context_scope(const ContextScope& value) const; | 1248 void set_context_scope(const ContextScope& value) const; |
1245 | 1249 |
1246 // Enclosing function of this local function. | 1250 // Enclosing function of this local function. |
1247 RawFunction* parent_function() const { return raw_ptr()->parent_function_; } | 1251 RawFunction* parent_function() const { return raw_ptr()->parent_function_; } |
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1351 } | 1355 } |
1352 void set_deoptimization_counter(intptr_t value) const { | 1356 void set_deoptimization_counter(intptr_t value) const { |
1353 raw_ptr()->deoptimization_counter_ = value; | 1357 raw_ptr()->deoptimization_counter_ = value; |
1354 } | 1358 } |
1355 | 1359 |
1356 bool is_optimizable() const { | 1360 bool is_optimizable() const { |
1357 return raw_ptr()->is_optimizable_; | 1361 return raw_ptr()->is_optimizable_; |
1358 } | 1362 } |
1359 void set_is_optimizable(bool value) const; | 1363 void set_is_optimizable(bool value) const; |
1360 | 1364 |
| 1365 bool HasOptimizedCode() const; |
| 1366 |
1361 intptr_t NumberOfParameters() const; | 1367 intptr_t NumberOfParameters() const; |
1362 | 1368 |
1363 bool AreValidArgumentCounts(int num_arguments, int num_named_arguments) const; | 1369 bool AreValidArgumentCounts(int num_arguments, int num_named_arguments) const; |
1364 bool AreValidArguments(int num_arguments, const Array& argument_names) const; | 1370 bool AreValidArguments(int num_arguments, const Array& argument_names) const; |
1365 | 1371 |
1366 // Fully qualified name uniquely identifying the function under gdb and during | 1372 // Fully qualified name uniquely identifying the function under gdb and during |
1367 // ast printing. The special ':' character, if present, is replaced by '_'. | 1373 // ast printing. The special ':' character, if present, is replaced by '_'. |
1368 const char* ToFullyQualifiedCString() const; | 1374 const char* ToFullyQualifiedCString() const; |
1369 | 1375 |
1370 // Returns true if this function has parameters that are compatible with the | 1376 // Returns true if this function has parameters that are compatible with the |
(...skipping 2340 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3711 Heap* vm_isolate_heap = Dart::vm_isolate()->heap(); | 3717 Heap* vm_isolate_heap = Dart::vm_isolate()->heap(); |
3712 ASSERT(isolate_heap->Contains(reinterpret_cast<uword>(raw_->ptr())) || | 3718 ASSERT(isolate_heap->Contains(reinterpret_cast<uword>(raw_->ptr())) || |
3713 vm_isolate_heap->Contains(reinterpret_cast<uword>(raw_->ptr()))); | 3719 vm_isolate_heap->Contains(reinterpret_cast<uword>(raw_->ptr()))); |
3714 #endif | 3720 #endif |
3715 set_vtable((raw_ == null_) ? | 3721 set_vtable((raw_ == null_) ? |
3716 handle_vtable_ : raw_->ptr()->class_->ptr()->handle_vtable_); | 3722 handle_vtable_ : raw_->ptr()->class_->ptr()->handle_vtable_); |
3717 } | 3723 } |
3718 | 3724 |
3719 | 3725 |
3720 bool Function::HasCode() const { | 3726 bool Function::HasCode() const { |
3721 return code() != Code::null(); | 3727 return raw_ptr()->code_ != Code::null(); |
3722 } | 3728 } |
3723 | 3729 |
3724 | 3730 |
3725 intptr_t Field::Offset() const { | 3731 intptr_t Field::Offset() const { |
3726 ASSERT(!is_static()); // Offset is valid only for instance fields. | 3732 ASSERT(!is_static()); // Offset is valid only for instance fields. |
3727 return Smi::Value(reinterpret_cast<RawSmi*>(raw_ptr()->value_)); | 3733 return Smi::Value(reinterpret_cast<RawSmi*>(raw_ptr()->value_)); |
3728 } | 3734 } |
3729 | 3735 |
3730 | 3736 |
3731 void Field::SetOffset(intptr_t value) const { | 3737 void Field::SetOffset(intptr_t value) const { |
(...skipping 13 matching lines...) Expand all Loading... |
3745 } | 3751 } |
3746 | 3752 |
3747 | 3753 |
3748 void Context::SetAt(intptr_t index, const Instance& value) const { | 3754 void Context::SetAt(intptr_t index, const Instance& value) const { |
3749 StorePointer(InstanceAddr(index), value.raw()); | 3755 StorePointer(InstanceAddr(index), value.raw()); |
3750 } | 3756 } |
3751 | 3757 |
3752 } // namespace dart | 3758 } // namespace dart |
3753 | 3759 |
3754 #endif // VM_OBJECT_H_ | 3760 #endif // VM_OBJECT_H_ |
OLD | NEW |