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

Unified Diff: runtime/vm/kernel_to_il.h

Issue 2820363002: Move Kernel strings into the VM's heap. (Closed)
Patch Set: Created 3 years, 8 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 side-by-side diff with in-line comments
Download patch
Index: runtime/vm/kernel_to_il.h
diff --git a/runtime/vm/kernel_to_il.h b/runtime/vm/kernel_to_il.h
index 66b2e937c46de50f257a5706941e3553f83155b3..db7a9add60cc681fe89341c9bb025fa3e4ff4424 100644
--- a/runtime/vm/kernel_to_il.h
+++ b/runtime/vm/kernel_to_il.h
@@ -269,12 +269,7 @@ class ActiveFunctionScope {
class TranslationHelper {
public:
- explicit TranslationHelper(dart::Thread* thread)
- : thread_(thread),
- zone_(thread->zone()),
- isolate_(thread->isolate()),
- allocation_space_(thread->IsMutatorThread() ? Heap::kNew : Heap::kOld) {
- }
+ explicit TranslationHelper(dart::Thread* thread);
virtual ~TranslationHelper() {}
Thread* thread() { return thread_; }
@@ -285,6 +280,31 @@ class TranslationHelper {
Heap::Space allocation_space() { return allocation_space_; }
+ // Access to strings.
+ const TypedData& string_data() { return string_data_; }
+ void SetStringData(const TypedData& string_data);
+ uint8_t CharacterAt(String* str, intptr_t index);
+ bool StringEquals(String* str, const char* other);
+
+ // Predicates on CanonicalNames.
+ bool IsAdministrative(CanonicalName* name);
+ bool IsPrivate(CanonicalName* name);
+ bool IsRoot(CanonicalName* name);
+ bool IsLibrary(CanonicalName* name);
+ bool IsClass(CanonicalName* name);
+ bool IsMember(CanonicalName* name);
+ bool IsField(CanonicalName* name);
+ bool IsConstructor(CanonicalName* name);
+ bool IsProcedure(CanonicalName* name);
+ bool IsMethod(CanonicalName* name);
+ bool IsGetter(CanonicalName* name);
+ bool IsSetter(CanonicalName* name);
+ bool IsFactory(CanonicalName* name);
+
+ // For a member (field, constructor, or procedure) return the canonical name
+ // of the enclosing class or library.
+ CanonicalName* EnclosingName(CanonicalName* name);
+
RawInstance* Canonicalize(const Instance& instance);
const dart::String& DartString(const char* content) {
@@ -362,10 +382,12 @@ class TranslationHelper {
const dart::String& DartGetterName(CanonicalName* parent, String* getter);
const dart::String& DartMethodName(CanonicalName* parent, String* method);
- dart::Thread* thread_;
- dart::Zone* zone_;
- dart::Isolate* isolate_;
+ Thread* thread_;
+ Zone* zone_;
+ Isolate* isolate_;
Heap::Space allocation_space_;
+
+ TypedData& string_data_;
};
// Regarding malformed types:
@@ -628,20 +650,7 @@ class ScopeBuildingResult : public ZoneAllocated {
class ScopeBuilder : public RecursiveVisitor {
public:
- ScopeBuilder(ParsedFunction* parsed_function, TreeNode* node)
- : result_(NULL),
- parsed_function_(parsed_function),
- node_(node),
- translation_helper_(Thread::Current()),
- zone_(translation_helper_.zone()),
- type_translator_(&translation_helper_,
- &active_class_,
- /*finalize=*/true),
- current_function_scope_(NULL),
- scope_(NULL),
- depth_(0),
- name_index_(0),
- needs_expr_temp_(false) {}
+ ScopeBuilder(ParsedFunction* parsed_function, TreeNode* node);
virtual ~ScopeBuilder() {}
@@ -1120,7 +1129,7 @@ class CatchBlock {
};
-RawObject* EvaluateMetadata(TreeNode* const kernel_node);
+RawObject* EvaluateMetadata(const dart::Field& metadata_field);
RawObject* BuildParameterDescriptor(TreeNode* const kernel_node);
@@ -1135,7 +1144,7 @@ RawObject* BuildParameterDescriptor(TreeNode* const kernel_node);
namespace dart {
namespace kernel {
-RawObject* EvaluateMetadata(TreeNode* const kernel_node);
+RawObject* EvaluateMetadata(const dart::Field& metadata_field);
RawObject* BuildParameterDescriptor(TreeNode* const kernel_node);
} // namespace kernel

Powered by Google App Engine
This is Rietveld 408576698