| 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_ARM_MACRO_ASSEMBLER_ARM_H_ | 5 #ifndef V8_ARM_MACRO_ASSEMBLER_ARM_H_ |
| 6 #define V8_ARM_MACRO_ASSEMBLER_ARM_H_ | 6 #define V8_ARM_MACRO_ASSEMBLER_ARM_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 1383 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1394 and_(dst, src, Operand(mask)); | 1394 and_(dst, src, Operand(mask)); |
| 1395 } | 1395 } |
| 1396 } | 1396 } |
| 1397 | 1397 |
| 1398 template<typename Field> | 1398 template<typename Field> |
| 1399 void DecodeFieldToSmi(Register reg) { | 1399 void DecodeFieldToSmi(Register reg) { |
| 1400 DecodeField<Field>(reg, reg); | 1400 DecodeField<Field>(reg, reg); |
| 1401 } | 1401 } |
| 1402 | 1402 |
| 1403 // Activation support. | 1403 // Activation support. |
| 1404 void EnterFrame(StackFrame::Type type, bool load_constant_pool = false); | 1404 void EnterFrame(StackFrame::Type type, |
| 1405 bool load_constant_pool_pointer_reg = false); |
| 1405 // Returns the pc offset at which the frame ends. | 1406 // Returns the pc offset at which the frame ends. |
| 1406 int LeaveFrame(StackFrame::Type type); | 1407 int LeaveFrame(StackFrame::Type type); |
| 1407 | 1408 |
| 1408 // Expects object in r0 and returns map with validated enum cache | 1409 // Expects object in r0 and returns map with validated enum cache |
| 1409 // in r0. Assumes that any other register can be used as a scratch. | 1410 // in r0. Assumes that any other register can be used as a scratch. |
| 1410 void CheckEnumCache(Register null_value, Label* call_runtime); | 1411 void CheckEnumCache(Register null_value, Label* call_runtime); |
| 1411 | 1412 |
| 1412 // AllocationMemento support. Arrays may have an associated | 1413 // AllocationMemento support. Arrays may have an associated |
| 1413 // AllocationMemento object that can be checked for in order to pretransition | 1414 // AllocationMemento object that can be checked for in order to pretransition |
| 1414 // to another type. | 1415 // to another type. |
| (...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1523 void EmitCondition(Condition cond); | 1524 void EmitCondition(Condition cond); |
| 1524 | 1525 |
| 1525 private: | 1526 private: |
| 1526 byte* address_; // The address of the code being patched. | 1527 byte* address_; // The address of the code being patched. |
| 1527 int size_; // Number of bytes of the expected patch size. | 1528 int size_; // Number of bytes of the expected patch size. |
| 1528 MacroAssembler masm_; // Macro assembler used to generate the code. | 1529 MacroAssembler masm_; // Macro assembler used to generate the code. |
| 1529 FlushICache flush_cache_; // Whether to flush the I cache after patching. | 1530 FlushICache flush_cache_; // Whether to flush the I cache after patching. |
| 1530 }; | 1531 }; |
| 1531 | 1532 |
| 1532 | 1533 |
| 1533 class FrameAndConstantPoolScope { | |
| 1534 public: | |
| 1535 FrameAndConstantPoolScope(MacroAssembler* masm, StackFrame::Type type) | |
| 1536 : masm_(masm), | |
| 1537 type_(type), | |
| 1538 old_has_frame_(masm->has_frame()), | |
| 1539 old_constant_pool_available_(masm->is_constant_pool_available()) { | |
| 1540 // We only want to enable constant pool access for non-manual frame scopes | |
| 1541 // to ensure the constant pool pointer is valid throughout the scope. | |
| 1542 DCHECK(type_ != StackFrame::MANUAL && type_ != StackFrame::NONE); | |
| 1543 masm->set_has_frame(true); | |
| 1544 masm->set_constant_pool_available(true); | |
| 1545 masm->EnterFrame(type, !old_constant_pool_available_); | |
| 1546 } | |
| 1547 | |
| 1548 ~FrameAndConstantPoolScope() { | |
| 1549 masm_->LeaveFrame(type_); | |
| 1550 masm_->set_has_frame(old_has_frame_); | |
| 1551 masm_->set_constant_pool_available(old_constant_pool_available_); | |
| 1552 } | |
| 1553 | |
| 1554 // Normally we generate the leave-frame code when this object goes | |
| 1555 // out of scope. Sometimes we may need to generate the code somewhere else | |
| 1556 // in addition. Calling this will achieve that, but the object stays in | |
| 1557 // scope, the MacroAssembler is still marked as being in a frame scope, and | |
| 1558 // the code will be generated again when it goes out of scope. | |
| 1559 void GenerateLeaveFrame() { | |
| 1560 DCHECK(type_ != StackFrame::MANUAL && type_ != StackFrame::NONE); | |
| 1561 masm_->LeaveFrame(type_); | |
| 1562 } | |
| 1563 | |
| 1564 private: | |
| 1565 MacroAssembler* masm_; | |
| 1566 StackFrame::Type type_; | |
| 1567 bool old_has_frame_; | |
| 1568 bool old_constant_pool_available_; | |
| 1569 | |
| 1570 DISALLOW_IMPLICIT_CONSTRUCTORS(FrameAndConstantPoolScope); | |
| 1571 }; | |
| 1572 | |
| 1573 | |
| 1574 // Class for scoping the the unavailability of constant pool access. | |
| 1575 class ConstantPoolUnavailableScope { | |
| 1576 public: | |
| 1577 explicit ConstantPoolUnavailableScope(MacroAssembler* masm) | |
| 1578 : masm_(masm), | |
| 1579 old_constant_pool_available_(masm->is_constant_pool_available()) { | |
| 1580 if (FLAG_enable_ool_constant_pool) { | |
| 1581 masm_->set_constant_pool_available(false); | |
| 1582 } | |
| 1583 } | |
| 1584 ~ConstantPoolUnavailableScope() { | |
| 1585 if (FLAG_enable_ool_constant_pool) { | |
| 1586 masm_->set_constant_pool_available(old_constant_pool_available_); | |
| 1587 } | |
| 1588 } | |
| 1589 | |
| 1590 private: | |
| 1591 MacroAssembler* masm_; | |
| 1592 int old_constant_pool_available_; | |
| 1593 | |
| 1594 DISALLOW_IMPLICIT_CONSTRUCTORS(ConstantPoolUnavailableScope); | |
| 1595 }; | |
| 1596 | |
| 1597 | |
| 1598 // ----------------------------------------------------------------------------- | 1534 // ----------------------------------------------------------------------------- |
| 1599 // Static helper functions. | 1535 // Static helper functions. |
| 1600 | 1536 |
| 1601 inline MemOperand ContextOperand(Register context, int index) { | 1537 inline MemOperand ContextOperand(Register context, int index) { |
| 1602 return MemOperand(context, Context::SlotOffset(index)); | 1538 return MemOperand(context, Context::SlotOffset(index)); |
| 1603 } | 1539 } |
| 1604 | 1540 |
| 1605 | 1541 |
| 1606 inline MemOperand GlobalObjectOperand() { | 1542 inline MemOperand GlobalObjectOperand() { |
| 1607 return ContextOperand(cp, Context::GLOBAL_OBJECT_INDEX); | 1543 return ContextOperand(cp, Context::GLOBAL_OBJECT_INDEX); |
| 1608 } | 1544 } |
| 1609 | 1545 |
| 1610 | 1546 |
| 1611 #ifdef GENERATED_CODE_COVERAGE | 1547 #ifdef GENERATED_CODE_COVERAGE |
| 1612 #define CODE_COVERAGE_STRINGIFY(x) #x | 1548 #define CODE_COVERAGE_STRINGIFY(x) #x |
| 1613 #define CODE_COVERAGE_TOSTRING(x) CODE_COVERAGE_STRINGIFY(x) | 1549 #define CODE_COVERAGE_TOSTRING(x) CODE_COVERAGE_STRINGIFY(x) |
| 1614 #define __FILE_LINE__ __FILE__ ":" CODE_COVERAGE_TOSTRING(__LINE__) | 1550 #define __FILE_LINE__ __FILE__ ":" CODE_COVERAGE_TOSTRING(__LINE__) |
| 1615 #define ACCESS_MASM(masm) masm->stop(__FILE_LINE__); masm-> | 1551 #define ACCESS_MASM(masm) masm->stop(__FILE_LINE__); masm-> |
| 1616 #else | 1552 #else |
| 1617 #define ACCESS_MASM(masm) masm-> | 1553 #define ACCESS_MASM(masm) masm-> |
| 1618 #endif | 1554 #endif |
| 1619 | 1555 |
| 1620 | 1556 |
| 1621 } } // namespace v8::internal | 1557 } } // namespace v8::internal |
| 1622 | 1558 |
| 1623 #endif // V8_ARM_MACRO_ASSEMBLER_ARM_H_ | 1559 #endif // V8_ARM_MACRO_ASSEMBLER_ARM_H_ |
| OLD | NEW |