Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(132)

Side by Side Diff: runtime/vm/object.h

Issue 2363413004: VM: Avoid allocating strings when disassembling code. (Closed)
Patch Set: addressed comments Created 4 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « runtime/vm/disassembler.cc ('k') | runtime/vm/object.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 4910 matching lines...) Expand 10 before | Expand all | Expand 10 after
4921 enum { 4921 enum {
4922 kInvalidPc = -1 4922 kInvalidPc = -1
4923 }; 4923 };
4924 4924
4925 uword GetLazyDeoptPc() const; 4925 uword GetLazyDeoptPc() const;
4926 4926
4927 // Find pc, return 0 if not found. 4927 // Find pc, return 0 if not found.
4928 uword GetPcForDeoptId(intptr_t deopt_id, RawPcDescriptors::Kind kind) const; 4928 uword GetPcForDeoptId(intptr_t deopt_id, RawPcDescriptors::Kind kind) const;
4929 intptr_t GetDeoptIdForOsr(uword pc) const; 4929 intptr_t GetDeoptIdForOsr(uword pc) const;
4930 4930
4931 RawString* Name() const; 4931 const char* Name() const;
4932 RawString* QualifiedName() const; 4932 const char* QualifiedName() const;
4933 4933
4934 int64_t compile_timestamp() const { 4934 int64_t compile_timestamp() const {
4935 #if defined(DART_PRECOMPILED_RUNTIME) 4935 #if defined(DART_PRECOMPILED_RUNTIME)
4936 return 0; 4936 return 0;
4937 #else 4937 #else
4938 return raw_ptr()->compile_timestamp_; 4938 return raw_ptr()->compile_timestamp_;
4939 #endif 4939 #endif
4940 } 4940 }
4941 4941
4942 intptr_t lazy_deopt_pc_offset() const { 4942 intptr_t lazy_deopt_pc_offset() const {
(...skipping 856 matching lines...) Expand 10 before | Expand all | Expand 10 after
5799 virtual RawString* Name() const { 5799 virtual RawString* Name() const {
5800 return BuildName(kInternalName); 5800 return BuildName(kInternalName);
5801 } 5801 }
5802 5802
5803 // The name of this type, including the names of its type arguments, if any. 5803 // The name of this type, including the names of its type arguments, if any.
5804 // Names of internal classes are mapped to their public interfaces. 5804 // Names of internal classes are mapped to their public interfaces.
5805 virtual RawString* UserVisibleName() const { 5805 virtual RawString* UserVisibleName() const {
5806 return BuildName(kUserVisibleName); 5806 return BuildName(kUserVisibleName);
5807 } 5807 }
5808 5808
5809 // Same as user visible name, but including the URI of each occuring type.
5810 // Used to report errors involving types with identical names.
5811 virtual RawString* UserVisibleNameWithURI() const;
5812
5813 // Returns a formatted list of occuring types with their URI. 5809 // Returns a formatted list of occuring types with their URI.
5814 virtual RawString* EnumerateURIs() const; 5810 virtual RawString* EnumerateURIs() const;
5815 5811
5816 virtual intptr_t Hash() const; 5812 virtual intptr_t Hash() const;
5817 5813
5818 // The name of this type's class, i.e. without the type argument names of this 5814 // The name of this type's class, i.e. without the type argument names of this
5819 // type. 5815 // type.
5820 RawString* ClassName() const; 5816 RawString* ClassName() const;
5821 5817
5822 // Check if this type represents the 'dynamic' type or if it is malformed, 5818 // Check if this type represents the 'dynamic' type or if it is malformed,
(...skipping 1135 matching lines...) Expand 10 before | Expand all | Expand 10 after
6958 intptr_t len); 6954 intptr_t len);
6959 static void Copy(const String& dst, 6955 static void Copy(const String& dst,
6960 intptr_t dst_offset, 6956 intptr_t dst_offset,
6961 const String& src, 6957 const String& src,
6962 intptr_t src_offset, 6958 intptr_t src_offset,
6963 intptr_t len); 6959 intptr_t len);
6964 6960
6965 static RawString* EscapeSpecialCharacters(const String& str); 6961 static RawString* EscapeSpecialCharacters(const String& str);
6966 // Encodes 'str' for use in an Internationalized Resource Identifier (IRI), 6962 // Encodes 'str' for use in an Internationalized Resource Identifier (IRI),
6967 // a generalization of URI (percent-encoding). See RFC 3987. 6963 // a generalization of URI (percent-encoding). See RFC 3987.
6968 static RawString* EncodeIRI(const String& str); 6964 static const char* EncodeIRI(const String& str);
6969 // Returns null if 'str' is not a valid encoding. 6965 // Returns null if 'str' is not a valid encoding.
6970 static RawString* DecodeIRI(const String& str); 6966 static RawString* DecodeIRI(const String& str);
6971 static RawString* Concat(const String& str1, 6967 static RawString* Concat(const String& str1,
6972 const String& str2, 6968 const String& str2,
6973 Heap::Space space = Heap::kNew); 6969 Heap::Space space = Heap::kNew);
6974 static RawString* ConcatAll(const Array& strings, 6970 static RawString* ConcatAll(const Array& strings,
6975 Heap::Space space = Heap::kNew); 6971 Heap::Space space = Heap::kNew);
6976 // Concat all strings in 'strings' from 'start' to 'end' (excluding). 6972 // Concat all strings in 'strings' from 'start' to 'end' (excluding).
6977 static RawString* ConcatAllRange(const Array& strings, 6973 static RawString* ConcatAllRange(const Array& strings,
6978 intptr_t start, 6974 intptr_t start,
(...skipping 2024 matching lines...) Expand 10 before | Expand all | Expand 10 after
9003 8999
9004 inline void TypeArguments::SetHash(intptr_t value) const { 9000 inline void TypeArguments::SetHash(intptr_t value) const {
9005 // This is only safe because we create a new Smi, which does not cause 9001 // This is only safe because we create a new Smi, which does not cause
9006 // heap allocation. 9002 // heap allocation.
9007 StoreSmi(&raw_ptr()->hash_, Smi::New(value)); 9003 StoreSmi(&raw_ptr()->hash_, Smi::New(value));
9008 } 9004 }
9009 9005
9010 } // namespace dart 9006 } // namespace dart
9011 9007
9012 #endif // VM_OBJECT_H_ 9008 #endif // VM_OBJECT_H_
OLDNEW
« no previous file with comments | « runtime/vm/disassembler.cc ('k') | runtime/vm/object.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698