| 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 "vm/ast_printer.h" | 10 #include "vm/ast_printer.h" |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 58 DISALLOW_COPY_AND_ASSIGN(DeoptimizationStub); | 58 DISALLOW_COPY_AND_ASSIGN(DeoptimizationStub); |
| 59 }; | 59 }; |
| 60 | 60 |
| 61 | 61 |
| 62 void DeoptimizationStub::GenerateCode(FlowGraphCompiler* compiler) { | 62 void DeoptimizationStub::GenerateCode(FlowGraphCompiler* compiler) { |
| 63 Assembler* assem = compiler->assembler(); | 63 Assembler* assem = compiler->assembler(); |
| 64 #define __ assem-> | 64 #define __ assem-> |
| 65 __ Comment("Deopt stub for id %d", deopt_id_); | 65 __ Comment("Deopt stub for id %d", deopt_id_); |
| 66 __ Bind(entry_label()); | 66 __ Bind(entry_label()); |
| 67 for (intptr_t i = 0; i < registers_.length(); i++) { | 67 for (intptr_t i = 0; i < registers_.length(); i++) { |
| 68 __ pushl(registers_[i]); | 68 if (registers_[i] != kNoRegister) { |
| 69 __ pushl(registers_[i]); |
| 70 } |
| 69 } | 71 } |
| 70 __ movl(EAX, Immediate(Smi::RawValue(reason_))); | 72 __ movl(EAX, Immediate(Smi::RawValue(reason_))); |
| 71 __ call(&StubCode::DeoptimizeLabel()); | 73 __ call(&StubCode::DeoptimizeLabel()); |
| 72 compiler->AddCurrentDescriptor(PcDescriptors::kOther, | 74 compiler->AddCurrentDescriptor(PcDescriptors::kOther, |
| 73 deopt_id_, | 75 deopt_id_, |
| 74 deopt_token_index_, | 76 deopt_token_index_, |
| 75 try_index_); | 77 try_index_); |
| 76 #undef __ | 78 #undef __ |
| 77 } | 79 } |
| 78 | 80 |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 132 intptr_t cid, | 134 intptr_t cid, |
| 133 intptr_t token_index, | 135 intptr_t token_index, |
| 134 intptr_t try_index) { | 136 intptr_t try_index) { |
| 135 pc_descriptors_list_->AddDescriptor(kind, | 137 pc_descriptors_list_->AddDescriptor(kind, |
| 136 assembler_->CodeSize(), | 138 assembler_->CodeSize(), |
| 137 cid, | 139 cid, |
| 138 token_index, | 140 token_index, |
| 139 try_index); | 141 try_index); |
| 140 } | 142 } |
| 141 | 143 |
| 144 |
| 145 Label* FlowGraphCompiler::AddDeoptStub(intptr_t deopt_id, |
| 146 intptr_t deopt_token_index, |
| 147 intptr_t try_index, |
| 148 DeoptReasonId reason, |
| 149 Register reg1, |
| 150 Register reg2) { |
| 151 DeoptimizationStub* stub = |
| 152 new DeoptimizationStub(deopt_id, deopt_token_index, try_index, reason); |
| 153 stub->Push(reg1); |
| 154 stub->Push(reg2); |
| 155 deopt_stubs_.Add(stub); |
| 156 return stub->entry_label(); |
| 157 } |
| 158 |
| 159 |
| 160 |
| 142 #define __ assembler_-> | 161 #define __ assembler_-> |
| 143 | 162 |
| 144 void FlowGraphCompiler::IntrinsifyGetter() { | 163 void FlowGraphCompiler::IntrinsifyGetter() { |
| 145 // TOS: return address. | 164 // TOS: return address. |
| 146 // +1 : receiver. | 165 // +1 : receiver. |
| 147 // Sequence node has one return node, its input is load field node. | 166 // Sequence node has one return node, its input is load field node. |
| 148 const SequenceNode& sequence_node = *parsed_function_.node_sequence(); | 167 const SequenceNode& sequence_node = *parsed_function_.node_sequence(); |
| 149 ASSERT(sequence_node.length() == 1); | 168 ASSERT(sequence_node.length() == 1); |
| 150 ASSERT(sequence_node.NodeAt(0)->IsReturnNode()); | 169 ASSERT(sequence_node.NodeAt(0)->IsReturnNode()); |
| 151 const ReturnNode& return_node = *sequence_node.NodeAt(0)->AsReturnNode(); | 170 const ReturnNode& return_node = *sequence_node.NodeAt(0)->AsReturnNode(); |
| (...skipping 340 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 492 | 511 |
| 493 void FlowGraphCompiler::FinalizeComments(const Code& code) { | 512 void FlowGraphCompiler::FinalizeComments(const Code& code) { |
| 494 code.set_comments(assembler_->GetCodeComments()); | 513 code.set_comments(assembler_->GetCodeComments()); |
| 495 } | 514 } |
| 496 | 515 |
| 497 #undef __ | 516 #undef __ |
| 498 | 517 |
| 499 } // namespace dart | 518 } // namespace dart |
| 500 | 519 |
| 501 #endif // defined TARGET_ARCH_IA32 | 520 #endif // defined TARGET_ARCH_IA32 |
| OLD | NEW |