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

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: Remove redundant check. 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 12035 matching lines...) Expand 10 before | Expand all | Expand 10 after
12046 } 12046 }
12047 } 12047 }
12048 if (!func.IsNull()) { 12048 if (!func.IsNull()) {
12049 return func.raw(); 12049 return func.raw();
12050 } 12050 }
12051 } 12051 }
12052 return Function::null(); 12052 return Function::null();
12053 } 12053 }
12054 12054
12055 12055
12056 RawObject* Library::GetFunctionClosure(const String& name) const {
12057 Thread* thread = Thread::Current();
12058 Zone* zone = thread->zone();
12059 Function& func = Function::Handle(zone, LookupFunctionAllowPrivate(name));
12060 if (func.IsNull()) {
12061 // Check whether the function is reexported into the library.
12062 const Object& obj = Object::Handle(zone, LookupReExport(name));
12063 if (obj.IsFunction()) {
12064 func ^= obj.raw();
12065 } else {
12066 // Check if there is a getter of 'name', in which case invoke it
12067 // and return the result.
12068 const String& getter_name = String::Handle(zone, Field::GetterName(name));
12069 func = LookupFunctionAllowPrivate(getter_name);
12070 if (func.IsNull()) {
12071 return Closure::null();
12072 }
12073 // Invoke the getter and return the result.
12074 return DartEntry::InvokeFunction(func, Object::empty_array());
12075 }
12076 }
12077 func = func.ImplicitClosureFunction();
12078 return func.ImplicitStaticClosure();
12079 }
12080
12081
12056 #if defined(DART_NO_SNAPSHOT) && !defined(PRODUCT) 12082 #if defined(DART_NO_SNAPSHOT) && !defined(PRODUCT)
12057 void Library::CheckFunctionFingerprints() { 12083 void Library::CheckFunctionFingerprints() {
12058 GrowableArray<Library*> all_libs; 12084 GrowableArray<Library*> all_libs;
12059 Function& func = Function::Handle(); 12085 Function& func = Function::Handle();
12060 bool has_errors = false; 12086 bool has_errors = false;
12061 12087
12062 #define CHECK_FINGERPRINTS(class_name, function_name, dest, fp) \ 12088 #define CHECK_FINGERPRINTS(class_name, function_name, dest, fp) \
12063 func = GetFunction(all_libs, #class_name, #function_name); \ 12089 func = GetFunction(all_libs, #class_name, #function_name); \
12064 if (func.IsNull()) { \ 12090 if (func.IsNull()) { \
12065 has_errors = true; \ 12091 has_errors = true; \
(...skipping 11310 matching lines...) Expand 10 before | Expand all | Expand 10 after
23376 return UserTag::null(); 23402 return UserTag::null();
23377 } 23403 }
23378 23404
23379 23405
23380 const char* UserTag::ToCString() const { 23406 const char* UserTag::ToCString() const {
23381 const String& tag_label = String::Handle(label()); 23407 const String& tag_label = String::Handle(label());
23382 return tag_label.ToCString(); 23408 return tag_label.ToCString();
23383 } 23409 }
23384 23410
23385 } // namespace dart 23411 } // namespace dart
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698