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

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

Issue 6716018: X64: Optimize access to external references. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Merge with tip of bleeding edge. Created 9 years, 9 months 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/x64/lithium-codegen-x64.cc ('k') | src/x64/macro-assembler-x64.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 2011 the V8 project authors. All rights reserved. 1 // Copyright 2011 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
69 scale(scale) {} 69 scale(scale) {}
70 Register reg; 70 Register reg;
71 ScaleFactor scale; 71 ScaleFactor scale;
72 }; 72 };
73 73
74 // MacroAssembler implements a collection of frequently used macros. 74 // MacroAssembler implements a collection of frequently used macros.
75 class MacroAssembler: public Assembler { 75 class MacroAssembler: public Assembler {
76 public: 76 public:
77 MacroAssembler(void* buffer, int size); 77 MacroAssembler(void* buffer, int size);
78 78
79 // Prevent the use of the RootArray during the lifetime of this
80 // scope object.
81 class NoRootArrayScope BASE_EMBEDDED {
82 public:
83 explicit NoRootArrayScope(MacroAssembler* assembler)
84 : variable_(&assembler->root_array_available_),
85 old_value_(assembler->root_array_available_) {
86 assembler->root_array_available_ = false;
87 }
88 ~NoRootArrayScope() {
89 *variable_ = old_value_;
90 }
91 private:
92 bool* variable_;
93 bool old_value_;
94 };
95
96 // Operand pointing to an external reference.
97 // May emit code to set up the scratch register. The operand is
98 // only guaranteed to be correct as long as the scratch register
99 // isn't changed.
100 // If the operand is used more than once, use a scratch register
101 // that is guaranteed not to be clobbered.
102 Operand ExternalOperand(ExternalReference reference,
103 Register scratch = kScratchRegister);
104 // Loads and stores the value of an external reference.
105 // Special case code for load and store to take advantage of
106 // load_rax/store_rax if possible/necessary.
107 // For other operations, just use:
108 // Operand operand = ExternalOperand(extref);
109 // operation(operand, ..);
110 void Load(Register destination, ExternalReference source);
111 void Store(ExternalReference destination, Register source);
112 // Loads the address of the external reference into the destination
113 // register.
114 void LoadAddress(Register destination, ExternalReference source);
115 // Returns the size of the code generated by LoadAddress.
116 // Used by CallSize(ExternalReference) to find the size of a call.
117 int LoadAddressSize(ExternalReference source);
118
119 // Operations on roots in the root-array.
79 void LoadRoot(Register destination, Heap::RootListIndex index); 120 void LoadRoot(Register destination, Heap::RootListIndex index);
121 void StoreRoot(Register source, Heap::RootListIndex index);
80 // Load a root value where the index (or part of it) is variable. 122 // Load a root value where the index (or part of it) is variable.
81 // The variable_offset register is added to the fixed_offset value 123 // The variable_offset register is added to the fixed_offset value
82 // to get the index into the root-array. 124 // to get the index into the root-array.
83 void LoadRootIndexed(Register destination, 125 void LoadRootIndexed(Register destination,
84 Register variable_offset, 126 Register variable_offset,
85 int fixed_offset); 127 int fixed_offset);
86 void CompareRoot(Register with, Heap::RootListIndex index); 128 void CompareRoot(Register with, Heap::RootListIndex index);
87 void CompareRoot(const Operand& with, Heap::RootListIndex index); 129 void CompareRoot(const Operand& with, Heap::RootListIndex index);
88 void PushRoot(Heap::RootListIndex index); 130 void PushRoot(Heap::RootListIndex index);
89 void StoreRoot(Register source, Heap::RootListIndex index);
90 131
91 // --------------------------------------------------------------------------- 132 // ---------------------------------------------------------------------------
92 // GC Support 133 // GC Support
93 134
94 // For page containing |object| mark region covering |addr| dirty. 135 // For page containing |object| mark region covering |addr| dirty.
95 // RecordWriteHelper only works if the object is not in new 136 // RecordWriteHelper only works if the object is not in new
96 // space. 137 // space.
97 void RecordWriteHelper(Register object, 138 void RecordWriteHelper(Register object,
98 Register addr, 139 Register addr,
99 Register scratch); 140 Register scratch);
(...skipping 527 matching lines...) Expand 10 before | Expand all | Expand 10 after
627 void Jump(Handle<Code> code_object, RelocInfo::Mode rmode); 668 void Jump(Handle<Code> code_object, RelocInfo::Mode rmode);
628 669
629 void Call(Address destination, RelocInfo::Mode rmode); 670 void Call(Address destination, RelocInfo::Mode rmode);
630 void Call(ExternalReference ext); 671 void Call(ExternalReference ext);
631 void Call(Handle<Code> code_object, RelocInfo::Mode rmode); 672 void Call(Handle<Code> code_object, RelocInfo::Mode rmode);
632 673
633 // The size of the code generated for different call instructions. 674 // The size of the code generated for different call instructions.
634 int CallSize(Address destination, RelocInfo::Mode rmode) { 675 int CallSize(Address destination, RelocInfo::Mode rmode) {
635 return kCallInstructionLength; 676 return kCallInstructionLength;
636 } 677 }
637 int CallSize(ExternalReference ext) { 678 int CallSize(ExternalReference ext);
638 return kCallInstructionLength;
639 }
640 int CallSize(Handle<Code> code_object) { 679 int CallSize(Handle<Code> code_object) {
641 // Code calls use 32-bit relative addressing. 680 // Code calls use 32-bit relative addressing.
642 return kShortCallInstructionLength; 681 return kShortCallInstructionLength;
643 } 682 }
644 int CallSize(Register target) { 683 int CallSize(Register target) {
645 // Opcode: REX_opt FF /2 m64 684 // Opcode: REX_opt FF /2 m64
646 return (target.high_bit() != 0) ? 3 : 2; 685 return (target.high_bit() != 0) ? 3 : 2;
647 } 686 }
648 int CallSize(const Operand& target) { 687 int CallSize(const Operand& target) {
649 // Opcode: REX_opt FF /2 m64 688 // Opcode: REX_opt FF /2 m64
(...skipping 367 matching lines...) Expand 10 before | Expand all | Expand 10 after
1017 bool allow_stub_calls() { return allow_stub_calls_; } 1056 bool allow_stub_calls() { return allow_stub_calls_; }
1018 1057
1019 private: 1058 private:
1020 // Order general registers are pushed by Pushad. 1059 // Order general registers are pushed by Pushad.
1021 // rax, rcx, rdx, rbx, rsi, rdi, r8, r9, r11, r14, r15. 1060 // rax, rcx, rdx, rbx, rsi, rdi, r8, r9, r11, r14, r15.
1022 static int kSafepointPushRegisterIndices[Register::kNumRegisters]; 1061 static int kSafepointPushRegisterIndices[Register::kNumRegisters];
1023 static const int kNumSafepointSavedRegisters = 11; 1062 static const int kNumSafepointSavedRegisters = 11;
1024 1063
1025 bool generating_stub_; 1064 bool generating_stub_;
1026 bool allow_stub_calls_; 1065 bool allow_stub_calls_;
1066 bool root_array_available_;
1027 1067
1028 // Returns a register holding the smi value. The register MUST NOT be 1068 // Returns a register holding the smi value. The register MUST NOT be
1029 // modified. It may be the "smi 1 constant" register. 1069 // modified. It may be the "smi 1 constant" register.
1030 Register GetSmiConstant(Smi* value); 1070 Register GetSmiConstant(Smi* value);
1031 1071
1032 // Moves the smi value to the destination register. 1072 // Moves the smi value to the destination register.
1033 void LoadSmiConstant(Register dst, Smi* value); 1073 void LoadSmiConstant(Register dst, Smi* value);
1034 1074
1035 // This handle will be patched with the code object on installation. 1075 // This handle will be patched with the code object on installation.
1036 Handle<Object> code_object_; 1076 Handle<Object> code_object_;
(...skipping 852 matching lines...) Expand 10 before | Expand all | Expand 10 after
1889 Jump(adaptor, RelocInfo::CODE_TARGET); 1929 Jump(adaptor, RelocInfo::CODE_TARGET);
1890 } 1930 }
1891 bind(&invoke); 1931 bind(&invoke);
1892 } 1932 }
1893 } 1933 }
1894 1934
1895 1935
1896 } } // namespace v8::internal 1936 } } // namespace v8::internal
1897 1937
1898 #endif // V8_X64_MACRO_ASSEMBLER_X64_H_ 1938 #endif // V8_X64_MACRO_ASSEMBLER_X64_H_
OLDNEW
« no previous file with comments | « src/x64/lithium-codegen-x64.cc ('k') | src/x64/macro-assembler-x64.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698