| 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 30 matching lines...) Expand all Loading... |
| 68 __ call(&L); | 69 __ call(&L); |
| 69 const intptr_t offset = assem->CodeSize(); | 70 const intptr_t offset = assem->CodeSize(); |
| 70 __ Bind(&L); | 71 __ Bind(&L); |
| 71 __ popl(EAX); | 72 __ popl(EAX); |
| 72 __ subl(EAX, | 73 __ subl(EAX, |
| 73 Immediate(offset - AssemblerMacros::kOffsetOfSavedPCfromEntrypoint)); | 74 Immediate(offset - AssemblerMacros::kOffsetOfSavedPCfromEntrypoint)); |
| 74 __ movl(Address(EBP, -kWordSize), EAX); | 75 __ movl(Address(EBP, -kWordSize), EAX); |
| 75 } | 76 } |
| 76 __ movl(EAX, Immediate(Smi::RawValue(reason_))); | 77 __ movl(EAX, Immediate(Smi::RawValue(reason_))); |
| 77 __ call(&StubCode::DeoptimizeLabel()); | 78 __ call(&StubCode::DeoptimizeLabel()); |
| 78 compiler->AddCurrentDescriptor(PcDescriptors::kOther, | 79 const intptr_t deopt_info_index = stub_ix; |
| 79 deopt_id_, | 80 compiler->pc_descriptors_list()-> AddDeoptInfo( |
| 80 deopt_token_pos_, | 81 compiler->assembler()->CodeSize(), |
| 81 try_index_); | 82 deopt_id_, |
| 83 deopt_token_pos_, |
| 84 deopt_info_index); |
| 82 #undef __ | 85 #undef __ |
| 83 } | 86 } |
| 84 | 87 |
| 85 | 88 |
| 86 #define __ assembler()-> | 89 #define __ assembler()-> |
| 87 | 90 |
| 88 | 91 |
| 89 // Fall through if bool_register contains null. | 92 // Fall through if bool_register contains null. |
| 90 void FlowGraphCompiler::GenerateBoolToJump(Register bool_register, | 93 void FlowGraphCompiler::GenerateBoolToJump(Register bool_register, |
| 91 Label* is_true, | 94 Label* is_true, |
| (...skipping 1153 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1245 __ popl(ECX); | 1248 __ popl(ECX); |
| 1246 __ popl(EAX); | 1249 __ popl(EAX); |
| 1247 } | 1250 } |
| 1248 | 1251 |
| 1249 | 1252 |
| 1250 #undef __ | 1253 #undef __ |
| 1251 | 1254 |
| 1252 } // namespace dart | 1255 } // namespace dart |
| 1253 | 1256 |
| 1254 #endif // defined TARGET_ARCH_IA32 | 1257 #endif // defined TARGET_ARCH_IA32 |
| OLD | NEW |