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 4372 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4383 const intptr_t kind_mask_; | 4383 const intptr_t kind_mask_; |
4384 intptr_t byte_index_; | 4384 intptr_t byte_index_; |
4385 | 4385 |
4386 intptr_t cur_pc_offset_; | 4386 intptr_t cur_pc_offset_; |
4387 intptr_t cur_kind_; | 4387 intptr_t cur_kind_; |
4388 intptr_t cur_deopt_id_; | 4388 intptr_t cur_deopt_id_; |
4389 intptr_t cur_token_pos_; | 4389 intptr_t cur_token_pos_; |
4390 intptr_t cur_try_index_; | 4390 intptr_t cur_try_index_; |
4391 }; | 4391 }; |
4392 | 4392 |
| 4393 intptr_t Length() const; |
| 4394 bool Equals(const PcDescriptors& other) const { |
| 4395 if (Length() != other.Length()) { |
| 4396 return false; |
| 4397 } |
| 4398 NoSafepointScope no_safepoint; |
| 4399 return memcmp(raw_ptr(), other.raw_ptr(), InstanceSize(Length())) == 0; |
| 4400 } |
| 4401 |
4393 private: | 4402 private: |
4394 static const char* KindAsStr(RawPcDescriptors::Kind kind); | 4403 static const char* KindAsStr(RawPcDescriptors::Kind kind); |
4395 | 4404 |
4396 static RawPcDescriptors* New(intptr_t length); | 4405 static RawPcDescriptors* New(intptr_t length); |
4397 | 4406 |
4398 intptr_t Length() const; | |
4399 void SetLength(intptr_t value) const; | 4407 void SetLength(intptr_t value) const; |
4400 void CopyData(GrowableArray<uint8_t>* data); | 4408 void CopyData(GrowableArray<uint8_t>* data); |
4401 | 4409 |
4402 FINAL_HEAP_OBJECT_IMPLEMENTATION(PcDescriptors, Object); | 4410 FINAL_HEAP_OBJECT_IMPLEMENTATION(PcDescriptors, Object); |
4403 friend class Class; | 4411 friend class Class; |
4404 friend class Object; | 4412 friend class Object; |
4405 }; | 4413 }; |
4406 | 4414 |
4407 | 4415 |
4408 class CodeSourceMap : public Object { | 4416 class CodeSourceMap : public Object { |
(...skipping 282 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4691 RawCodeSourceMap* code_source_map() const { | 4699 RawCodeSourceMap* code_source_map() const { |
4692 return raw_ptr()->code_source_map_; | 4700 return raw_ptr()->code_source_map_; |
4693 } | 4701 } |
4694 | 4702 |
4695 void set_code_source_map(const CodeSourceMap& code_source_map) const { | 4703 void set_code_source_map(const CodeSourceMap& code_source_map) const { |
4696 ASSERT(code_source_map.IsOld()); | 4704 ASSERT(code_source_map.IsOld()); |
4697 StorePointer(&raw_ptr()->code_source_map_, code_source_map.raw()); | 4705 StorePointer(&raw_ptr()->code_source_map_, code_source_map.raw()); |
4698 } | 4706 } |
4699 | 4707 |
4700 RawArray* await_token_positions() const; | 4708 RawArray* await_token_positions() const; |
4701 void SetAwaitTokenPositions(const Array& await_token_positions) const; | 4709 void set_await_token_positions(const Array& await_token_positions) const; |
4702 | 4710 |
4703 // Used during reloading (see object_reload.cc). Calls Reset on all ICDatas | 4711 // Used during reloading (see object_reload.cc). Calls Reset on all ICDatas |
4704 // that are embedded inside the Code object. | 4712 // that are embedded inside the Code object. |
4705 void ResetICDatas(Zone* zone) const; | 4713 void ResetICDatas(Zone* zone) const; |
4706 | 4714 |
4707 // Array of DeoptInfo objects. | 4715 // Array of DeoptInfo objects. |
4708 RawArray* deopt_info_array() const { | 4716 RawArray* deopt_info_array() const { |
4709 #if defined(DART_PRECOMPILED_RUNTIME) | 4717 #if defined(DART_PRECOMPILED_RUNTIME) |
4710 UNREACHABLE(); | 4718 UNREACHABLE(); |
4711 return NULL; | 4719 return NULL; |
(...skipping 315 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5027 // the RawInstruction and RawCode objects, sets up the pointer offsets | 5035 // the RawInstruction and RawCode objects, sets up the pointer offsets |
5028 // and links the two in a GC safe manner. | 5036 // and links the two in a GC safe manner. |
5029 static RawCode* New(intptr_t pointer_offsets_length); | 5037 static RawCode* New(intptr_t pointer_offsets_length); |
5030 | 5038 |
5031 FINAL_HEAP_OBJECT_IMPLEMENTATION(Code, Object); | 5039 FINAL_HEAP_OBJECT_IMPLEMENTATION(Code, Object); |
5032 friend class Class; | 5040 friend class Class; |
5033 friend class SnapshotWriter; | 5041 friend class SnapshotWriter; |
5034 friend class FunctionSerializationCluster; | 5042 friend class FunctionSerializationCluster; |
5035 friend class CodeSerializationCluster; | 5043 friend class CodeSerializationCluster; |
5036 friend class CodePatcher; // for set_instructions | 5044 friend class CodePatcher; // for set_instructions |
5037 friend class Precompiler; // for set_instructions | 5045 friend class ProgramVisitor; // for set_instructions |
5038 // So that the RawFunction pointer visitor can determine whether code the | 5046 // So that the RawFunction pointer visitor can determine whether code the |
5039 // function points to is optimized. | 5047 // function points to is optimized. |
5040 friend class RawFunction; | 5048 friend class RawFunction; |
5041 }; | 5049 }; |
5042 | 5050 |
5043 | 5051 |
5044 class Context : public Object { | 5052 class Context : public Object { |
5045 public: | 5053 public: |
5046 RawContext* parent() const { return raw_ptr()->parent_; } | 5054 RawContext* parent() const { return raw_ptr()->parent_; } |
5047 void set_parent(const Context& parent) const { | 5055 void set_parent(const Context& parent) const { |
(...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5214 | 5222 |
5215 void Insert(const Smi& class_id, const Function& target) const; | 5223 void Insert(const Smi& class_id, const Function& target) const; |
5216 | 5224 |
5217 static intptr_t InstanceSize() { | 5225 static intptr_t InstanceSize() { |
5218 return RoundedAllocationSize(sizeof(RawMegamorphicCache)); | 5226 return RoundedAllocationSize(sizeof(RawMegamorphicCache)); |
5219 } | 5227 } |
5220 | 5228 |
5221 private: | 5229 private: |
5222 friend class Class; | 5230 friend class Class; |
5223 friend class MegamorphicCacheTable; | 5231 friend class MegamorphicCacheTable; |
5224 friend class Precompiler; | 5232 friend class ProgramVisitor; |
5225 | 5233 |
5226 static RawMegamorphicCache* New(); | 5234 static RawMegamorphicCache* New(); |
5227 | 5235 |
5228 void set_target_name(const String& value) const; | 5236 void set_target_name(const String& value) const; |
5229 void set_arguments_descriptor(const Array& value) const; | 5237 void set_arguments_descriptor(const Array& value) const; |
5230 | 5238 |
5231 enum { | 5239 enum { |
5232 kClassIdIndex, | 5240 kClassIdIndex, |
5233 kTargetFunctionIndex, | 5241 kTargetFunctionIndex, |
5234 kEntryLength, | 5242 kEntryLength, |
(...skipping 3726 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
8961 | 8969 |
8962 inline void TypeArguments::SetHash(intptr_t value) const { | 8970 inline void TypeArguments::SetHash(intptr_t value) const { |
8963 // This is only safe because we create a new Smi, which does not cause | 8971 // This is only safe because we create a new Smi, which does not cause |
8964 // heap allocation. | 8972 // heap allocation. |
8965 StoreSmi(&raw_ptr()->hash_, Smi::New(value)); | 8973 StoreSmi(&raw_ptr()->hash_, Smi::New(value)); |
8966 } | 8974 } |
8967 | 8975 |
8968 } // namespace dart | 8976 } // namespace dart |
8969 | 8977 |
8970 #endif // RUNTIME_VM_OBJECT_H_ | 8978 #endif // RUNTIME_VM_OBJECT_H_ |
OLD | NEW |