| 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 | 4 |
| 5 #include "vm/globals.h" // Needed here to get TARGET_ARCH_X64. | 5 #include "vm/globals.h" // Needed here to get TARGET_ARCH_X64. |
| 6 #if defined(TARGET_ARCH_X64) | 6 #if defined(TARGET_ARCH_X64) |
| 7 | 7 |
| 8 #include "vm/flow_graph_compiler.h" | 8 #include "vm/flow_graph_compiler.h" |
| 9 | 9 |
| 10 #include "lib/error.h" | 10 #include "lib/error.h" |
| (...skipping 1214 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1225 __ nop(1); | 1225 __ nop(1); |
| 1226 __ nop(1); | 1226 __ nop(1); |
| 1227 AddCurrentDescriptor(PcDescriptors::kReturn, | 1227 AddCurrentDescriptor(PcDescriptors::kReturn, |
| 1228 instr->cid(), | 1228 instr->cid(), |
| 1229 instr->token_index(), | 1229 instr->token_index(), |
| 1230 CatchClauseNode::kInvalidTryIndex); // try-index. | 1230 CatchClauseNode::kInvalidTryIndex); // try-index. |
| 1231 } | 1231 } |
| 1232 | 1232 |
| 1233 | 1233 |
| 1234 void FlowGraphCompiler::VisitThrow(ThrowInstr* instr) { | 1234 void FlowGraphCompiler::VisitThrow(ThrowInstr* instr) { |
| 1235 ASSERT(instr->exception()->IsUse()); | 1235 // Moved to intermediate_language_x64.cc. |
| 1236 GenerateCallRuntime(instr->cid(), | 1236 UNREACHABLE(); |
| 1237 instr->token_index(), | |
| 1238 instr->try_index(), | |
| 1239 kThrowRuntimeEntry); | |
| 1240 __ int3(); | |
| 1241 } | 1237 } |
| 1242 | 1238 |
| 1243 | 1239 |
| 1244 void FlowGraphCompiler::VisitReThrow(ReThrowInstr* instr) { | 1240 void FlowGraphCompiler::VisitReThrow(ReThrowInstr* instr) { |
| 1245 ASSERT(instr->exception()->IsUse()); | 1241 // Moved to intermediate_language_x64.cc. |
| 1246 ASSERT(instr->stack_trace()->IsUse()); | 1242 UNREACHABLE(); |
| 1247 GenerateCallRuntime(instr->cid(), | |
| 1248 instr->token_index(), | |
| 1249 instr->try_index(), | |
| 1250 kReThrowRuntimeEntry); | |
| 1251 __ int3(); | |
| 1252 } | 1243 } |
| 1253 | 1244 |
| 1254 | 1245 |
| 1255 | 1246 |
| 1256 void FlowGraphCompiler::VisitBranch(BranchInstr* instr) { | 1247 void FlowGraphCompiler::VisitBranch(BranchInstr* instr) { |
| 1257 // Determine if the true branch is fall through (!negated) or the false | 1248 // Moved to intermediate_language_x64.cc. |
| 1258 // branch is. They cannot both be backwards branches. | 1249 UNREACHABLE(); |
| 1259 intptr_t index = reverse_index(current_block()->postorder_number()); | |
| 1260 bool negated = (block_order_[index + 1] == instr->false_successor()); | |
| 1261 ASSERT(!negated == (block_order_[index + 1] == instr->true_successor())); | |
| 1262 | |
| 1263 LoadValue(RAX, instr->value()); | |
| 1264 __ LoadObject(RDX, Bool::ZoneHandle(Bool::True())); | |
| 1265 __ cmpq(RAX, RDX); | |
| 1266 if (negated) { | |
| 1267 intptr_t target_index = instr->true_successor()->postorder_number(); | |
| 1268 __ j(EQUAL, &block_info_[target_index]->label); | |
| 1269 } else { | |
| 1270 intptr_t target_index = instr->false_successor()->postorder_number(); | |
| 1271 __ j(NOT_EQUAL, &block_info_[target_index]->label); | |
| 1272 } | |
| 1273 } | 1250 } |
| 1274 | 1251 |
| 1275 | 1252 |
| 1276 // Coped from CodeGenerator::CopyParameters (CodeGenerator will be deprecated). | 1253 // Coped from CodeGenerator::CopyParameters (CodeGenerator will be deprecated). |
| 1277 void FlowGraphCompiler::CopyParameters() { | 1254 void FlowGraphCompiler::CopyParameters() { |
| 1278 const Function& function = parsed_function_.function(); | 1255 const Function& function = parsed_function_.function(); |
| 1279 LocalScope* scope = parsed_function_.node_sequence()->scope(); | 1256 LocalScope* scope = parsed_function_.node_sequence()->scope(); |
| 1280 const int num_fixed_params = function.num_fixed_parameters(); | 1257 const int num_fixed_params = function.num_fixed_parameters(); |
| 1281 const int num_opt_params = function.num_optional_parameters(); | 1258 const int num_opt_params = function.num_optional_parameters(); |
| 1282 ASSERT(parsed_function_.first_parameter_index() == | 1259 ASSERT(parsed_function_.first_parameter_index() == |
| (...skipping 439 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1722 | 1699 |
| 1723 void FlowGraphCompiler::FinalizeComments(const Code& code) { | 1700 void FlowGraphCompiler::FinalizeComments(const Code& code) { |
| 1724 code.set_comments(assembler_->GetCodeComments()); | 1701 code.set_comments(assembler_->GetCodeComments()); |
| 1725 } | 1702 } |
| 1726 | 1703 |
| 1727 #undef __ | 1704 #undef __ |
| 1728 | 1705 |
| 1729 } // namespace dart | 1706 } // namespace dart |
| 1730 | 1707 |
| 1731 #endif // defined TARGET_ARCH_X64 | 1708 #endif // defined TARGET_ARCH_X64 |
| OLD | NEW |