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

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

Issue 10538024: Implemented missing instructions in ia32, more sharing, removed bailouts, enable optimiziations on … (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 8 years, 6 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
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"
11 #include "vm/ast_printer.h" 11 #include "vm/ast_printer.h"
12 #include "vm/compiler_stats.h" 12 #include "vm/compiler_stats.h"
13 #include "vm/il_printer.h" 13 #include "vm/il_printer.h"
14 #include "vm/locations.h" 14 #include "vm/locations.h"
15 #include "vm/object_store.h" 15 #include "vm/object_store.h"
16 #include "vm/stub_code.h" 16 #include "vm/stub_code.h"
17 17
18 namespace dart { 18 namespace dart {
19 19
20 DECLARE_FLAG(bool, code_comments);
21 DECLARE_FLAG(bool, compiler_stats); 20 DECLARE_FLAG(bool, compiler_stats);
22 DECLARE_FLAG(bool, enable_type_checks); 21 DECLARE_FLAG(bool, enable_type_checks);
23 DECLARE_FLAG(bool, print_ast); 22 DECLARE_FLAG(bool, print_ast);
24 DECLARE_FLAG(bool, print_scopes); 23 DECLARE_FLAG(bool, print_scopes);
25 DECLARE_FLAG(bool, trace_functions); 24 DECLARE_FLAG(bool, trace_functions);
26 25
27 26
28 void DeoptimizationStub::GenerateCode(FlowGraphCompilerShared* compiler) { 27 void DeoptimizationStub::GenerateCode(FlowGraphCompilerShared* compiler) {
29 Assembler* assem = compiler->assembler(); 28 Assembler* assem = compiler->assembler();
30 #define __ assem-> 29 #define __ assem->
(...skipping 919 matching lines...) Expand 10 before | Expand all | Expand 10 after
950 // type check runtime call is the checked value. 949 // type check runtime call is the checked value.
951 __ Drop(8); 950 __ Drop(8);
952 __ popl(EAX); 951 __ popl(EAX);
953 952
954 __ Bind(&is_assignable); 953 __ Bind(&is_assignable);
955 __ popl(EDX); // Remove pushed instantiator type arguments.. 954 __ popl(EDX); // Remove pushed instantiator type arguments..
956 __ popl(ECX); // Remove pushed instantiator. 955 __ popl(ECX); // Remove pushed instantiator.
957 } 956 }
958 957
959 958
960 void FlowGraphCompiler::EmitComment(Instruction* instr) {
961 char buffer[80];
962 BufferFormatter f(buffer, sizeof(buffer));
963 instr->PrintTo(&f);
964 __ Comment("@%d: %s", instr->cid(), buffer);
965 }
966
967
968 void FlowGraphCompiler::BailoutOnInstruction(Instruction* instr) {
969 char buffer[80];
970 BufferFormatter f(buffer, sizeof(buffer));
971 instr->PrintTo(&f);
972 Bailout(buffer);
973 }
974
975
976 void FlowGraphCompiler::EmitInstructionPrologue(Instruction* instr) { 959 void FlowGraphCompiler::EmitInstructionPrologue(Instruction* instr) {
977 LocationSummary* locs = instr->locs(); 960 LocationSummary* locs = instr->locs();
978 ASSERT(locs != NULL); 961 ASSERT(locs != NULL);
979 962
980 locs->AllocateRegisters(); 963 locs->AllocateRegisters();
981 964
982 // Load instruction inputs into allocated registers. 965 // Load instruction inputs into allocated registers.
983 for (intptr_t i = locs->input_count() - 1; i >= 0; i--) { 966 for (intptr_t i = locs->input_count() - 1; i >= 0; i--) {
984 Location loc = locs->in(i); 967 Location loc = locs->in(i);
985 ASSERT(loc.kind() == Location::kRegister); 968 ASSERT(loc.kind() == Location::kRegister);
986 __ popl(loc.reg()); 969 __ popl(loc.reg());
987 } 970 }
988 } 971 }
989 972
990 973
991 void FlowGraphCompiler::VisitBlocks() {
992 for (intptr_t i = 0; i < block_order().length(); ++i) {
993 __ Comment("B%d", i);
994 // Compile the block entry.
995 set_current_block(block_order()[i]);
996 current_block()->PrepareEntry(this);
997 Instruction* instr = current_block()->StraightLineSuccessor();
998 // Compile all successors until an exit, branch, or a block entry.
999 while ((instr != NULL) && !instr->IsBlockEntry()) {
1000 if (FLAG_code_comments) EmitComment(instr);
1001 if (instr->locs() == NULL) {
1002 BailoutOnInstruction(instr);
1003 } else {
1004 EmitInstructionPrologue(instr);
1005 instr->EmitNativeCode(this);
1006 instr = instr->StraightLineSuccessor();
1007 }
1008 }
1009 BlockEntryInstr* successor =
1010 (instr == NULL) ? NULL : instr->AsBlockEntry();
1011 if (successor != NULL) {
1012 // Block ended with a "goto". We can fall through if it is the
1013 // next block in the list. Otherwise, we need a jump.
1014 if ((i == block_order().length() - 1) ||
1015 (block_order()[i + 1] != successor)) {
1016 __ jmp(GetBlockLabel(successor));
1017 }
1018 }
1019 }
1020 }
1021
1022 #undef __ 974 #undef __
1023 975
1024 } // namespace dart 976 } // namespace dart
1025 977
1026 #endif // defined TARGET_ARCH_IA32 978 #endif // defined TARGET_ARCH_IA32
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698