OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "src/crankshaft/lithium.h" | 5 #include "src/crankshaft/lithium.h" |
6 | 6 |
7 #include "src/ast/scopes.h" | 7 #include "src/ast/scopes.h" |
8 | 8 |
9 #if V8_TARGET_ARCH_IA32 | 9 #if V8_TARGET_ARCH_IA32 |
10 #include "src/crankshaft/ia32/lithium-ia32.h" // NOLINT | 10 #include "src/crankshaft/ia32/lithium-ia32.h" // NOLINT |
(...skipping 22 matching lines...) Expand all Loading... |
33 #elif V8_TARGET_ARCH_S390 | 33 #elif V8_TARGET_ARCH_S390 |
34 #include "src/crankshaft/s390/lithium-s390.h" // NOLINT | 34 #include "src/crankshaft/s390/lithium-s390.h" // NOLINT |
35 #include "src/crankshaft/s390/lithium-codegen-s390.h" // NOLINT | 35 #include "src/crankshaft/s390/lithium-codegen-s390.h" // NOLINT |
36 #else | 36 #else |
37 #error "Unknown architecture." | 37 #error "Unknown architecture." |
38 #endif | 38 #endif |
39 | 39 |
40 namespace v8 { | 40 namespace v8 { |
41 namespace internal { | 41 namespace internal { |
42 | 42 |
| 43 const auto GetRegConfig = RegisterConfiguration::Crankshaft; |
43 | 44 |
44 void LOperand::PrintTo(StringStream* stream) { | 45 void LOperand::PrintTo(StringStream* stream) { |
45 LUnallocated* unalloc = NULL; | 46 LUnallocated* unalloc = NULL; |
46 switch (kind()) { | 47 switch (kind()) { |
47 case INVALID: | 48 case INVALID: |
48 stream->Add("(0)"); | 49 stream->Add("(0)"); |
49 break; | 50 break; |
50 case UNALLOCATED: | 51 case UNALLOCATED: |
51 unalloc = LUnallocated::cast(this); | 52 unalloc = LUnallocated::cast(this); |
52 stream->Add("v%d", unalloc->virtual_register()); | 53 stream->Add("v%d", unalloc->virtual_register()); |
53 if (unalloc->basic_policy() == LUnallocated::FIXED_SLOT) { | 54 if (unalloc->basic_policy() == LUnallocated::FIXED_SLOT) { |
54 stream->Add("(=%dS)", unalloc->fixed_slot_index()); | 55 stream->Add("(=%dS)", unalloc->fixed_slot_index()); |
55 break; | 56 break; |
56 } | 57 } |
57 switch (unalloc->extended_policy()) { | 58 switch (unalloc->extended_policy()) { |
58 case LUnallocated::NONE: | 59 case LUnallocated::NONE: |
59 break; | 60 break; |
60 case LUnallocated::FIXED_REGISTER: { | 61 case LUnallocated::FIXED_REGISTER: { |
61 int reg_index = unalloc->fixed_register_index(); | 62 int reg_index = unalloc->fixed_register_index(); |
62 if (reg_index < 0 || reg_index >= Register::kNumRegisters) { | 63 if (reg_index < 0 || reg_index >= Register::kNumRegisters) { |
63 stream->Add("(=invalid_reg#%d)", reg_index); | 64 stream->Add("(=invalid_reg#%d)", reg_index); |
64 } else { | 65 } else { |
65 const char* register_name = | 66 const char* register_name = |
66 Register::from_code(reg_index).ToString(); | 67 GetRegConfig()->GetGeneralRegisterName(reg_index); |
67 stream->Add("(=%s)", register_name); | 68 stream->Add("(=%s)", register_name); |
68 } | 69 } |
69 break; | 70 break; |
70 } | 71 } |
71 case LUnallocated::FIXED_DOUBLE_REGISTER: { | 72 case LUnallocated::FIXED_DOUBLE_REGISTER: { |
72 int reg_index = unalloc->fixed_register_index(); | 73 int reg_index = unalloc->fixed_register_index(); |
73 if (reg_index < 0 || reg_index >= DoubleRegister::kMaxNumRegisters) { | 74 if (reg_index < 0 || reg_index >= DoubleRegister::kMaxNumRegisters) { |
74 stream->Add("(=invalid_double_reg#%d)", reg_index); | 75 stream->Add("(=invalid_double_reg#%d)", reg_index); |
75 } else { | 76 } else { |
76 const char* double_register_name = | 77 const char* double_register_name = |
77 DoubleRegister::from_code(reg_index).ToString(); | 78 GetRegConfig()->GetDoubleRegisterName(reg_index); |
78 stream->Add("(=%s)", double_register_name); | 79 stream->Add("(=%s)", double_register_name); |
79 } | 80 } |
80 break; | 81 break; |
81 } | 82 } |
82 case LUnallocated::MUST_HAVE_REGISTER: | 83 case LUnallocated::MUST_HAVE_REGISTER: |
83 stream->Add("(R)"); | 84 stream->Add("(R)"); |
84 break; | 85 break; |
85 case LUnallocated::MUST_HAVE_DOUBLE_REGISTER: | 86 case LUnallocated::MUST_HAVE_DOUBLE_REGISTER: |
86 stream->Add("(D)"); | 87 stream->Add("(D)"); |
87 break; | 88 break; |
(...skipping 15 matching lines...) Expand all Loading... |
103 stream->Add("[stack:%d]", index()); | 104 stream->Add("[stack:%d]", index()); |
104 break; | 105 break; |
105 case DOUBLE_STACK_SLOT: | 106 case DOUBLE_STACK_SLOT: |
106 stream->Add("[double_stack:%d]", index()); | 107 stream->Add("[double_stack:%d]", index()); |
107 break; | 108 break; |
108 case REGISTER: { | 109 case REGISTER: { |
109 int reg_index = index(); | 110 int reg_index = index(); |
110 if (reg_index < 0 || reg_index >= Register::kNumRegisters) { | 111 if (reg_index < 0 || reg_index >= Register::kNumRegisters) { |
111 stream->Add("(=invalid_reg#%d|R)", reg_index); | 112 stream->Add("(=invalid_reg#%d|R)", reg_index); |
112 } else { | 113 } else { |
113 stream->Add("[%s|R]", Register::from_code(reg_index).ToString()); | 114 stream->Add("[%s|R]", |
| 115 GetRegConfig()->GetGeneralRegisterName(reg_index)); |
114 } | 116 } |
115 break; | 117 break; |
116 } | 118 } |
117 case DOUBLE_REGISTER: { | 119 case DOUBLE_REGISTER: { |
118 int reg_index = index(); | 120 int reg_index = index(); |
119 if (reg_index < 0 || reg_index >= DoubleRegister::kMaxNumRegisters) { | 121 if (reg_index < 0 || reg_index >= DoubleRegister::kMaxNumRegisters) { |
120 stream->Add("(=invalid_double_reg#%d|R)", reg_index); | 122 stream->Add("(=invalid_double_reg#%d|R)", reg_index); |
121 } else { | 123 } else { |
122 stream->Add("[%s|R]", DoubleRegister::from_code(reg_index).ToString()); | 124 stream->Add("[%s|R]", GetRegConfig()->GetDoubleRegisterName(reg_index)); |
123 } | 125 } |
124 break; | 126 break; |
125 } | 127 } |
126 } | 128 } |
127 } | 129 } |
128 | 130 |
129 | 131 |
130 template<LOperand::Kind kOperandKind, int kNumCachedOperands> | 132 template<LOperand::Kind kOperandKind, int kNumCachedOperands> |
131 LSubKindOperand<kOperandKind, kNumCachedOperands>* | 133 LSubKindOperand<kOperandKind, kNumCachedOperands>* |
132 LSubKindOperand<kOperandKind, kNumCachedOperands>::cache = NULL; | 134 LSubKindOperand<kOperandKind, kNumCachedOperands>::cache = NULL; |
(...skipping 590 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
723 | 725 |
724 LPhase::~LPhase() { | 726 LPhase::~LPhase() { |
725 if (ShouldProduceTraceOutput()) { | 727 if (ShouldProduceTraceOutput()) { |
726 isolate()->GetHTracer()->TraceLithium(name(), chunk_); | 728 isolate()->GetHTracer()->TraceLithium(name(), chunk_); |
727 } | 729 } |
728 } | 730 } |
729 | 731 |
730 | 732 |
731 } // namespace internal | 733 } // namespace internal |
732 } // namespace v8 | 734 } // namespace v8 |
OLD | NEW |