| 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) | 61 #if !defined(DART_PRECOMPILED_RUNTIME) |
| 62 void Intrinsifier::InitializeState() { | 62 void Intrinsifier::InitializeState() { |
| 63 Thread* thread = Thread::Current(); | 63 Thread* thread = Thread::Current(); |
| 64 Zone* zone = thread->zone(); | 64 Zone* zone = thread->zone(); |
| 65 Library& lib = Library::Handle(zone); | 65 Library& lib = Library::Handle(zone); |
| 66 Class& cls = Class::Handle(zone); | 66 Class& cls = Class::Handle(zone); |
| 67 Function& func = Function::Handle(zone); | 67 Function& func = Function::Handle(zone); |
| 68 String& str = String::Handle(zone); | 68 String& str = String::Handle(zone); |
| 69 Error& error = Error::Handle(zone); | 69 Error& error = Error::Handle(zone); |
| 70 | 70 |
| 71 #define SETUP_FUNCTION(class_name, function_name, destination, type, fp) \ | 71 #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); | 110 TYPED_DATA_LIB_INTRINSIC_LIST(SETUP_FUNCTION); |
| 111 GRAPH_TYPED_DATA_INTRINSICS_LIST(SETUP_FUNCTION); | 111 GRAPH_TYPED_DATA_INTRINSICS_LIST(SETUP_FUNCTION); |
| 112 | 112 |
| 113 // Setup all dart:developer lib functions that can be intrinsified. | 113 // Setup all dart:developer lib functions that can be intrinsified. |
| 114 lib = Library::DeveloperLibrary(); | 114 lib = Library::DeveloperLibrary(); |
| 115 ASSERT(!lib.IsNull()); | 115 ASSERT(!lib.IsNull()); |
| 116 DEVELOPER_LIB_INTRINSIC_LIST(SETUP_FUNCTION); | 116 DEVELOPER_LIB_INTRINSIC_LIST(SETUP_FUNCTION); |
| 117 | 117 |
| 118 #undef SETUP_FUNCTION | 118 #undef SETUP_FUNCTION |
| 119 } | 119 } |
| 120 #endif // defined(DART_NO_SNAPSHOT). | 120 #endif // !defined(DART_PRECOMPILED_RUNTIME) |
| 121 | 121 |
| 122 | 122 |
| 123 // DBC does not use graph intrinsics. | 123 // DBC does not use graph intrinsics. |
| 124 #if !defined(TARGET_ARCH_DBC) | 124 #if !defined(TARGET_ARCH_DBC) |
| 125 static void EmitCodeFor(FlowGraphCompiler* compiler, FlowGraph* graph) { | 125 static void EmitCodeFor(FlowGraphCompiler* compiler, FlowGraph* graph) { |
| 126 // The FlowGraph here is constructed by the intrinsics builder methods, and | 126 // The FlowGraph here is constructed by the intrinsics builder methods, and |
| 127 // is different from compiler->flow_graph(), the original method's flow graph. | 127 // is different from compiler->flow_graph(), the original method's flow graph. |
| 128 compiler->assembler()->Comment("Graph intrinsic begin"); | 128 compiler->assembler()->Comment("Graph intrinsic begin"); |
| 129 for (intptr_t i = 0; i < graph->reverse_postorder().length(); i++) { | 129 for (intptr_t i = 0; i < graph->reverse_postorder().length(); i++) { |
| 130 BlockEntryInstr* block = graph->reverse_postorder()[i]; | 130 BlockEntryInstr* block = graph->reverse_postorder()[i]; |
| (...skipping 1026 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1157 GraphEntryInstr* graph_entry = flow_graph->graph_entry(); | 1157 GraphEntryInstr* graph_entry = flow_graph->graph_entry(); |
| 1158 TargetEntryInstr* normal_entry = graph_entry->normal_entry(); | 1158 TargetEntryInstr* normal_entry = graph_entry->normal_entry(); |
| 1159 BlockBuilder builder(flow_graph, normal_entry); | 1159 BlockBuilder builder(flow_graph, normal_entry); |
| 1160 | 1160 |
| 1161 return BuildInvokeMathCFunction(&builder, MethodRecognizer::kDoubleRound); | 1161 return BuildInvokeMathCFunction(&builder, MethodRecognizer::kDoubleRound); |
| 1162 } | 1162 } |
| 1163 #endif // !defined(TARGET_ARCH_DBC) | 1163 #endif // !defined(TARGET_ARCH_DBC) |
| 1164 | 1164 |
| 1165 | 1165 |
| 1166 } // namespace dart | 1166 } // namespace dart |
| OLD | NEW |