| 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 244 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 255 // Random-access store to a frame-top relative frame element. The result | 255 // Random-access store to a frame-top relative frame element. The result |
| 256 // becomes owned by the frame and is invalidated. | 256 // becomes owned by the frame and is invalidated. |
| 257 void SetElementAt(int index, Result* value); | 257 void SetElementAt(int index, Result* value); |
| 258 | 258 |
| 259 // Set a frame element to a constant. The index is frame-top relative. | 259 // Set a frame element to a constant. The index is frame-top relative. |
| 260 void SetElementAt(int index, Handle<Object> value) { | 260 void SetElementAt(int index, Handle<Object> value) { |
| 261 Result temp(value, cgen_); | 261 Result temp(value, cgen_); |
| 262 SetElementAt(index, &temp); | 262 SetElementAt(index, &temp); |
| 263 } | 263 } |
| 264 | 264 |
| 265 void PushElementAt(int index) { |
| 266 LoadFrameSlotAt(elements_.length() - index - 1); |
| 267 } |
| 268 |
| 265 // A frame-allocated local as an assembly operand. | 269 // A frame-allocated local as an assembly operand. |
| 266 Operand LocalAt(int index) const { | 270 Operand LocalAt(int index) const { |
| 267 ASSERT(0 <= index); | 271 ASSERT(0 <= index); |
| 268 ASSERT(index < local_count_); | 272 ASSERT(index < local_count_); |
| 269 return Operand(ebp, kLocal0Offset - index * kPointerSize); | 273 return Operand(ebp, kLocal0Offset - index * kPointerSize); |
| 270 } | 274 } |
| 271 | 275 |
| 272 // Push a copy of the value of a local frame slot on top of the frame. | 276 // Push a copy of the value of a local frame slot on top of the frame. |
| 273 void LoadLocalAt(int index) { | 277 void LoadLocalAt(int index) { |
| 274 LoadFrameSlotAt(local0_index() + index); | 278 LoadFrameSlotAt(local0_index() + index); |
| (...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 347 // removed from) the top of the physical frame. | 351 // removed from) the top of the physical frame. |
| 348 Result CallRuntime(Runtime::Function* f, int frame_arg_count); | 352 Result CallRuntime(Runtime::Function* f, int frame_arg_count); |
| 349 Result CallRuntime(Runtime::FunctionId id, int frame_arg_count); | 353 Result CallRuntime(Runtime::FunctionId id, int frame_arg_count); |
| 350 | 354 |
| 351 // Invoke a builtin, given the number of arguments it expects on (and | 355 // Invoke a builtin, given the number of arguments it expects on (and |
| 352 // removes from) the top of the physical frame. | 356 // removes from) the top of the physical frame. |
| 353 Result InvokeBuiltin(Builtins::JavaScript id, | 357 Result InvokeBuiltin(Builtins::JavaScript id, |
| 354 InvokeFlag flag, | 358 InvokeFlag flag, |
| 355 int frame_arg_count); | 359 int frame_arg_count); |
| 356 | 360 |
| 357 // Call into a JS code object, given the number of arguments it expects on | 361 // Call into a JS code object, given the number of arguments it |
| 358 // (and removes from) the top of the physical frame. | 362 // removes from the top of the physical frame. |
| 363 // Register arguments are passed as results and consumed by the call. |
| 359 Result CallCodeObject(Handle<Code> ic, | 364 Result CallCodeObject(Handle<Code> ic, |
| 360 RelocInfo::Mode rmode, | 365 RelocInfo::Mode rmode, |
| 361 int frame_arg_count); | 366 int dropped_args); |
| 367 Result CallCodeObject(Handle<Code> ic, |
| 368 RelocInfo::Mode rmode, |
| 369 Result* arg, |
| 370 int dropped_args); |
| 371 Result CallCodeObject(Handle<Code> ic, |
| 372 RelocInfo::Mode rmode, |
| 373 Result* arg0, |
| 374 Result* arg1, |
| 375 int dropped_args); |
| 376 |
| 377 |
| 362 | 378 |
| 363 // Drop a number of elements from the top of the expression stack. May | 379 // Drop a number of elements from the top of the expression stack. May |
| 364 // emit code to affect the physical frame. Does not clobber any registers | 380 // emit code to affect the physical frame. Does not clobber any registers |
| 365 // excepting possibly the stack pointer. | 381 // excepting possibly the stack pointer. |
| 366 void Drop(int count); | 382 void Drop(int count); |
| 367 | 383 |
| 368 // Drop one element. | 384 // Drop one element. |
| 369 void Drop() { Drop(1); } | 385 void Drop() { Drop(1); } |
| 370 | 386 |
| 371 // Duplicate the top element of the frame. | 387 // Duplicate the top element of the frame. |
| (...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 503 void LoadFrameSlotAt(int index); | 519 void LoadFrameSlotAt(int index); |
| 504 | 520 |
| 505 // Push a the value of a frame slot (typically a local or parameter) on | 521 // Push a the value of a frame slot (typically a local or parameter) on |
| 506 // top of the frame and invalidate the slot. | 522 // top of the frame and invalidate the slot. |
| 507 void TakeFrameSlotAt(int index); | 523 void TakeFrameSlotAt(int index); |
| 508 | 524 |
| 509 // Store the value on top of the frame to a frame slot (typically a local | 525 // Store the value on top of the frame to a frame slot (typically a local |
| 510 // or parameter). | 526 // or parameter). |
| 511 void StoreToFrameSlotAt(int index); | 527 void StoreToFrameSlotAt(int index); |
| 512 | 528 |
| 513 // Spill the topmost elements of the frame to memory (eg, they are the | 529 // Spill all elements in registers. Spill the top spilled_args elements |
| 514 // arguments to a call) and all registers. | 530 // on the frame. Sync all other frame elements. |
| 515 void PrepareForCall(int count); | 531 // Then drop dropped_args elements from the virtual frame, to match |
| 532 // the effect of an upcoming call that will drop them from the stack. |
| 533 void PrepareForCall(int spilled_args, int dropped_args); |
| 516 | 534 |
| 517 // Move frame elements currently in registers or constants, that | 535 // Move frame elements currently in registers or constants, that |
| 518 // should be in memory in the expected frame, to memory. | 536 // should be in memory in the expected frame, to memory. |
| 519 void MergeMoveRegistersToMemory(VirtualFrame* expected); | 537 void MergeMoveRegistersToMemory(VirtualFrame* expected); |
| 520 | 538 |
| 521 // Make the register-to-register moves necessary to | 539 // Make the register-to-register moves necessary to |
| 522 // merge this frame with the expected frame. | 540 // merge this frame with the expected frame. |
| 523 // Register to memory moves must already have been made, | 541 // Register to memory moves must already have been made, |
| 524 // and memory to register moves must follow this call. | 542 // and memory to register moves must follow this call. |
| 525 // This is because some new memory-to-register moves are | 543 // This is because some new memory-to-register moves are |
| 526 // created in order to break cycles of register moves. | 544 // created in order to break cycles of register moves. |
| 527 // Used in the implementation of MergeTo(). | 545 // Used in the implementation of MergeTo(). |
| 528 void MergeMoveRegistersToRegisters(VirtualFrame* expected); | 546 void MergeMoveRegistersToRegisters(VirtualFrame* expected); |
| 529 | 547 |
| 530 // Make the memory-to-register and constant-to-register moves | 548 // Make the memory-to-register and constant-to-register moves |
| 531 // needed to make this frame equal the expected frame. | 549 // needed to make this frame equal the expected frame. |
| 532 // Called after all register-to-memory and register-to-register | 550 // Called after all register-to-memory and register-to-register |
| 533 // moves have been made. After this function returns, the frames | 551 // moves have been made. After this function returns, the frames |
| 534 // should be equal. | 552 // should be equal. |
| 535 void MergeMoveMemoryToRegisters(VirtualFrame* expected); | 553 void MergeMoveMemoryToRegisters(VirtualFrame* expected); |
| 554 |
| 555 // Calls a code object which takes spilled_args frame arguments |
| 556 // and which drops dropped_args of them. |
| 557 Result RawCallCodeObject(Handle<Code> code, |
| 558 RelocInfo::Mode rmode, |
| 559 int spilled_args, |
| 560 int dropped_args); |
| 536 }; | 561 }; |
| 537 | 562 |
| 538 | |
| 539 } } // namespace v8::internal | 563 } } // namespace v8::internal |
| 540 | 564 |
| 541 #endif // V8_VIRTUAL_FRAME_IA32_H_ | 565 #endif // V8_VIRTUAL_FRAME_IA32_H_ |
| OLD | NEW |