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

Side by Side Diff: runtime/vm/object.cc

Issue 14247005: Add flag --check-function-fingerprints, it checks all function fingerprints of the intrinsifier and… (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 7 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
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 "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 6813 matching lines...) Expand 10 before | Expand all | Expand 10 after
6851 cls ^= anon_classes.At(i); 6852 cls ^= anon_classes.At(i);
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
6862 struct FpDiff {
6863 FpDiff(int32_t old_, int32_t new_): old_fp(old_), new_fp(new_) {}
6864 int32_t old_fp;
6865 int32_t new_fp;
6866 };
6867
6868 void Library::CheckFunctionFingerprints() {
6869 GrowableArray<FpDiff> collected_fp_diffs;
6870 Library& lib = Library::Handle();
6871 Class& cls = Class::Handle();
6872 Function& func = Function::Handle();
6873 String& str = String::Handle();
6874 bool has_errors = false;
6875
6876 #define CHECK_FINGERPRINTS(class_name, function_name, dest, fp) \
6877 func = Function::null(); \
6878 if (strcmp(#class_name, "::") == 0) { \
6879 str = Symbols::New(#function_name); \
6880 func = lib.LookupFunctionAllowPrivate(str); \
6881 } else { \
6882 str = String::New(#class_name); \
6883 cls = lib.LookupClassAllowPrivate(str); \
6884 if (!cls.IsNull()) { \
6885 if (#function_name[0] == '.') { \
6886 str = String::New(#class_name#function_name); \
6887 } else { \
6888 str = String::New(#function_name); \
6889 } \
6890 func = cls.LookupFunctionAllowPrivate(str); \
6891 } \
6892 } \
6893 if (!func.IsNull() && (func.SourceFingerprint() != fp)) { \
6894 has_errors = true; \
6895 OS::Print("Wrong fingerprint for '%s': expecting %d found %d\n", \
6896 func.ToFullyQualifiedCString(), fp, func.SourceFingerprint()); \
6897 collected_fp_diffs.Add(FpDiff(fp, func.SourceFingerprint())); \
6898 } \
6899
6900 lib = Library::CoreLibrary();
6901 CORE_LIB_INTRINSIC_LIST(CHECK_FINGERPRINTS);
6902
6903 RECOGNIZED_LIST(CHECK_FINGERPRINTS);
6904
6905 lib = Library::MathLibrary();
6906 MATH_LIB_INTRINSIC_LIST(CHECK_FINGERPRINTS);
6907
6908 lib = Library::TypedDataLibrary();
6909 TYPEDDATA_LIB_INTRINSIC_LIST(CHECK_FINGERPRINTS);
6910
6911 #undef CHECK_FINGERPRINTS
6912 if (has_errors) {
6913 for (intptr_t i = 0; i < collected_fp_diffs.length(); i++) {
6914 OS::Print("s/%d/%d/\n",
6915 collected_fp_diffs[i].old_fp, collected_fp_diffs[i].new_fp);
6916 }
6917 OS::Print("\n")
6918 FATAL("Fingerprint mismatch.");
6919 }
6920 }
6921
6861 6922
6862 RawInstructions* Instructions::New(intptr_t size) { 6923 RawInstructions* Instructions::New(intptr_t size) {
6863 ASSERT(Object::instructions_class() != Class::null()); 6924 ASSERT(Object::instructions_class() != Class::null());
6864 if (size < 0 || size > kMaxElements) { 6925 if (size < 0 || size > kMaxElements) {
6865 // This should be caught before we reach here. 6926 // This should be caught before we reach here.
6866 FATAL1("Fatal error in Instructions::New: invalid size %"Pd"\n", size); 6927 FATAL1("Fatal error in Instructions::New: invalid size %"Pd"\n", size);
6867 } 6928 }
6868 Instructions& result = Instructions::Handle(); 6929 Instructions& result = Instructions::Handle();
6869 { 6930 {
6870 uword aligned_size = Instructions::InstanceSize(size); 6931 uword aligned_size = Instructions::InstanceSize(size);
(...skipping 6243 matching lines...) Expand 10 before | Expand all | Expand 10 after
13114 } 13175 }
13115 return result.raw(); 13176 return result.raw();
13116 } 13177 }
13117 13178
13118 13179
13119 const char* WeakProperty::ToCString() const { 13180 const char* WeakProperty::ToCString() const {
13120 return "_WeakProperty"; 13181 return "_WeakProperty";
13121 } 13182 }
13122 13183
13123 } // namespace dart 13184 } // namespace dart
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698