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

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

Issue 29413003: Fix VM crash when ClosureMirror.findInContext operates on a fake function. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 2 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/invocation_mirror.h" 5 #include "lib/invocation_mirror.h"
6 #include "vm/bootstrap_natives.h" 6 #include "vm/bootstrap_natives.h"
7 #include "vm/class_finalizer.h" 7 #include "vm/class_finalizer.h"
8 #include "vm/compiler.h" 8 #include "vm/compiler.h"
9 #include "vm/dart_entry.h" 9 #include "vm/dart_entry.h"
10 #include "vm/exceptions.h" 10 #include "vm/exceptions.h"
(...skipping 1432 matching lines...) Expand 10 before | Expand all | Expand 10 after
1443 } 1443 }
1444 return result.raw(); 1444 return result.raw();
1445 } 1445 }
1446 1446
1447 1447
1448 DEFINE_NATIVE_ENTRY(ClosureMirror_find_in_context, 2) { 1448 DEFINE_NATIVE_ENTRY(ClosureMirror_find_in_context, 2) {
1449 GET_NON_NULL_NATIVE_ARGUMENT(Instance, closure, arguments->NativeArgAt(0)); 1449 GET_NON_NULL_NATIVE_ARGUMENT(Instance, closure, arguments->NativeArgAt(0));
1450 GET_NON_NULL_NATIVE_ARGUMENT(Array, lookup_parts, arguments->NativeArgAt(1)); 1450 GET_NON_NULL_NATIVE_ARGUMENT(Array, lookup_parts, arguments->NativeArgAt(1));
1451 ASSERT(lookup_parts.Length() >= 1 && lookup_parts.Length() <= 3); 1451 ASSERT(lookup_parts.Length() >= 1 && lookup_parts.Length() <= 3);
1452 1452
1453 if (!closure.IsClosure()) {
1454 const Array& result_tuple = Array::Handle(Array::New(2));
1455 result_tuple.SetAt(0, Bool::False());
1456 return result_tuple.raw();
1457 }
1458
1453 Function& function = Function::Handle(); 1459 Function& function = Function::Handle();
1454 const bool callable = closure.IsCallable(&function, NULL); 1460 const bool callable = closure.IsCallable(&function, NULL);
1455 ASSERT(callable); 1461 ASSERT(callable);
1456 1462
1457 const int parts_len = lookup_parts.Length(); 1463 const int parts_len = lookup_parts.Length();
1458 // Lookup name is always the last part. 1464 // Lookup name is always the last part.
1459 const String& lookup_name = String::Handle(String::RawCast( 1465 const String& lookup_name = String::Handle(String::RawCast(
1460 lookup_parts.At(parts_len - 1))); 1466 lookup_parts.At(parts_len - 1)));
1461 1467
1462 String& part_name = String::Handle(); 1468 String& part_name = String::Handle();
(...skipping 503 matching lines...) Expand 10 before | Expand all | Expand 10 after
1966 } 1972 }
1967 1973
1968 1974
1969 DEFINE_NATIVE_ENTRY(VariableMirror_type, 1) { 1975 DEFINE_NATIVE_ENTRY(VariableMirror_type, 1) {
1970 GET_NON_NULL_NATIVE_ARGUMENT(MirrorReference, ref, arguments->NativeArgAt(0)); 1976 GET_NON_NULL_NATIVE_ARGUMENT(MirrorReference, ref, arguments->NativeArgAt(0));
1971 const Field& field = Field::Handle(ref.GetFieldReferent()); 1977 const Field& field = Field::Handle(ref.GetFieldReferent());
1972 return field.type(); 1978 return field.type();
1973 } 1979 }
1974 1980
1975 } // namespace dart 1981 } // 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