| 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 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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 // The height of the virtual expression stack. | 69 // The height of the virtual expression stack. |
| 70 int height() const { | 70 int height() const { |
| 71 return virtual_stack_pointer_ - expression_base_index() + 1; | 71 return elements_.length() - expression_base_index(); |
| 72 } | 72 } |
| 73 | 73 |
| 74 // Add extra in-memory elements to the top of the frame without generating | 74 // Add extra in-memory elements to the top of the frame without generating |
| 75 // code. | 75 // code. |
| 76 void Adjust(int count); | 76 void Adjust(int count); |
| 77 | 77 |
| 78 // Forget frame elements without generating code. | 78 // Forget frame elements without generating code. |
| 79 void Forget(int count); | 79 void Forget(int count); |
| 80 | 80 |
| 81 // Make this virtual frame have a state identical to an expected virtual | 81 // Make this virtual frame have a state identical to an expected virtual |
| (...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 172 static const int kLocal0Offset = JavaScriptFrameConstants::kLocal0Offset; | 172 static const int kLocal0Offset = JavaScriptFrameConstants::kLocal0Offset; |
| 173 static const int kFunctionOffset = JavaScriptFrameConstants::kFunctionOffset; | 173 static const int kFunctionOffset = JavaScriptFrameConstants::kFunctionOffset; |
| 174 static const int kContextOffset = StandardFrameConstants::kContextOffset; | 174 static const int kContextOffset = StandardFrameConstants::kContextOffset; |
| 175 | 175 |
| 176 static const int kHandlerSize = StackHandlerConstants::kSize / kPointerSize; | 176 static const int kHandlerSize = StackHandlerConstants::kSize / kPointerSize; |
| 177 | 177 |
| 178 MacroAssembler* masm_; | 178 MacroAssembler* masm_; |
| 179 | 179 |
| 180 List<Element> elements_; | 180 List<Element> elements_; |
| 181 | 181 |
| 182 // The virtual stack pointer is the index of the top element of the stack. | |
| 183 int virtual_stack_pointer_; | |
| 184 | |
| 185 int virtual_frame_pointer_; | |
| 186 | |
| 187 int parameter_count_; | 182 int parameter_count_; |
| 188 int local_count_; | 183 int local_count_; |
| 189 | 184 |
| 185 int frame_pointer_; |
| 186 |
| 190 // The index of the first parameter. The receiver lies below the first | 187 // The index of the first parameter. The receiver lies below the first |
| 191 // parameter. | 188 // parameter. |
| 192 int param0_index() const { return 1; } | 189 int param0_index() const { return 1; } |
| 193 | 190 |
| 194 // The index of the first local. Between the parameters and the locals | 191 // The index of the first local. Between the parameters and the locals |
| 195 // lie the return address, the saved frame pointer, the context, and the | 192 // lie the return address, the saved frame pointer, the context, and the |
| 196 // function. | 193 // function. |
| 197 int local0_index() const { return param0_index() + parameter_count_ + 4; } | 194 int local0_index() const { return param0_index() + parameter_count_ + 4; } |
| 198 | 195 |
| 199 // The index of the base of the expression stack. | 196 // The index of the base of the expression stack. |
| 200 int expression_base_index() const { return local0_index() + local_count_; } | 197 int expression_base_index() const { return local0_index() + local_count_; } |
| 201 | |
| 202 void AddElement(const Element& element) { | |
| 203 virtual_stack_pointer_++; | |
| 204 elements_.Add(element); | |
| 205 } | |
| 206 | |
| 207 Element RemoveElement() { | |
| 208 virtual_stack_pointer_--; | |
| 209 return elements_.RemoveLast(); | |
| 210 } | |
| 211 }; | 198 }; |
| 212 | 199 |
| 213 | 200 |
| 214 } } // namespace v8::internal | 201 } } // namespace v8::internal |
| 215 | 202 |
| 216 #endif // V8_VIRTUAL_FRAME_IA32_H_ | 203 #endif // V8_VIRTUAL_FRAME_IA32_H_ |
| OLD | NEW |