| 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_IA32. | 5 #include "vm/globals.h" // Needed here to get TARGET_ARCH_IA32. |
| 6 #if defined(TARGET_ARCH_IA32) | 6 #if defined(TARGET_ARCH_IA32) |
| 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 Label L; | 39 Label L; |
| 38 __ pushl(EAX); // Preserve EAX. | 40 __ pushl(EAX); // Preserve EAX. |
| (...skipping 1008 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1047 intptr_t token_pos, | 1049 intptr_t token_pos, |
| 1048 intptr_t try_index, | 1050 intptr_t try_index, |
| 1049 LocationSummary* locs) { | 1051 LocationSummary* locs) { |
| 1050 ASSERT(!IsLeaf()); | 1052 ASSERT(!IsLeaf()); |
| 1051 __ LoadObject(ECX, function); | 1053 __ LoadObject(ECX, function); |
| 1052 __ LoadObject(EDX, arguments_descriptor); | 1054 __ LoadObject(EDX, arguments_descriptor); |
| 1053 __ call(&StubCode::CallStaticFunctionLabel()); | 1055 __ call(&StubCode::CallStaticFunctionLabel()); |
| 1054 AddCurrentDescriptor(PcDescriptors::kFuncCall, deopt_id, token_pos, | 1056 AddCurrentDescriptor(PcDescriptors::kFuncCall, deopt_id, token_pos, |
| 1055 try_index); | 1057 try_index); |
| 1056 RecordSafepoint(locs); | 1058 RecordSafepoint(locs); |
| 1059 if (is_optimizing()) { |
| 1060 AddDeoptIndexAtCall(deopt_id, token_pos); |
| 1061 } |
| 1057 __ Drop(argument_count); | 1062 __ Drop(argument_count); |
| 1058 } | 1063 } |
| 1059 | 1064 |
| 1060 | 1065 |
| 1061 // Checks class id of instance against all 'class_ids'. Jump to 'deopt' label | 1066 // Checks class id of instance against all 'class_ids'. Jump to 'deopt' label |
| 1062 // if no match or instance is Smi. | 1067 // if no match or instance is Smi. |
| 1063 void FlowGraphCompiler::EmitClassChecksNoSmi(const ICData& ic_data, | 1068 void FlowGraphCompiler::EmitClassChecksNoSmi(const ICData& ic_data, |
| 1064 Register instance_reg, | 1069 Register instance_reg, |
| 1065 Register temp_reg, | 1070 Register temp_reg, |
| 1066 Label* deopt) { | 1071 Label* deopt) { |
| (...skipping 243 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1310 __ popl(ECX); | 1315 __ popl(ECX); |
| 1311 __ popl(EAX); | 1316 __ popl(EAX); |
| 1312 } | 1317 } |
| 1313 | 1318 |
| 1314 | 1319 |
| 1315 #undef __ | 1320 #undef __ |
| 1316 | 1321 |
| 1317 } // namespace dart | 1322 } // namespace dart |
| 1318 | 1323 |
| 1319 #endif // defined TARGET_ARCH_IA32 | 1324 #endif // defined TARGET_ARCH_IA32 |
| OLD | NEW |