OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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 269 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
280 | 280 |
281 void LoadHeapObject(Register result, Handle<HeapObject> object); | 281 void LoadHeapObject(Register result, Handle<HeapObject> object); |
282 void CmpHeapObject(Register reg, Handle<HeapObject> object); | 282 void CmpHeapObject(Register reg, Handle<HeapObject> object); |
283 void PushHeapObject(Handle<HeapObject> object); | 283 void PushHeapObject(Handle<HeapObject> object); |
284 | 284 |
285 void LoadObject(Register result, Handle<Object> object) { | 285 void LoadObject(Register result, Handle<Object> object) { |
286 AllowDeferredHandleDereference heap_object_check; | 286 AllowDeferredHandleDereference heap_object_check; |
287 if (object->IsHeapObject()) { | 287 if (object->IsHeapObject()) { |
288 LoadHeapObject(result, Handle<HeapObject>::cast(object)); | 288 LoadHeapObject(result, Handle<HeapObject>::cast(object)); |
289 } else { | 289 } else { |
290 Set(result, Immediate(object)); | 290 Move(result, Immediate(object)); |
291 } | 291 } |
292 } | 292 } |
293 | 293 |
294 void CmpObject(Register reg, Handle<Object> object) { | 294 void CmpObject(Register reg, Handle<Object> object) { |
295 AllowDeferredHandleDereference heap_object_check; | 295 AllowDeferredHandleDereference heap_object_check; |
296 if (object->IsHeapObject()) { | 296 if (object->IsHeapObject()) { |
297 CmpHeapObject(reg, Handle<HeapObject>::cast(object)); | 297 CmpHeapObject(reg, Handle<HeapObject>::cast(object)); |
298 } else { | 298 } else { |
299 cmp(reg, Immediate(object)); | 299 cmp(reg, Immediate(object)); |
300 } | 300 } |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
343 InvokeFlag flag, | 343 InvokeFlag flag, |
344 const CallWrapper& call_wrapper = NullCallWrapper()); | 344 const CallWrapper& call_wrapper = NullCallWrapper()); |
345 | 345 |
346 // Store the function for the given builtin in the target register. | 346 // Store the function for the given builtin in the target register. |
347 void GetBuiltinFunction(Register target, Builtins::JavaScript id); | 347 void GetBuiltinFunction(Register target, Builtins::JavaScript id); |
348 | 348 |
349 // Store the code object for the given builtin in the target register. | 349 // Store the code object for the given builtin in the target register. |
350 void GetBuiltinEntry(Register target, Builtins::JavaScript id); | 350 void GetBuiltinEntry(Register target, Builtins::JavaScript id); |
351 | 351 |
352 // Expression support | 352 // Expression support |
353 void Set(Register dst, const Immediate& x); | |
354 void Set(const Operand& dst, const Immediate& x); | |
355 | |
356 // cvtsi2sd instruction only writes to the low 64-bit of dst register, which | 353 // cvtsi2sd instruction only writes to the low 64-bit of dst register, which |
357 // hinders register renaming and makes dependence chains longer. So we use | 354 // hinders register renaming and makes dependence chains longer. So we use |
358 // xorps to clear the dst register before cvtsi2sd to solve this issue. | 355 // xorps to clear the dst register before cvtsi2sd to solve this issue. |
359 void Cvtsi2sd(XMMRegister dst, Register src) { Cvtsi2sd(dst, Operand(src)); } | 356 void Cvtsi2sd(XMMRegister dst, Register src) { Cvtsi2sd(dst, Operand(src)); } |
360 void Cvtsi2sd(XMMRegister dst, const Operand& src); | 357 void Cvtsi2sd(XMMRegister dst, const Operand& src); |
361 | 358 |
362 // Support for constant splitting. | 359 // Support for constant splitting. |
363 bool IsUnsafeImmediate(const Immediate& x); | 360 bool IsUnsafeImmediate(const Immediate& x); |
364 void SafeSet(Register dst, const Immediate& x); | 361 void SafeMove(Register dst, const Immediate& x); |
365 void SafePush(const Immediate& x); | 362 void SafePush(const Immediate& x); |
366 | 363 |
367 // Compare object type for heap object. | 364 // Compare object type for heap object. |
368 // Incoming register is heap_object and outgoing register is map. | 365 // Incoming register is heap_object and outgoing register is map. |
369 void CmpObjectType(Register heap_object, InstanceType type, Register map); | 366 void CmpObjectType(Register heap_object, InstanceType type, Register map); |
370 | 367 |
371 // Compare instance type for map. | 368 // Compare instance type for map. |
372 void CmpInstanceType(Register map, InstanceType type); | 369 void CmpInstanceType(Register map, InstanceType type); |
373 | 370 |
374 // Check if a map for a JSObject indicates that the object has fast elements. | 371 // Check if a map for a JSObject indicates that the object has fast elements. |
(...skipping 465 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
840 | 837 |
841 // Emit call to the code we are currently generating. | 838 // Emit call to the code we are currently generating. |
842 void CallSelf() { | 839 void CallSelf() { |
843 Handle<Code> self(reinterpret_cast<Code**>(CodeObject().location())); | 840 Handle<Code> self(reinterpret_cast<Code**>(CodeObject().location())); |
844 call(self, RelocInfo::CODE_TARGET); | 841 call(self, RelocInfo::CODE_TARGET); |
845 } | 842 } |
846 | 843 |
847 // Move if the registers are not identical. | 844 // Move if the registers are not identical. |
848 void Move(Register target, Register source); | 845 void Move(Register target, Register source); |
849 | 846 |
850 // Move a constant into a register using the most efficient encoding. | 847 // Move a constant into a destination using the most efficient encoding. |
851 void Move(Register dst, Immediate imm); | 848 void Move(Register dst, const Immediate& x); |
| 849 void Move(const Operand& dst, const Immediate& x); |
852 | 850 |
853 // Move an immediate into an XMM register. | 851 // Move an immediate into an XMM register. |
854 void Move(XMMRegister dst, double val); | 852 void Move(XMMRegister dst, double val); |
855 | 853 |
856 // Push a handle value. | 854 // Push a handle value. |
857 void Push(Handle<Object> handle) { push(Immediate(handle)); } | 855 void Push(Handle<Object> handle) { push(Immediate(handle)); } |
858 void Push(Smi* smi) { Push(Handle<Smi>(smi, isolate())); } | 856 void Push(Smi* smi) { Push(Handle<Smi>(smi, isolate())); } |
859 | 857 |
860 Handle<Object> CodeObject() { | 858 Handle<Object> CodeObject() { |
861 ASSERT(!code_object_.is_null()); | 859 ASSERT(!code_object_.is_null()); |
(...skipping 266 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1128 } \ | 1126 } \ |
1129 masm-> | 1127 masm-> |
1130 #else | 1128 #else |
1131 #define ACCESS_MASM(masm) masm-> | 1129 #define ACCESS_MASM(masm) masm-> |
1132 #endif | 1130 #endif |
1133 | 1131 |
1134 | 1132 |
1135 } } // namespace v8::internal | 1133 } } // namespace v8::internal |
1136 | 1134 |
1137 #endif // V8_IA32_MACRO_ASSEMBLER_IA32_H_ | 1135 #endif // V8_IA32_MACRO_ASSEMBLER_IA32_H_ |
OLD | NEW |