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

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

Issue 2933603002: 1. Dynamic compute the main closure that needs to be run by the main isolate (Closed)
Patch Set: Address review comments. 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 unified diff | Download patch
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 #include "vm/object.h" 5 #include "vm/object.h"
6 6
7 #include "include/dart_api.h" 7 #include "include/dart_api.h"
8 #include "platform/assert.h" 8 #include "platform/assert.h"
9 #include "vm/assembler.h" 9 #include "vm/assembler.h"
10 #include "vm/become.h" 10 #include "vm/become.h"
(...skipping 12045 matching lines...) Expand 10 before | Expand all | Expand 10 after
12056 } 12056 }
12057 } 12057 }
12058 if (!func.IsNull()) { 12058 if (!func.IsNull()) {
12059 return func.raw(); 12059 return func.raw();
12060 } 12060 }
12061 } 12061 }
12062 return Function::null(); 12062 return Function::null();
12063 } 12063 }
12064 12064
12065 12065
12066 RawObject* Library::GetFunctionClosure(const String& name) const {
12067 Thread* thread = Thread::Current();
12068 Zone* zone = thread->zone();
12069 Function& func = Function::Handle(zone, LookupFunctionAllowPrivate(name));
12070 if (func.IsNull()) {
12071 // Check whether the function is reexported into the library.
12072 const Object& obj = Object::Handle(zone, LookupReExport(name));
12073 if (obj.IsFunction()) {
12074 func ^= obj.raw();
12075 } else {
12076 // Check if there is a getter of 'name', in which case invoke it
12077 // and return the result.
12078 const String& getter_name = String::Handle(zone, Field::GetterName(name));
12079 func = LookupFunctionAllowPrivate(getter_name);
12080 if (func.IsNull()) {
12081 return Closure::null();
12082 }
12083 // Invoke the getter and return the result.
12084 return DartEntry::InvokeFunction(func, Object::empty_array());
12085 }
12086 }
12087 func = func.ImplicitClosureFunction();
12088 return func.ImplicitStaticClosure();
12089 }
12090
12091
12066 #if defined(DART_NO_SNAPSHOT) && !defined(PRODUCT) 12092 #if defined(DART_NO_SNAPSHOT) && !defined(PRODUCT)
12067 void Library::CheckFunctionFingerprints() { 12093 void Library::CheckFunctionFingerprints() {
12068 GrowableArray<Library*> all_libs; 12094 GrowableArray<Library*> all_libs;
12069 Function& func = Function::Handle(); 12095 Function& func = Function::Handle();
12070 bool has_errors = false; 12096 bool has_errors = false;
12071 12097
12072 #define CHECK_FINGERPRINTS(class_name, function_name, dest, fp) \ 12098 #define CHECK_FINGERPRINTS(class_name, function_name, dest, fp) \
12073 func = GetFunction(all_libs, #class_name, #function_name); \ 12099 func = GetFunction(all_libs, #class_name, #function_name); \
12074 if (func.IsNull()) { \ 12100 if (func.IsNull()) { \
12075 has_errors = true; \ 12101 has_errors = true; \
(...skipping 11317 matching lines...) Expand 10 before | Expand all | Expand 10 after
23393 return UserTag::null(); 23419 return UserTag::null();
23394 } 23420 }
23395 23421
23396 23422
23397 const char* UserTag::ToCString() const { 23423 const char* UserTag::ToCString() const {
23398 const String& tag_label = String::Handle(label()); 23424 const String& tag_label = String::Handle(label());
23399 return tag_label.ToCString(); 23425 return tag_label.ToCString();
23400 } 23426 }
23401 23427
23402 } // namespace dart 23428 } // namespace dart
OLDNEW
« no previous file with comments | « runtime/vm/object.h ('k') | runtime/vm/precompiler.h » ('j') | tests/co19/co19-kernel.status » ('J')

Powered by Google App Engine
This is Rietveld 408576698