OLD | NEW |
1 // Copyright 2014 the V8 project authors. All rights reserved. | 1 // Copyright 2014 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_PPC_MACRO_ASSEMBLER_PPC_H_ | 5 #ifndef V8_PPC_MACRO_ASSEMBLER_PPC_H_ |
6 #define V8_PPC_MACRO_ASSEMBLER_PPC_H_ | 6 #define V8_PPC_MACRO_ASSEMBLER_PPC_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/frames.h" | 10 #include "src/frames.h" |
(...skipping 452 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
463 // Load the global object from the current context. | 463 // Load the global object from the current context. |
464 void LoadGlobalObject(Register dst) { | 464 void LoadGlobalObject(Register dst) { |
465 LoadNativeContextSlot(Context::EXTENSION_INDEX, dst); | 465 LoadNativeContextSlot(Context::EXTENSION_INDEX, dst); |
466 } | 466 } |
467 | 467 |
468 // Load the global proxy from the current context. | 468 // Load the global proxy from the current context. |
469 void LoadGlobalProxy(Register dst) { | 469 void LoadGlobalProxy(Register dst) { |
470 LoadNativeContextSlot(Context::GLOBAL_PROXY_INDEX, dst); | 470 LoadNativeContextSlot(Context::GLOBAL_PROXY_INDEX, dst); |
471 } | 471 } |
472 | 472 |
473 // Conditionally load the cached Array transitioned map of type | |
474 // transitioned_kind from the native context if the map in register | |
475 // map_in_out is the cached Array map in the native context of | |
476 // expected_kind. | |
477 void LoadTransitionedArrayMapConditional(ElementsKind expected_kind, | |
478 ElementsKind transitioned_kind, | |
479 Register map_in_out, | |
480 Register scratch, | |
481 Label* no_map_match); | |
482 | |
483 void LoadNativeContextSlot(int index, Register dst); | 473 void LoadNativeContextSlot(int index, Register dst); |
484 | 474 |
485 // Load the initial map from the global function. The registers | 475 // Load the initial map from the global function. The registers |
486 // function and map can be the same, function is then overwritten. | 476 // function and map can be the same, function is then overwritten. |
487 void LoadGlobalFunctionInitialMap(Register function, Register map, | 477 void LoadGlobalFunctionInitialMap(Register function, Register map, |
488 Register scratch); | 478 Register scratch); |
489 | 479 |
490 void InitializeRootRegister() { | 480 void InitializeRootRegister() { |
491 ExternalReference roots_array_start = | 481 ExternalReference roots_array_start = |
492 ExternalReference::roots_array_start(isolate()); | 482 ExternalReference::roots_array_start(isolate()); |
(...skipping 303 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
796 // other registers. | 786 // other registers. |
797 // Type_reg can be no_reg. In that case ip is used. | 787 // Type_reg can be no_reg. In that case ip is used. |
798 void CompareObjectType(Register heap_object, Register map, Register type_reg, | 788 void CompareObjectType(Register heap_object, Register map, Register type_reg, |
799 InstanceType type); | 789 InstanceType type); |
800 | 790 |
801 // Compare instance type in a map. map contains a valid map object whose | 791 // Compare instance type in a map. map contains a valid map object whose |
802 // object type should be compared with the given type. This both | 792 // object type should be compared with the given type. This both |
803 // sets the flags and leaves the object type in the type_reg register. | 793 // sets the flags and leaves the object type in the type_reg register. |
804 void CompareInstanceType(Register map, Register type_reg, InstanceType type); | 794 void CompareInstanceType(Register map, Register type_reg, InstanceType type); |
805 | 795 |
806 // Check if a map for a JSObject indicates that the object can have both smi | |
807 // and HeapObject elements. Jump to the specified label if it does not. | |
808 void CheckFastObjectElements(Register map, Register scratch, Label* fail); | |
809 | |
810 // Check if a map for a JSObject indicates that the object has fast smi only | |
811 // elements. Jump to the specified label if it does not. | |
812 void CheckFastSmiElements(Register map, Register scratch, Label* fail); | |
813 | |
814 // Check to see if maybe_number can be stored as a double in | |
815 // FastDoubleElements. If it can, store it at the index specified by key in | |
816 // the FastDoubleElements array elements. Otherwise jump to fail. | |
817 void StoreNumberToDoubleElements(Register value_reg, Register key_reg, | |
818 Register elements_reg, Register scratch1, | |
819 DoubleRegister double_scratch, Label* fail, | |
820 int elements_offset = 0); | |
821 | |
822 // Compare an object's map with the specified map and its transitioned | 796 // Compare an object's map with the specified map and its transitioned |
823 // elements maps if mode is ALLOW_ELEMENT_TRANSITION_MAPS. Condition flags are | 797 // elements maps if mode is ALLOW_ELEMENT_TRANSITION_MAPS. Condition flags are |
824 // set with result of map compare. If multiple map compares are required, the | 798 // set with result of map compare. If multiple map compares are required, the |
825 // compare sequences branches to early_success. | 799 // compare sequences branches to early_success. |
826 void CompareMap(Register obj, Register scratch, Handle<Map> map, | 800 void CompareMap(Register obj, Register scratch, Handle<Map> map, |
827 Label* early_success); | 801 Label* early_success); |
828 | 802 |
829 // As above, but the map of the object is already loaded into the register | 803 // As above, but the map of the object is already loaded into the register |
830 // which is preserved by the code generated. | 804 // which is preserved by the code generated. |
831 void CompareMap(Register obj_map, Handle<Map> map, Label* early_success); | 805 void CompareMap(Register obj_map, Handle<Map> map, Label* early_success); |
(...skipping 470 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1302 SmiToArrayOffset(dst, src, elementSizeLog2); | 1276 SmiToArrayOffset(dst, src, elementSizeLog2); |
1303 } else { | 1277 } else { |
1304 ShiftLeftImm(dst, src, Operand(elementSizeLog2)); | 1278 ShiftLeftImm(dst, src, Operand(elementSizeLog2)); |
1305 } | 1279 } |
1306 } | 1280 } |
1307 | 1281 |
1308 // Untag the source value into destination and jump if source is a smi. | 1282 // Untag the source value into destination and jump if source is a smi. |
1309 // Souce and destination can be the same register. | 1283 // Souce and destination can be the same register. |
1310 void UntagAndJumpIfSmi(Register dst, Register src, Label* smi_case); | 1284 void UntagAndJumpIfSmi(Register dst, Register src, Label* smi_case); |
1311 | 1285 |
1312 // Untag the source value into destination and jump if source is not a smi. | |
1313 // Souce and destination can be the same register. | |
1314 void UntagAndJumpIfNotSmi(Register dst, Register src, Label* non_smi_case); | |
1315 | |
1316 inline void TestIfSmi(Register value, Register scratch) { | 1286 inline void TestIfSmi(Register value, Register scratch) { |
1317 TestBitRange(value, kSmiTagSize - 1, 0, scratch); | 1287 TestBitRange(value, kSmiTagSize - 1, 0, scratch); |
1318 } | 1288 } |
1319 | 1289 |
1320 inline void TestIfPositiveSmi(Register value, Register scratch) { | 1290 inline void TestIfPositiveSmi(Register value, Register scratch) { |
1321 #if V8_TARGET_ARCH_PPC64 | 1291 #if V8_TARGET_ARCH_PPC64 |
1322 rldicl(scratch, value, 1, kBitsPerPointer - (1 + kSmiTagSize), SetRC); | 1292 rldicl(scratch, value, 1, kBitsPerPointer - (1 + kSmiTagSize), SetRC); |
1323 #else | 1293 #else |
1324 rlwinm(scratch, value, 1, kBitsPerPointer - (1 + kSmiTagSize), | 1294 rlwinm(scratch, value, 1, kBitsPerPointer - (1 + kSmiTagSize), |
1325 kBitsPerPointer - 1, SetRC); | 1295 kBitsPerPointer - 1, SetRC); |
(...skipping 195 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1521 // AllocationMemento object that can be checked for in order to pretransition | 1491 // AllocationMemento object that can be checked for in order to pretransition |
1522 // to another type. | 1492 // to another type. |
1523 // On entry, receiver_reg should point to the array object. | 1493 // On entry, receiver_reg should point to the array object. |
1524 // scratch_reg gets clobbered. | 1494 // scratch_reg gets clobbered. |
1525 // If allocation info is present, condition flags are set to eq. | 1495 // If allocation info is present, condition flags are set to eq. |
1526 void TestJSArrayForAllocationMemento(Register receiver_reg, | 1496 void TestJSArrayForAllocationMemento(Register receiver_reg, |
1527 Register scratch_reg, | 1497 Register scratch_reg, |
1528 Register scratch2_reg, | 1498 Register scratch2_reg, |
1529 Label* no_memento_found); | 1499 Label* no_memento_found); |
1530 | 1500 |
1531 void JumpIfJSArrayHasAllocationMemento(Register receiver_reg, | |
1532 Register scratch_reg, | |
1533 Register scratch2_reg, | |
1534 Label* memento_found) { | |
1535 Label no_memento_found; | |
1536 TestJSArrayForAllocationMemento(receiver_reg, scratch_reg, scratch2_reg, | |
1537 &no_memento_found); | |
1538 beq(memento_found); | |
1539 bind(&no_memento_found); | |
1540 } | |
1541 | |
1542 // Jumps to found label if a prototype map has dictionary elements. | |
1543 void JumpIfDictionaryInPrototypeChain(Register object, Register scratch0, | |
1544 Register scratch1, Label* found); | |
1545 | |
1546 // Loads the constant pool pointer (kConstantPoolRegister). | 1501 // Loads the constant pool pointer (kConstantPoolRegister). |
1547 void LoadConstantPoolPointerRegisterFromCodeTargetAddress( | 1502 void LoadConstantPoolPointerRegisterFromCodeTargetAddress( |
1548 Register code_target_address); | 1503 Register code_target_address); |
1549 void LoadConstantPoolPointerRegister(); | 1504 void LoadConstantPoolPointerRegister(); |
1550 void LoadConstantPoolPointerRegister(Register base, int code_entry_delta = 0); | 1505 void LoadConstantPoolPointerRegister(Register base, int code_entry_delta = 0); |
1551 | 1506 |
1552 void AbortConstantPoolBuilding() { | 1507 void AbortConstantPoolBuilding() { |
1553 #ifdef DEBUG | 1508 #ifdef DEBUG |
1554 // Avoid DCHECK(!is_linked()) failure in ~Label() | 1509 // Avoid DCHECK(!is_linked()) failure in ~Label() |
1555 bind(ConstantPoolPosition()); | 1510 bind(ConstantPoolPosition()); |
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1647 inline MemOperand NativeContextMemOperand() { | 1602 inline MemOperand NativeContextMemOperand() { |
1648 return ContextMemOperand(cp, Context::NATIVE_CONTEXT_INDEX); | 1603 return ContextMemOperand(cp, Context::NATIVE_CONTEXT_INDEX); |
1649 } | 1604 } |
1650 | 1605 |
1651 #define ACCESS_MASM(masm) masm-> | 1606 #define ACCESS_MASM(masm) masm-> |
1652 | 1607 |
1653 } // namespace internal | 1608 } // namespace internal |
1654 } // namespace v8 | 1609 } // namespace v8 |
1655 | 1610 |
1656 #endif // V8_PPC_MACRO_ASSEMBLER_PPC_H_ | 1611 #endif // V8_PPC_MACRO_ASSEMBLER_PPC_H_ |
OLD | NEW |