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/compiler.h" | 7 #include "vm/compiler.h" |
8 #include "vm/cpu.h" | 8 #include "vm/cpu.h" |
9 #include "vm/flags.h" | 9 #include "vm/flags.h" |
10 #include "vm/flow_graph.h" | 10 #include "vm/flow_graph.h" |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
51 } | 51 } |
52 return false; | 52 return false; |
53 } | 53 } |
54 if (FLAG_trace_intrinsifier) { | 54 if (FLAG_trace_intrinsifier) { |
55 THR_Print("Yes.\n"); | 55 THR_Print("Yes.\n"); |
56 } | 56 } |
57 return true; | 57 return true; |
58 } | 58 } |
59 | 59 |
60 | 60 |
61 #if defined(DART_NO_SNAPSHOT) | |
62 void Intrinsifier::InitializeState() { | 61 void Intrinsifier::InitializeState() { |
63 Thread* thread = Thread::Current(); | 62 Thread* thread = Thread::Current(); |
64 Zone* zone = thread->zone(); | 63 Zone* zone = thread->zone(); |
65 Library& lib = Library::Handle(zone); | 64 Library& lib = Library::Handle(zone); |
66 Class& cls = Class::Handle(zone); | 65 Class& cls = Class::Handle(zone); |
67 Function& func = Function::Handle(zone); | 66 Function& func = Function::Handle(zone); |
68 String& str = String::Handle(zone); | 67 String& str = String::Handle(zone); |
69 Error& error = Error::Handle(zone); | 68 Error& error = Error::Handle(zone); |
70 | 69 |
71 #define SETUP_FUNCTION(class_name, function_name, destination, type, fp) \ | 70 #define SETUP_FUNCTION(class_name, function_name, destination, type, fp) \ |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
110 TYPED_DATA_LIB_INTRINSIC_LIST(SETUP_FUNCTION); | 109 TYPED_DATA_LIB_INTRINSIC_LIST(SETUP_FUNCTION); |
111 GRAPH_TYPED_DATA_INTRINSICS_LIST(SETUP_FUNCTION); | 110 GRAPH_TYPED_DATA_INTRINSICS_LIST(SETUP_FUNCTION); |
112 | 111 |
113 // Setup all dart:developer lib functions that can be intrinsified. | 112 // Setup all dart:developer lib functions that can be intrinsified. |
114 lib = Library::DeveloperLibrary(); | 113 lib = Library::DeveloperLibrary(); |
115 ASSERT(!lib.IsNull()); | 114 ASSERT(!lib.IsNull()); |
116 DEVELOPER_LIB_INTRINSIC_LIST(SETUP_FUNCTION); | 115 DEVELOPER_LIB_INTRINSIC_LIST(SETUP_FUNCTION); |
117 | 116 |
118 #undef SETUP_FUNCTION | 117 #undef SETUP_FUNCTION |
119 } | 118 } |
120 #endif // defined(DART_NO_SNAPSHOT). | |
121 | 119 |
122 | 120 |
123 // DBC does not use graph intrinsics. | 121 // DBC does not use graph intrinsics. |
124 #if !defined(TARGET_ARCH_DBC) | 122 #if !defined(TARGET_ARCH_DBC) |
125 static void EmitCodeFor(FlowGraphCompiler* compiler, | 123 static void EmitCodeFor(FlowGraphCompiler* compiler, |
126 FlowGraph* graph) { | 124 FlowGraph* graph) { |
127 // The FlowGraph here is constructed by the intrinsics builder methods, and | 125 // The FlowGraph here is constructed by the intrinsics builder methods, and |
128 // is different from compiler->flow_graph(), the original method's flow graph. | 126 // is different from compiler->flow_graph(), the original method's flow graph. |
129 compiler->assembler()->Comment("Graph intrinsic begin"); | 127 compiler->assembler()->Comment("Graph intrinsic begin"); |
130 for (intptr_t i = 0; i < graph->reverse_postorder().length(); i++) { | 128 for (intptr_t i = 0; i < graph->reverse_postorder().length(); i++) { |
(...skipping 1143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1274 TargetEntryInstr* normal_entry = graph_entry->normal_entry(); | 1272 TargetEntryInstr* normal_entry = graph_entry->normal_entry(); |
1275 BlockBuilder builder(flow_graph, normal_entry); | 1273 BlockBuilder builder(flow_graph, normal_entry); |
1276 | 1274 |
1277 return BuildInvokeMathCFunction(&builder, | 1275 return BuildInvokeMathCFunction(&builder, |
1278 MethodRecognizer::kDoubleRound); | 1276 MethodRecognizer::kDoubleRound); |
1279 } | 1277 } |
1280 #endif // !defined(TARGET_ARCH_DBC) | 1278 #endif // !defined(TARGET_ARCH_DBC) |
1281 | 1279 |
1282 | 1280 |
1283 } // namespace dart | 1281 } // namespace dart |
OLD | NEW |