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. |
159 #define INVISIBLE_LIST(V) \ | 161 #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) \ | |
168 V(CoreLibrary, int, _throwFormatException) \ | 162 V(CoreLibrary, int, _throwFormatException) \ |
169 V(CoreLibrary, int, _parse) \ | 163 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 | |
200 | 164 |
201 static void MarkFunctionAsInvisible(const Library& lib, | 165 static void MarkFunctionAsInvisible(const Library& lib, |
202 const char* class_name, | 166 const char* class_name, |
203 const char* function_name) { | 167 const char* function_name) { |
204 ASSERT(!lib.IsNull()); | 168 ASSERT(!lib.IsNull()); |
205 const Class& cls = Class::Handle( | 169 const Class& cls = Class::Handle( |
206 lib.LookupClassAllowPrivate(String::Handle(String::New(class_name)))); | 170 lib.LookupClassAllowPrivate(String::Handle(String::New(class_name)))); |
207 ASSERT(!cls.IsNull()); | 171 ASSERT(!cls.IsNull()); |
208 const Function& function = | 172 const Function& function = |
209 Function::Handle( | 173 Function::Handle( |
(...skipping 8746 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
8956 GrowableObjectArray::New(4, Heap::kOld)); | 8920 GrowableObjectArray::New(4, Heap::kOld)); |
8957 result.raw_ptr()->anonymous_classes_ = Object::empty_array().raw(); | 8921 result.raw_ptr()->anonymous_classes_ = Object::empty_array().raw(); |
8958 result.raw_ptr()->num_anonymous_ = 0; | 8922 result.raw_ptr()->num_anonymous_ = 0; |
8959 result.raw_ptr()->imports_ = Object::empty_array().raw(); | 8923 result.raw_ptr()->imports_ = Object::empty_array().raw(); |
8960 result.raw_ptr()->exports_ = Object::empty_array().raw(); | 8924 result.raw_ptr()->exports_ = Object::empty_array().raw(); |
8961 result.raw_ptr()->loaded_scripts_ = Array::null(); | 8925 result.raw_ptr()->loaded_scripts_ = Array::null(); |
8962 result.set_native_entry_resolver(NULL); | 8926 result.set_native_entry_resolver(NULL); |
8963 result.set_native_entry_symbol_resolver(NULL); | 8927 result.set_native_entry_symbol_resolver(NULL); |
8964 result.raw_ptr()->corelib_imported_ = true; | 8928 result.raw_ptr()->corelib_imported_ = true; |
8965 result.set_debuggable(false); | 8929 result.set_debuggable(false); |
| 8930 result.set_is_dart_scheme(url.StartsWith(Symbols::DartScheme())); |
8966 result.raw_ptr()->load_state_ = RawLibrary::kAllocated; | 8931 result.raw_ptr()->load_state_ = RawLibrary::kAllocated; |
8967 result.raw_ptr()->index_ = -1; | 8932 result.raw_ptr()->index_ = -1; |
8968 const intptr_t kInitialNameCacheSize = 64; | 8933 const intptr_t kInitialNameCacheSize = 64; |
8969 result.InitResolvedNamesCache(kInitialNameCacheSize); | 8934 result.InitResolvedNamesCache(kInitialNameCacheSize); |
8970 result.InitClassDictionary(); | 8935 result.InitClassDictionary(); |
8971 result.InitImportList(); | 8936 result.InitImportList(); |
8972 result.AllocatePrivateKey(); | 8937 result.AllocatePrivateKey(); |
8973 if (import_core_lib) { | 8938 if (import_core_lib) { |
8974 const Library& core_lib = Library::Handle(Library::CoreLibrary()); | 8939 const Library& core_lib = Library::Handle(Library::CoreLibrary()); |
8975 ASSERT(!core_lib.IsNull()); | 8940 ASSERT(!core_lib.IsNull()); |
(...skipping 9486 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
18462 return tag_label.ToCString(); | 18427 return tag_label.ToCString(); |
18463 } | 18428 } |
18464 | 18429 |
18465 | 18430 |
18466 void UserTag::PrintToJSONStream(JSONStream* stream, bool ref) const { | 18431 void UserTag::PrintToJSONStream(JSONStream* stream, bool ref) const { |
18467 Instance::PrintToJSONStream(stream, ref); | 18432 Instance::PrintToJSONStream(stream, ref); |
18468 } | 18433 } |
18469 | 18434 |
18470 | 18435 |
18471 } // namespace dart | 18436 } // namespace dart |
OLD | NEW |