| 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 Assembler* assem = compiler->assembler(); | 29 Assembler* assem = compiler->assembler(); |
| 29 #define __ assem-> | 30 #define __ assem-> |
| 30 __ Comment("Deopt stub for id %d", deopt_id_); | 31 __ Comment("Deopt stub for id %d", deopt_id_); |
| 31 __ Bind(entry_label()); | 32 __ Bind(entry_label()); |
| 32 | 33 |
| 33 if (deoptimization_env_ == NULL) { | 34 if (deoptimization_env_ == NULL) { |
| 34 for (intptr_t i = 0; i < registers_.length(); i++) { | 35 for (intptr_t i = 0; i < registers_.length(); i++) { |
| 35 if (registers_[i] != kNoRegister) { | 36 if (registers_[i] != kNoRegister) { |
| 36 __ pushl(registers_[i]); | 37 __ pushl(registers_[i]); |
| 37 } | 38 } |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 89 __ call(&L); | 90 __ call(&L); |
| 90 const intptr_t offset = assem->CodeSize(); | 91 const intptr_t offset = assem->CodeSize(); |
| 91 __ Bind(&L); | 92 __ Bind(&L); |
| 92 __ popl(EAX); | 93 __ popl(EAX); |
| 93 __ subl(EAX, | 94 __ subl(EAX, |
| 94 Immediate(offset - AssemblerMacros::kOffsetOfSavedPCfromEntrypoint)); | 95 Immediate(offset - AssemblerMacros::kOffsetOfSavedPCfromEntrypoint)); |
| 95 __ movl(Address(EBP, -kWordSize), EAX); | 96 __ movl(Address(EBP, -kWordSize), EAX); |
| 96 } | 97 } |
| 97 __ movl(EAX, Immediate(Smi::RawValue(reason_))); | 98 __ movl(EAX, Immediate(Smi::RawValue(reason_))); |
| 98 __ call(&StubCode::DeoptimizeLabel()); | 99 __ call(&StubCode::DeoptimizeLabel()); |
| 99 compiler->AddCurrentDescriptor(PcDescriptors::kOther, | 100 const intptr_t deopt_info_index = stub_ix; |
| 100 deopt_id_, | 101 compiler->pc_descriptors_list()-> AddDeoptInfo( |
| 101 deopt_token_pos_, | 102 compiler->assembler()->CodeSize(), |
| 102 try_index_); | 103 deopt_id_, |
| 104 deopt_token_pos_, |
| 105 deopt_info_index); |
| 103 #undef __ | 106 #undef __ |
| 104 } | 107 } |
| 105 | 108 |
| 106 | 109 |
| 107 #define __ assembler()-> | 110 #define __ assembler()-> |
| 108 | 111 |
| 109 | 112 |
| 110 // Fall through if bool_register contains null. | 113 // Fall through if bool_register contains null. |
| 111 void FlowGraphCompiler::GenerateBoolToJump(Register bool_register, | 114 void FlowGraphCompiler::GenerateBoolToJump(Register bool_register, |
| 112 Label* is_true, | 115 Label* is_true, |
| (...skipping 1153 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1266 __ popl(ECX); | 1269 __ popl(ECX); |
| 1267 __ popl(EAX); | 1270 __ popl(EAX); |
| 1268 } | 1271 } |
| 1269 | 1272 |
| 1270 | 1273 |
| 1271 #undef __ | 1274 #undef __ |
| 1272 | 1275 |
| 1273 } // namespace dart | 1276 } // namespace dart |
| 1274 | 1277 |
| 1275 #endif // defined TARGET_ARCH_IA32 | 1278 #endif // defined TARGET_ARCH_IA32 |
| OLD | NEW |