blob: 44573f34fae2efecec835d435716906aadf19776 [file] [log] [blame]
ager@chromium.orga1645e22009-09-09 19:27:10 +00001// Copyright 2009 the V8 project authors. All rights reserved.
ager@chromium.org5ec48922009-05-05 07:25:34 +00002// Redistribution and use in source and binary forms, with or without
3// modification, are permitted provided that the following conditions are
4// met:
5//
6// * Redistributions of source code must retain the above copyright
7// notice, this list of conditions and the following disclaimer.
8// * Redistributions in binary form must reproduce the above
9// copyright notice, this list of conditions and the following
10// disclaimer in the documentation and/or other materials provided
11// with the distribution.
12// * Neither the name of Google Inc. nor the names of its
13// contributors may be used to endorse or promote products derived
14// from this software without specific prior written permission.
15//
16// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
17// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
18// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
19// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
20// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
21// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
22// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
23// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
24// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
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.
27
ager@chromium.org9085a012009-05-11 19:22:57 +000028#ifndef V8_X64_MACRO_ASSEMBLER_X64_H_
29#define V8_X64_MACRO_ASSEMBLER_X64_H_
30
31#include "assembler.h"
32
kasperl@chromium.org71affb52009-05-26 05:44:31 +000033namespace v8 {
34namespace internal {
ager@chromium.org9085a012009-05-11 19:22:57 +000035
sgjesse@chromium.org720dc0b2010-05-10 09:25:39 +000036// Flags used for the AllocateInNewSpace functions.
37enum AllocationFlags {
38 // No special flags.
39 NO_ALLOCATION_FLAGS = 0,
40 // Return the pointer to the allocated already tagged as a heap object.
41 TAG_OBJECT = 1 << 0,
42 // The content of the result register already contains the allocation top in
43 // new space.
44 RESULT_CONTAINS_TOP = 1 << 1
45};
46
ager@chromium.orge2902be2009-06-08 12:21:35 +000047// Default scratch register used by MacroAssembler (and other code that needs
48// a spare register). The register isn't callee save, and not used by the
49// function calling convention.
fschneider@chromium.orgb95b98b2010-02-23 10:34:29 +000050static const Register kScratchRegister = { 10 }; // r10.
whesse@chromium.orgb6e43bb2010-04-14 09:36:28 +000051static const Register kRootRegister = { 13 }; // r13
ager@chromium.orge2902be2009-06-08 12:21:35 +000052
fschneider@chromium.org0c20e672010-01-14 15:28:53 +000053// Convenience for platform-independent signatures.
54typedef Operand MemOperand;
55
ager@chromium.org9085a012009-05-11 19:22:57 +000056// Forward declaration.
57class JumpTarget;
58
ager@chromium.org4af710e2009-09-15 12:20:11 +000059struct SmiIndex {
60 SmiIndex(Register index_register, ScaleFactor scale)
61 : reg(index_register),
62 scale(scale) {}
63 Register reg;
64 ScaleFactor scale;
65};
ager@chromium.org9085a012009-05-11 19:22:57 +000066
ager@chromium.org9085a012009-05-11 19:22:57 +000067// MacroAssembler implements a collection of frequently used macros.
68class MacroAssembler: public Assembler {
69 public:
70 MacroAssembler(void* buffer, int size);
71
ager@chromium.org18ad94b2009-09-02 08:22:29 +000072 void LoadRoot(Register destination, Heap::RootListIndex index);
73 void CompareRoot(Register with, Heap::RootListIndex index);
sgjesse@chromium.orgc5145742009-10-07 09:00:33 +000074 void CompareRoot(Operand with, Heap::RootListIndex index);
ager@chromium.org18ad94b2009-09-02 08:22:29 +000075 void PushRoot(Heap::RootListIndex index);
sgjesse@chromium.org720dc0b2010-05-10 09:25:39 +000076 void StoreRoot(Register source, Heap::RootListIndex index);
ager@chromium.org18ad94b2009-09-02 08:22:29 +000077
ager@chromium.org9085a012009-05-11 19:22:57 +000078 // ---------------------------------------------------------------------------
79 // GC Support
80
ricow@chromium.org30ce4112010-05-31 10:38:25 +000081 // For page containing |object| mark region covering |addr| dirty.
82 // RecordWriteHelper only works if the object is not in new
ager@chromium.orgac091b72010-05-05 07:34:42 +000083 // space.
84 void RecordWriteHelper(Register object,
85 Register addr,
86 Register scratch);
87
kmillikin@chromium.org4111b802010-05-03 10:34:42 +000088 // Check if object is in new space. The condition cc can be equal or
89 // not_equal. If it is equal a jump will be done if the object is on new
90 // space. The register scratch can be object itself, but it will be clobbered.
91 void InNewSpace(Register object,
92 Register scratch,
93 Condition cc,
94 Label* branch);
95
ricow@chromium.org30ce4112010-05-31 10:38:25 +000096 // For page containing |object| mark region covering [object+offset] dirty.
ager@chromium.org9085a012009-05-11 19:22:57 +000097 // object is the object being stored into, value is the object being stored.
98 // If offset is zero, then the scratch register contains the array index into
99 // the elements array represented as a Smi.
100 // All registers are clobbered by the operation.
101 void RecordWrite(Register object,
102 int offset,
103 Register value,
104 Register scratch);
105
ricow@chromium.org30ce4112010-05-31 10:38:25 +0000106 // For page containing |object| mark region covering [object+offset] dirty.
christian.plesner.hansen@gmail.com9d58c2b2009-10-16 11:48:38 +0000107 // The value is known to not be a smi.
108 // object is the object being stored into, value is the object being stored.
109 // If offset is zero, then the scratch register contains the array index into
110 // the elements array represented as a Smi.
111 // All registers are clobbered by the operation.
112 void RecordWriteNonSmi(Register object,
113 int offset,
114 Register value,
115 Register scratch);
116
ager@chromium.org9085a012009-05-11 19:22:57 +0000117#ifdef ENABLE_DEBUGGER_SUPPORT
118 // ---------------------------------------------------------------------------
119 // Debugger Support
120
121 void SaveRegistersToMemory(RegList regs);
122 void RestoreRegistersFromMemory(RegList regs);
123 void PushRegistersFromMemory(RegList regs);
124 void PopRegistersToMemory(RegList regs);
125 void CopyRegistersFromStackToMemory(Register base,
126 Register scratch,
127 RegList regs);
ager@chromium.org5c838252010-02-19 08:53:10 +0000128 void DebugBreak();
ager@chromium.org9085a012009-05-11 19:22:57 +0000129#endif
130
131 // ---------------------------------------------------------------------------
sgjesse@chromium.orgac6aa172009-12-04 12:29:05 +0000132 // Stack limit support
133
134 // Do simple test for stack overflow. This doesn't handle an overflow.
135 void StackLimitCheck(Label* on_stack_limit_hit);
136
137 // ---------------------------------------------------------------------------
ager@chromium.org9085a012009-05-11 19:22:57 +0000138 // Activation frames
139
140 void EnterInternalFrame() { EnterFrame(StackFrame::INTERNAL); }
141 void LeaveInternalFrame() { LeaveFrame(StackFrame::INTERNAL); }
142
143 void EnterConstructFrame() { EnterFrame(StackFrame::CONSTRUCT); }
144 void LeaveConstructFrame() { LeaveFrame(StackFrame::CONSTRUCT); }
145
ager@chromium.orgc4c92722009-11-18 14:12:51 +0000146 // Enter specific kind of exit frame; either in normal or
147 // debug mode. Expects the number of arguments in register rax and
ager@chromium.orga1645e22009-09-09 19:27:10 +0000148 // sets up the number of arguments in register rdi and the pointer
149 // to the first argument in register rsi.
ager@chromium.orgc4c92722009-11-18 14:12:51 +0000150 void EnterExitFrame(ExitFrame::Mode mode, int result_size = 1);
ager@chromium.org9085a012009-05-11 19:22:57 +0000151
ager@chromium.orga1645e22009-09-09 19:27:10 +0000152 // Leave the current exit frame. Expects/provides the return value in
153 // register rax:rdx (untouched) and the pointer to the first
154 // argument in register rsi.
ager@chromium.orgc4c92722009-11-18 14:12:51 +0000155 void LeaveExitFrame(ExitFrame::Mode mode, int result_size = 1);
ager@chromium.org9085a012009-05-11 19:22:57 +0000156
157
158 // ---------------------------------------------------------------------------
159 // JavaScript invokes
160
161 // Invoke the JavaScript function code by either calling or jumping.
ager@chromium.orgeadaf222009-06-16 09:43:10 +0000162 void InvokeCode(Register code,
ager@chromium.org9085a012009-05-11 19:22:57 +0000163 const ParameterCount& expected,
164 const ParameterCount& actual,
165 InvokeFlag flag);
166
167 void InvokeCode(Handle<Code> code,
168 const ParameterCount& expected,
169 const ParameterCount& actual,
170 RelocInfo::Mode rmode,
171 InvokeFlag flag);
172
173 // Invoke the JavaScript function in the given register. Changes the
174 // current context to the context in the function before invoking.
175 void InvokeFunction(Register function,
176 const ParameterCount& actual,
177 InvokeFlag flag);
178
ager@chromium.org5c838252010-02-19 08:53:10 +0000179 void InvokeFunction(JSFunction* function,
180 const ParameterCount& actual,
181 InvokeFlag flag);
182
ager@chromium.org9085a012009-05-11 19:22:57 +0000183 // Invoke specified builtin JavaScript function. Adds an entry to
184 // the unresolved list if the name does not resolve.
185 void InvokeBuiltin(Builtins::JavaScript id, InvokeFlag flag);
186
187 // Store the code object for the given builtin in the target register.
188 void GetBuiltinEntry(Register target, Builtins::JavaScript id);
189
ager@chromium.org4af710e2009-09-15 12:20:11 +0000190
191 // ---------------------------------------------------------------------------
192 // Smi tagging, untagging and operations on tagged smis.
193
194 // Conversions between tagged smi values and non-tagged integer values.
195
196 // Tag an integer value. The result must be known to be a valid smi value.
sgjesse@chromium.orgb302e562010-02-03 11:26:59 +0000197 // Only uses the low 32 bits of the src register. Sets the N and Z flags
198 // based on the value of the resulting integer.
ager@chromium.org4af710e2009-09-15 12:20:11 +0000199 void Integer32ToSmi(Register dst, Register src);
200
201 // Tag an integer value if possible, or jump the integer value cannot be
202 // represented as a smi. Only uses the low 32 bit of the src registers.
christian.plesner.hansen@gmail.com9d58c2b2009-10-16 11:48:38 +0000203 // NOTICE: Destroys the dst register even if unsuccessful!
ager@chromium.org4af710e2009-09-15 12:20:11 +0000204 void Integer32ToSmi(Register dst, Register src, Label* on_overflow);
205
ricow@chromium.org5ad5ace2010-06-23 09:06:43 +0000206 // Stores an integer32 value into a memory field that already holds a smi.
207 void Integer32ToSmiField(const Operand& dst, Register src);
208
ager@chromium.org4af710e2009-09-15 12:20:11 +0000209 // Adds constant to src and tags the result as a smi.
210 // Result must be a valid smi.
christian.plesner.hansen@gmail.com9d58c2b2009-10-16 11:48:38 +0000211 void Integer64PlusConstantToSmi(Register dst, Register src, int constant);
ager@chromium.org4af710e2009-09-15 12:20:11 +0000212
213 // Convert smi to 32-bit integer. I.e., not sign extended into
214 // high 32 bits of destination.
215 void SmiToInteger32(Register dst, Register src);
ricow@chromium.org30ce4112010-05-31 10:38:25 +0000216 void SmiToInteger32(Register dst, const Operand& src);
ager@chromium.org4af710e2009-09-15 12:20:11 +0000217
218 // Convert smi to 64-bit integer (sign extended if necessary).
219 void SmiToInteger64(Register dst, Register src);
ricow@chromium.org5ad5ace2010-06-23 09:06:43 +0000220 void SmiToInteger64(Register dst, const Operand& src);
ager@chromium.org4af710e2009-09-15 12:20:11 +0000221
222 // Multiply a positive smi's integer value by a power of two.
223 // Provides result as 64-bit integer value.
224 void PositiveSmiTimesPowerOfTwoToInteger64(Register dst,
225 Register src,
226 int power);
227
ricow@chromium.org30ce4112010-05-31 10:38:25 +0000228 // Divide a positive smi's integer value by a power of two.
229 // Provides result as 32-bit integer value.
230 void PositiveSmiDivPowerOfTwoToInteger32(Register dst,
231 Register src,
232 int power);
233
234
christian.plesner.hansen@gmail.com9d58c2b2009-10-16 11:48:38 +0000235 // Simple comparison of smis.
236 void SmiCompare(Register dst, Register src);
237 void SmiCompare(Register dst, Smi* src);
ager@chromium.orgac091b72010-05-05 07:34:42 +0000238 void SmiCompare(Register dst, const Operand& src);
christian.plesner.hansen@gmail.com9d58c2b2009-10-16 11:48:38 +0000239 void SmiCompare(const Operand& dst, Register src);
240 void SmiCompare(const Operand& dst, Smi* src);
ricow@chromium.org5ad5ace2010-06-23 09:06:43 +0000241 // Compare the int32 in src register to the value of the smi stored at dst.
242 void SmiCompareInteger32(const Operand& dst, Register src);
christian.plesner.hansen@gmail.com9d58c2b2009-10-16 11:48:38 +0000243 // Sets sign and zero flags depending on value of smi in register.
244 void SmiTest(Register src);
245
ager@chromium.org4af710e2009-09-15 12:20:11 +0000246 // Functions performing a check on a known or potential smi. Returns
247 // a condition that is satisfied if the check is successful.
248
249 // Is the value a tagged smi.
250 Condition CheckSmi(Register src);
251
ager@chromium.org4af710e2009-09-15 12:20:11 +0000252 // Is the value a positive tagged smi.
253 Condition CheckPositiveSmi(Register src);
254
sgjesse@chromium.orgb302e562010-02-03 11:26:59 +0000255 // Are both values tagged smis.
ager@chromium.org4af710e2009-09-15 12:20:11 +0000256 Condition CheckBothSmi(Register first, Register second);
257
sgjesse@chromium.orgb302e562010-02-03 11:26:59 +0000258 // Are both values tagged smis.
259 Condition CheckBothPositiveSmi(Register first, Register second);
260
261 // Are either value a tagged smi.
262 Condition CheckEitherSmi(Register first, Register second);
263
ager@chromium.org4af710e2009-09-15 12:20:11 +0000264 // Is the value the minimum smi value (since we are using
265 // two's complement numbers, negating the value is known to yield
266 // a non-smi value).
267 Condition CheckIsMinSmi(Register src);
268
ager@chromium.org4af710e2009-09-15 12:20:11 +0000269 // Checks whether an 32-bit integer value is a valid for conversion
270 // to a smi.
271 Condition CheckInteger32ValidSmiValue(Register src);
272
ager@chromium.org3811b432009-10-28 14:53:37 +0000273 // Checks whether an 32-bit unsigned integer value is a valid for
274 // conversion to a smi.
275 Condition CheckUInteger32ValidSmiValue(Register src);
276
ager@chromium.org4af710e2009-09-15 12:20:11 +0000277 // Test-and-jump functions. Typically combines a check function
278 // above with a conditional jump.
279
280 // Jump if the value cannot be represented by a smi.
281 void JumpIfNotValidSmiValue(Register src, Label* on_invalid);
282
ager@chromium.org3811b432009-10-28 14:53:37 +0000283 // Jump if the unsigned integer value cannot be represented by a smi.
284 void JumpIfUIntNotValidSmiValue(Register src, Label* on_invalid);
285
ager@chromium.org4af710e2009-09-15 12:20:11 +0000286 // Jump to label if the value is a tagged smi.
287 void JumpIfSmi(Register src, Label* on_smi);
288
289 // Jump to label if the value is not a tagged smi.
290 void JumpIfNotSmi(Register src, Label* on_not_smi);
291
292 // Jump to label if the value is not a positive tagged smi.
293 void JumpIfNotPositiveSmi(Register src, Label* on_not_smi);
294
christian.plesner.hansen@gmail.com9d58c2b2009-10-16 11:48:38 +0000295 // Jump to label if the value, which must be a tagged smi, has value equal
ager@chromium.org4af710e2009-09-15 12:20:11 +0000296 // to the constant.
christian.plesner.hansen@gmail.com9d58c2b2009-10-16 11:48:38 +0000297 void JumpIfSmiEqualsConstant(Register src, Smi* constant, Label* on_equals);
sgjesse@chromium.orgc5145742009-10-07 09:00:33 +0000298
ager@chromium.org4af710e2009-09-15 12:20:11 +0000299 // Jump if either or both register are not smi values.
300 void JumpIfNotBothSmi(Register src1, Register src2, Label* on_not_both_smi);
301
sgjesse@chromium.orgb302e562010-02-03 11:26:59 +0000302 // Jump if either or both register are not positive smi values.
303 void JumpIfNotBothPositiveSmi(Register src1, Register src2,
304 Label* on_not_both_smi);
305
ager@chromium.org4af710e2009-09-15 12:20:11 +0000306 // Operations on tagged smi values.
307
308 // Smis represent a subset of integers. The subset is always equivalent to
309 // a two's complement interpretation of a fixed number of bits.
310
311 // Optimistically adds an integer constant to a supposed smi.
312 // If the src is not a smi, or the result is not a smi, jump to
313 // the label.
314 void SmiTryAddConstant(Register dst,
315 Register src,
christian.plesner.hansen@gmail.com9d58c2b2009-10-16 11:48:38 +0000316 Smi* constant,
ager@chromium.org4af710e2009-09-15 12:20:11 +0000317 Label* on_not_smi_result);
318
christian.plesner.hansen@gmail.com9d58c2b2009-10-16 11:48:38 +0000319 // Add an integer constant to a tagged smi, giving a tagged smi as result.
320 // No overflow testing on the result is done.
321 void SmiAddConstant(Register dst, Register src, Smi* constant);
322
erik.corry@gmail.com9dfbea42010-05-21 12:58:28 +0000323 // Add an integer constant to a tagged smi, giving a tagged smi as result.
324 // No overflow testing on the result is done.
325 void SmiAddConstant(const Operand& dst, Smi* constant);
326
ager@chromium.org4af710e2009-09-15 12:20:11 +0000327 // Add an integer constant to a tagged smi, giving a tagged smi as result,
328 // or jumping to a label if the result cannot be represented by a smi.
ager@chromium.org4af710e2009-09-15 12:20:11 +0000329 void SmiAddConstant(Register dst,
330 Register src,
christian.plesner.hansen@gmail.com9d58c2b2009-10-16 11:48:38 +0000331 Smi* constant,
ager@chromium.org4af710e2009-09-15 12:20:11 +0000332 Label* on_not_smi_result);
333
334 // Subtract an integer constant from a tagged smi, giving a tagged smi as
ager@chromium.orgac091b72010-05-05 07:34:42 +0000335 // result. No testing on the result is done. Sets the N and Z flags
336 // based on the value of the resulting integer.
christian.plesner.hansen@gmail.com9d58c2b2009-10-16 11:48:38 +0000337 void SmiSubConstant(Register dst, Register src, Smi* constant);
338
339 // Subtract an integer constant from a tagged smi, giving a tagged smi as
ager@chromium.org4af710e2009-09-15 12:20:11 +0000340 // result, or jumping to a label if the result cannot be represented by a smi.
ager@chromium.org4af710e2009-09-15 12:20:11 +0000341 void SmiSubConstant(Register dst,
342 Register src,
christian.plesner.hansen@gmail.com9d58c2b2009-10-16 11:48:38 +0000343 Smi* constant,
ager@chromium.org4af710e2009-09-15 12:20:11 +0000344 Label* on_not_smi_result);
345
346 // Negating a smi can give a negative zero or too large positive value.
christian.plesner.hansen@gmail.com9d58c2b2009-10-16 11:48:38 +0000347 // NOTICE: This operation jumps on success, not failure!
ager@chromium.org4af710e2009-09-15 12:20:11 +0000348 void SmiNeg(Register dst,
349 Register src,
christian.plesner.hansen@gmail.com9d58c2b2009-10-16 11:48:38 +0000350 Label* on_smi_result);
ager@chromium.org4af710e2009-09-15 12:20:11 +0000351
352 // Adds smi values and return the result as a smi.
353 // If dst is src1, then src1 will be destroyed, even if
354 // the operation is unsuccessful.
355 void SmiAdd(Register dst,
356 Register src1,
357 Register src2,
358 Label* on_not_smi_result);
359
360 // Subtracts smi values and return the result as a smi.
361 // If dst is src1, then src1 will be destroyed, even if
362 // the operation is unsuccessful.
363 void SmiSub(Register dst,
364 Register src1,
365 Register src2,
366 Label* on_not_smi_result);
367
ager@chromium.orgac091b72010-05-05 07:34:42 +0000368 void SmiSub(Register dst,
369 Register src1,
erik.corry@gmail.com9dfbea42010-05-21 12:58:28 +0000370 const Operand& src2,
ager@chromium.orgac091b72010-05-05 07:34:42 +0000371 Label* on_not_smi_result);
372
ager@chromium.org4af710e2009-09-15 12:20:11 +0000373 // Multiplies smi values and return the result as a smi,
374 // if possible.
375 // If dst is src1, then src1 will be destroyed, even if
376 // the operation is unsuccessful.
377 void SmiMul(Register dst,
378 Register src1,
379 Register src2,
380 Label* on_not_smi_result);
381
382 // Divides one smi by another and returns the quotient.
383 // Clobbers rax and rdx registers.
384 void SmiDiv(Register dst,
385 Register src1,
386 Register src2,
387 Label* on_not_smi_result);
388
389 // Divides one smi by another and returns the remainder.
390 // Clobbers rax and rdx registers.
391 void SmiMod(Register dst,
392 Register src1,
393 Register src2,
394 Label* on_not_smi_result);
395
396 // Bitwise operations.
397 void SmiNot(Register dst, Register src);
398 void SmiAnd(Register dst, Register src1, Register src2);
399 void SmiOr(Register dst, Register src1, Register src2);
400 void SmiXor(Register dst, Register src1, Register src2);
christian.plesner.hansen@gmail.com9d58c2b2009-10-16 11:48:38 +0000401 void SmiAndConstant(Register dst, Register src1, Smi* constant);
402 void SmiOrConstant(Register dst, Register src1, Smi* constant);
403 void SmiXorConstant(Register dst, Register src1, Smi* constant);
ager@chromium.org4af710e2009-09-15 12:20:11 +0000404
405 void SmiShiftLeftConstant(Register dst,
406 Register src,
sgjesse@chromium.org720dc0b2010-05-10 09:25:39 +0000407 int shift_value);
ager@chromium.org4af710e2009-09-15 12:20:11 +0000408 void SmiShiftLogicalRightConstant(Register dst,
409 Register src,
410 int shift_value,
411 Label* on_not_smi_result);
412 void SmiShiftArithmeticRightConstant(Register dst,
413 Register src,
414 int shift_value);
415
416 // Shifts a smi value to the left, and returns the result if that is a smi.
417 // Uses and clobbers rcx, so dst may not be rcx.
418 void SmiShiftLeft(Register dst,
419 Register src1,
sgjesse@chromium.org720dc0b2010-05-10 09:25:39 +0000420 Register src2);
ager@chromium.org4af710e2009-09-15 12:20:11 +0000421 // Shifts a smi value to the right, shifting in zero bits at the top, and
422 // returns the unsigned intepretation of the result if that is a smi.
423 // Uses and clobbers rcx, so dst may not be rcx.
424 void SmiShiftLogicalRight(Register dst,
425 Register src1,
426 Register src2,
427 Label* on_not_smi_result);
428 // Shifts a smi value to the right, sign extending the top, and
429 // returns the signed intepretation of the result. That will always
430 // be a valid smi value, since it's numerically smaller than the
431 // original.
432 // Uses and clobbers rcx, so dst may not be rcx.
433 void SmiShiftArithmeticRight(Register dst,
434 Register src1,
435 Register src2);
436
437 // Specialized operations
438
439 // Select the non-smi register of two registers where exactly one is a
440 // smi. If neither are smis, jump to the failure label.
441 void SelectNonSmi(Register dst,
442 Register src1,
443 Register src2,
444 Label* on_not_smis);
445
446 // Converts, if necessary, a smi to a combination of number and
447 // multiplier to be used as a scaled index.
448 // The src register contains a *positive* smi value. The shift is the
449 // power of two to multiply the index value by (e.g.
450 // to index by smi-value * kPointerSize, pass the smi and kPointerSizeLog2).
451 // The returned index register may be either src or dst, depending
452 // on what is most efficient. If src and dst are different registers,
453 // src is always unchanged.
454 SmiIndex SmiToIndex(Register dst, Register src, int shift);
455
456 // Converts a positive smi to a negative index.
457 SmiIndex SmiToNegativeIndex(Register dst, Register src, int shift);
458
christian.plesner.hansen@gmail.com9d58c2b2009-10-16 11:48:38 +0000459 // Basic Smi operations.
ager@chromium.org3811b432009-10-28 14:53:37 +0000460 void Move(Register dst, Smi* source) {
461 Set(dst, reinterpret_cast<int64_t>(source));
462 }
463
464 void Move(const Operand& dst, Smi* source) {
465 Set(dst, reinterpret_cast<int64_t>(source));
466 }
467
christian.plesner.hansen@gmail.com9d58c2b2009-10-16 11:48:38 +0000468 void Push(Smi* smi);
469 void Test(const Operand& dst, Smi* source);
470
ager@chromium.orgeadaf222009-06-16 09:43:10 +0000471 // ---------------------------------------------------------------------------
sgjesse@chromium.orgb302e562010-02-03 11:26:59 +0000472 // String macros.
473 void JumpIfNotBothSequentialAsciiStrings(Register first_object,
474 Register second_object,
475 Register scratch1,
476 Register scratch2,
477 Label* on_not_both_flat_ascii);
478
ager@chromium.orgce5e87b2010-03-10 10:24:18 +0000479 // Check whether the instance type represents a flat ascii string. Jump to the
480 // label if not. If the instance type can be scratched specify same register
481 // for both instance type and scratch.
482 void JumpIfInstanceTypeIsNotSequentialAscii(Register instance_type,
483 Register scratch,
484 Label *on_not_flat_ascii_string);
485
486 void JumpIfBothInstanceTypesAreNotSequentialAscii(
487 Register first_object_instance_type,
488 Register second_object_instance_type,
489 Register scratch1,
490 Register scratch2,
491 Label* on_fail);
492
sgjesse@chromium.orgb302e562010-02-03 11:26:59 +0000493 // ---------------------------------------------------------------------------
kmillikin@chromium.org13bd2942009-12-16 15:36:05 +0000494 // Macro instructions.
ager@chromium.orgeadaf222009-06-16 09:43:10 +0000495
christian.plesner.hansen@gmail.com9d58c2b2009-10-16 11:48:38 +0000496 // Load a register with a long value as efficiently as possible.
ager@chromium.orge2902be2009-06-08 12:21:35 +0000497 void Set(Register dst, int64_t x);
498 void Set(const Operand& dst, int64_t x);
ager@chromium.org9085a012009-05-11 19:22:57 +0000499
ager@chromium.org5aa501c2009-06-23 07:57:28 +0000500 // Handle support
ager@chromium.org5aa501c2009-06-23 07:57:28 +0000501 void Move(Register dst, Handle<Object> source);
502 void Move(const Operand& dst, Handle<Object> source);
503 void Cmp(Register dst, Handle<Object> source);
ager@chromium.org3e875802009-06-29 08:26:34 +0000504 void Cmp(const Operand& dst, Handle<Object> source);
ager@chromium.org5aa501c2009-06-23 07:57:28 +0000505 void Push(Handle<Object> source);
fschneider@chromium.org0c20e672010-01-14 15:28:53 +0000506
507 // Emit code to discard a non-negative number of pointer-sized elements
508 // from the stack, clobbering only the rsp register.
kmillikin@chromium.org13bd2942009-12-16 15:36:05 +0000509 void Drop(int stack_elements);
fschneider@chromium.org0c20e672010-01-14 15:28:53 +0000510
kmillikin@chromium.org13bd2942009-12-16 15:36:05 +0000511 void Call(Label* target) { call(target); }
ager@chromium.org5aa501c2009-06-23 07:57:28 +0000512
ager@chromium.orgeadaf222009-06-16 09:43:10 +0000513 // Control Flow
514 void Jump(Address destination, RelocInfo::Mode rmode);
515 void Jump(ExternalReference ext);
ager@chromium.org5aa501c2009-06-23 07:57:28 +0000516 void Jump(Handle<Code> code_object, RelocInfo::Mode rmode);
517
ager@chromium.orgeadaf222009-06-16 09:43:10 +0000518 void Call(Address destination, RelocInfo::Mode rmode);
519 void Call(ExternalReference ext);
ager@chromium.org5aa501c2009-06-23 07:57:28 +0000520 void Call(Handle<Code> code_object, RelocInfo::Mode rmode);
ager@chromium.orgeadaf222009-06-16 09:43:10 +0000521
ager@chromium.org9085a012009-05-11 19:22:57 +0000522 // Compare object type for heap object.
kasperl@chromium.orge959c182009-07-27 08:59:04 +0000523 // Always use unsigned comparisons: above and below, not less and greater.
ager@chromium.org9085a012009-05-11 19:22:57 +0000524 // Incoming register is heap_object and outgoing register is map.
kasperl@chromium.org86f77b72009-07-06 08:21:57 +0000525 // They may be the same register, and may be kScratchRegister.
ager@chromium.org9085a012009-05-11 19:22:57 +0000526 void CmpObjectType(Register heap_object, InstanceType type, Register map);
527
528 // Compare instance type for map.
kasperl@chromium.orge959c182009-07-27 08:59:04 +0000529 // Always use unsigned comparisons: above and below, not less and greater.
ager@chromium.org9085a012009-05-11 19:22:57 +0000530 void CmpInstanceType(Register map, InstanceType type);
531
ager@chromium.org5c838252010-02-19 08:53:10 +0000532 // Check if the map of an object is equal to a specified map and
533 // branch to label if not. Skip the smi check if not required
534 // (object is known to be a heap object)
535 void CheckMap(Register obj,
536 Handle<Map> map,
537 Label* fail,
538 bool is_heap_object);
539
sgjesse@chromium.orgb302e562010-02-03 11:26:59 +0000540 // Check if the object in register heap_object is a string. Afterwards the
541 // register map contains the object map and the register instance_type
542 // contains the instance_type. The registers map and instance_type can be the
543 // same in which case it contains the instance type afterwards. Either of the
544 // registers map and instance_type can be the same as heap_object.
545 Condition IsObjectStringType(Register heap_object,
546 Register map,
547 Register instance_type);
548
fschneider@chromium.org40b9da32010-06-28 11:29:21 +0000549 // FCmp compares and pops the two values on top of the FPU stack.
550 // The flag results are similar to integer cmp, but requires unsigned
ager@chromium.org9085a012009-05-11 19:22:57 +0000551 // jcc instructions (je, ja, jae, jb, jbe, je, and jz).
552 void FCmp();
553
ager@chromium.org5c838252010-02-19 08:53:10 +0000554 // Abort execution if argument is not a number. Used in debug code.
erik.corry@gmail.com9dfbea42010-05-21 12:58:28 +0000555 void AbortIfNotNumber(Register object);
ager@chromium.org5c838252010-02-19 08:53:10 +0000556
lrn@chromium.org25156de2010-04-06 13:10:27 +0000557 // Abort execution if argument is not a smi. Used in debug code.
erik.corry@gmail.com9dfbea42010-05-21 12:58:28 +0000558 void AbortIfNotSmi(Register object);
lrn@chromium.org25156de2010-04-06 13:10:27 +0000559
ricow@chromium.org5ad5ace2010-06-23 09:06:43 +0000560 // Abort execution if argument is not the root value with the given index.
561 void AbortIfNotRootValue(Register src,
562 Heap::RootListIndex root_value_index,
563 const char* message);
564
ager@chromium.org9085a012009-05-11 19:22:57 +0000565 // ---------------------------------------------------------------------------
566 // Exception handling
567
ager@chromium.orgeadaf222009-06-16 09:43:10 +0000568 // Push a new try handler and link into try handler chain. The return
569 // address must be pushed before calling this helper.
ager@chromium.org9085a012009-05-11 19:22:57 +0000570 void PushTryHandler(CodeLocation try_location, HandlerType type);
571
kmillikin@chromium.org13bd2942009-12-16 15:36:05 +0000572 // Unlink the stack handler on top of the stack from the try handler chain.
573 void PopTryHandler();
ager@chromium.org9085a012009-05-11 19:22:57 +0000574
575 // ---------------------------------------------------------------------------
576 // Inline caching support
577
578 // Generates code that verifies that the maps of objects in the
579 // prototype chain of object hasn't changed since the code was
580 // generated and branches to the miss label if any map has. If
581 // necessary the function also generates code for security check
582 // in case of global object holders. The scratch and holder
583 // registers are always clobbered, but the object register is only
584 // clobbered if it the same as the holder register. The function
585 // returns a register containing the holder - either object_reg or
586 // holder_reg.
kmillikin@chromium.org4111b802010-05-03 10:34:42 +0000587 // The function can optionally (when save_at_depth !=
588 // kInvalidProtoDepth) save the object at the given depth by moving
589 // it to [rsp + kPointerSize].
ager@chromium.org9085a012009-05-11 19:22:57 +0000590 Register CheckMaps(JSObject* object, Register object_reg,
591 JSObject* holder, Register holder_reg,
kmillikin@chromium.org4111b802010-05-03 10:34:42 +0000592 Register scratch,
593 int save_at_depth,
594 Label* miss);
ager@chromium.org9085a012009-05-11 19:22:57 +0000595
596 // Generate code for checking access rights - used for security checks
597 // on access to global objects across environments. The holder register
kasperl@chromium.orge959c182009-07-27 08:59:04 +0000598 // is left untouched, but the scratch register and kScratchRegister,
599 // which must be different, are clobbered.
ager@chromium.org9085a012009-05-11 19:22:57 +0000600 void CheckAccessGlobalProxy(Register holder_reg,
601 Register scratch,
602 Label* miss);
603
604
605 // ---------------------------------------------------------------------------
ager@chromium.org18ad94b2009-09-02 08:22:29 +0000606 // Allocation support
607
608 // Allocate an object in new space. If the new space is exhausted control
609 // continues at the gc_required label. The allocated object is returned in
610 // result and end of the new object is returned in result_end. The register
611 // scratch can be passed as no_reg in which case an additional object
612 // reference will be added to the reloc info. The returned pointers in result
613 // and result_end have not yet been tagged as heap objects. If
614 // result_contains_top_on_entry is true the content of result is known to be
615 // the allocation top on entry (could be result_end from a previous call to
sgjesse@chromium.orgc5145742009-10-07 09:00:33 +0000616 // AllocateInNewSpace). If result_contains_top_on_entry is true scratch
ager@chromium.org18ad94b2009-09-02 08:22:29 +0000617 // should be no_reg as it is never used.
sgjesse@chromium.orgc5145742009-10-07 09:00:33 +0000618 void AllocateInNewSpace(int object_size,
619 Register result,
620 Register result_end,
621 Register scratch,
622 Label* gc_required,
623 AllocationFlags flags);
ager@chromium.org18ad94b2009-09-02 08:22:29 +0000624
sgjesse@chromium.orgc5145742009-10-07 09:00:33 +0000625 void AllocateInNewSpace(int header_size,
626 ScaleFactor element_size,
627 Register element_count,
628 Register result,
629 Register result_end,
630 Register scratch,
631 Label* gc_required,
632 AllocationFlags flags);
ager@chromium.org18ad94b2009-09-02 08:22:29 +0000633
sgjesse@chromium.orgc5145742009-10-07 09:00:33 +0000634 void AllocateInNewSpace(Register object_size,
635 Register result,
636 Register result_end,
637 Register scratch,
638 Label* gc_required,
639 AllocationFlags flags);
ager@chromium.org18ad94b2009-09-02 08:22:29 +0000640
641 // Undo allocation in new space. The object passed and objects allocated after
642 // it will no longer be allocated. Make sure that no pointers are left to the
643 // object(s) no longer allocated as they would be invalid when allocation is
644 // un-done.
645 void UndoAllocationInNewSpace(Register object);
646
ager@chromium.org3811b432009-10-28 14:53:37 +0000647 // Allocate a heap number in new space with undefined value. Returns
648 // tagged pointer in result register, or jumps to gc_required if new
649 // space is full.
650 void AllocateHeapNumber(Register result,
651 Register scratch,
652 Label* gc_required);
653
kmillikin@chromium.org13bd2942009-12-16 15:36:05 +0000654 // Allocate a sequential string. All the header fields of the string object
655 // are initialized.
656 void AllocateTwoByteString(Register result,
657 Register length,
658 Register scratch1,
659 Register scratch2,
660 Register scratch3,
661 Label* gc_required);
662 void AllocateAsciiString(Register result,
663 Register length,
664 Register scratch1,
665 Register scratch2,
666 Register scratch3,
667 Label* gc_required);
668
669 // Allocate a raw cons string object. Only the map field of the result is
670 // initialized.
671 void AllocateConsString(Register result,
672 Register scratch1,
673 Register scratch2,
674 Label* gc_required);
675 void AllocateAsciiConsString(Register result,
676 Register scratch1,
677 Register scratch2,
678 Label* gc_required);
679
ager@chromium.org18ad94b2009-09-02 08:22:29 +0000680 // ---------------------------------------------------------------------------
ager@chromium.org9085a012009-05-11 19:22:57 +0000681 // Support functions.
682
683 // Check if result is zero and op is negative.
684 void NegativeZeroTest(Register result, Register op, Label* then_label);
685
686 // Check if result is zero and op is negative in code using jump targets.
687 void NegativeZeroTest(CodeGenerator* cgen,
688 Register result,
689 Register op,
690 JumpTarget* then_target);
691
692 // Check if result is zero and any of op1 and op2 are negative.
693 // Register scratch is destroyed, and it must be different from op2.
694 void NegativeZeroTest(Register result, Register op1, Register op2,
695 Register scratch, Label* then_label);
696
697 // Try to get function prototype of a function and puts the value in
698 // the result register. Checks that the function really is a
699 // function and jumps to the miss label if the fast checks fail. The
kasperl@chromium.org86f77b72009-07-06 08:21:57 +0000700 // function register will be untouched; the other register may be
ager@chromium.org9085a012009-05-11 19:22:57 +0000701 // clobbered.
702 void TryGetFunctionPrototype(Register function,
703 Register result,
ager@chromium.org9085a012009-05-11 19:22:57 +0000704 Label* miss);
705
706 // Generates code for reporting that an illegal operation has
707 // occurred.
708 void IllegalOperation(int num_arguments);
709
sgjesse@chromium.orgac6aa172009-12-04 12:29:05 +0000710 // Find the function context up the context chain.
711 void LoadContext(Register dst, int context_chain_length);
712
ager@chromium.org9085a012009-05-11 19:22:57 +0000713 // ---------------------------------------------------------------------------
714 // Runtime calls
715
716 // Call a code stub.
717 void CallStub(CodeStub* stub);
718
kmillikin@chromium.org13bd2942009-12-16 15:36:05 +0000719 // Tail call a code stub (jump).
720 void TailCallStub(CodeStub* stub);
721
ager@chromium.org9085a012009-05-11 19:22:57 +0000722 // Return from a code stub after popping its arguments.
723 void StubReturn(int argc);
724
725 // Call a runtime routine.
ager@chromium.org9085a012009-05-11 19:22:57 +0000726 void CallRuntime(Runtime::Function* f, int num_arguments);
727
728 // Convenience function: Same as above, but takes the fid instead.
729 void CallRuntime(Runtime::FunctionId id, int num_arguments);
730
ager@chromium.org5c838252010-02-19 08:53:10 +0000731 // Convenience function: call an external reference.
732 void CallExternalReference(const ExternalReference& ext,
733 int num_arguments);
734
ager@chromium.org9085a012009-05-11 19:22:57 +0000735 // Tail call of a runtime routine (jump).
ager@chromium.orgce5e87b2010-03-10 10:24:18 +0000736 // Like JumpToExternalReference, but also takes care of passing the number
737 // of parameters.
738 void TailCallExternalReference(const ExternalReference& ext,
739 int num_arguments,
740 int result_size);
741
742 // Convenience function: tail call a runtime routine (jump).
743 void TailCallRuntime(Runtime::FunctionId fid,
ager@chromium.orga1645e22009-09-09 19:27:10 +0000744 int num_arguments,
745 int result_size);
ager@chromium.org9085a012009-05-11 19:22:57 +0000746
sgjesse@chromium.orgc5145742009-10-07 09:00:33 +0000747 // Jump to a runtime routine.
ager@chromium.orgce5e87b2010-03-10 10:24:18 +0000748 void JumpToExternalReference(const ExternalReference& ext, int result_size);
ager@chromium.org9085a012009-05-11 19:22:57 +0000749
sgjesse@chromium.orgb302e562010-02-03 11:26:59 +0000750 // Before calling a C-function from generated code, align arguments on stack.
751 // After aligning the frame, arguments must be stored in esp[0], esp[4],
752 // etc., not pushed. The argument count assumes all arguments are word sized.
753 // The number of slots reserved for arguments depends on platform. On Windows
754 // stack slots are reserved for the arguments passed in registers. On other
755 // platforms stack slots are only reserved for the arguments actually passed
756 // on the stack.
757 void PrepareCallCFunction(int num_arguments);
758
759 // Calls a C function and cleans up the space for arguments allocated
760 // by PrepareCallCFunction. The called function is not allowed to trigger a
761 // garbage collection, since that might move the code and invalidate the
762 // return address (unless this is somehow accounted for by the called
763 // function).
764 void CallCFunction(ExternalReference function, int num_arguments);
765 void CallCFunction(Register function, int num_arguments);
766
767 // Calculate the number of stack slots to reserve for arguments when calling a
768 // C function.
769 int ArgumentStackSlotsForCFunctionCall(int num_arguments);
ager@chromium.org9085a012009-05-11 19:22:57 +0000770
771 // ---------------------------------------------------------------------------
772 // Utilities
773
774 void Ret();
775
ager@chromium.org9085a012009-05-11 19:22:57 +0000776 Handle<Object> CodeObject() { return code_object_; }
777
778
779 // ---------------------------------------------------------------------------
780 // StatsCounter support
781
782 void SetCounter(StatsCounter* counter, int value);
783 void IncrementCounter(StatsCounter* counter, int value);
784 void DecrementCounter(StatsCounter* counter, int value);
785
786
787 // ---------------------------------------------------------------------------
788 // Debugging
789
790 // Calls Abort(msg) if the condition cc is not satisfied.
791 // Use --debug_code to enable.
792 void Assert(Condition cc, const char* msg);
793
794 // Like Assert(), but always enabled.
795 void Check(Condition cc, const char* msg);
796
797 // Print a message to stdout and abort execution.
798 void Abort(const char* msg);
799
ricow@chromium.orgc9c80822010-04-21 08:22:37 +0000800 // Check that the stack is aligned.
801 void CheckStackAlignment();
802
ager@chromium.org9085a012009-05-11 19:22:57 +0000803 // Verify restrictions about code generated in stubs.
804 void set_generating_stub(bool value) { generating_stub_ = value; }
805 bool generating_stub() { return generating_stub_; }
806 void set_allow_stub_calls(bool value) { allow_stub_calls_ = value; }
807 bool allow_stub_calls() { return allow_stub_calls_; }
808
809 private:
ager@chromium.org9085a012009-05-11 19:22:57 +0000810 bool generating_stub_;
811 bool allow_stub_calls_;
ager@chromium.org5c838252010-02-19 08:53:10 +0000812 // This handle will be patched with the code object on installation.
813 Handle<Object> code_object_;
ager@chromium.org9085a012009-05-11 19:22:57 +0000814
815 // Helper functions for generating invokes.
816 void InvokePrologue(const ParameterCount& expected,
817 const ParameterCount& actual,
818 Handle<Code> code_constant,
ager@chromium.orgeadaf222009-06-16 09:43:10 +0000819 Register code_register,
ager@chromium.org9085a012009-05-11 19:22:57 +0000820 Label* done,
821 InvokeFlag flag);
822
ager@chromium.org9085a012009-05-11 19:22:57 +0000823 // Activation support.
824 void EnterFrame(StackFrame::Type type);
825 void LeaveFrame(StackFrame::Type type);
ager@chromium.org18ad94b2009-09-02 08:22:29 +0000826
827 // Allocation support helpers.
ager@chromium.orgac091b72010-05-05 07:34:42 +0000828 // Loads the top of new-space into the result register.
829 // If flags contains RESULT_CONTAINS_TOP then result_end is valid and
830 // already contains the top of new-space, and scratch is invalid.
831 // Otherwise the address of the new-space top is loaded into scratch (if
832 // scratch is valid), and the new-space top is loaded into result.
ager@chromium.org18ad94b2009-09-02 08:22:29 +0000833 void LoadAllocationTopHelper(Register result,
834 Register result_end,
835 Register scratch,
ager@chromium.orga1645e22009-09-09 19:27:10 +0000836 AllocationFlags flags);
ager@chromium.orgac091b72010-05-05 07:34:42 +0000837 // Update allocation top with value in result_end register.
838 // If scratch is valid, it contains the address of the allocation top.
ager@chromium.org18ad94b2009-09-02 08:22:29 +0000839 void UpdateAllocationTopHelper(Register result_end, Register scratch);
ager@chromium.org9085a012009-05-11 19:22:57 +0000840};
841
842
ager@chromium.org4af710e2009-09-15 12:20:11 +0000843// The code patcher is used to patch (typically) small parts of code e.g. for
844// debugging and other types of instrumentation. When using the code patcher
845// the exact number of bytes specified must be emitted. Is not legal to emit
846// relocation information. If any of these constraints are violated it causes
847// an assertion.
848class CodePatcher {
849 public:
850 CodePatcher(byte* address, int size);
851 virtual ~CodePatcher();
852
853 // Macro assembler to emit code.
854 MacroAssembler* masm() { return &masm_; }
855
856 private:
857 byte* address_; // The address of the code being patched.
858 int size_; // Number of bytes of the expected patch size.
859 MacroAssembler masm_; // Macro assembler used to generate the code.
860};
861
862
ager@chromium.org9085a012009-05-11 19:22:57 +0000863// -----------------------------------------------------------------------------
864// Static helper functions.
865
866// Generate an Operand for loading a field from an object.
867static inline Operand FieldOperand(Register object, int offset) {
868 return Operand(object, offset - kHeapObjectTag);
869}
870
871
872// Generate an Operand for loading an indexed field from an object.
873static inline Operand FieldOperand(Register object,
874 Register index,
875 ScaleFactor scale,
876 int offset) {
877 return Operand(object, index, scale, offset - kHeapObjectTag);
878}
879
880
881#ifdef GENERATED_CODE_COVERAGE
882extern void LogGeneratedCodeCoverage(const char* file_line);
883#define CODE_COVERAGE_STRINGIFY(x) #x
884#define CODE_COVERAGE_TOSTRING(x) CODE_COVERAGE_STRINGIFY(x)
885#define __FILE_LINE__ __FILE__ ":" CODE_COVERAGE_TOSTRING(__LINE__)
886#define ACCESS_MASM(masm) { \
kasperl@chromium.org86f77b72009-07-06 08:21:57 +0000887 byte* x64_coverage_function = \
ager@chromium.org9085a012009-05-11 19:22:57 +0000888 reinterpret_cast<byte*>(FUNCTION_ADDR(LogGeneratedCodeCoverage)); \
889 masm->pushfd(); \
890 masm->pushad(); \
891 masm->push(Immediate(reinterpret_cast<int>(&__FILE_LINE__))); \
kasperl@chromium.org86f77b72009-07-06 08:21:57 +0000892 masm->call(x64_coverage_function, RelocInfo::RUNTIME_ENTRY); \
ager@chromium.org9085a012009-05-11 19:22:57 +0000893 masm->pop(rax); \
894 masm->popad(); \
895 masm->popfd(); \
896 } \
897 masm->
898#else
899#define ACCESS_MASM(masm) masm->
900#endif
901
902
903} } // namespace v8::internal
904
905#endif // V8_X64_MACRO_ASSEMBLER_X64_H_