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 138 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
149 reinterpret_cast<RawClass*>(RAW_NULL); | 149 reinterpret_cast<RawClass*>(RAW_NULL); |
150 RawClass* Object::unwind_error_class_ = reinterpret_cast<RawClass*>(RAW_NULL); | 150 RawClass* Object::unwind_error_class_ = reinterpret_cast<RawClass*>(RAW_NULL); |
151 | 151 |
152 | 152 |
153 const double MegamorphicCache::kLoadFactor = 0.75; | 153 const double MegamorphicCache::kLoadFactor = 0.75; |
154 | 154 |
155 | 155 |
156 // The following functions are marked as invisible, meaning they will be hidden | 156 // The following functions are marked as invisible, meaning they will be hidden |
157 // in the stack trace and will be hidden from reflective access. | 157 // in the stack trace and will be hidden from reflective access. |
158 // (Library, class name, method name) | 158 // (Library, class name, method name) |
159 // Additionally, private functions in dart:* that are native or constructors are | |
160 // marked as invisible by the parser. | |
161 #define INVISIBLE_LIST(V) \ | 159 #define INVISIBLE_LIST(V) \ |
| 160 V(CoreLibrary, Object, _noSuchMethod) \ |
| 161 V(CoreLibrary, Object, _as) \ |
| 162 V(CoreLibrary, Object, _instanceOf) \ |
| 163 V(CoreLibrary, _List, _List.) \ |
| 164 V(CoreLibrary, AssertionError, _throwNew) \ |
| 165 V(CoreLibrary, TypeError, _throwNew) \ |
| 166 V(CoreLibrary, FallThroughError, _throwNew) \ |
| 167 V(CoreLibrary, AbstractClassInstantiationError, _throwNew) \ |
162 V(CoreLibrary, int, _throwFormatException) \ | 168 V(CoreLibrary, int, _throwFormatException) \ |
163 V(CoreLibrary, int, _parse) \ | 169 V(CoreLibrary, int, _parse) \ |
| 170 V(CoreLibrary, StackTrace, _setupFullStackTrace) \ |
| 171 V(CoreLibrary, _OneByteString, _setAt) \ |
| 172 V(CoreLibrary, _StringBase, _substringUncheckedNative) \ |
| 173 V(CoreLibrary, _OneByteString, _substringUncheckedNative) \ |
| 174 V(CoreLibrary, _GrowableList, _setData) \ |
| 175 V(CoreLibrary, _GrowableList, _setLength) \ |
| 176 V(TypedDataLibrary, _TypedList, _getInt8) \ |
| 177 V(TypedDataLibrary, _TypedList, _setInt8) \ |
| 178 V(TypedDataLibrary, _TypedList, _getUint8) \ |
| 179 V(TypedDataLibrary, _TypedList, _setUint8) \ |
| 180 V(TypedDataLibrary, _TypedList, _getInt16) \ |
| 181 V(TypedDataLibrary, _TypedList, _setInt16) \ |
| 182 V(TypedDataLibrary, _TypedList, _getUint16) \ |
| 183 V(TypedDataLibrary, _TypedList, _setUint16) \ |
| 184 V(TypedDataLibrary, _TypedList, _getInt32) \ |
| 185 V(TypedDataLibrary, _TypedList, _setInt32) \ |
| 186 V(TypedDataLibrary, _TypedList, _getUint32) \ |
| 187 V(TypedDataLibrary, _TypedList, _setUint32) \ |
| 188 V(TypedDataLibrary, _TypedList, _getInt64) \ |
| 189 V(TypedDataLibrary, _TypedList, _setInt64) \ |
| 190 V(TypedDataLibrary, _TypedList, _getUint64) \ |
| 191 V(TypedDataLibrary, _TypedList, _setUint64) \ |
| 192 V(TypedDataLibrary, _TypedList, _getFloat32) \ |
| 193 V(TypedDataLibrary, _TypedList, _setFloat32) \ |
| 194 V(TypedDataLibrary, _TypedList, _getFloat64) \ |
| 195 V(TypedDataLibrary, _TypedList, _setFloat64) \ |
| 196 V(TypedDataLibrary, _TypedList, _getFloat32x4) \ |
| 197 V(TypedDataLibrary, _TypedList, _setFloat32x4) \ |
| 198 |
| 199 |
164 | 200 |
165 static void MarkFunctionAsInvisible(const Library& lib, | 201 static void MarkFunctionAsInvisible(const Library& lib, |
166 const char* class_name, | 202 const char* class_name, |
167 const char* function_name) { | 203 const char* function_name) { |
168 ASSERT(!lib.IsNull()); | 204 ASSERT(!lib.IsNull()); |
169 const Class& cls = Class::Handle( | 205 const Class& cls = Class::Handle( |
170 lib.LookupClassAllowPrivate(String::Handle(String::New(class_name)))); | 206 lib.LookupClassAllowPrivate(String::Handle(String::New(class_name)))); |
171 ASSERT(!cls.IsNull()); | 207 ASSERT(!cls.IsNull()); |
172 const Function& function = | 208 const Function& function = |
173 Function::Handle( | 209 Function::Handle( |
(...skipping 8746 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
8920 GrowableObjectArray::New(4, Heap::kOld)); | 8956 GrowableObjectArray::New(4, Heap::kOld)); |
8921 result.raw_ptr()->anonymous_classes_ = Object::empty_array().raw(); | 8957 result.raw_ptr()->anonymous_classes_ = Object::empty_array().raw(); |
8922 result.raw_ptr()->num_anonymous_ = 0; | 8958 result.raw_ptr()->num_anonymous_ = 0; |
8923 result.raw_ptr()->imports_ = Object::empty_array().raw(); | 8959 result.raw_ptr()->imports_ = Object::empty_array().raw(); |
8924 result.raw_ptr()->exports_ = Object::empty_array().raw(); | 8960 result.raw_ptr()->exports_ = Object::empty_array().raw(); |
8925 result.raw_ptr()->loaded_scripts_ = Array::null(); | 8961 result.raw_ptr()->loaded_scripts_ = Array::null(); |
8926 result.set_native_entry_resolver(NULL); | 8962 result.set_native_entry_resolver(NULL); |
8927 result.set_native_entry_symbol_resolver(NULL); | 8963 result.set_native_entry_symbol_resolver(NULL); |
8928 result.raw_ptr()->corelib_imported_ = true; | 8964 result.raw_ptr()->corelib_imported_ = true; |
8929 result.set_debuggable(false); | 8965 result.set_debuggable(false); |
8930 result.set_is_dart_scheme(url.StartsWith(Symbols::DartScheme())); | |
8931 result.raw_ptr()->load_state_ = RawLibrary::kAllocated; | 8966 result.raw_ptr()->load_state_ = RawLibrary::kAllocated; |
8932 result.raw_ptr()->index_ = -1; | 8967 result.raw_ptr()->index_ = -1; |
8933 const intptr_t kInitialNameCacheSize = 64; | 8968 const intptr_t kInitialNameCacheSize = 64; |
8934 result.InitResolvedNamesCache(kInitialNameCacheSize); | 8969 result.InitResolvedNamesCache(kInitialNameCacheSize); |
8935 result.InitClassDictionary(); | 8970 result.InitClassDictionary(); |
8936 result.InitImportList(); | 8971 result.InitImportList(); |
8937 result.AllocatePrivateKey(); | 8972 result.AllocatePrivateKey(); |
8938 if (import_core_lib) { | 8973 if (import_core_lib) { |
8939 const Library& core_lib = Library::Handle(Library::CoreLibrary()); | 8974 const Library& core_lib = Library::Handle(Library::CoreLibrary()); |
8940 ASSERT(!core_lib.IsNull()); | 8975 ASSERT(!core_lib.IsNull()); |
(...skipping 9484 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
18425 return tag_label.ToCString(); | 18460 return tag_label.ToCString(); |
18426 } | 18461 } |
18427 | 18462 |
18428 | 18463 |
18429 void UserTag::PrintToJSONStream(JSONStream* stream, bool ref) const { | 18464 void UserTag::PrintToJSONStream(JSONStream* stream, bool ref) const { |
18430 Instance::PrintToJSONStream(stream, ref); | 18465 Instance::PrintToJSONStream(stream, ref); |
18431 } | 18466 } |
18432 | 18467 |
18433 | 18468 |
18434 } // namespace dart | 18469 } // namespace dart |
OLD | NEW |