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

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

Issue 10870053: Fix Growable array set length intrinsics to check if the incoming value is a Smi, otherwise call na… (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
« no previous file with comments | « no previous file | runtime/vm/intrinsifier_ia32.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
45 const char* function_name, 45 const char* function_name,
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 // Closure functions may have different arguments.
56 if (function.IsClosureFunction()) return false;
55 const char* function_name = String::Handle(function.name()).ToCString(); 57 const char* function_name = String::Handle(function.name()).ToCString();
56 const Class& function_class = Class::Handle(function.Owner()); 58 const Class& function_class = Class::Handle(function.Owner());
57 const char* class_name = String::Handle(function_class.Name()).ToCString(); 59 const char* class_name = String::Handle(function_class.Name()).ToCString();
58 // Only core and math library methods can be intrinsified. 60 // Only core and math library methods can be intrinsified.
59 const Library& core_lib = Library::Handle(Library::CoreLibrary()); 61 const Library& core_lib = Library::Handle(Library::CoreLibrary());
60 const Library& core_impl_lib = Library::Handle(Library::CoreImplLibrary()); 62 const Library& core_impl_lib = Library::Handle(Library::CoreImplLibrary());
61 const Library& math_lib = Library::Handle(Library::MathLibrary()); 63 const Library& math_lib = Library::Handle(Library::MathLibrary());
62 if ((function_class.library() != core_lib.raw()) && 64 if ((function_class.library() != core_lib.raw()) &&
63 (function_class.library() != core_impl_lib.raw()) && 65 (function_class.library() != core_impl_lib.raw()) &&
64 (function_class.library() != math_lib.raw())) { 66 (function_class.library() != math_lib.raw())) {
65 return false; 67 return false;
66 } 68 }
67 #define FIND_INTRINSICS(test_class_name, test_function_name, destination) \ 69 #define FIND_INTRINSICS(test_class_name, test_function_name, destination) \
68 if (TestFunction(function, \ 70 if (TestFunction(function, \
69 class_name, function_name, \ 71 class_name, function_name, \
70 #test_class_name, #test_function_name)) { \ 72 #test_class_name, #test_function_name)) { \
71 return destination(assembler); \ 73 return destination(assembler); \
72 } \ 74 } \
73 75
74 INTRINSIC_LIST(FIND_INTRINSICS); 76 INTRINSIC_LIST(FIND_INTRINSICS);
75 #undef FIND_INTRINSICS 77 #undef FIND_INTRINSICS
76 return false; 78 return false;
77 } 79 }
78 80
79 } // namespace dart 81 } // namespace dart
OLDNEW
« no previous file with comments | « no previous file | runtime/vm/intrinsifier_ia32.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698