OLD | NEW |
1 // Copyright 2009 the V8 project authors. All rights reserved. | 1 // Copyright 2009 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 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
138 // Spill all occurrences of a specific register from the frame. | 138 // Spill all occurrences of a specific register from the frame. |
139 void Spill(Register reg) { | 139 void Spill(Register reg) { |
140 if (is_used(reg)) SpillElementAt(register_location(reg)); | 140 if (is_used(reg)) SpillElementAt(register_location(reg)); |
141 } | 141 } |
142 | 142 |
143 // Spill all occurrences of an arbitrary register if possible. Return the | 143 // Spill all occurrences of an arbitrary register if possible. Return the |
144 // register spilled or no_reg if it was not possible to free any register | 144 // register spilled or no_reg if it was not possible to free any register |
145 // (ie, they all have frame-external references). | 145 // (ie, they all have frame-external references). |
146 Register SpillAnyRegister(); | 146 Register SpillAnyRegister(); |
147 | 147 |
| 148 // Spill the top element of the frame to memory. |
| 149 void SpillTop() { SpillElementAt(element_count() - 1); } |
| 150 |
148 // Sync the range of elements in [begin, end] with memory. | 151 // Sync the range of elements in [begin, end] with memory. |
149 void SyncRange(int begin, int end); | 152 void SyncRange(int begin, int end); |
150 | 153 |
151 // Make this frame so that an arbitrary frame of the same height can | 154 // Make this frame so that an arbitrary frame of the same height can |
152 // be merged to it. Copies and constants are removed from the frame. | 155 // be merged to it. Copies and constants are removed from the frame. |
153 void MakeMergable(); | 156 void MakeMergable(); |
154 | 157 |
155 // Prepare this virtual frame for merging to an expected frame by | 158 // Prepare this virtual frame for merging to an expected frame by |
156 // performing some state changes that do not require generating | 159 // performing some state changes that do not require generating |
157 // code. It is guaranteed that no code will be generated. | 160 // code. It is guaranteed that no code will be generated. |
(...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
326 int arg_count); | 329 int arg_count); |
327 | 330 |
328 // Call load IC. Name and receiver are found on top of the frame. | 331 // Call load IC. Name and receiver are found on top of the frame. |
329 // Receiver is not dropped. | 332 // Receiver is not dropped. |
330 Result CallLoadIC(RelocInfo::Mode mode); | 333 Result CallLoadIC(RelocInfo::Mode mode); |
331 | 334 |
332 // Call keyed load IC. Key and receiver are found on top of the | 335 // Call keyed load IC. Key and receiver are found on top of the |
333 // frame. They are not dropped. | 336 // frame. They are not dropped. |
334 Result CallKeyedLoadIC(RelocInfo::Mode mode); | 337 Result CallKeyedLoadIC(RelocInfo::Mode mode); |
335 | 338 |
336 // Call store IC. Name, value, and receiver are found on top of the | 339 |
337 // frame. Receiver is not dropped. | 340 // Calling a store IC and a keyed store IC differ only by which ic is called |
338 Result CallStoreIC(); | 341 // and by the order of the three arguments on the frame. |
| 342 Result CallCommonStoreIC(Handle<Code> ic, |
| 343 Result* value, |
| 344 Result *key, |
| 345 Result* receiver); |
| 346 |
| 347 // Call store IC. Name, value, and receiver are found on top |
| 348 // of the frame. All are dropped. |
| 349 Result CallStoreIC() { |
| 350 Handle<Code> ic(Builtins::builtin(Builtins::StoreIC_Initialize)); |
| 351 Result name = Pop(); |
| 352 Result value = Pop(); |
| 353 Result receiver = Pop(); |
| 354 return CallCommonStoreIC(ic, &value, &name, &receiver); |
| 355 } |
339 | 356 |
340 // Call keyed store IC. Value, key, and receiver are found on top | 357 // Call keyed store IC. Value, key, and receiver are found on top |
341 // of the frame. Key and receiver are not dropped. | 358 // of the frame. All are dropped. |
342 Result CallKeyedStoreIC(); | 359 Result CallKeyedStoreIC() { |
| 360 Handle<Code> ic(Builtins::builtin(Builtins::KeyedStoreIC_Initialize)); |
| 361 Result value = Pop(); |
| 362 Result key = Pop(); |
| 363 Result receiver = Pop(); |
| 364 return CallCommonStoreIC(ic, &value, &key, &receiver); |
| 365 } |
343 | 366 |
344 // Call call IC. Function name, arguments, and receiver are found on top | 367 // Call call IC. Function name, arguments, and receiver are found on top |
345 // of the frame and dropped by the call. | 368 // of the frame and dropped by the call. |
346 // The argument count does not include the receiver. | 369 // The argument count does not include the receiver. |
347 Result CallCallIC(RelocInfo::Mode mode, int arg_count, int loop_nesting); | 370 Result CallCallIC(RelocInfo::Mode mode, int arg_count, int loop_nesting); |
348 | 371 |
349 // Allocate and call JS function as constructor. Arguments, | 372 // Allocate and call JS function as constructor. Arguments, |
350 // receiver (global object), and function are found on top of the | 373 // receiver (global object), and function are found on top of the |
351 // frame. Function is not dropped. The argument count does not | 374 // frame. Function is not dropped. The argument count does not |
352 // include the receiver. | 375 // include the receiver. |
(...skipping 188 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
541 // should be equal. | 564 // should be equal. |
542 void MergeMoveMemoryToRegisters(VirtualFrame* expected); | 565 void MergeMoveMemoryToRegisters(VirtualFrame* expected); |
543 | 566 |
544 // Invalidates a frame slot (puts an invalid frame element in it). | 567 // Invalidates a frame slot (puts an invalid frame element in it). |
545 // Copies on the frame are correctly handled, and if this slot was | 568 // Copies on the frame are correctly handled, and if this slot was |
546 // the backing store of copies, the index of the new backing store | 569 // the backing store of copies, the index of the new backing store |
547 // is returned. Otherwise, returns kIllegalIndex. | 570 // is returned. Otherwise, returns kIllegalIndex. |
548 // Register counts are correctly updated. | 571 // Register counts are correctly updated. |
549 int InvalidateFrameSlotAt(int index); | 572 int InvalidateFrameSlotAt(int index); |
550 | 573 |
| 574 // This function assumes that a and b are the only results that could be in |
| 575 // the registers a_reg or b_reg. Other results can be live, but must not |
| 576 // be in the registers a_reg or b_reg. The results a and b are invalidated. |
| 577 void MoveResultsToRegisters(Result* a, |
| 578 Result* b, |
| 579 Register a_reg, |
| 580 Register b_reg); |
| 581 |
551 // Call a code stub that has already been prepared for calling (via | 582 // Call a code stub that has already been prepared for calling (via |
552 // PrepareForCall). | 583 // PrepareForCall). |
553 Result RawCallStub(CodeStub* stub); | 584 Result RawCallStub(CodeStub* stub); |
554 | 585 |
555 // Calls a code object which has already been prepared for calling | 586 // Calls a code object which has already been prepared for calling |
556 // (via PrepareForCall). | 587 // (via PrepareForCall). |
557 Result RawCallCodeObject(Handle<Code> code, RelocInfo::Mode rmode); | 588 Result RawCallCodeObject(Handle<Code> code, RelocInfo::Mode rmode); |
558 | 589 |
559 inline bool Equals(VirtualFrame* other); | 590 inline bool Equals(VirtualFrame* other); |
560 | 591 |
561 // Classes that need raw access to the elements_ array. | 592 // Classes that need raw access to the elements_ array. |
562 friend class DeferredCode; | 593 friend class DeferredCode; |
563 friend class JumpTarget; | 594 friend class JumpTarget; |
564 }; | 595 }; |
565 | 596 |
566 | 597 |
567 } } // namespace v8::internal | 598 } } // namespace v8::internal |
568 | 599 |
569 #endif // V8_X64_VIRTUAL_FRAME_X64_H_ | 600 #endif // V8_X64_VIRTUAL_FRAME_X64_H_ |
OLD | NEW |