Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2080)

Side by Side Diff: src/ia32/macro-assembler-ia32.h

Issue 5188006: Push version 2.5.7 to trunk.... (Closed) Base URL: http://v8.googlecode.com/svn/trunk/
Patch Set: Created 10 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « src/ia32/full-codegen-ia32.cc ('k') | src/ia32/macro-assembler-ia32.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2006-2009 the V8 project authors. All rights reserved. 1 // Copyright 2006-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 105 matching lines...) Expand 10 before | Expand all | Expand 10 after
116 116
117 void EnterConstructFrame() { EnterFrame(StackFrame::CONSTRUCT); } 117 void EnterConstructFrame() { EnterFrame(StackFrame::CONSTRUCT); }
118 void LeaveConstructFrame() { LeaveFrame(StackFrame::CONSTRUCT); } 118 void LeaveConstructFrame() { LeaveFrame(StackFrame::CONSTRUCT); }
119 119
120 // Enter specific kind of exit frame; either in normal or debug mode. 120 // Enter specific kind of exit frame; either in normal or debug mode.
121 // Expects the number of arguments in register eax and 121 // Expects the number of arguments in register eax and
122 // sets up the number of arguments in register edi and the pointer 122 // sets up the number of arguments in register edi and the pointer
123 // to the first argument in register esi. 123 // to the first argument in register esi.
124 void EnterExitFrame(); 124 void EnterExitFrame();
125 125
126 void EnterApiExitFrame(int stack_space, int argc); 126 void EnterApiExitFrame(int argc);
127 127
128 // Leave the current exit frame. Expects the return value in 128 // Leave the current exit frame. Expects the return value in
129 // register eax:edx (untouched) and the pointer to the first 129 // register eax:edx (untouched) and the pointer to the first
130 // argument in register esi. 130 // argument in register esi.
131 void LeaveExitFrame(); 131 void LeaveExitFrame();
132 132
133 // Leave the current exit frame. Expects the return value in
134 // register eax (untouched).
135 void LeaveApiExitFrame();
136
133 // Find the function context up the context chain. 137 // Find the function context up the context chain.
134 void LoadContext(Register dst, int context_chain_length); 138 void LoadContext(Register dst, int context_chain_length);
135 139
136 // Load the global function with the given index. 140 // Load the global function with the given index.
137 void LoadGlobalFunction(int index, Register function); 141 void LoadGlobalFunction(int index, Register function);
138 142
139 // Load the initial map from the global function. The registers 143 // Load the initial map from the global function. The registers
140 // function and map can be the same. 144 // function and map can be the same.
141 void LoadGlobalFunctionInitialMap(Register function, Register map); 145 void LoadGlobalFunctionInitialMap(Register function, Register map);
142 146
(...skipping 310 matching lines...) Expand 10 before | Expand all | Expand 10 after
453 // Convenience function: call an external reference. 457 // Convenience function: call an external reference.
454 void CallExternalReference(ExternalReference ref, int num_arguments); 458 void CallExternalReference(ExternalReference ref, int num_arguments);
455 459
456 // Tail call of a runtime routine (jump). 460 // Tail call of a runtime routine (jump).
457 // Like JumpToExternalReference, but also takes care of passing the number 461 // Like JumpToExternalReference, but also takes care of passing the number
458 // of parameters. 462 // of parameters.
459 void TailCallExternalReference(const ExternalReference& ext, 463 void TailCallExternalReference(const ExternalReference& ext,
460 int num_arguments, 464 int num_arguments,
461 int result_size); 465 int result_size);
462 466
467 // Tail call of a runtime routine (jump). Try to generate the code if
468 // necessary. Do not perform a GC but instead return a retry after GC failure.
469 MUST_USE_RESULT MaybeObject* TryTailCallExternalReference(
470 const ExternalReference& ext, int num_arguments, int result_size);
471
463 // Convenience function: tail call a runtime routine (jump). 472 // Convenience function: tail call a runtime routine (jump).
464 void TailCallRuntime(Runtime::FunctionId fid, 473 void TailCallRuntime(Runtime::FunctionId fid,
465 int num_arguments, 474 int num_arguments,
466 int result_size); 475 int result_size);
467 476
477 // Convenience function: tail call a runtime routine (jump). Try to generate
478 // the code if necessary. Do not perform a GC but instead return a retry after
479 // GC failure.
480 MUST_USE_RESULT MaybeObject* TryTailCallRuntime(Runtime::FunctionId fid,
481 int num_arguments,
482 int result_size);
483
468 // Before calling a C-function from generated code, align arguments on stack. 484 // Before calling a C-function from generated code, align arguments on stack.
469 // After aligning the frame, arguments must be stored in esp[0], esp[4], 485 // After aligning the frame, arguments must be stored in esp[0], esp[4],
470 // etc., not pushed. The argument count assumes all arguments are word sized. 486 // etc., not pushed. The argument count assumes all arguments are word sized.
471 // Some compilers/platforms require the stack to be aligned when calling 487 // Some compilers/platforms require the stack to be aligned when calling
472 // C++ code. 488 // C++ code.
473 // Needs a scratch register to do some arithmetic. This register will be 489 // Needs a scratch register to do some arithmetic. This register will be
474 // trashed. 490 // trashed.
475 void PrepareCallCFunction(int num_arguments, Register scratch); 491 void PrepareCallCFunction(int num_arguments, Register scratch);
476 492
477 // Calls a C function and cleans up the space for arguments allocated 493 // Calls a C function and cleans up the space for arguments allocated
478 // by PrepareCallCFunction. The called function is not allowed to trigger a 494 // by PrepareCallCFunction. The called function is not allowed to trigger a
479 // garbage collection, since that might move the code and invalidate the 495 // garbage collection, since that might move the code and invalidate the
480 // return address (unless this is somehow accounted for by the called 496 // return address (unless this is somehow accounted for by the called
481 // function). 497 // function).
482 void CallCFunction(ExternalReference function, int num_arguments); 498 void CallCFunction(ExternalReference function, int num_arguments);
483 void CallCFunction(Register function, int num_arguments); 499 void CallCFunction(Register function, int num_arguments);
484 500
485 // Prepares stack to put arguments (aligns and so on). Reserves 501 // Prepares stack to put arguments (aligns and so on). Reserves
486 // space for return value if needed (assumes the return value is a handle). 502 // space for return value if needed (assumes the return value is a handle).
487 // Uses callee-saved esi to restore stack state after call. Arguments must be 503 // Uses callee-saved esi to restore stack state after call. Arguments must be
488 // stored in ApiParameterOperand(0), ApiParameterOperand(1) etc. 504 // stored in ApiParameterOperand(0), ApiParameterOperand(1) etc. Saves
489 void PrepareCallApiFunction(int stack_space, int argc); 505 // context (esi).
506 void PrepareCallApiFunction(int argc, Register scratch);
490 507
491 // Calls an API function. Allocates HandleScope, extracts 508 // Calls an API function. Allocates HandleScope, extracts
492 // returned value from handle and propagates exceptions. 509 // returned value from handle and propagates exceptions.
493 // Clobbers ebx, esi, edi and caller-save registers. 510 // Clobbers ebx, edi and caller-save registers. Restores context.
494 void CallApiFunctionAndReturn(ApiFunction* function, int argc); 511 // On return removes stack_space * kPointerSize (GCed).
512 MaybeObject* TryCallApiFunctionAndReturn(ApiFunction* function,
513 int stack_space);
495 514
496 // Jump to a runtime routine. 515 // Jump to a runtime routine.
497 void JumpToExternalReference(const ExternalReference& ext); 516 void JumpToExternalReference(const ExternalReference& ext);
498 517
518 MaybeObject* TryJumpToExternalReference(const ExternalReference& ext);
519
499 520
500 // --------------------------------------------------------------------------- 521 // ---------------------------------------------------------------------------
501 // Utilities 522 // Utilities
502 523
503 void Ret(); 524 void Ret();
504 525
505 // Emit code to discard a non-negative number of pointer-sized elements 526 // Emit code to discard a non-negative number of pointer-sized elements
506 // from the stack, clobbering only the esp register. 527 // from the stack, clobbering only the esp register.
507 void Drop(int element_count); 528 void Drop(int element_count);
508 529
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
582 Label* done, 603 Label* done,
583 InvokeFlag flag); 604 InvokeFlag flag);
584 605
585 // Activation support. 606 // Activation support.
586 void EnterFrame(StackFrame::Type type); 607 void EnterFrame(StackFrame::Type type);
587 void LeaveFrame(StackFrame::Type type); 608 void LeaveFrame(StackFrame::Type type);
588 609
589 void EnterExitFramePrologue(); 610 void EnterExitFramePrologue();
590 void EnterExitFrameEpilogue(int argc); 611 void EnterExitFrameEpilogue(int argc);
591 612
613 void LeaveExitFrameEpilogue();
614
592 // Allocation support helpers. 615 // Allocation support helpers.
593 void LoadAllocationTopHelper(Register result, 616 void LoadAllocationTopHelper(Register result,
594 Register result_end, 617 Register result_end,
595 Register scratch, 618 Register scratch,
596 AllocationFlags flags); 619 AllocationFlags flags);
597 void UpdateAllocationTopHelper(Register result_end, Register scratch); 620 void UpdateAllocationTopHelper(Register result_end, Register scratch);
598 621
599 // Helper for PopHandleScope. Allowed to perform a GC and returns 622 // Helper for PopHandleScope. Allowed to perform a GC and returns
600 // NULL if gc_allowed. Does not perform a GC if !gc_allowed, and 623 // NULL if gc_allowed. Does not perform a GC if !gc_allowed, and
601 // possibly returns a failure object indicating an allocation failure. 624 // possibly returns a failure object indicating an allocation failure.
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
635 658
636 659
637 // Generate an Operand for loading an indexed field from an object. 660 // Generate an Operand for loading an indexed field from an object.
638 static inline Operand FieldOperand(Register object, 661 static inline Operand FieldOperand(Register object,
639 Register index, 662 Register index,
640 ScaleFactor scale, 663 ScaleFactor scale,
641 int offset) { 664 int offset) {
642 return Operand(object, index, scale, offset - kHeapObjectTag); 665 return Operand(object, index, scale, offset - kHeapObjectTag);
643 } 666 }
644 667
668
669 static inline Operand ContextOperand(Register context, int index) {
670 return Operand(context, Context::SlotOffset(index));
671 }
672
673
674 static inline Operand GlobalObjectOperand() {
675 return ContextOperand(esi, Context::GLOBAL_INDEX);
676 }
677
678
645 // Generates an Operand for saving parameters after PrepareCallApiFunction. 679 // Generates an Operand for saving parameters after PrepareCallApiFunction.
646 Operand ApiParameterOperand(int index); 680 Operand ApiParameterOperand(int index);
647 681
648 682
649 #ifdef GENERATED_CODE_COVERAGE 683 #ifdef GENERATED_CODE_COVERAGE
650 extern void LogGeneratedCodeCoverage(const char* file_line); 684 extern void LogGeneratedCodeCoverage(const char* file_line);
651 #define CODE_COVERAGE_STRINGIFY(x) #x 685 #define CODE_COVERAGE_STRINGIFY(x) #x
652 #define CODE_COVERAGE_TOSTRING(x) CODE_COVERAGE_STRINGIFY(x) 686 #define CODE_COVERAGE_TOSTRING(x) CODE_COVERAGE_STRINGIFY(x)
653 #define __FILE_LINE__ __FILE__ ":" CODE_COVERAGE_TOSTRING(__LINE__) 687 #define __FILE_LINE__ __FILE__ ":" CODE_COVERAGE_TOSTRING(__LINE__)
654 #define ACCESS_MASM(masm) { \ 688 #define ACCESS_MASM(masm) { \
655 byte* ia32_coverage_function = \ 689 byte* ia32_coverage_function = \
656 reinterpret_cast<byte*>(FUNCTION_ADDR(LogGeneratedCodeCoverage)); \ 690 reinterpret_cast<byte*>(FUNCTION_ADDR(LogGeneratedCodeCoverage)); \
657 masm->pushfd(); \ 691 masm->pushfd(); \
658 masm->pushad(); \ 692 masm->pushad(); \
659 masm->push(Immediate(reinterpret_cast<int>(&__FILE_LINE__))); \ 693 masm->push(Immediate(reinterpret_cast<int>(&__FILE_LINE__))); \
660 masm->call(ia32_coverage_function, RelocInfo::RUNTIME_ENTRY); \ 694 masm->call(ia32_coverage_function, RelocInfo::RUNTIME_ENTRY); \
661 masm->pop(eax); \ 695 masm->pop(eax); \
662 masm->popad(); \ 696 masm->popad(); \
663 masm->popfd(); \ 697 masm->popfd(); \
664 } \ 698 } \
665 masm-> 699 masm->
666 #else 700 #else
667 #define ACCESS_MASM(masm) masm-> 701 #define ACCESS_MASM(masm) masm->
668 #endif 702 #endif
669 703
670 704
671 } } // namespace v8::internal 705 } } // namespace v8::internal
672 706
673 #endif // V8_IA32_MACRO_ASSEMBLER_IA32_H_ 707 #endif // V8_IA32_MACRO_ASSEMBLER_IA32_H_
OLDNEW
« no previous file with comments | « src/ia32/full-codegen-ia32.cc ('k') | src/ia32/macro-assembler-ia32.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698