| OLD | NEW |
| 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/cpu.h" | 10 #include "vm/cpu.h" |
| (...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 154 | 154 |
| 155 | 155 |
| 156 const double MegamorphicCache::kLoadFactor = 0.75; | 156 const double MegamorphicCache::kLoadFactor = 0.75; |
| 157 | 157 |
| 158 | 158 |
| 159 // The following functions are marked as invisible, meaning they will be hidden | 159 // The following functions are marked as invisible, meaning they will be hidden |
| 160 // in the stack trace and will be hidden from reflective access. | 160 // in the stack trace and will be hidden from reflective access. |
| 161 // (Library, class name, method name) | 161 // (Library, class name, method name) |
| 162 // Additionally, private functions in dart:* that are native or constructors are | 162 // Additionally, private functions in dart:* that are native or constructors are |
| 163 // marked as invisible by the parser. | 163 // marked as invisible by the parser. |
| 164 #define INVISIBLE_LIST(V) \ | 164 #define INVISIBLE_CLASS_FUNCTIONS(V) \ |
| 165 V(CoreLibrary, int, _throwFormatException) \ | 165 V(CoreLibrary, int, _throwFormatException) \ |
| 166 V(CoreLibrary, int, _parse) \ | 166 V(CoreLibrary, int, _parse) \ |
| 167 V(CoreLibrary, _Bigint, _mulAdd) \ |
| 167 | 168 |
| 168 static void MarkFunctionAsInvisible(const Library& lib, | 169 #define INVISIBLE_LIBRARY_FUNCTIONS(V) \ |
| 169 const char* class_name, | 170 V(TypedDataLibrary, _toInt8) \ |
| 170 const char* function_name) { | 171 V(TypedDataLibrary, _toInt16) \ |
| 172 V(TypedDataLibrary, _toInt32) \ |
| 173 V(TypedDataLibrary, _toInt64) \ |
| 174 V(TypedDataLibrary, _toUint8) \ |
| 175 V(TypedDataLibrary, _toUint16) \ |
| 176 V(TypedDataLibrary, _toUint32) \ |
| 177 V(TypedDataLibrary, _toUint64) \ |
| 178 |
| 179 static void MarkClassFunctionAsInvisible(const Library& lib, |
| 180 const char* class_name, |
| 181 const char* function_name) { |
| 171 ASSERT(!lib.IsNull()); | 182 ASSERT(!lib.IsNull()); |
| 172 const Class& cls = Class::Handle( | 183 const Class& cls = Class::Handle( |
| 173 lib.LookupClassAllowPrivate(String::Handle(String::New(class_name)))); | 184 lib.LookupClassAllowPrivate(String::Handle(String::New(class_name)))); |
| 174 ASSERT(!cls.IsNull()); | 185 ASSERT(!cls.IsNull()); |
| 175 const Function& function = | 186 const Function& function = |
| 176 Function::Handle( | 187 Function::Handle( |
| 177 cls.LookupFunctionAllowPrivate( | 188 cls.LookupFunctionAllowPrivate( |
| 178 String::Handle(String::New(function_name)))); | 189 String::Handle(String::New(function_name)))); |
| 179 ASSERT(!function.IsNull()); | 190 ASSERT(!function.IsNull()); |
| 180 function.set_is_visible(false); | 191 function.set_is_visible(false); |
| 181 } | 192 } |
| 182 | 193 |
| 194 static void MarkLibraryFunctionAsInvisible(const Library& lib, |
| 195 const char* function_name) { |
| 196 ASSERT(!lib.IsNull()); |
| 197 const Function& function = |
| 198 Function::Handle( |
| 199 lib.LookupFunctionAllowPrivate( |
| 200 String::Handle(String::New(function_name)))); |
| 201 ASSERT(!function.IsNull()); |
| 202 function.set_is_visible(false); |
| 203 } |
| 204 |
| 183 | 205 |
| 184 static void MarkInvisibleFunctions() { | 206 static void MarkInvisibleFunctions() { |
| 185 #define MARK_FUNCTION(lib, class_name, function_name) \ | 207 #define MARK_FUNCTION(lib, class_name, function_name) \ |
| 186 MarkFunctionAsInvisible(Library::Handle(Library::lib()), \ | 208 MarkClassFunctionAsInvisible(Library::Handle(Library::lib()), \ |
| 187 #class_name, #function_name); \ | 209 #class_name, #function_name); \ |
| 188 | 210 |
| 189 INVISIBLE_LIST(MARK_FUNCTION) | 211 INVISIBLE_CLASS_FUNCTIONS(MARK_FUNCTION) |
| 212 #undef MARK_FUNCTION |
| 213 |
| 214 #define MARK_FUNCTION(lib, function_name) \ |
| 215 MarkLibraryFunctionAsInvisible(Library::Handle(Library::lib()), \ |
| 216 #function_name); \ |
| 217 |
| 218 INVISIBLE_LIBRARY_FUNCTIONS(MARK_FUNCTION) |
| 190 #undef MARK_FUNCTION | 219 #undef MARK_FUNCTION |
| 191 } | 220 } |
| 192 | 221 |
| 193 | 222 |
| 194 // Takes a vm internal name and makes it suitable for external user. | 223 // Takes a vm internal name and makes it suitable for external user. |
| 195 // | 224 // |
| 196 // Examples: | 225 // Examples: |
| 197 // | 226 // |
| 198 // Internal getter and setter prefixes are changed: | 227 // Internal getter and setter prefixes are changed: |
| 199 // | 228 // |
| (...skipping 20161 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 20361 return tag_label.ToCString(); | 20390 return tag_label.ToCString(); |
| 20362 } | 20391 } |
| 20363 | 20392 |
| 20364 | 20393 |
| 20365 void UserTag::PrintJSONImpl(JSONStream* stream, bool ref) const { | 20394 void UserTag::PrintJSONImpl(JSONStream* stream, bool ref) const { |
| 20366 Instance::PrintJSONImpl(stream, ref); | 20395 Instance::PrintJSONImpl(stream, ref); |
| 20367 } | 20396 } |
| 20368 | 20397 |
| 20369 | 20398 |
| 20370 } // namespace dart | 20399 } // namespace dart |
| OLD | NEW |