| 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 1512 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1523 void EmitCondition(Condition cond); | 1523 void EmitCondition(Condition cond); |
| 1524 | 1524 |
| 1525 private: | 1525 private: |
| 1526 byte* address_; // The address of the code being patched. | 1526 byte* address_; // The address of the code being patched. |
| 1527 int size_; // Number of bytes of the expected patch size. | 1527 int size_; // Number of bytes of the expected patch size. |
| 1528 MacroAssembler masm_; // Macro assembler used to generate the code. | 1528 MacroAssembler masm_; // Macro assembler used to generate the code. |
| 1529 FlushICache flush_cache_; // Whether to flush the I cache after patching. | 1529 FlushICache flush_cache_; // Whether to flush the I cache after patching. |
| 1530 }; | 1530 }; |
| 1531 | 1531 |
| 1532 | 1532 |
| 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. | 1533 // Class for scoping the the unavailability of constant pool access. |
| 1575 class ConstantPoolUnavailableScope { | 1534 class ConstantPoolUnavailableScope { |
| 1576 public: | 1535 public: |
| 1577 explicit ConstantPoolUnavailableScope(MacroAssembler* masm) | 1536 explicit ConstantPoolUnavailableScope(MacroAssembler* masm) |
| 1578 : masm_(masm), | 1537 : masm_(masm), |
| 1579 old_constant_pool_available_(masm->is_constant_pool_available()) { | 1538 old_constant_pool_available_(masm->is_constant_pool_available()) { |
| 1580 if (FLAG_enable_ool_constant_pool) { | 1539 if (FLAG_enable_ool_constant_pool) { |
| 1581 masm_->set_constant_pool_available(false); | 1540 masm_->set_constant_pool_available(false); |
| 1582 } | 1541 } |
| 1583 } | 1542 } |
| (...skipping 30 matching lines...) Expand all Loading... |
| 1614 #define __FILE_LINE__ __FILE__ ":" CODE_COVERAGE_TOSTRING(__LINE__) | 1573 #define __FILE_LINE__ __FILE__ ":" CODE_COVERAGE_TOSTRING(__LINE__) |
| 1615 #define ACCESS_MASM(masm) masm->stop(__FILE_LINE__); masm-> | 1574 #define ACCESS_MASM(masm) masm->stop(__FILE_LINE__); masm-> |
| 1616 #else | 1575 #else |
| 1617 #define ACCESS_MASM(masm) masm-> | 1576 #define ACCESS_MASM(masm) masm-> |
| 1618 #endif | 1577 #endif |
| 1619 | 1578 |
| 1620 | 1579 |
| 1621 } } // namespace v8::internal | 1580 } } // namespace v8::internal |
| 1622 | 1581 |
| 1623 #endif // V8_ARM_MACRO_ASSEMBLER_ARM_H_ | 1582 #endif // V8_ARM_MACRO_ASSEMBLER_ARM_H_ |
| OLD | NEW |