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 // Class for intrinsifying functions. | 4 // Class for intrinsifying functions. |
5 | 5 |
6 #include "vm/assembler.h" | 6 #include "vm/assembler.h" |
7 #include "vm/intrinsifier.h" | 7 #include "vm/intrinsifier.h" |
8 #include "vm/flags.h" | 8 #include "vm/flags.h" |
9 #include "vm/object.h" | 9 #include "vm/object.h" |
10 #include "vm/symbols.h" | 10 #include "vm/symbols.h" |
(...skipping 18 matching lines...) Expand all Loading... |
29 if (!FLAG_intrinsify) return false; | 29 if (!FLAG_intrinsify) return false; |
30 if (function.IsClosureFunction()) return false; | 30 if (function.IsClosureFunction()) return false; |
31 // Can occur because of compile-all flag. | 31 // Can occur because of compile-all flag. |
32 if (function.is_external()) return false; | 32 if (function.is_external()) return false; |
33 return function.is_intrinsic(); | 33 return function.is_intrinsic(); |
34 } | 34 } |
35 | 35 |
36 | 36 |
37 #if defined(DART_NO_SNAPSHOT) | 37 #if defined(DART_NO_SNAPSHOT) |
38 void Intrinsifier::InitializeState() { | 38 void Intrinsifier::InitializeState() { |
39 Isolate* isolate = Isolate::Current(); | 39 Thread* thread = Thread::Current(); |
40 Library& lib = Library::Handle(isolate); | 40 Zone* zone = thread->zone(); |
41 Class& cls = Class::Handle(isolate); | 41 Library& lib = Library::Handle(zone); |
42 Function& func = Function::Handle(isolate); | 42 Class& cls = Class::Handle(zone); |
43 String& str = String::Handle(isolate); | 43 Function& func = Function::Handle(zone); |
44 Error& error = Error::Handle(isolate); | 44 String& str = String::Handle(zone); |
| 45 Error& error = Error::Handle(zone); |
45 | 46 |
46 #define SETUP_FUNCTION(class_name, function_name, destination, fp) \ | 47 #define SETUP_FUNCTION(class_name, function_name, destination, fp) \ |
47 if (strcmp(#class_name, "::") == 0) { \ | 48 if (strcmp(#class_name, "::") == 0) { \ |
48 str = String::New(#function_name); \ | 49 str = String::New(#function_name); \ |
49 func = lib.LookupFunctionAllowPrivate(str); \ | 50 func = lib.LookupFunctionAllowPrivate(str); \ |
50 } else { \ | 51 } else { \ |
51 str = String::New(#class_name); \ | 52 str = String::New(#class_name); \ |
52 cls = lib.LookupClassAllowPrivate(str); \ | 53 cls = lib.LookupClassAllowPrivate(str); \ |
53 ASSERT(!cls.IsNull()); \ | 54 ASSERT(!cls.IsNull()); \ |
54 error = cls.EnsureIsFinalized(isolate); \ | 55 error = cls.EnsureIsFinalized(thread); \ |
55 if (!error.IsNull()) { \ | 56 if (!error.IsNull()) { \ |
56 OS::PrintErr("%s\n", error.ToErrorCString()); \ | 57 OS::PrintErr("%s\n", error.ToErrorCString()); \ |
57 } \ | 58 } \ |
58 ASSERT(error.IsNull()); \ | 59 ASSERT(error.IsNull()); \ |
59 if (#function_name[0] == '.') { \ | 60 if (#function_name[0] == '.') { \ |
60 str = String::New(#class_name#function_name); \ | 61 str = String::New(#class_name#function_name); \ |
61 } else { \ | 62 } else { \ |
62 str = String::New(#function_name); \ | 63 str = String::New(#function_name); \ |
63 } \ | 64 } \ |
64 func = cls.LookupFunctionAllowPrivate(str); \ | 65 func = cls.LookupFunctionAllowPrivate(str); \ |
(...skipping 795 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
860 new Value(growable_array), | 861 new Value(growable_array), |
861 new Value(length), | 862 new Value(length), |
862 kNoStoreBarrier, | 863 kNoStoreBarrier, |
863 builder.TokenPos())); | 864 builder.TokenPos())); |
864 Definition* null_def = builder.AddNullDefinition(); | 865 Definition* null_def = builder.AddNullDefinition(); |
865 builder.AddIntrinsicReturn(new Value(null_def)); | 866 builder.AddIntrinsicReturn(new Value(null_def)); |
866 return true; | 867 return true; |
867 } | 868 } |
868 | 869 |
869 } // namespace dart | 870 } // namespace dart |
OLD | NEW |