| 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" |
| 11 #include "vm/ast_printer.h" | 11 #include "vm/ast_printer.h" |
| 12 #include "vm/il_printer.h" | 12 #include "vm/il_printer.h" |
| 13 #include "vm/locations.h" | 13 #include "vm/locations.h" |
| 14 #include "vm/object_store.h" | 14 #include "vm/object_store.h" |
| 15 #include "vm/parser.h" | 15 #include "vm/parser.h" |
| 16 #include "vm/stub_code.h" | 16 #include "vm/stub_code.h" |
| 17 #include "vm/symbols.h" | 17 #include "vm/symbols.h" |
| 18 | 18 |
| 19 namespace dart { | 19 namespace dart { |
| 20 | 20 |
| 21 DECLARE_FLAG(bool, enable_type_checks); | 21 DECLARE_FLAG(bool, enable_type_checks); |
| 22 DECLARE_FLAG(bool, print_ast); | 22 DECLARE_FLAG(bool, print_ast); |
| 23 DECLARE_FLAG(bool, print_scopes); | 23 DECLARE_FLAG(bool, print_scopes); |
| 24 DECLARE_FLAG(bool, trace_functions); | 24 DECLARE_FLAG(bool, trace_functions); |
| 25 | 25 |
| 26 | 26 |
| 27 void DeoptimizationStub::GenerateCode(FlowGraphCompiler* compiler, | 27 void DeoptimizationStub::GenerateCode(FlowGraphCompiler* compiler, |
| 28 intptr_t stub_ix) { | 28 intptr_t stub_ix) { |
| 29 // Calls do not need stubs, they share a deoptimization trampoline. |
| 30 if (reason_ == kDeoptAtCall) return; |
| 29 Assembler* assem = compiler->assembler(); | 31 Assembler* assem = compiler->assembler(); |
| 30 #define __ assem-> | 32 #define __ assem-> |
| 31 __ Comment("Deopt stub for id %d", deopt_id_); | 33 __ Comment("Deopt stub for id %d", deopt_id_); |
| 32 __ Bind(entry_label()); | 34 __ Bind(entry_label()); |
| 33 | 35 |
| 34 ASSERT(deoptimization_env_ != NULL); | 36 ASSERT(deoptimization_env_ != NULL); |
| 35 | 37 |
| 36 if (compiler->IsLeaf()) { | 38 if (compiler->IsLeaf()) { |
| 37 __ Comment("Leaf method, lazy PC marker setup"); | 39 __ Comment("Leaf method, lazy PC marker setup"); |
| 38 // TODO(srdjan): Can we use TMP instead of RAX? We must guarantee that | 40 // TODO(srdjan): Can we use TMP instead of RAX? We must guarantee that |
| (...skipping 1016 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1055 intptr_t token_pos, | 1057 intptr_t token_pos, |
| 1056 intptr_t try_index, | 1058 intptr_t try_index, |
| 1057 LocationSummary* locs) { | 1059 LocationSummary* locs) { |
| 1058 ASSERT(!IsLeaf()); | 1060 ASSERT(!IsLeaf()); |
| 1059 __ LoadObject(RBX, function); | 1061 __ LoadObject(RBX, function); |
| 1060 __ LoadObject(R10, arguments_descriptor); | 1062 __ LoadObject(R10, arguments_descriptor); |
| 1061 __ call(&StubCode::CallStaticFunctionLabel()); | 1063 __ call(&StubCode::CallStaticFunctionLabel()); |
| 1062 AddCurrentDescriptor(PcDescriptors::kFuncCall, deopt_id, token_pos, | 1064 AddCurrentDescriptor(PcDescriptors::kFuncCall, deopt_id, token_pos, |
| 1063 try_index); | 1065 try_index); |
| 1064 RecordSafepoint(locs); | 1066 RecordSafepoint(locs); |
| 1067 if (is_optimizing()) { |
| 1068 AddDeoptIndexAtCall(deopt_id, token_pos); |
| 1069 } |
| 1065 __ Drop(argument_count); | 1070 __ Drop(argument_count); |
| 1066 } | 1071 } |
| 1067 | 1072 |
| 1068 | 1073 |
| 1069 // Checks class id of instance against all 'class_ids'. Jump to 'deopt' label | 1074 // Checks class id of instance against all 'class_ids'. Jump to 'deopt' label |
| 1070 // if no match or instance is Smi. | 1075 // if no match or instance is Smi. |
| 1071 void FlowGraphCompiler::EmitClassChecksNoSmi(const ICData& ic_data, | 1076 void FlowGraphCompiler::EmitClassChecksNoSmi(const ICData& ic_data, |
| 1072 Register instance_reg, | 1077 Register instance_reg, |
| 1073 Register temp_reg, | 1078 Register temp_reg, |
| 1074 Label* deopt) { | 1079 Label* deopt) { |
| (...skipping 225 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1300 void ParallelMoveResolver::Exchange(const Address& mem1, const Address& mem2) { | 1305 void ParallelMoveResolver::Exchange(const Address& mem1, const Address& mem2) { |
| 1301 __ Exchange(mem1, mem2); | 1306 __ Exchange(mem1, mem2); |
| 1302 } | 1307 } |
| 1303 | 1308 |
| 1304 | 1309 |
| 1305 #undef __ | 1310 #undef __ |
| 1306 | 1311 |
| 1307 } // namespace dart | 1312 } // namespace dart |
| 1308 | 1313 |
| 1309 #endif // defined TARGET_ARCH_X64 | 1314 #endif // defined TARGET_ARCH_X64 |
| OLD | NEW |