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

Side by Side Diff: runtime/lib/mirrors.cc

Issue 973913002: Treat functions generated for closurization as equivalent to their source functions. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 5 years, 9 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | tests/lib/lib.status » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 "lib/mirrors.h" 5 #include "lib/mirrors.h"
6 6
7 #include "lib/invocation_mirror.h" 7 #include "lib/invocation_mirror.h"
8 #include "vm/bootstrap_natives.h" 8 #include "vm/bootstrap_natives.h"
9 #include "vm/class_finalizer.h" 9 #include "vm/class_finalizer.h"
10 #include "vm/compiler.h" 10 #include "vm/compiler.h"
(...skipping 1348 matching lines...) Expand 10 before | Expand all | Expand 10 after
1359 } 1359 }
1360 1360
1361 1361
1362 DEFINE_NATIVE_ENTRY(ClosureMirror_function, 1) { 1362 DEFINE_NATIVE_ENTRY(ClosureMirror_function, 1) {
1363 GET_NON_NULL_NATIVE_ARGUMENT(Instance, closure, arguments->NativeArgAt(0)); 1363 GET_NON_NULL_NATIVE_ARGUMENT(Instance, closure, arguments->NativeArgAt(0));
1364 ASSERT(!closure.IsNull()); 1364 ASSERT(!closure.IsNull());
1365 1365
1366 Function& function = Function::Handle(); 1366 Function& function = Function::Handle();
1367 bool callable = closure.IsCallable(&function); 1367 bool callable = closure.IsCallable(&function);
1368 if (callable) { 1368 if (callable) {
1369 if (function.IsImplicitClosureFunction()) {
1370 // The VM uses separate Functions for tear-offs, but the mirrors consider
1371 // the tear-offs to be the same as the torn-off methods. Avoid handing out
1372 // a reference to the tear-off here to avoid a special case in the
1373 // the equality test.
1374 function = function.parent_function();
1375 }
1369 return CreateMethodMirror(function, Instance::null_instance()); 1376 return CreateMethodMirror(function, Instance::null_instance());
1370 } 1377 }
1371 return Instance::null(); 1378 return Instance::null();
1372 } 1379 }
1373 1380
1374 1381
1375 DEFINE_NATIVE_ENTRY(ClassMirror_invoke, 5) { 1382 DEFINE_NATIVE_ENTRY(ClassMirror_invoke, 5) {
1376 // Argument 0 is the mirror, which is unused by the native. It exists 1383 // Argument 0 is the mirror, which is unused by the native. It exists
1377 // because this native is an instance method in order to be polymorphic 1384 // because this native is an instance method in order to be polymorphic
1378 // with its cousins. 1385 // with its cousins.
(...skipping 650 matching lines...) Expand 10 before | Expand all | Expand 10 after
2029 } 2036 }
2030 2037
2031 DEFINE_NATIVE_ENTRY(TypeMirror_moreSpecificTest, 2) { 2038 DEFINE_NATIVE_ENTRY(TypeMirror_moreSpecificTest, 2) {
2032 GET_NON_NULL_NATIVE_ARGUMENT(AbstractType, a, arguments->NativeArgAt(0)); 2039 GET_NON_NULL_NATIVE_ARGUMENT(AbstractType, a, arguments->NativeArgAt(0));
2033 GET_NON_NULL_NATIVE_ARGUMENT(AbstractType, b, arguments->NativeArgAt(1)); 2040 GET_NON_NULL_NATIVE_ARGUMENT(AbstractType, b, arguments->NativeArgAt(1));
2034 return Bool::Get(a.IsMoreSpecificThan(b, NULL)).raw(); 2041 return Bool::Get(a.IsMoreSpecificThan(b, NULL)).raw();
2035 } 2042 }
2036 2043
2037 2044
2038 } // namespace dart 2045 } // namespace dart
OLDNEW
« no previous file with comments | « no previous file | tests/lib/lib.status » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698