OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef V8_X64_MACRO_ASSEMBLER_X64_H_ | 5 #ifndef V8_X64_MACRO_ASSEMBLER_X64_H_ |
6 #define V8_X64_MACRO_ASSEMBLER_X64_H_ | 6 #define V8_X64_MACRO_ASSEMBLER_X64_H_ |
7 | 7 |
8 #include "src/assembler.h" | 8 #include "src/assembler.h" |
9 #include "src/bailout-reason.h" | 9 #include "src/bailout-reason.h" |
10 #include "src/base/flags.h" | 10 #include "src/base/flags.h" |
(...skipping 1094 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1105 // Compare object type for heap object. | 1105 // Compare object type for heap object. |
1106 // Always use unsigned comparisons: above and below, not less and greater. | 1106 // Always use unsigned comparisons: above and below, not less and greater. |
1107 // Incoming register is heap_object and outgoing register is map. | 1107 // Incoming register is heap_object and outgoing register is map. |
1108 // They may be the same register, and may be kScratchRegister. | 1108 // They may be the same register, and may be kScratchRegister. |
1109 void CmpObjectType(Register heap_object, InstanceType type, Register map); | 1109 void CmpObjectType(Register heap_object, InstanceType type, Register map); |
1110 | 1110 |
1111 // Compare instance type for map. | 1111 // Compare instance type for map. |
1112 // Always use unsigned comparisons: above and below, not less and greater. | 1112 // Always use unsigned comparisons: above and below, not less and greater. |
1113 void CmpInstanceType(Register map, InstanceType type); | 1113 void CmpInstanceType(Register map, InstanceType type); |
1114 | 1114 |
1115 // Check if a map for a JSObject indicates that the object can have both smi | |
1116 // and HeapObject elements. Jump to the specified label if it does not. | |
1117 void CheckFastObjectElements(Register map, | |
1118 Label* fail, | |
1119 Label::Distance distance = Label::kFar); | |
1120 | |
1121 // Check if a map for a JSObject indicates that the object has fast smi only | |
1122 // elements. Jump to the specified label if it does not. | |
1123 void CheckFastSmiElements(Register map, | |
1124 Label* fail, | |
1125 Label::Distance distance = Label::kFar); | |
1126 | |
1127 // Check to see if maybe_number can be stored as a double in | |
1128 // FastDoubleElements. If it can, store it at the index specified by index in | |
1129 // the FastDoubleElements array elements, otherwise jump to fail. Note that | |
1130 // index must not be smi-tagged. | |
1131 void StoreNumberToDoubleElements(Register maybe_number, | |
1132 Register elements, | |
1133 Register index, | |
1134 XMMRegister xmm_scratch, | |
1135 Label* fail, | |
1136 int elements_offset = 0); | |
1137 | |
1138 // Compare an object's map with the specified map. | 1115 // Compare an object's map with the specified map. |
1139 void CompareMap(Register obj, Handle<Map> map); | 1116 void CompareMap(Register obj, Handle<Map> map); |
1140 | 1117 |
1141 // Check if the map of an object is equal to a specified map and branch to | 1118 // Check if the map of an object is equal to a specified map and branch to |
1142 // label if not. Skip the smi check if not required (object is known to be a | 1119 // label if not. Skip the smi check if not required (object is known to be a |
1143 // heap object). If mode is ALLOW_ELEMENT_TRANSITION_MAPS, then also match | 1120 // heap object). If mode is ALLOW_ELEMENT_TRANSITION_MAPS, then also match |
1144 // against maps that are ElementsKind transition maps of the specified map. | 1121 // against maps that are ElementsKind transition maps of the specified map. |
1145 void CheckMap(Register obj, | 1122 void CheckMap(Register obj, |
1146 Handle<Map> map, | 1123 Handle<Map> map, |
1147 Label* fail, | 1124 Label* fail, |
(...skipping 265 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1413 // Load the global object from the current context. | 1390 // Load the global object from the current context. |
1414 void LoadGlobalObject(Register dst) { | 1391 void LoadGlobalObject(Register dst) { |
1415 LoadNativeContextSlot(Context::EXTENSION_INDEX, dst); | 1392 LoadNativeContextSlot(Context::EXTENSION_INDEX, dst); |
1416 } | 1393 } |
1417 | 1394 |
1418 // Load the global proxy from the current context. | 1395 // Load the global proxy from the current context. |
1419 void LoadGlobalProxy(Register dst) { | 1396 void LoadGlobalProxy(Register dst) { |
1420 LoadNativeContextSlot(Context::GLOBAL_PROXY_INDEX, dst); | 1397 LoadNativeContextSlot(Context::GLOBAL_PROXY_INDEX, dst); |
1421 } | 1398 } |
1422 | 1399 |
1423 // Conditionally load the cached Array transitioned map of type | |
1424 // transitioned_kind from the native context if the map in register | |
1425 // map_in_out is the cached Array map in the native context of | |
1426 // expected_kind. | |
1427 void LoadTransitionedArrayMapConditional( | |
1428 ElementsKind expected_kind, | |
1429 ElementsKind transitioned_kind, | |
1430 Register map_in_out, | |
1431 Register scratch, | |
1432 Label* no_map_match); | |
1433 | |
1434 // Load the native context slot with the current index. | 1400 // Load the native context slot with the current index. |
1435 void LoadNativeContextSlot(int index, Register dst); | 1401 void LoadNativeContextSlot(int index, Register dst); |
1436 | 1402 |
1437 // Load the initial map from the global function. The registers | 1403 // Load the initial map from the global function. The registers |
1438 // function and map can be the same. | 1404 // function and map can be the same. |
1439 void LoadGlobalFunctionInitialMap(Register function, Register map); | 1405 void LoadGlobalFunctionInitialMap(Register function, Register map); |
1440 | 1406 |
1441 // --------------------------------------------------------------------------- | 1407 // --------------------------------------------------------------------------- |
1442 // Runtime calls | 1408 // Runtime calls |
1443 | 1409 |
(...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1586 // AllocationMemento support. Arrays may have an associated | 1552 // AllocationMemento support. Arrays may have an associated |
1587 // AllocationMemento object that can be checked for in order to pretransition | 1553 // AllocationMemento object that can be checked for in order to pretransition |
1588 // to another type. | 1554 // to another type. |
1589 // On entry, receiver_reg should point to the array object. | 1555 // On entry, receiver_reg should point to the array object. |
1590 // scratch_reg gets clobbered. | 1556 // scratch_reg gets clobbered. |
1591 // If allocation info is present, condition flags are set to equal. | 1557 // If allocation info is present, condition flags are set to equal. |
1592 void TestJSArrayForAllocationMemento(Register receiver_reg, | 1558 void TestJSArrayForAllocationMemento(Register receiver_reg, |
1593 Register scratch_reg, | 1559 Register scratch_reg, |
1594 Label* no_memento_found); | 1560 Label* no_memento_found); |
1595 | 1561 |
1596 void JumpIfJSArrayHasAllocationMemento(Register receiver_reg, | |
1597 Register scratch_reg, | |
1598 Label* memento_found) { | |
1599 Label no_memento_found; | |
1600 TestJSArrayForAllocationMemento(receiver_reg, scratch_reg, | |
1601 &no_memento_found); | |
1602 j(equal, memento_found); | |
1603 bind(&no_memento_found); | |
1604 } | |
1605 | |
1606 // Jumps to found label if a prototype map has dictionary elements. | |
1607 void JumpIfDictionaryInPrototypeChain(Register object, Register scratch0, | |
1608 Register scratch1, Label* found); | |
1609 | |
1610 private: | 1562 private: |
1611 // Order general registers are pushed by Pushad. | 1563 // Order general registers are pushed by Pushad. |
1612 // rax, rcx, rdx, rbx, rsi, rdi, r8, r9, r11, r12, r14, r15. | 1564 // rax, rcx, rdx, rbx, rsi, rdi, r8, r9, r11, r12, r14, r15. |
1613 static const int kSafepointPushRegisterIndices[Register::kNumRegisters]; | 1565 static const int kSafepointPushRegisterIndices[Register::kNumRegisters]; |
1614 static const int kNumSafepointSavedRegisters = 12; | 1566 static const int kNumSafepointSavedRegisters = 12; |
1615 static const int kSmiShift = kSmiTagSize + kSmiShiftSize; | 1567 static const int kSmiShift = kSmiTagSize + kSmiShiftSize; |
1616 | 1568 |
1617 bool generating_stub_; | 1569 bool generating_stub_; |
1618 bool has_frame_; | 1570 bool has_frame_; |
1619 bool root_array_available_; | 1571 bool root_array_available_; |
(...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1760 inline Operand StackOperandForReturnAddress(int32_t disp) { | 1712 inline Operand StackOperandForReturnAddress(int32_t disp) { |
1761 return Operand(rsp, disp); | 1713 return Operand(rsp, disp); |
1762 } | 1714 } |
1763 | 1715 |
1764 #define ACCESS_MASM(masm) masm-> | 1716 #define ACCESS_MASM(masm) masm-> |
1765 | 1717 |
1766 } // namespace internal | 1718 } // namespace internal |
1767 } // namespace v8 | 1719 } // namespace v8 |
1768 | 1720 |
1769 #endif // V8_X64_MACRO_ASSEMBLER_X64_H_ | 1721 #endif // V8_X64_MACRO_ASSEMBLER_X64_H_ |
OLD | NEW |