| 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 157 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 168 explicit VirtualFrame(CodeGenerator* cgen); | 168 explicit VirtualFrame(CodeGenerator* cgen); |
| 169 | 169 |
| 170 // Construct a virtual frame as a clone of an existing one. | 170 // Construct a virtual frame as a clone of an existing one. |
| 171 explicit VirtualFrame(VirtualFrame* original); | 171 explicit VirtualFrame(VirtualFrame* original); |
| 172 | 172 |
| 173 // The height of the virtual expression stack. | 173 // The height of the virtual expression stack. |
| 174 int height() const { | 174 int height() const { |
| 175 return elements_.length() - expression_base_index(); | 175 return elements_.length() - expression_base_index(); |
| 176 } | 176 } |
| 177 | 177 |
| 178 int register_count(Register reg) { |
| 179 return frame_registers_.count(reg); |
| 180 } |
| 181 |
| 178 // Add extra in-memory elements to the top of the frame to match an actual | 182 // Add extra in-memory elements to the top of the frame to match an actual |
| 179 // frame (eg, the frame after an exception handler is pushed). No code is | 183 // frame (eg, the frame after an exception handler is pushed). No code is |
| 180 // emitted. | 184 // emitted. |
| 181 void Adjust(int count); | 185 void Adjust(int count); |
| 182 | 186 |
| 183 // Forget elements from the top of the frame to match an actual frame (eg, | 187 // Forget elements from the top of the frame to match an actual frame (eg, |
| 184 // the frame after a runtime call). No code is emitted. | 188 // the frame after a runtime call). No code is emitted. |
| 185 void Forget(int count); | 189 void Forget(int count); |
| 186 | 190 |
| 187 // Spill all values from the frame to memory. | 191 // Spill all values from the frame to memory. |
| 188 void SpillAll(); | 192 void SpillAll(); |
| 189 | 193 |
| 190 // Spill a register if possible. Return the register spilled or no_reg if | 194 // Spill all occurrences of a specific register from the frame. |
| 191 // it was not possible to spill one. | 195 void Spill(Register reg); |
| 196 |
| 197 // Spill all occurrences of an arbitrary register if possible. Return the |
| 198 // register spilled or no_reg if it was not possible to free any register |
| 199 // (ie, they all have frame-external references). |
| 192 Register SpillAnyRegister(); | 200 Register SpillAnyRegister(); |
| 193 | 201 |
| 194 // True if an arbitrary frame of the same size could be merged to this | |
| 195 // one. Requires all values to be in a unique register or memory | |
| 196 // location. | |
| 197 bool IsMergable(); | |
| 198 | |
| 199 // True if making the frame mergable via MakeMergable will generate code. | 202 // True if making the frame mergable via MakeMergable will generate code. |
| 200 // This differs from !IsMergable() because there are some non-mergable | |
| 201 // frames that can be made mergable simply by changing internal state (eg, | |
| 202 // forgetting about constants that are synced to memory) without | |
| 203 // generating code. | |
| 204 bool RequiresMergeCode(); | 203 bool RequiresMergeCode(); |
| 205 | 204 |
| 206 // Ensure that this frame is in a state where an arbitrary frame of the | 205 // Ensure that this frame is in a state where an arbitrary frame of the |
| 207 // right size could be merged to it. May emit code. | 206 // right size could be merged to it. May emit code. |
| 208 void MakeMergable(); | 207 void MakeMergable(); |
| 209 | 208 |
| 210 // Make this virtual frame have a state identical to an expected virtual | 209 // Make this virtual frame have a state identical to an expected virtual |
| 211 // frame. As a side effect, code may be emitted to make this frame match | 210 // frame. As a side effect, code may be emitted to make this frame match |
| 212 // the expected one. | 211 // the expected one. |
| 213 void MergeTo(VirtualFrame* expected); | 212 void MergeTo(VirtualFrame* expected); |
| (...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 287 | 286 |
| 288 // The receiver frame slot. | 287 // The receiver frame slot. |
| 289 Operand Receiver() const { return ParameterAt(-1); } | 288 Operand Receiver() const { return ParameterAt(-1); } |
| 290 | 289 |
| 291 // Push a try-catch or try-finally handler on top of the virtual frame. | 290 // Push a try-catch or try-finally handler on top of the virtual frame. |
| 292 void PushTryHandler(HandlerType type); | 291 void PushTryHandler(HandlerType type); |
| 293 | 292 |
| 294 // Call a code stub, given the number of arguments it expects on (and | 293 // Call a code stub, given the number of arguments it expects on (and |
| 295 // removes from) the top of the physical frame. | 294 // removes from) the top of the physical frame. |
| 296 void CallStub(CodeStub* stub, int frame_arg_count); | 295 void CallStub(CodeStub* stub, int frame_arg_count); |
| 296 Result CallStub(CodeStub* stub, |
| 297 Result* arg0, |
| 298 Result* arg1, |
| 299 int frame_arg_count); |
| 297 | 300 |
| 298 // Call the runtime, given the number of arguments expected on (and | 301 // Call the runtime, given the number of arguments expected on (and |
| 299 // removed from) the top of the physical frame. | 302 // removed from) the top of the physical frame. |
| 300 void CallRuntime(Runtime::Function* f, int frame_arg_count); | 303 void CallRuntime(Runtime::Function* f, int frame_arg_count); |
| 301 void CallRuntime(Runtime::FunctionId id, int frame_arg_count); | 304 void CallRuntime(Runtime::FunctionId id, int frame_arg_count); |
| 302 | 305 |
| 303 // Invoke a builtin, given the number of arguments it expects on (and | 306 // Invoke a builtin, given the number of arguments it expects on (and |
| 304 // removes from) the top of the physical frame. | 307 // removes from) the top of the physical frame. |
| 305 void InvokeBuiltin(Builtins::JavaScript id, | 308 void InvokeBuiltin(Builtins::JavaScript id, |
| 306 InvokeFlag flag, | 309 InvokeFlag flag, |
| (...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 471 // Called after all register-to-memory and register-to-register | 474 // Called after all register-to-memory and register-to-register |
| 472 // moves have been made. After this function returns, the frames | 475 // moves have been made. After this function returns, the frames |
| 473 // should be equal. | 476 // should be equal. |
| 474 void MergeMoveMemoryToRegisters(VirtualFrame *expected); | 477 void MergeMoveMemoryToRegisters(VirtualFrame *expected); |
| 475 }; | 478 }; |
| 476 | 479 |
| 477 | 480 |
| 478 } } // namespace v8::internal | 481 } } // namespace v8::internal |
| 479 | 482 |
| 480 #endif // V8_VIRTUAL_FRAME_IA32_H_ | 483 #endif // V8_VIRTUAL_FRAME_IA32_H_ |
| OLD | NEW |