| 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 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 53 register_allocation_map_(0) { } | 53 register_allocation_map_(0) { } |
| 54 | 54 |
| 55 | 55 |
| 56 // When cloned, a frame is a deep copy of the original. | 56 // When cloned, a frame is a deep copy of the original. |
| 57 VirtualFrame::VirtualFrame(VirtualFrame* original) | 57 VirtualFrame::VirtualFrame(VirtualFrame* original) |
| 58 : element_count_(original->element_count()), | 58 : element_count_(original->element_count()), |
| 59 top_of_stack_state_(original->top_of_stack_state_), | 59 top_of_stack_state_(original->top_of_stack_state_), |
| 60 register_allocation_map_(original->register_allocation_map_) { } | 60 register_allocation_map_(original->register_allocation_map_) { } |
| 61 | 61 |
| 62 | 62 |
| 63 bool VirtualFrame::Equals(VirtualFrame* other) { | 63 bool VirtualFrame::Equals(const VirtualFrame* other) { |
| 64 ASSERT(element_count() == other->element_count()); | 64 ASSERT(element_count() == other->element_count()); |
| 65 if (top_of_stack_state_ != other->top_of_stack_state_) return false; | 65 if (top_of_stack_state_ != other->top_of_stack_state_) return false; |
| 66 if (register_allocation_map_ != other->register_allocation_map_) return false; | 66 if (register_allocation_map_ != other->register_allocation_map_) return false; |
| 67 | 67 |
| 68 return true; | 68 return true; |
| 69 } | 69 } |
| 70 | 70 |
| 71 | 71 |
| 72 void VirtualFrame::PrepareForReturn() { | 72 void VirtualFrame::PrepareForReturn() { |
| 73 SpillAll(); | 73 SpillAll(); |
| (...skipping 18 matching lines...) Expand all Loading... |
| 92 SpilledScope::is_spilled_ = old_is_spilled_; | 92 SpilledScope::is_spilled_ = old_is_spilled_; |
| 93 if (old_is_spilled_) { | 93 if (old_is_spilled_) { |
| 94 VirtualFrame* frame = cgen_->frame(); | 94 VirtualFrame* frame = cgen_->frame(); |
| 95 if (frame != NULL) { | 95 if (frame != NULL) { |
| 96 frame->SpillAll(); | 96 frame->SpillAll(); |
| 97 } | 97 } |
| 98 } | 98 } |
| 99 } | 99 } |
| 100 | 100 |
| 101 | 101 |
| 102 CodeGenerator* VirtualFrame::cgen() { return CodeGeneratorScope::Current(); } | 102 CodeGenerator* VirtualFrame::cgen() const { |
| 103 return CodeGeneratorScope::Current(); |
| 104 } |
| 103 | 105 |
| 104 | 106 |
| 105 MacroAssembler* VirtualFrame::masm() { return cgen()->masm(); } | 107 MacroAssembler* VirtualFrame::masm() { return cgen()->masm(); } |
| 106 | 108 |
| 107 | 109 |
| 108 void VirtualFrame::CallStub(CodeStub* stub, int arg_count) { | 110 void VirtualFrame::CallStub(CodeStub* stub, int arg_count) { |
| 109 if (arg_count != 0) Forget(arg_count); | 111 if (arg_count != 0) Forget(arg_count); |
| 110 ASSERT(cgen()->HasValidEntryRegisters()); | 112 ASSERT(cgen()->HasValidEntryRegisters()); |
| 111 masm()->CallStub(stub); | 113 masm()->CallStub(stub); |
| 112 } | 114 } |
| 113 | 115 |
| 114 | 116 |
| 115 int VirtualFrame::parameter_count() { | 117 int VirtualFrame::parameter_count() const { |
| 116 return cgen()->scope()->num_parameters(); | 118 return cgen()->scope()->num_parameters(); |
| 117 } | 119 } |
| 118 | 120 |
| 119 | 121 |
| 120 int VirtualFrame::local_count() { return cgen()->scope()->num_stack_slots(); } | 122 int VirtualFrame::local_count() const { |
| 123 return cgen()->scope()->num_stack_slots(); |
| 124 } |
| 121 | 125 |
| 122 | 126 |
| 123 int VirtualFrame::frame_pointer() { return parameter_count() + 3; } | 127 int VirtualFrame::frame_pointer() const { return parameter_count() + 3; } |
| 124 | 128 |
| 125 | 129 |
| 126 int VirtualFrame::context_index() { return frame_pointer() - 1; } | 130 int VirtualFrame::context_index() { return frame_pointer() - 1; } |
| 127 | 131 |
| 128 | 132 |
| 129 int VirtualFrame::function_index() { return frame_pointer() - 2; } | 133 int VirtualFrame::function_index() { return frame_pointer() - 2; } |
| 130 | 134 |
| 131 | 135 |
| 132 int VirtualFrame::local0_index() { return frame_pointer() + 2; } | 136 int VirtualFrame::local0_index() const { return frame_pointer() + 2; } |
| 133 | 137 |
| 134 | 138 |
| 135 int VirtualFrame::fp_relative(int index) { | 139 int VirtualFrame::fp_relative(int index) { |
| 136 ASSERT(index < element_count()); | 140 ASSERT(index < element_count()); |
| 137 ASSERT(frame_pointer() < element_count()); // FP is on the frame. | 141 ASSERT(frame_pointer() < element_count()); // FP is on the frame. |
| 138 return (frame_pointer() - index) * kPointerSize; | 142 return (frame_pointer() - index) * kPointerSize; |
| 139 } | 143 } |
| 140 | 144 |
| 141 | 145 |
| 142 int VirtualFrame::expression_base_index() { | 146 int VirtualFrame::expression_base_index() const { |
| 143 return local0_index() + local_count(); | 147 return local0_index() + local_count(); |
| 144 } | 148 } |
| 145 | 149 |
| 146 | 150 |
| 147 int VirtualFrame::height() { | 151 int VirtualFrame::height() const { |
| 148 return element_count() - expression_base_index(); | 152 return element_count() - expression_base_index(); |
| 149 } | 153 } |
| 150 | 154 |
| 151 | 155 |
| 152 MemOperand VirtualFrame::LocalAt(int index) { | 156 MemOperand VirtualFrame::LocalAt(int index) { |
| 153 ASSERT(0 <= index); | 157 ASSERT(0 <= index); |
| 154 ASSERT(index < local_count()); | 158 ASSERT(index < local_count()); |
| 155 return MemOperand(fp, kLocal0Offset - index * kPointerSize); | 159 return MemOperand(fp, kLocal0Offset - index * kPointerSize); |
| 156 } | 160 } |
| 157 | 161 |
| 158 } } // namespace v8::internal | 162 } } // namespace v8::internal |
| 159 | 163 |
| 160 #endif // V8_VIRTUAL_FRAME_LIGHT_INL_H_ | 164 #endif // V8_VIRTUAL_FRAME_LIGHT_INL_H_ |
| OLD | NEW |