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

Unified Diff: runtime/vm/object.cc

Issue 982723002: Fix for issue 20992 - Allow sending static/top-level functions to other isolates which are spawned … (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 5 years, 10 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
« no previous file with comments | « runtime/vm/object.h ('k') | runtime/vm/raw_object.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/object.cc
===================================================================
--- runtime/vm/object.cc (revision 44266)
+++ runtime/vm/object.cc (working copy)
@@ -6084,6 +6084,21 @@
}
+bool Function::IsImplicitStaticClosureFunction(RawFunction* func) {
+ NoGCScope no_gc;
+ uint32_t kind_tag = func->ptr()->kind_tag_;
+ if (KindBits::decode(kind_tag) != RawFunction::kClosureFunction) {
+ return false;
+ }
+ if (!StaticBit::decode(kind_tag)) {
+ return false;
+ }
+ RawClosureData* data = reinterpret_cast<RawClosureData*>(func->ptr()->data_);
+ RawFunction* parent_function = data->ptr()->parent_function_;
+ return (parent_function->ptr()->data_ == reinterpret_cast<RawObject*>(func));
+}
+
+
RawFunction* Function::New() {
ASSERT(Object::function_class() != Class::null());
RawObject* raw = Object::Allocate(Function::kClassId,
@@ -6383,10 +6398,15 @@
RawInstance* Function::ImplicitStaticClosure() const {
if (implicit_static_closure() == Instance::null()) {
- ObjectStore* object_store = Isolate::Current()->object_store();
- const Context& context = Context::Handle(object_store->empty_context());
- const Instance& closure =
- Instance::Handle(Closure::New(*this, context, Heap::kOld));
+ Isolate* isolate = Isolate::Current();
+ ObjectStore* object_store = isolate->object_store();
+ const Context& context = Context::Handle(isolate,
+ object_store->empty_context());
+ Instance& closure =
+ Instance::Handle(isolate, Closure::New(*this, context, Heap::kOld));
+ const char* error_str = NULL;
+ closure ^= closure.CheckAndCanonicalize(&error_str);
+ ASSERT(!closure.IsNull());
set_implicit_static_closure(closure);
}
return implicit_static_closure();
« no previous file with comments | « runtime/vm/object.h ('k') | runtime/vm/raw_object.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698