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

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

Issue 1877813003: Use exact name lookup for static fields in mirrors. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 4 years, 8 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
« 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 700 matching lines...) Expand 10 before | Expand all | Expand 10 after
711 // make sure that this null does not leak into Dartland. 711 // make sure that this null does not leak into Dartland.
712 return Object::sentinel().raw(); 712 return Object::sentinel().raw();
713 } 713 }
714 714
715 715
716 static RawInstance* InvokeClassGetter(const Class& klass, 716 static RawInstance* InvokeClassGetter(const Class& klass,
717 const String& getter_name, 717 const String& getter_name,
718 const bool throw_nsm_if_absent) { 718 const bool throw_nsm_if_absent) {
719 // Note static fields do not have implicit getters. 719 // Note static fields do not have implicit getters.
720 const Field& field = 720 const Field& field =
721 Field::Handle(klass.LookupStaticFieldAllowPrivate(getter_name)); 721 Field::Handle(klass.LookupStaticField(getter_name));
722 if (field.IsNull() || field.IsUninitialized()) { 722 if (field.IsNull() || field.IsUninitialized()) {
723 const String& internal_getter_name = String::Handle( 723 const String& internal_getter_name = String::Handle(
724 Field::GetterName(getter_name)); 724 Field::GetterName(getter_name));
725 Function& getter = Function::Handle( 725 Function& getter = Function::Handle(
726 klass.LookupStaticFunction(internal_getter_name)); 726 klass.LookupStaticFunction(internal_getter_name));
727 727
728 if (getter.IsNull() || !getter.is_reflectable()) { 728 if (getter.IsNull() || !getter.is_reflectable()) {
729 if (getter.IsNull()) { 729 if (getter.IsNull()) {
730 getter = klass.LookupStaticFunction(getter_name); 730 getter = klass.LookupStaticFunction(getter_name);
731 if (!getter.IsNull()) { 731 if (!getter.IsNull()) {
(...skipping 832 matching lines...) Expand 10 before | Expand all | Expand 10 after
1564 GET_NATIVE_ARGUMENT(Instance, value, arguments->NativeArgAt(3)); 1564 GET_NATIVE_ARGUMENT(Instance, value, arguments->NativeArgAt(3));
1565 1565
1566 const Error& error = Error::Handle(zone, klass.EnsureIsFinalized(thread)); 1566 const Error& error = Error::Handle(zone, klass.EnsureIsFinalized(thread));
1567 if (!error.IsNull()) { 1567 if (!error.IsNull()) {
1568 Exceptions::PropagateError(error); 1568 Exceptions::PropagateError(error);
1569 UNREACHABLE(); 1569 UNREACHABLE();
1570 } 1570 }
1571 1571
1572 // Check for real fields and user-defined setters. 1572 // Check for real fields and user-defined setters.
1573 const Field& field = 1573 const Field& field =
1574 Field::Handle(klass.LookupStaticFieldAllowPrivate(setter_name)); 1574 Field::Handle(klass.LookupStaticField(setter_name));
1575 Function& setter = Function::Handle(); 1575 Function& setter = Function::Handle();
1576 const String& internal_setter_name = String::Handle( 1576 const String& internal_setter_name = String::Handle(
1577 Field::SetterName(setter_name)); 1577 Field::SetterName(setter_name));
1578 1578
1579 if (field.IsNull()) { 1579 if (field.IsNull()) {
1580 setter = klass.LookupStaticFunction(internal_setter_name); 1580 setter = klass.LookupStaticFunction(internal_setter_name);
1581 1581
1582 const int kNumArgs = 1; 1582 const int kNumArgs = 1;
1583 const Array& args = Array::Handle(Array::New(kNumArgs)); 1583 const Array& args = Array::Handle(Array::New(kNumArgs));
1584 args.SetAt(0, value); 1584 args.SetAt(0, value);
(...skipping 521 matching lines...) Expand 10 before | Expand all | Expand 10 after
2106 2106
2107 DEFINE_NATIVE_ENTRY(TypeMirror_subtypeTest, 2) { 2107 DEFINE_NATIVE_ENTRY(TypeMirror_subtypeTest, 2) {
2108 GET_NON_NULL_NATIVE_ARGUMENT(AbstractType, a, arguments->NativeArgAt(0)); 2108 GET_NON_NULL_NATIVE_ARGUMENT(AbstractType, a, arguments->NativeArgAt(0));
2109 GET_NON_NULL_NATIVE_ARGUMENT(AbstractType, b, arguments->NativeArgAt(1)); 2109 GET_NON_NULL_NATIVE_ARGUMENT(AbstractType, b, arguments->NativeArgAt(1));
2110 return Bool::Get(a.IsSubtypeOf(b, NULL, NULL, Heap::kNew)).raw(); 2110 return Bool::Get(a.IsSubtypeOf(b, NULL, NULL, Heap::kNew)).raw();
2111 } 2111 }
2112 2112
2113 #endif // !PRODUCT 2113 #endif // !PRODUCT
2114 2114
2115 } // namespace dart 2115 } // 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