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 3558 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3569 RawString* GetLine(intptr_t line_number, | 3569 RawString* GetLine(intptr_t line_number, |
3570 Heap::Space space = Heap::kNew) const; | 3570 Heap::Space space = Heap::kNew) const; |
3571 RawString* GetSnippet(TokenPosition from, TokenPosition to) const; | 3571 RawString* GetSnippet(TokenPosition from, TokenPosition to) const; |
3572 RawString* GetSnippet(intptr_t from_line, | 3572 RawString* GetSnippet(intptr_t from_line, |
3573 intptr_t from_column, | 3573 intptr_t from_column, |
3574 intptr_t to_line, | 3574 intptr_t to_line, |
3575 intptr_t to_column) const; | 3575 intptr_t to_column) const; |
3576 | 3576 |
3577 void SetLocationOffset(intptr_t line_offset, intptr_t col_offset) const; | 3577 void SetLocationOffset(intptr_t line_offset, intptr_t col_offset) const; |
3578 | 3578 |
| 3579 intptr_t GetTokenLineUsingLineStarts(TokenPosition token_pos) const; |
3579 void GetTokenLocation(TokenPosition token_pos, | 3580 void GetTokenLocation(TokenPosition token_pos, |
3580 intptr_t* line, | 3581 intptr_t* line, |
3581 intptr_t* column, | 3582 intptr_t* column, |
3582 intptr_t* token_len = NULL) const; | 3583 intptr_t* token_len = NULL) const; |
3583 | 3584 |
3584 // Returns index of first and last token on the given line. Returns both | 3585 // Returns index of first and last token on the given line. Returns both |
3585 // indices < 0 if no token exists on or after the line. If a token exists | 3586 // indices < 0 if no token exists on or after the line. If a token exists |
3586 // after, but not on given line, returns in *first_token_index the index of | 3587 // after, but not on given line, returns in *first_token_index the index of |
3587 // the first token after the line, and a negative value in *last_token_index. | 3588 // the first token after the line, and a negative value in *last_token_index. |
3588 void TokenRangeAtLine(intptr_t line_number, | 3589 void TokenRangeAtLine(intptr_t line_number, |
(...skipping 812 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4401 return RoundedAllocationSize(sizeof(RawCodeSourceMap) + len); | 4402 return RoundedAllocationSize(sizeof(RawCodeSourceMap) + len); |
4402 } | 4403 } |
4403 | 4404 |
4404 static RawCodeSourceMap* New(intptr_t length); | 4405 static RawCodeSourceMap* New(intptr_t length); |
4405 | 4406 |
4406 intptr_t Length() const { return raw_ptr()->length_; } | 4407 intptr_t Length() const { return raw_ptr()->length_; } |
4407 uint8_t* Data() const { | 4408 uint8_t* Data() const { |
4408 return UnsafeMutableNonPointer(&raw_ptr()->data()[0]); | 4409 return UnsafeMutableNonPointer(&raw_ptr()->data()[0]); |
4409 } | 4410 } |
4410 | 4411 |
| 4412 bool Equals(const CodeSourceMap& other) const { |
| 4413 if (Length() != other.Length()) { |
| 4414 return false; |
| 4415 } |
| 4416 NoSafepointScope no_safepoint; |
| 4417 return memcmp(raw_ptr(), other.raw_ptr(), InstanceSize(Length())) == 0; |
| 4418 } |
| 4419 |
4411 void PrintToJSONObject(JSONObject* jsobj, bool ref) const; | 4420 void PrintToJSONObject(JSONObject* jsobj, bool ref) const; |
4412 | 4421 |
4413 private: | 4422 private: |
4414 void SetLength(intptr_t value) const; | 4423 void SetLength(intptr_t value) const; |
4415 | 4424 |
4416 FINAL_HEAP_OBJECT_IMPLEMENTATION(CodeSourceMap, Object); | 4425 FINAL_HEAP_OBJECT_IMPLEMENTATION(CodeSourceMap, Object); |
4417 friend class Class; | 4426 friend class Class; |
4418 friend class Object; | 4427 friend class Object; |
4419 }; | 4428 }; |
4420 | 4429 |
(...skipping 231 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4652 | 4661 |
4653 RawPcDescriptors* pc_descriptors() const { | 4662 RawPcDescriptors* pc_descriptors() const { |
4654 return raw_ptr()->pc_descriptors_; | 4663 return raw_ptr()->pc_descriptors_; |
4655 } | 4664 } |
4656 void set_pc_descriptors(const PcDescriptors& descriptors) const { | 4665 void set_pc_descriptors(const PcDescriptors& descriptors) const { |
4657 ASSERT(descriptors.IsOld()); | 4666 ASSERT(descriptors.IsOld()); |
4658 StorePointer(&raw_ptr()->pc_descriptors_, descriptors.raw()); | 4667 StorePointer(&raw_ptr()->pc_descriptors_, descriptors.raw()); |
4659 } | 4668 } |
4660 | 4669 |
4661 RawCodeSourceMap* code_source_map() const { | 4670 RawCodeSourceMap* code_source_map() const { |
4662 #if defined(DART_PRECOMPILED_RUNTIME) | |
4663 return CodeSourceMap::null(); | |
4664 #else | |
4665 return raw_ptr()->code_source_map_; | 4671 return raw_ptr()->code_source_map_; |
4666 #endif | |
4667 } | 4672 } |
4668 | 4673 |
4669 void set_code_source_map(const CodeSourceMap& code_source_map) const { | 4674 void set_code_source_map(const CodeSourceMap& code_source_map) const { |
4670 #if defined(DART_PRECOMPILED_RUNTIME) | |
4671 UNREACHABLE(); | |
4672 #else | |
4673 ASSERT(code_source_map.IsOld()); | 4675 ASSERT(code_source_map.IsOld()); |
4674 StorePointer(&raw_ptr()->code_source_map_, code_source_map.raw()); | 4676 StorePointer(&raw_ptr()->code_source_map_, code_source_map.raw()); |
4675 #endif | |
4676 } | 4677 } |
4677 | 4678 |
4678 // Used during reloading (see object_reload.cc). Calls Reset on all ICDatas | 4679 // Used during reloading (see object_reload.cc). Calls Reset on all ICDatas |
4679 // that are embedded inside the Code object. | 4680 // that are embedded inside the Code object. |
4680 void ResetICDatas(Zone* zone) const; | 4681 void ResetICDatas(Zone* zone) const; |
4681 | 4682 |
4682 // Array of DeoptInfo objects. | 4683 // Array of DeoptInfo objects. |
4683 RawArray* deopt_info_array() const { | 4684 RawArray* deopt_info_array() const { |
4684 #if defined(DART_PRECOMPILED_RUNTIME) | 4685 #if defined(DART_PRECOMPILED_RUNTIME) |
4685 UNREACHABLE(); | 4686 UNREACHABLE(); |
(...skipping 4224 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
8910 | 8911 |
8911 inline void TypeArguments::SetHash(intptr_t value) const { | 8912 inline void TypeArguments::SetHash(intptr_t value) const { |
8912 // This is only safe because we create a new Smi, which does not cause | 8913 // This is only safe because we create a new Smi, which does not cause |
8913 // heap allocation. | 8914 // heap allocation. |
8914 StoreSmi(&raw_ptr()->hash_, Smi::New(value)); | 8915 StoreSmi(&raw_ptr()->hash_, Smi::New(value)); |
8915 } | 8916 } |
8916 | 8917 |
8917 } // namespace dart | 8918 } // namespace dart |
8918 | 8919 |
8919 #endif // RUNTIME_VM_OBJECT_H_ | 8920 #endif // RUNTIME_VM_OBJECT_H_ |
OLD | NEW |