| 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 10 matching lines...) Expand all Loading... |
| 21 // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT | 21 // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT |
| 22 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | 22 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
| 23 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | 23 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
| 24 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 24 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
| 25 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 25 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
| 26 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 26 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 27 | 27 |
| 28 #ifndef V8_X64_VIRTUAL_FRAME_X64_H_ | 28 #ifndef V8_X64_VIRTUAL_FRAME_X64_H_ |
| 29 #define V8_X64_VIRTUAL_FRAME_X64_H_ | 29 #define V8_X64_VIRTUAL_FRAME_X64_H_ |
| 30 | 30 |
| 31 #include "number-info.h" |
| 31 #include "register-allocator.h" | 32 #include "register-allocator.h" |
| 32 #include "scopes.h" | 33 #include "scopes.h" |
| 33 | 34 |
| 34 namespace v8 { | 35 namespace v8 { |
| 35 namespace internal { | 36 namespace internal { |
| 36 | 37 |
| 37 // ------------------------------------------------------------------------- | 38 // ------------------------------------------------------------------------- |
| 38 // Virtual frames | 39 // Virtual frames |
| 39 // | 40 // |
| 40 // The virtual frame is an abstraction of the physical stack frame. It | 41 // The virtual frame is an abstraction of the physical stack frame. It |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 74 // Construct an initial virtual frame on entry to a JS function. | 75 // Construct an initial virtual frame on entry to a JS function. |
| 75 VirtualFrame(); | 76 VirtualFrame(); |
| 76 | 77 |
| 77 // Construct a virtual frame as a clone of an existing one. | 78 // Construct a virtual frame as a clone of an existing one. |
| 78 explicit VirtualFrame(VirtualFrame* original); | 79 explicit VirtualFrame(VirtualFrame* original); |
| 79 | 80 |
| 80 CodeGenerator* cgen() { return CodeGeneratorScope::Current(); } | 81 CodeGenerator* cgen() { return CodeGeneratorScope::Current(); } |
| 81 MacroAssembler* masm() { return cgen()->masm(); } | 82 MacroAssembler* masm() { return cgen()->masm(); } |
| 82 | 83 |
| 83 // Create a duplicate of an existing valid frame element. | 84 // Create a duplicate of an existing valid frame element. |
| 84 FrameElement CopyElementAt(int index); | 85 FrameElement CopyElementAt(int index, |
| 86 NumberInfo::Type info = NumberInfo::kUninitialized); |
| 85 | 87 |
| 86 // The number of elements on the virtual frame. | 88 // The number of elements on the virtual frame. |
| 87 int element_count() { return elements_.length(); } | 89 int element_count() { return elements_.length(); } |
| 88 | 90 |
| 89 // The height of the virtual expression stack. | 91 // The height of the virtual expression stack. |
| 90 int height() { | 92 int height() { |
| 91 return element_count() - expression_base_index(); | 93 return element_count() - expression_base_index(); |
| 92 } | 94 } |
| 93 | 95 |
| 94 int register_location(int num) { | 96 int register_location(int num) { |
| (...skipping 219 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 314 // eax (arg1, rax). The arguments are given as results which do not have | 316 // eax (arg1, rax). The arguments are given as results which do not have |
| 315 // to be in the proper registers or even in registers. The | 317 // to be in the proper registers or even in registers. The |
| 316 // arguments are consumed by the call. | 318 // arguments are consumed by the call. |
| 317 Result CallStub(CodeStub* stub, Result* arg0, Result* arg1); | 319 Result CallStub(CodeStub* stub, Result* arg0, Result* arg1); |
| 318 | 320 |
| 319 // Call runtime given the number of arguments expected on (and | 321 // Call runtime given the number of arguments expected on (and |
| 320 // removed from) the stack. | 322 // removed from) the stack. |
| 321 Result CallRuntime(Runtime::Function* f, int arg_count); | 323 Result CallRuntime(Runtime::Function* f, int arg_count); |
| 322 Result CallRuntime(Runtime::FunctionId id, int arg_count); | 324 Result CallRuntime(Runtime::FunctionId id, int arg_count); |
| 323 | 325 |
| 326 #ifdef ENABLE_DEBUGGER_SUPPORT |
| 327 void DebugBreak(); |
| 328 #endif |
| 329 |
| 324 // Invoke builtin given the number of arguments it expects on (and | 330 // Invoke builtin given the number of arguments it expects on (and |
| 325 // removes from) the stack. | 331 // removes from) the stack. |
| 326 Result InvokeBuiltin(Builtins::JavaScript id, | 332 Result InvokeBuiltin(Builtins::JavaScript id, |
| 327 InvokeFlag flag, | 333 InvokeFlag flag, |
| 328 int arg_count); | 334 int arg_count); |
| 329 | 335 |
| 330 // Call load IC. Name and receiver are found on top of the frame. | 336 // Call load IC. Name and receiver are found on top of the frame. |
| 331 // Receiver is not dropped. | 337 // Receiver is not dropped. |
| 332 Result CallLoadIC(RelocInfo::Mode mode); | 338 Result CallLoadIC(RelocInfo::Mode mode); |
| 333 | 339 |
| 334 // Call keyed load IC. Key and receiver are found on top of the | 340 // Call keyed load IC. Key and receiver are found on top of the |
| 335 // frame. They are not dropped. | 341 // frame. They are not dropped. |
| 336 Result CallKeyedLoadIC(RelocInfo::Mode mode); | 342 Result CallKeyedLoadIC(RelocInfo::Mode mode); |
| 337 | 343 |
| 338 // Call store IC. Name, value, and receiver are found on top of the | 344 // Call store IC. Name, value, and receiver are found on top of the |
| 339 // frame. Receiver is not dropped. | 345 // frame. Receiver is not dropped. |
| 340 Result CallStoreIC(); | 346 Result CallStoreIC(); |
| 341 | 347 |
| 342 // Call keyed store IC. Value, key, and receiver are found on top | 348 // Call keyed store IC. Value, key, and receiver are found on top |
| 343 // of the frame. Key and receiver are not dropped. | 349 // of the frame. Key and receiver are not dropped. |
| 344 Result CallKeyedStoreIC(); | 350 Result CallKeyedStoreIC(); |
| 345 | 351 |
| 346 // Call call IC. Arguments, receiver, and function name are found | 352 // Call call IC. Function name, arguments, and receiver are found on top |
| 347 // on top of the frame. Function name slot is not dropped. The | 353 // of the frame and dropped by the call. |
| 348 // argument count does not include the receiver. | 354 // The argument count does not include the receiver. |
| 349 Result CallCallIC(RelocInfo::Mode mode, int arg_count, int loop_nesting); | 355 Result CallCallIC(RelocInfo::Mode mode, int arg_count, int loop_nesting); |
| 350 | 356 |
| 351 // Allocate and call JS function as constructor. Arguments, | 357 // Allocate and call JS function as constructor. Arguments, |
| 352 // receiver (global object), and function are found on top of the | 358 // receiver (global object), and function are found on top of the |
| 353 // frame. Function is not dropped. The argument count does not | 359 // frame. Function is not dropped. The argument count does not |
| 354 // include the receiver. | 360 // include the receiver. |
| 355 Result CallConstructor(int arg_count); | 361 Result CallConstructor(int arg_count); |
| 356 | 362 |
| 357 // Drop a number of elements from the top of the expression stack. May | 363 // Drop a number of elements from the top of the expression stack. May |
| 358 // emit code to affect the physical frame. Does not clobber any registers | 364 // emit code to affect the physical frame. Does not clobber any registers |
| (...skipping 10 matching lines...) Expand all Loading... |
| 369 // Result, which may be a constant or a register. | 375 // Result, which may be a constant or a register. |
| 370 Result Pop(); | 376 Result Pop(); |
| 371 | 377 |
| 372 // Pop and save an element from the top of the expression stack and | 378 // Pop and save an element from the top of the expression stack and |
| 373 // emit a corresponding pop instruction. | 379 // emit a corresponding pop instruction. |
| 374 void EmitPop(Register reg); | 380 void EmitPop(Register reg); |
| 375 void EmitPop(const Operand& operand); | 381 void EmitPop(const Operand& operand); |
| 376 | 382 |
| 377 // Push an element on top of the expression stack and emit a | 383 // Push an element on top of the expression stack and emit a |
| 378 // corresponding push instruction. | 384 // corresponding push instruction. |
| 379 void EmitPush(Register reg); | 385 void EmitPush(Register reg, |
| 380 void EmitPush(const Operand& operand); | 386 NumberInfo::Type info = NumberInfo::kUnknown); |
| 381 void EmitPush(Heap::RootListIndex index); | 387 void EmitPush(const Operand& operand, |
| 382 void EmitPush(Immediate immediate); | 388 NumberInfo::Type info = NumberInfo::kUnknown); |
| 389 void EmitPush(Heap::RootListIndex index, |
| 390 NumberInfo::Type info = NumberInfo::kUnknown); |
| 391 void EmitPush(Immediate immediate, |
| 392 NumberInfo::Type info = NumberInfo::kUnknown); |
| 383 void EmitPush(Smi* value); | 393 void EmitPush(Smi* value); |
| 384 // Uses kScratchRegister, emits appropriate relocation info. | 394 // Uses kScratchRegister, emits appropriate relocation info. |
| 385 void EmitPush(Handle<Object> value); | 395 void EmitPush(Handle<Object> value); |
| 386 | 396 |
| 387 // Push an element on the virtual frame. | 397 // Push an element on the virtual frame. |
| 388 void Push(Register reg); | 398 void Push(Register reg, NumberInfo::Type info = NumberInfo::kUnknown); |
| 389 void Push(Handle<Object> value); | 399 void Push(Handle<Object> value); |
| 390 void Push(Smi* value) { Push(Handle<Object>(value)); } | 400 void Push(Smi* value) { Push(Handle<Object>(value)); } |
| 391 | 401 |
| 392 // Pushing a result invalidates it (its contents become owned by the | 402 // Pushing a result invalidates it (its contents become owned by the |
| 393 // frame). | 403 // frame). |
| 394 void Push(Result* result) { | 404 void Push(Result* result) { |
| 395 if (result->is_register()) { | 405 if (result->is_register()) { |
| 396 Push(result->reg()); | 406 Push(result->reg(), result->number_info()); |
| 397 } else { | 407 } else { |
| 398 ASSERT(result->is_constant()); | 408 ASSERT(result->is_constant()); |
| 399 Push(result->handle()); | 409 Push(result->handle()); |
| 400 } | 410 } |
| 401 result->Unuse(); | 411 result->Unuse(); |
| 402 } | 412 } |
| 403 | 413 |
| 404 // Nip removes zero or more elements from immediately below the top | 414 // Nip removes zero or more elements from immediately below the top |
| 405 // of the frame, leaving the previous top-of-frame value on top of | 415 // of the frame, leaving the previous top-of-frame value on top of |
| 406 // the frame. Nip(k) is equivalent to x = Pop(), Drop(k), Push(x). | 416 // the frame. Nip(k) is equivalent to x = Pop(), Drop(k), Push(x). |
| (...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 551 | 561 |
| 552 // Classes that need raw access to the elements_ array. | 562 // Classes that need raw access to the elements_ array. |
| 553 friend class DeferredCode; | 563 friend class DeferredCode; |
| 554 friend class JumpTarget; | 564 friend class JumpTarget; |
| 555 }; | 565 }; |
| 556 | 566 |
| 557 | 567 |
| 558 } } // namespace v8::internal | 568 } } // namespace v8::internal |
| 559 | 569 |
| 560 #endif // V8_X64_VIRTUAL_FRAME_X64_H_ | 570 #endif // V8_X64_VIRTUAL_FRAME_X64_H_ |
| OLD | NEW |