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

Unified Diff: runtime/vm/object.h

Issue 2891053003: Add support for converted closures with explicit contexts to VM (Closed)
Patch Set: Return statement-to-block conversion for procedure bodies Created 3 years, 6 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/object.h
diff --git a/runtime/vm/object.h b/runtime/vm/object.h
index d5062633402b9c66a7b4e20c46a5eb4e109c01be..dfa966abc562e2605b3295ed3d3a9b39abb55112 100644
--- a/runtime/vm/object.h
+++ b/runtime/vm/object.h
@@ -499,6 +499,10 @@ class Object {
ASSERT(void_type_ != NULL);
return *void_type_;
}
+ static const Type& vector_type() {
+ ASSERT(vector_type_ != NULL);
+ return *vector_type_;
+ }
static void set_vm_isolate_snapshot_object_table(const Array& table);
@@ -763,6 +767,7 @@ class Object {
static RawClass* class_class_; // Class of the Class vm object.
static RawClass* dynamic_class_; // Class of the 'dynamic' type.
static RawClass* void_class_; // Class of the 'void' type.
+ static RawClass* vector_class_; // Class of the 'vector' type.
static RawClass* unresolved_class_class_; // Class of UnresolvedClass.
static RawClass* type_arguments_class_; // Class of TypeArguments vm object.
static RawClass* patch_class_class_; // Class of the PatchClass vm object.
@@ -829,6 +834,7 @@ class Object {
static Array* vm_isolate_snapshot_object_table_;
static Type* dynamic_type_;
static Type* void_type_;
+ static Type* vector_type_;
friend void ClassTable::Register(const Class& cls);
friend void RawObject::Validate(Isolate* isolate) const;
@@ -1573,9 +1579,9 @@ class UnresolvedClass : public Object {
// Classification of type genericity according to type parameter owners.
enum Genericity {
- kAny, // Consider type params of current class and functions.
- kCurrentClass, // Consider type params of current class only.
- kFunctions, // Consider type params of current and parent functions.
+ kAny, // Consider type params of current class and functions.
+ kCurrentClass, // Consider type params of current class only.
+ kFunctions, // Consider type params of current and parent functions.
};
@@ -2395,11 +2401,22 @@ class Function : public Object {
return implicit_closure_function() != null();
}
+ // Returns true iff a converted closure function has been created
+ // for this function.
+ bool HasConvertedClosureFunction() const {
+ return converted_closure_function() != null();
+ }
+
// Return the closure function implicitly created for this function.
// If none exists yet, create one and remember it.
RawFunction* ImplicitClosureFunction() const;
void DropUncompiledImplicitClosureFunction() const;
+ // Return the converted closure function created for this function.
kustermann 2017/06/20 12:13:14 s/Return/Returns/ also above in the old code.
Dmitry Stefantsov 2017/06/22 14:12:52 Thanks! Fixed.
+ // If none exists yet, create one and remember it.
+ RawFunction* ConvertedClosureFunction() const;
+ void DropUncompiledConvertedClosureFunction() const;
kustermann 2017/06/20 12:13:14 A reader of this could would be very curious what
Dmitry Stefantsov 2017/06/22 14:12:52 I think the comment on `Function::ConvertedClosure
+
// Return the closure implicitly created for this function.
// If none exists yet, create one and remember it.
RawInstance* ImplicitStaticClosure() const;
@@ -2760,6 +2777,11 @@ class Function : public Object {
// Returns true if this function represents an implicit closure function.
bool IsImplicitClosureFunction() const;
+ // Returns true if this function represents a converted closure function.
+ bool IsConvertedClosureFunction() const {
+ return kind() == RawFunction::kConvertedClosureFunction;
+ }
+
// Returns true if this function represents a non implicit closure function.
bool IsNonImplicitClosureFunction() const {
return IsClosureFunction() && !IsImplicitClosureFunction();
@@ -2852,6 +2874,11 @@ class Function : public Object {
const Function& parent,
TokenPosition token_pos);
+ // Allocates a new Function object representing a converted closure function.
+ static RawFunction* NewConvertedClosureFunction(const String& name,
+ const Function& parent,
+ TokenPosition token_pos);
+
// Allocates a new Function object representing a signature function.
// The owner is the scope class of the function type.
static RawFunction* NewSignatureFunction(const Object& owner,
@@ -3013,6 +3040,8 @@ class Function : public Object {
void set_owner(const Object& value) const;
RawFunction* implicit_closure_function() const;
void set_implicit_closure_function(const Function& value) const;
+ RawFunction* converted_closure_function() const;
+ void set_converted_closure_function(const Function& value) const;
RawInstance* implicit_static_closure() const;
void set_implicit_static_closure(const Instance& closure) const;
RawScript* eval_script() const;
@@ -5106,7 +5135,7 @@ class Code : public Object {
friend class SnapshotWriter;
friend class FunctionSerializationCluster;
friend class CodeSerializationCluster;
- friend class CodePatcher; // for set_instructions
+ friend class CodePatcher; // for set_instructions
friend class ProgramVisitor; // for set_instructions
// So that the RawFunction pointer visitor can determine whether code the
// function points to is optimized.

Powered by Google App Engine
This is Rietveld 408576698