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

Side by Side Diff: vm/object.cc

Issue 10021072: Remove the deprecated method invocation and field access apis from the (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/runtime/
Patch Set: Created 8 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 | Annotate | Revision Log
« no previous file with comments | « vm/object.h ('k') | vm/snapshot_test.cc » ('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 "vm/object.h" 5 #include "vm/object.h"
6 6
7 #include "platform/assert.h" 7 #include "platform/assert.h"
8 #include "vm/assembler.h" 8 #include "vm/assembler.h"
9 #include "vm/bigint_operations.h" 9 #include "vm/bigint_operations.h"
10 #include "vm/bootstrap.h" 10 #include "vm/bootstrap.h"
(...skipping 4669 matching lines...) Expand 10 before | Expand all | Expand 10 after
4680 name.CharAt(0) == '_') || 4680 name.CharAt(0) == '_') ||
4681 (name.Length() >= 5 && 4681 (name.Length() >= 5 &&
4682 (name.CharAt(4) == '_' && 4682 (name.CharAt(4) == '_' &&
4683 (name.CharAt(0) == 'g' || name.CharAt(0) == 's') && 4683 (name.CharAt(0) == 'g' || name.CharAt(0) == 's') &&
4684 name.CharAt(1) == 'e' && 4684 name.CharAt(1) == 'e' &&
4685 name.CharAt(2) == 't' && 4685 name.CharAt(2) == 't' &&
4686 name.CharAt(3) == ':')); 4686 name.CharAt(3) == ':'));
4687 } 4687 }
4688 4688
4689 4689
4690 RawField* Library::LookupFieldAllowPrivate(const String& name) const {
4691 // First check if name is found in the local scope of the library.
4692 Field& field = Field::Handle(LookupLocalField(name));
4693 if (!field.IsNull()) {
4694 return field.raw();
4695 }
4696
4697 // Do not look up private names in imported libraries.
4698 if (ShouldBePrivate(name)) {
4699 return Field::null();
4700 }
4701
4702 // Now check if name is found in the top level scope of any imported
4703 // libs.
4704 const Array& imports = Array::Handle(this->imports());
4705 Library& import_lib = Library::Handle();
4706 for (intptr_t j = 0; j < this->num_imports(); j++) {
4707 import_lib ^= imports.At(j);
4708
4709
4710 field = import_lib.LookupLocalField(name);
4711 if (!field.IsNull()) {
4712 return field.raw();
4713 }
4714 }
4715 return Field::null();
4716 }
4717
4718
4690 RawField* Library::LookupLocalField(const String& name) const { 4719 RawField* Library::LookupLocalField(const String& name) const {
4691 Isolate* isolate = Isolate::Current(); 4720 Isolate* isolate = Isolate::Current();
4692 Field& field = Field::Handle(isolate, Field::null()); 4721 Field& field = Field::Handle(isolate, Field::null());
4693 Object& obj = Object::Handle(isolate, Object::null()); 4722 Object& obj = Object::Handle(isolate, Object::null());
4694 obj = LookupLocalObject(name); 4723 obj = LookupLocalObject(name);
4695 if (obj.IsNull() && ShouldBePrivate(name)) { 4724 if (obj.IsNull() && ShouldBePrivate(name)) {
4696 String& private_name = String::Handle(isolate, PrivateName(name)); 4725 String& private_name = String::Handle(isolate, PrivateName(name));
4697 obj = LookupLocalObject(private_name); 4726 obj = LookupLocalObject(private_name);
4698 } 4727 }
4699 if (!obj.IsNull()) { 4728 if (!obj.IsNull()) {
4700 if (obj.IsField()) { 4729 if (obj.IsField()) {
4701 field ^= obj.raw(); 4730 field ^= obj.raw();
4702 return field.raw(); 4731 return field.raw();
4703 } 4732 }
4704 } 4733 }
4705 4734
4706 // No field found. 4735 // No field found.
4707 return Field::null(); 4736 return Field::null();
4708 } 4737 }
4709 4738
4710 4739
4740 RawFunction* Library::LookupFunctionAllowPrivate(const String& name) const {
4741 // First check if name is found in the local scope of the library.
4742 Function& function = Function::Handle(LookupLocalFunction(name));
4743 if (!function.IsNull()) {
4744 return function.raw();
4745 }
4746
4747 // Do not look up private names in imported libraries.
4748 if (ShouldBePrivate(name)) {
4749 return Function::null();
4750 }
4751
4752 // Now check if name is found in the top level scope of any imported
4753 // libs.
4754 const Array& imports = Array::Handle(this->imports());
4755 Library& import_lib = Library::Handle();
4756 for (intptr_t j = 0; j < this->num_imports(); j++) {
4757 import_lib ^= imports.At(j);
4758
4759
4760 function = import_lib.LookupLocalFunction(name);
4761 if (!function.IsNull()) {
4762 return function.raw();
4763 }
4764 }
4765 return Function::null();
4766 }
4767
4768
4711 RawFunction* Library::LookupLocalFunction(const String& name) const { 4769 RawFunction* Library::LookupLocalFunction(const String& name) const {
4712 Isolate* isolate = Isolate::Current(); 4770 Isolate* isolate = Isolate::Current();
4713 Function& function = Function::Handle(isolate, Function::null()); 4771 Function& function = Function::Handle(isolate, Function::null());
4714 Object& obj = Object::Handle(isolate, Object::null()); 4772 Object& obj = Object::Handle(isolate, Object::null());
4715 obj = LookupLocalObject(name); 4773 obj = LookupLocalObject(name);
4716 if (obj.IsNull() && ShouldBePrivate(name)) { 4774 if (obj.IsNull() && ShouldBePrivate(name)) {
4717 String& private_name = String::Handle(isolate, PrivateName(name)); 4775 String& private_name = String::Handle(isolate, PrivateName(name));
4718 obj = LookupLocalObject(private_name); 4776 obj = LookupLocalObject(private_name);
4719 } 4777 }
4720 if (!obj.IsNull()) { 4778 if (!obj.IsNull()) {
(...skipping 4411 matching lines...) Expand 10 before | Expand all | Expand 10 after
9132 const String& str = String::Handle(pattern()); 9190 const String& str = String::Handle(pattern());
9133 const char* format = "JSRegExp: pattern=%s flags=%s"; 9191 const char* format = "JSRegExp: pattern=%s flags=%s";
9134 intptr_t len = OS::SNPrint(NULL, 0, format, str.ToCString(), Flags()); 9192 intptr_t len = OS::SNPrint(NULL, 0, format, str.ToCString(), Flags());
9135 char* chars = reinterpret_cast<char*>( 9193 char* chars = reinterpret_cast<char*>(
9136 Isolate::Current()->current_zone()->Allocate(len + 1)); 9194 Isolate::Current()->current_zone()->Allocate(len + 1));
9137 OS::SNPrint(chars, (len + 1), format, str.ToCString(), Flags()); 9195 OS::SNPrint(chars, (len + 1), format, str.ToCString(), Flags());
9138 return chars; 9196 return chars;
9139 } 9197 }
9140 9198
9141 } // namespace dart 9199 } // namespace dart
OLDNEW
« no previous file with comments | « vm/object.h ('k') | vm/snapshot_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698