| OLD | NEW |
| 1 // Copyright 2008 the V8 project authors. All rights reserved. | 1 // Copyright 2008 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 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 60 public: | 60 public: |
| 61 // Construct a virtual frame with the given code generator used to | 61 // Construct a virtual frame with the given code generator used to |
| 62 // generate code. | 62 // generate code. |
| 63 explicit VirtualFrame(CodeGenerator* cgen); | 63 explicit VirtualFrame(CodeGenerator* cgen); |
| 64 | 64 |
| 65 // Construct a virtual frame that is a clone of an existing one, initially | 65 // Construct a virtual frame that is a clone of an existing one, initially |
| 66 // with an identical state. | 66 // with an identical state. |
| 67 explicit VirtualFrame(VirtualFrame* original); | 67 explicit VirtualFrame(VirtualFrame* original); |
| 68 | 68 |
| 69 int height() const { | 69 int height() const { |
| 70 return virtual_stack_pointer_ - expression_base_index() + 1; | 70 return elements_.length() - expression_base_index(); |
| 71 } | 71 } |
| 72 | 72 |
| 73 // Add extra in-memory elements to the top of the frame without generating | 73 // Add extra in-memory elements to the top of the frame without generating |
| 74 // code. | 74 // code. |
| 75 void Adjust(int count); | 75 void Adjust(int count); |
| 76 | 76 |
| 77 // Forget frame elements without generating code. | 77 // Forget frame elements without generating code. |
| 78 void Forget(int count); | 78 void Forget(int count); |
| 79 | 79 |
| 80 // Make this virtual frame have a state identical to an expected virtual | 80 // Make this virtual frame have a state identical to an expected virtual |
| (...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 165 static const int kLocal0Offset = JavaScriptFrameConstants::kLocal0Offset; | 165 static const int kLocal0Offset = JavaScriptFrameConstants::kLocal0Offset; |
| 166 static const int kFunctionOffset = JavaScriptFrameConstants::kFunctionOffset; | 166 static const int kFunctionOffset = JavaScriptFrameConstants::kFunctionOffset; |
| 167 static const int kContextOffset = StandardFrameConstants::kContextOffset; | 167 static const int kContextOffset = StandardFrameConstants::kContextOffset; |
| 168 | 168 |
| 169 static const int kHandlerSize = StackHandlerConstants::kSize / kPointerSize; | 169 static const int kHandlerSize = StackHandlerConstants::kSize / kPointerSize; |
| 170 | 170 |
| 171 MacroAssembler* masm_; | 171 MacroAssembler* masm_; |
| 172 | 172 |
| 173 List<Element> elements_; | 173 List<Element> elements_; |
| 174 | 174 |
| 175 // The virtual stack pointer is the index of the top element of the stack. | |
| 176 int virtual_stack_pointer_; | |
| 177 | |
| 178 int virtual_frame_pointer_; | |
| 179 | |
| 180 // The number of frame-allocated locals and parameters respectively. | 175 // The number of frame-allocated locals and parameters respectively. |
| 181 int parameter_count_; | 176 int parameter_count_; |
| 182 int local_count_; | 177 int local_count_; |
| 183 | 178 |
| 179 int frame_pointer_; |
| 180 |
| 184 // The index of the first parameter. The receiver lies below the first | 181 // The index of the first parameter. The receiver lies below the first |
| 185 // parameter. | 182 // parameter. |
| 186 int param0_index() const { return 1; } | 183 int param0_index() const { return 1; } |
| 187 | 184 |
| 188 // The index of the first local. Between the parameters and the locals | 185 // The index of the first local. Between the parameters and the locals |
| 189 // lie the return address, the saved frame pointer, the context, and the | 186 // lie the return address, the saved frame pointer, the context, and the |
| 190 // function. | 187 // function. |
| 191 int local0_index() const { return param0_index() + parameter_count_ + 4; } | 188 int local0_index() const { return param0_index() + parameter_count_ + 4; } |
| 192 | 189 |
| 193 // The index of the base of the expression stack. | 190 // The index of the base of the expression stack. |
| 194 int expression_base_index() const { return local0_index() + local_count_; } | 191 int expression_base_index() const { return local0_index() + local_count_; } |
| 195 | |
| 196 void AddElement(const Element& element) { | |
| 197 virtual_stack_pointer_++; | |
| 198 elements_.Add(element); | |
| 199 } | |
| 200 | |
| 201 Element RemoveElement() { | |
| 202 virtual_stack_pointer_--; | |
| 203 return elements_.RemoveLast(); | |
| 204 } | |
| 205 }; | 192 }; |
| 206 | 193 |
| 207 | 194 |
| 208 } } // namespace v8::internal | 195 } } // namespace v8::internal |
| 209 | 196 |
| 210 #endif // V8_VIRTUAL_FRAME_ARM_H_ | 197 #endif // V8_VIRTUAL_FRAME_ARM_H_ |
| OLD | NEW |