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 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
69 explicit VirtualFrame(VirtualFrame* original); | 69 explicit VirtualFrame(VirtualFrame* original); |
70 | 70 |
71 // Create a duplicate of an existing valid frame element. | 71 // Create a duplicate of an existing valid frame element. |
72 FrameElement CopyElementAt(int index); | 72 FrameElement CopyElementAt(int index); |
73 | 73 |
74 // The height of the virtual expression stack. | 74 // The height of the virtual expression stack. |
75 int height() const { | 75 int height() const { |
76 return elements_.length() - expression_base_index(); | 76 return elements_.length() - expression_base_index(); |
77 } | 77 } |
78 | 78 |
79 int register_count(Register reg) { | 79 int register_index(Register reg) { |
80 return frame_registers_.count(reg); | 80 return register_locations_[reg.code()]; |
| 81 } |
| 82 |
| 83 bool is_used(int reg_code) { |
| 84 return register_locations_[reg_code] != kIllegalIndex; |
| 85 } |
| 86 |
| 87 bool is_used(Register reg) { |
| 88 return is_used(reg.code()); |
81 } | 89 } |
82 | 90 |
83 // Add extra in-memory elements to the top of the frame to match an actual | 91 // Add extra in-memory elements to the top of the frame to match an actual |
84 // frame (eg, the frame after an exception handler is pushed). No code is | 92 // frame (eg, the frame after an exception handler is pushed). No code is |
85 // emitted. | 93 // emitted. |
86 void Adjust(int count); | 94 void Adjust(int count); |
87 | 95 |
88 // Forget count elements from the top of the frame all in-memory | 96 // Forget count elements from the top of the frame all in-memory |
89 // (including synced) and adjust the stack pointer downward, to | 97 // (including synced) and adjust the stack pointer downward, to |
90 // match an external frame effect (examples include a call removing | 98 // match an external frame effect (examples include a call removing |
(...skipping 235 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
326 int local_count_; | 334 int local_count_; |
327 | 335 |
328 // The index of the element that is at the processor's stack pointer | 336 // The index of the element that is at the processor's stack pointer |
329 // (the esp register). | 337 // (the esp register). |
330 int stack_pointer_; | 338 int stack_pointer_; |
331 | 339 |
332 // The index of the element that is at the processor's frame pointer | 340 // The index of the element that is at the processor's frame pointer |
333 // (the ebp register). | 341 // (the ebp register). |
334 int frame_pointer_; | 342 int frame_pointer_; |
335 | 343 |
336 // The frame has an embedded register file that it uses to track registers | |
337 // used in the frame. | |
338 RegisterFile frame_registers_; | |
339 | |
340 // The index of the register frame element using each register, or | 344 // The index of the register frame element using each register, or |
341 // kIllegalIndex if a register is not on the frame. | 345 // kIllegalIndex if a register is not on the frame. |
342 int register_locations_[kNumRegisters]; | 346 int register_locations_[kNumRegisters]; |
343 | 347 |
344 // The index of the first parameter. The receiver lies below the first | 348 // The index of the first parameter. The receiver lies below the first |
345 // parameter. | 349 // parameter. |
346 int param0_index() const { return 1; } | 350 int param0_index() const { return 1; } |
347 | 351 |
348 // The index of the context slot in the frame. | 352 // The index of the context slot in the frame. |
349 int context_index() const { | 353 int context_index() const { |
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
456 Result RawCallCodeObject(Handle<Code> code, RelocInfo::Mode rmode); | 460 Result RawCallCodeObject(Handle<Code> code, RelocInfo::Mode rmode); |
457 | 461 |
458 bool Equals(VirtualFrame* other); | 462 bool Equals(VirtualFrame* other); |
459 | 463 |
460 friend class JumpTarget; | 464 friend class JumpTarget; |
461 }; | 465 }; |
462 | 466 |
463 } } // namespace v8::internal | 467 } } // namespace v8::internal |
464 | 468 |
465 #endif // V8_VIRTUAL_FRAME_IA32_H_ | 469 #endif // V8_VIRTUAL_FRAME_IA32_H_ |
OLD | NEW |