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

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

Issue 14820028: Delay Class parsing until the class is actually used. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 7 years, 7 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 #include "vm/symbols.h" 9 #include "vm/symbols.h"
10 10
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
85 bool Intrinsifier::CanIntrinsify(const Function& function) { 85 bool Intrinsifier::CanIntrinsify(const Function& function) {
86 if (!FLAG_intrinsify) return false; 86 if (!FLAG_intrinsify) return false;
87 if (function.IsClosureFunction()) return false; 87 if (function.IsClosureFunction()) return false;
88 // Can occur because of compile-all flag. 88 // Can occur because of compile-all flag.
89 if (function.is_external()) return false; 89 if (function.is_external()) return false;
90 return function.is_intrinsic(); 90 return function.is_intrinsic();
91 } 91 }
92 92
93 93
94 void Intrinsifier::InitializeState() { 94 void Intrinsifier::InitializeState() {
95 Library& lib = Library::Handle(); 95 Isolate* isolate = Isolate::Current();
96 Class& cls = Class::Handle(); 96 Library& lib = Library::Handle(isolate);
97 Function& func = Function::Handle(); 97 Class& cls = Class::Handle(isolate);
98 String& str = String::Handle(); 98 Function& func = Function::Handle(isolate);
99 String& str = String::Handle(isolate);
100 Error& error = Error::Handle(isolate);
99 101
100 #define SETUP_FUNCTION(class_name, function_name, destination, fp) \ 102 #define SETUP_FUNCTION(class_name, function_name, destination, fp) \
101 if (strcmp(#class_name, "::") == 0) { \ 103 if (strcmp(#class_name, "::") == 0) { \
102 str = String::New(#function_name); \ 104 str = String::New(#function_name); \
103 func = lib.LookupFunctionAllowPrivate(str); \ 105 func = lib.LookupFunctionAllowPrivate(str); \
104 } else { \ 106 } else { \
105 str = String::New(#class_name); \ 107 str = String::New(#class_name); \
106 cls = lib.LookupClassAllowPrivate(str); \ 108 cls = lib.LookupClassAllowPrivate(str); \
107 ASSERT(!cls.IsNull()); \ 109 ASSERT(!cls.IsNull()); \
110 error = cls.EnsureIsFinalized(isolate); \
111 ASSERT(error.IsNull()); \
108 if (#function_name[0] == '.') { \ 112 if (#function_name[0] == '.') { \
109 str = String::New(#class_name#function_name); \ 113 str = String::New(#class_name#function_name); \
110 } else { \ 114 } else { \
111 str = String::New(#function_name); \ 115 str = String::New(#function_name); \
112 } \ 116 } \
113 func = cls.LookupFunctionAllowPrivate(str); \ 117 func = cls.LookupFunctionAllowPrivate(str); \
114 } \ 118 } \
115 ASSERT(!func.IsNull()); \ 119 ASSERT(!func.IsNull()); \
116 func.set_is_intrinsic(true); \ 120 func.set_is_intrinsic(true); \
117 121
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
153 TYPED_DATA_LIB_INTRINSIC_LIST(FIND_INTRINSICS); 157 TYPED_DATA_LIB_INTRINSIC_LIST(FIND_INTRINSICS);
154 } else if (lib.raw() == Library::MathLibrary()) { 158 } else if (lib.raw() == Library::MathLibrary()) {
155 MATH_LIB_INTRINSIC_LIST(FIND_INTRINSICS); 159 MATH_LIB_INTRINSIC_LIST(FIND_INTRINSICS);
156 } 160 }
157 return false; 161 return false;
158 162
159 #undef FIND_INTRINSICS 163 #undef FIND_INTRINSICS
160 } 164 }
161 165
162 } // namespace dart 166 } // namespace dart
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698