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

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

Issue 10827288: - Support for patching of class methods and fields. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 8 years, 4 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 // Class for intrinsifying functions. 4 // Class for intrinsifying functions.
5 5
6 #include "vm/intrinsifier.h" 6 #include "vm/intrinsifier.h"
7 #include "vm/flags.h" 7 #include "vm/flags.h"
8 #include "vm/object.h" 8 #include "vm/object.h"
9 9
10 namespace dart { 10 namespace dart {
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
46 const char* test_class_name, 46 const char* test_class_name,
47 const char* test_function_name) { 47 const char* test_function_name) {
48 return CompareNames(test_class_name, function_class_name) && 48 return CompareNames(test_class_name, function_class_name) &&
49 CompareNames(test_function_name, function_name); 49 CompareNames(test_function_name, function_name);
50 } 50 }
51 51
52 52
53 bool Intrinsifier::Intrinsify(const Function& function, Assembler* assembler) { 53 bool Intrinsifier::Intrinsify(const Function& function, Assembler* assembler) {
54 if (!FLAG_intrinsify) return false; 54 if (!FLAG_intrinsify) return false;
55 const char* function_name = String::Handle(function.name()).ToCString(); 55 const char* function_name = String::Handle(function.name()).ToCString();
56 const Class& function_class = Class::Handle(function.owner()); 56 const Class& function_class = Class::Handle(function.Owner());
57 const char* class_name = String::Handle(function_class.Name()).ToCString(); 57 const char* class_name = String::Handle(function_class.Name()).ToCString();
58 // Only core library methods can be intrinsified. 58 // Only core library methods can be intrinsified.
59 const Library& core_lib = Library::Handle(Library::CoreLibrary()); 59 const Library& core_lib = Library::Handle(Library::CoreLibrary());
60 const Library& core_impl_lib = Library::Handle(Library::CoreImplLibrary()); 60 const Library& core_impl_lib = Library::Handle(Library::CoreImplLibrary());
61 if ((function_class.library() != core_lib.raw()) && 61 if ((function_class.library() != core_lib.raw()) &&
62 (function_class.library() != core_impl_lib.raw())) { 62 (function_class.library() != core_impl_lib.raw())) {
63 return false; 63 return false;
64 } 64 }
65 #define FIND_INTRINSICS(test_class_name, test_function_name, destination) \ 65 #define FIND_INTRINSICS(test_class_name, test_function_name, destination) \
66 if (TestFunction(function, \ 66 if (TestFunction(function, \
67 class_name, function_name, \ 67 class_name, function_name, \
68 #test_class_name, #test_function_name)) { \ 68 #test_class_name, #test_function_name)) { \
69 return destination(assembler); \ 69 return destination(assembler); \
70 } \ 70 } \
71 71
72 INTRINSIC_LIST(FIND_INTRINSICS); 72 INTRINSIC_LIST(FIND_INTRINSICS);
73 #undef FIND_INTRINSICS 73 #undef FIND_INTRINSICS
74 return false; 74 return false;
75 } 75 }
76 76
77 } // namespace dart 77 } // namespace dart
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698