OLD | NEW |
---|---|
1 // Copyright 2010 the V8 project authors. All rights reserved. | 1 // Copyright 2010 the V8 project authors. All rights reserved. |
2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
4 // met: | 4 // met: |
5 // | 5 // |
6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
90 Register scratch0(); | 90 Register scratch0(); |
91 Register scratch1(); | 91 Register scratch1(); |
92 Register receiver_reg(); | 92 Register receiver_reg(); |
93 Register context_reg(); | 93 Register context_reg(); |
94 | 94 |
95 Register other_accumulator(Register reg) { | 95 Register other_accumulator(Register reg) { |
96 ASSERT(reg.is(accumulator0()) || reg.is(accumulator1())); | 96 ASSERT(reg.is(accumulator0()) || reg.is(accumulator1())); |
97 return (reg.is(accumulator0())) ? accumulator1() : accumulator0(); | 97 return (reg.is(accumulator0())) ? accumulator1() : accumulator0(); |
98 } | 98 } |
99 | 99 |
100 // Flags are true if the respective register is statically known to hold a | |
101 // smi. We do not track every register, only the accumulator registers. | |
102 bool is_smi(Register reg) { return (smi_bits_ & reg.bit()) != 0; } | |
fschneider
2010/02/10 15:14:33
What happens if reg == no_reg? Maybe we should
AS
Kevin Millikin (Chromium)
2010/02/11 08:30:09
Done.
| |
103 void set_as_smi(Register reg) { smi_bits_ = smi_bits_ | reg.bit(); } | |
104 void clear_as_smi(Register reg) { smi_bits_ = smi_bits_ & ~reg.bit(); } | |
105 | |
100 // AST node visit functions. | 106 // AST node visit functions. |
101 #define DECLARE_VISIT(type) virtual void Visit##type(type* node); | 107 #define DECLARE_VISIT(type) virtual void Visit##type(type* node); |
102 AST_NODE_LIST(DECLARE_VISIT) | 108 AST_NODE_LIST(DECLARE_VISIT) |
103 #undef DECLARE_VISIT | 109 #undef DECLARE_VISIT |
104 | 110 |
105 // Emit code to load the receiver from the stack into receiver_reg. | 111 // Emit code to load the receiver from the stack into receiver_reg. |
106 void EmitLoadReceiver(); | 112 void EmitLoadReceiver(); |
107 | 113 |
108 // Emit code to load a global variable directly from a global property | 114 // Emit code to load a global variable directly from a global property |
109 // cell into the destination register. | 115 // cell into the destination register. |
(...skipping 12 matching lines...) Expand all Loading... | |
122 | 128 |
123 // Emit a bitwise or operation. The left operand is in accumulator1 and | 129 // Emit a bitwise or operation. The left operand is in accumulator1 and |
124 // the right is in accumulator0. The result should be left in the | 130 // the right is in accumulator0. The result should be left in the |
125 // destination register. | 131 // destination register. |
126 void EmitBitOr(); | 132 void EmitBitOr(); |
127 | 133 |
128 MacroAssembler* masm_; | 134 MacroAssembler* masm_; |
129 CompilationInfo* info_; | 135 CompilationInfo* info_; |
130 Label bailout_; | 136 Label bailout_; |
131 Register destination_; | 137 Register destination_; |
138 uint32_t smi_bits_; | |
fschneider
2010/02/10 15:14:33
smi_bits_ should be initialized to 0?
Kevin Millikin (Chromium)
2010/02/11 08:30:09
Done.
| |
132 | 139 |
133 DISALLOW_COPY_AND_ASSIGN(FastCodeGenerator); | 140 DISALLOW_COPY_AND_ASSIGN(FastCodeGenerator); |
134 }; | 141 }; |
135 | 142 |
136 | 143 |
137 } } // namespace v8::internal | 144 } } // namespace v8::internal |
138 | 145 |
139 #endif // V8_FAST_CODEGEN_H_ | 146 #endif // V8_FAST_CODEGEN_H_ |
OLD | NEW |