Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, 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 | 4 |
| 5 #include "vm/globals.h" // Needed here to get TARGET_ARCH_XXX. | 5 #include "vm/globals.h" // Needed here to get TARGET_ARCH_XXX. |
| 6 | 6 |
| 7 #include "vm/flow_graph_compiler.h" | 7 #include "vm/flow_graph_compiler.h" |
| 8 | 8 |
| 9 #include "vm/bit_vector.h" | 9 #include "vm/bit_vector.h" |
| 10 #include "vm/cha.h" | 10 #include "vm/cha.h" |
| (...skipping 1064 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1075 INC_STAT(Thread::Current(), | 1075 INC_STAT(Thread::Current(), |
| 1076 total_code_size, | 1076 total_code_size, |
| 1077 targets.Length() * sizeof(uword)); | 1077 targets.Length() * sizeof(uword)); |
| 1078 } | 1078 } |
| 1079 | 1079 |
| 1080 | 1080 |
| 1081 // Returns 'true' if regular code generation should be skipped. | 1081 // Returns 'true' if regular code generation should be skipped. |
| 1082 bool FlowGraphCompiler::TryIntrinsify() { | 1082 bool FlowGraphCompiler::TryIntrinsify() { |
| 1083 // Intrinsification skips arguments checks, therefore disable if in checked | 1083 // Intrinsification skips arguments checks, therefore disable if in checked |
| 1084 // mode. | 1084 // mode. |
| 1085 if (FLAG_intrinsify && !isolate()->flags().type_checks()) { | 1085 // Only intrinsify getters/setters in precompiled code. Otherwise, unoptimized |
| 1086 // code cannot depend on guarded_cid since it may be regenerated lazily after | |
| 1087 // code collection. | |
| 1088 if (FLAG_precompilation && | |
|
Vyacheslav Egorov (Google)
2016/02/12 14:20:42
FLAG_precompilation -> !FLAG_use_field_guards?
| |
| 1089 FLAG_intrinsify && | |
| 1090 !isolate()->flags().type_checks()) { | |
| 1086 if (parsed_function().function().kind() == RawFunction::kImplicitGetter) { | 1091 if (parsed_function().function().kind() == RawFunction::kImplicitGetter) { |
| 1087 // An implicit getter must have a specific AST structure. | 1092 // An implicit getter must have a specific AST structure. |
| 1088 const SequenceNode& sequence_node = *parsed_function().node_sequence(); | 1093 const SequenceNode& sequence_node = *parsed_function().node_sequence(); |
| 1089 ASSERT(sequence_node.length() == 1); | 1094 ASSERT(sequence_node.length() == 1); |
| 1090 ASSERT(sequence_node.NodeAt(0)->IsReturnNode()); | 1095 ASSERT(sequence_node.NodeAt(0)->IsReturnNode()); |
| 1091 const ReturnNode& return_node = *sequence_node.NodeAt(0)->AsReturnNode(); | 1096 const ReturnNode& return_node = *sequence_node.NodeAt(0)->AsReturnNode(); |
| 1092 ASSERT(return_node.value()->IsLoadInstanceFieldNode()); | 1097 ASSERT(return_node.value()->IsLoadInstanceFieldNode()); |
| 1093 const LoadInstanceFieldNode& load_node = | 1098 const LoadInstanceFieldNode& load_node = |
| 1094 *return_node.value()->AsLoadInstanceFieldNode(); | 1099 *return_node.value()->AsLoadInstanceFieldNode(); |
| 1095 // Only intrinsify getter if the field cannot contain a mutable double. | 1100 // Only intrinsify getter if the field cannot contain a mutable double. |
| 1096 // Reading from a mutable double box requires allocating a fresh double. | 1101 // Reading from a mutable double box requires allocating a fresh double. |
| 1097 if (load_node.field().guarded_cid() == kDynamicCid) { | 1102 if (load_node.field().guarded_cid() == kDynamicCid) { |
| 1098 GenerateInlinedGetter(load_node.field().Offset()); | 1103 GenerateInlinedGetter(load_node.field().Offset()); |
| 1099 return true; | 1104 return true; |
|
Vyacheslav Egorov (Google)
2016/02/12 14:20:42
alternatively you can do
return !FLAG_use_field_g
Florian Schneider
2016/02/12 14:25:21
Done.
| |
| 1100 } | 1105 } |
| 1101 return false; | 1106 return false; |
| 1102 } | 1107 } |
| 1103 if (parsed_function().function().kind() == RawFunction::kImplicitSetter) { | 1108 if (parsed_function().function().kind() == RawFunction::kImplicitSetter) { |
| 1104 // An implicit setter must have a specific AST structure. | 1109 // An implicit setter must have a specific AST structure. |
| 1105 // Sequence node has one store node and one return NULL node. | 1110 // Sequence node has one store node and one return NULL node. |
| 1106 const SequenceNode& sequence_node = *parsed_function().node_sequence(); | 1111 const SequenceNode& sequence_node = *parsed_function().node_sequence(); |
| 1107 ASSERT(sequence_node.length() == 2); | 1112 ASSERT(sequence_node.length() == 2); |
| 1108 ASSERT(sequence_node.NodeAt(0)->IsStoreInstanceFieldNode()); | 1113 ASSERT(sequence_node.NodeAt(0)->IsStoreInstanceFieldNode()); |
| 1109 ASSERT(sequence_node.NodeAt(1)->IsReturnNode()); | 1114 ASSERT(sequence_node.NodeAt(1)->IsReturnNode()); |
| (...skipping 762 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1872 | 1877 |
| 1873 | 1878 |
| 1874 void FlowGraphCompiler::FrameStateClear() { | 1879 void FlowGraphCompiler::FrameStateClear() { |
| 1875 ASSERT(!is_optimizing()); | 1880 ASSERT(!is_optimizing()); |
| 1876 frame_state_.TruncateTo(0); | 1881 frame_state_.TruncateTo(0); |
| 1877 } | 1882 } |
| 1878 #endif | 1883 #endif |
| 1879 | 1884 |
| 1880 | 1885 |
| 1881 } // namespace dart | 1886 } // namespace dart |
| OLD | NEW |