| 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/bigint_operations.h" | 10 #include "vm/bigint_operations.h" |
| 11 #include "vm/bootstrap.h" | 11 #include "vm/bootstrap.h" |
| 12 #include "vm/class_finalizer.h" | 12 #include "vm/class_finalizer.h" |
| 13 #include "vm/code_generator.h" | 13 #include "vm/code_generator.h" |
| 14 #include "vm/code_observers.h" | 14 #include "vm/code_observers.h" |
| 15 #include "vm/code_patcher.h" | 15 #include "vm/code_patcher.h" |
| 16 #include "vm/compiler.h" | 16 #include "vm/compiler.h" |
| 17 #include "vm/compiler_stats.h" | 17 #include "vm/compiler_stats.h" |
| 18 #include "vm/dart.h" | 18 #include "vm/dart.h" |
| 19 #include "vm/dart_api_state.h" | 19 #include "vm/dart_api_state.h" |
| 20 #include "vm/dart_entry.h" | 20 #include "vm/dart_entry.h" |
| 21 #include "vm/datastream.h" | 21 #include "vm/datastream.h" |
| 22 #include "vm/debugger.h" | 22 #include "vm/debugger.h" |
| 23 #include "vm/deopt_instructions.h" | 23 #include "vm/deopt_instructions.h" |
| 24 #include "vm/double_conversion.h" | 24 #include "vm/double_conversion.h" |
| 25 #include "vm/exceptions.h" | 25 #include "vm/exceptions.h" |
| 26 #include "vm/growable_array.h" | 26 #include "vm/growable_array.h" |
| 27 #include "vm/heap.h" | 27 #include "vm/heap.h" |
| 28 #include "vm/intermediate_language.h" |
| 28 #include "vm/intrinsifier.h" | 29 #include "vm/intrinsifier.h" |
| 29 #include "vm/object_store.h" | 30 #include "vm/object_store.h" |
| 30 #include "vm/parser.h" | 31 #include "vm/parser.h" |
| 31 #include "vm/runtime_entry.h" | 32 #include "vm/runtime_entry.h" |
| 32 #include "vm/scopes.h" | 33 #include "vm/scopes.h" |
| 33 #include "vm/stack_frame.h" | 34 #include "vm/stack_frame.h" |
| 34 #include "vm/symbols.h" | 35 #include "vm/symbols.h" |
| 35 #include "vm/timer.h" | 36 #include "vm/timer.h" |
| 36 #include "vm/unicode.h" | 37 #include "vm/unicode.h" |
| 37 | 38 |
| (...skipping 6814 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6852 error = Compiler::CompileAllFunctions(cls); | 6853 error = Compiler::CompileAllFunctions(cls); |
| 6853 if (!error.IsNull()) { | 6854 if (!error.IsNull()) { |
| 6854 return error.raw(); | 6855 return error.raw(); |
| 6855 } | 6856 } |
| 6856 } | 6857 } |
| 6857 } | 6858 } |
| 6858 return error.raw(); | 6859 return error.raw(); |
| 6859 } | 6860 } |
| 6860 | 6861 |
| 6861 | 6862 |
| 6863 void Library::CheckFunctionFingerprints() { |
| 6864 Library& lib = Library::Handle(); |
| 6865 Class& cls = Class::Handle(); |
| 6866 Function& func = Function::Handle(); |
| 6867 String& str = String::Handle(); |
| 6868 bool has_errors = false; |
| 6869 #define CHECK_FINGERPRINTS(class_name, function_name, dest, fp) \ |
| 6870 if (strcmp(#class_name, "::") == 0) { \ |
| 6871 str = String::New(#function_name); \ |
| 6872 func = lib.LookupFunctionAllowPrivate(str); \ |
| 6873 } else { \ |
| 6874 str = String::New(#class_name); \ |
| 6875 cls = lib.LookupClassAllowPrivate(str); \ |
| 6876 ASSERT(!cls.IsNull()); \ |
| 6877 if (#function_name[0] == '.') { \ |
| 6878 str = String::New(#class_name#function_name); \ |
| 6879 } else { \ |
| 6880 str = String::New(#function_name); \ |
| 6881 } \ |
| 6882 func = cls.LookupFunctionAllowPrivate(str); \ |
| 6883 } \ |
| 6884 ASSERT(!func.IsNull()); \ |
| 6885 if (func.SourceFingerprint() != fp) { \ |
| 6886 has_errors = true; \ |
| 6887 OS::Print("Wrong fingerprint for '%s': expecting %d found %d\n", \ |
| 6888 func.ToFullyQualifiedCString(), fp, func.SourceFingerprint()); \ |
| 6889 } \ |
| 6890 |
| 6891 lib = Library::CoreLibrary(); |
| 6892 CORE_LIB_INTRINSIC_LIST(CHECK_FINGERPRINTS); |
| 6893 |
| 6894 RECOGNIZED_LIST(CHECK_FINGERPRINTS); |
| 6895 |
| 6896 lib = Library::MathLibrary(); |
| 6897 MATH_LIB_INTRINSIC_LIST(CHECK_FINGERPRINTS); |
| 6898 |
| 6899 lib = Library::TypedDataLibrary(); |
| 6900 TYPEDDATA_LIB_INTRINSIC_LIST(CHECK_FINGERPRINTS); |
| 6901 |
| 6902 #undef CHECK_FINGERPRINTS |
| 6903 if (has_errors) { |
| 6904 FATAL("Fingerprint mismatch."); |
| 6905 } |
| 6906 } |
| 6907 |
| 6908 |
| 6862 RawInstructions* Instructions::New(intptr_t size) { | 6909 RawInstructions* Instructions::New(intptr_t size) { |
| 6863 ASSERT(Object::instructions_class() != Class::null()); | 6910 ASSERT(Object::instructions_class() != Class::null()); |
| 6864 if (size < 0 || size > kMaxElements) { | 6911 if (size < 0 || size > kMaxElements) { |
| 6865 // This should be caught before we reach here. | 6912 // This should be caught before we reach here. |
| 6866 FATAL1("Fatal error in Instructions::New: invalid size %"Pd"\n", size); | 6913 FATAL1("Fatal error in Instructions::New: invalid size %"Pd"\n", size); |
| 6867 } | 6914 } |
| 6868 Instructions& result = Instructions::Handle(); | 6915 Instructions& result = Instructions::Handle(); |
| 6869 { | 6916 { |
| 6870 uword aligned_size = Instructions::InstanceSize(size); | 6917 uword aligned_size = Instructions::InstanceSize(size); |
| 6871 RawObject* raw = Object::Allocate(Instructions::kClassId, | 6918 RawObject* raw = Object::Allocate(Instructions::kClassId, |
| (...skipping 6242 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 13114 } | 13161 } |
| 13115 return result.raw(); | 13162 return result.raw(); |
| 13116 } | 13163 } |
| 13117 | 13164 |
| 13118 | 13165 |
| 13119 const char* WeakProperty::ToCString() const { | 13166 const char* WeakProperty::ToCString() const { |
| 13120 return "_WeakProperty"; | 13167 return "_WeakProperty"; |
| 13121 } | 13168 } |
| 13122 | 13169 |
| 13123 } // namespace dart | 13170 } // namespace dart |
| OLD | NEW |