Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(212)

Side by Side Diff: runtime/vm/flow_graph_compiler_ia32.cc

Issue 10832411: Remove support for non-ssa optimizing code generation. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: disable optimizations on bailout Created 8 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « runtime/vm/flow_graph_compiler_ia32.h ('k') | runtime/vm/flow_graph_compiler_x64.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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"
(...skipping 13 matching lines...) Expand all
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 Assembler* assem = compiler->assembler(); 29 Assembler* assem = compiler->assembler();
30 #define __ assem-> 30 #define __ assem->
31 __ Comment("Deopt stub for id %d", deopt_id_); 31 __ Comment("Deopt stub for id %d", deopt_id_);
32 __ Bind(entry_label()); 32 __ Bind(entry_label());
33 33
34 if (deoptimization_env_ == NULL) { 34 ASSERT(deoptimization_env_ != NULL);
35 for (intptr_t i = 0; i < registers_.length(); i++) {
36 if (registers_[i] != kNoRegister) {
37 __ pushl(registers_[i]);
38 }
39 }
40 }
41 35
42 if (compiler->IsLeaf()) { 36 if (compiler->IsLeaf()) {
43 Label L; 37 Label L;
44 __ pushl(EAX); // Preserve EAX. 38 __ pushl(EAX); // Preserve EAX.
45 __ call(&L); 39 __ call(&L);
46 const intptr_t offset = assem->CodeSize(); 40 const intptr_t offset = assem->CodeSize();
47 __ Bind(&L); 41 __ Bind(&L);
48 __ popl(EAX); 42 __ popl(EAX);
49 __ subl(EAX, 43 __ subl(EAX,
50 Immediate(offset - AssemblerMacros::kOffsetOfSavedPCfromEntrypoint)); 44 Immediate(offset - AssemblerMacros::kOffsetOfSavedPCfromEntrypoint));
(...skipping 555 matching lines...) Expand 10 before | Expand all | Expand 10 after
606 __ Drop(6); 600 __ Drop(6);
607 __ popl(EAX); 601 __ popl(EAX);
608 602
609 __ Bind(&is_assignable); 603 __ Bind(&is_assignable);
610 __ popl(EDX); // Remove pushed instantiator type arguments. 604 __ popl(EDX); // Remove pushed instantiator type arguments.
611 __ popl(ECX); // Remove pushed instantiator. 605 __ popl(ECX); // Remove pushed instantiator.
612 } 606 }
613 607
614 608
615 void FlowGraphCompiler::EmitInstructionPrologue(Instruction* instr) { 609 void FlowGraphCompiler::EmitInstructionPrologue(Instruction* instr) {
616 LocationSummary* locs = instr->locs(); 610 if (!is_optimizing()) {
617 ASSERT(locs != NULL); 611 AllocateRegistersLocally(instr);
618 612 }
619 frame_register_allocator()->AllocateRegisters(instr);
620
621 // TODO(vegorov): adjust assertion when we start removing comparison from the
622 // graph when it is merged with a branch.
623 ASSERT(locs->always_calls() ||
624 (locs->input_count() == instr->InputCount()));
625 } 613 }
626 614
627 615
628 void FlowGraphCompiler::CopyParameters() { 616 void FlowGraphCompiler::CopyParameters() {
629 __ Comment("Copy parameters"); 617 __ Comment("Copy parameters");
630 const Function& function = parsed_function().function(); 618 const Function& function = parsed_function().function();
631 const bool is_native_instance_closure = 619 const bool is_native_instance_closure =
632 function.is_native() && function.IsImplicitInstanceClosureFunction(); 620 function.is_native() && function.IsImplicitInstanceClosureFunction();
633 LocalScope* scope = parsed_function().node_sequence()->scope(); 621 LocalScope* scope = parsed_function().node_sequence()->scope();
634 const int num_fixed_params = function.num_fixed_parameters(); 622 const int num_fixed_params = function.num_fixed_parameters();
(...skipping 306 matching lines...) Expand 10 before | Expand all | Expand 10 after
941 } 929 }
942 } else { 930 } else {
943 CopyParameters(); 931 CopyParameters();
944 } 932 }
945 933
946 // Initialize (non-argument) stack allocated slots to null. 934 // Initialize (non-argument) stack allocated slots to null.
947 // 935 //
948 // TODO(vegorov): introduce stack maps and stop initializing all spill slots 936 // TODO(vegorov): introduce stack maps and stop initializing all spill slots
949 // with null. 937 // with null.
950 intptr_t uninitialized_slot_count; 938 intptr_t uninitialized_slot_count;
951 if (is_ssa_) { 939 if (is_optimizing()) {
952 GraphEntryInstr* entry = block_order_[0]->AsGraphEntry(); 940 GraphEntryInstr* entry = block_order_[0]->AsGraphEntry();
953 uninitialized_slot_count = 941 uninitialized_slot_count =
954 entry->spill_slot_count() - copied_parameter_count; 942 entry->spill_slot_count() - copied_parameter_count;
955 } else { 943 } else {
956 uninitialized_slot_count = local_count; 944 uninitialized_slot_count = local_count;
957 } 945 }
958 const intptr_t slot_base = parsed_function().first_stack_local_index(); 946 const intptr_t slot_base = parsed_function().first_stack_local_index();
959 947
960 if (uninitialized_slot_count > 0) { 948 if (uninitialized_slot_count > 0) {
961 __ Comment("Initialize spill slots"); 949 __ Comment("Initialize spill slots");
(...skipping 30 matching lines...) Expand all
992 __ jmp(&StubCode::FixCallersTargetLabel()); 980 __ jmp(&StubCode::FixCallersTargetLabel());
993 } 981 }
994 982
995 983
996 void FlowGraphCompiler::GenerateCall(intptr_t token_pos, 984 void FlowGraphCompiler::GenerateCall(intptr_t token_pos,
997 intptr_t try_index, 985 intptr_t try_index,
998 const ExternalLabel* label, 986 const ExternalLabel* label,
999 PcDescriptors::Kind kind, 987 PcDescriptors::Kind kind,
1000 BitmapBuilder* stack_bitmap) { 988 BitmapBuilder* stack_bitmap) {
1001 ASSERT(!IsLeaf()); 989 ASSERT(!IsLeaf());
1002 ASSERT(frame_register_allocator()->IsSpilled());
1003 __ call(label); 990 __ call(label);
1004 if (is_ssa() && (stack_bitmap != NULL)) { 991 if (is_optimizing() && (stack_bitmap != NULL)) {
1005 stackmap_table_builder_->AddEntry(assembler()->CodeSize(), stack_bitmap); 992 stackmap_table_builder_->AddEntry(assembler()->CodeSize(), stack_bitmap);
1006 } 993 }
1007 AddCurrentDescriptor(kind, Isolate::kNoDeoptId, token_pos, try_index); 994 AddCurrentDescriptor(kind, Isolate::kNoDeoptId, token_pos, try_index);
1008 } 995 }
1009 996
1010 997
1011 void FlowGraphCompiler::GenerateCallRuntime(intptr_t deopt_id, 998 void FlowGraphCompiler::GenerateCallRuntime(intptr_t deopt_id,
1012 intptr_t token_pos, 999 intptr_t token_pos,
1013 intptr_t try_index, 1000 intptr_t try_index,
1014 const RuntimeEntry& entry, 1001 const RuntimeEntry& entry,
1015 BitmapBuilder* stack_bitmap) { 1002 BitmapBuilder* stack_bitmap) {
1016 ASSERT(!IsLeaf()); 1003 ASSERT(!IsLeaf());
1017 ASSERT(frame_register_allocator()->IsSpilled());
1018 __ CallRuntime(entry); 1004 __ CallRuntime(entry);
1019 if (is_ssa() && (stack_bitmap != NULL)) { 1005 if (is_optimizing() && (stack_bitmap != NULL)) {
1020 stackmap_table_builder_->AddEntry(assembler()->CodeSize(), stack_bitmap); 1006 stackmap_table_builder_->AddEntry(assembler()->CodeSize(), stack_bitmap);
1021 } 1007 }
1022 AddCurrentDescriptor(PcDescriptors::kOther, deopt_id, token_pos, try_index); 1008 AddCurrentDescriptor(PcDescriptors::kOther, deopt_id, token_pos, try_index);
1023 } 1009 }
1024 1010
1025 1011
1026 intptr_t FlowGraphCompiler::EmitInstanceCall(ExternalLabel* target_label, 1012 intptr_t FlowGraphCompiler::EmitInstanceCall(ExternalLabel* target_label,
1027 const ICData& ic_data, 1013 const ICData& ic_data,
1028 const Array& arguments_descriptor, 1014 const Array& arguments_descriptor,
1029 intptr_t argument_count) { 1015 intptr_t argument_count) {
(...skipping 198 matching lines...) Expand 10 before | Expand all | Expand 10 after
1228 __ popl(ECX); 1214 __ popl(ECX);
1229 __ popl(EAX); 1215 __ popl(EAX);
1230 } 1216 }
1231 1217
1232 1218
1233 #undef __ 1219 #undef __
1234 1220
1235 } // namespace dart 1221 } // namespace dart
1236 1222
1237 #endif // defined TARGET_ARCH_IA32 1223 #endif // defined TARGET_ARCH_IA32
OLDNEW
« no previous file with comments | « runtime/vm/flow_graph_compiler_ia32.h ('k') | runtime/vm/flow_graph_compiler_x64.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698