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 522 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
533 Register dst, | 533 Register dst, |
534 Register heap_number_map, | 534 Register heap_number_map, |
535 Register scratch, | 535 Register scratch, |
536 DwVfpRegister double_scratch0, | 536 DwVfpRegister double_scratch0, |
537 LowDwVfpRegister double_scratch1, | 537 LowDwVfpRegister double_scratch1, |
538 Label* not_int32); | 538 Label* not_int32); |
539 | 539 |
540 // Generates function and stub prologue code. | 540 // Generates function and stub prologue code. |
541 void Prologue(PrologueFrameMode frame_mode); | 541 void Prologue(PrologueFrameMode frame_mode); |
542 | 542 |
543 // Loads the constant pool pointer (pp) register. | |
544 void LoadConstantPoolPointerRegister(); | |
545 | |
546 // Enter exit frame. | 543 // Enter exit frame. |
547 // stack_space - extra stack space, used for alignment before call to C. | 544 // stack_space - extra stack space, used for alignment before call to C. |
548 void EnterExitFrame(bool save_doubles, int stack_space = 0); | 545 void EnterExitFrame(bool save_doubles, int stack_space = 0); |
549 | 546 |
550 // Leave the current exit frame. Expects the return value in r0. | 547 // Leave the current exit frame. Expects the return value in r0. |
551 // Expect the number of values, pushed prior to the exit frame, to | 548 // Expect the number of values, pushed prior to the exit frame, to |
552 // remove in a register (or no_reg, if there is nothing to remove). | 549 // remove in a register (or no_reg, if there is nothing to remove). |
553 void LeaveExitFrame(bool save_doubles, | 550 void LeaveExitFrame(bool save_doubles, |
554 Register argument_count, | 551 Register argument_count, |
555 bool restore_context); | 552 bool restore_context); |
(...skipping 824 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1380 | 1377 |
1381 template<typename Field> | 1378 template<typename Field> |
1382 void DecodeField(Register reg) { | 1379 void DecodeField(Register reg) { |
1383 static const int shift = Field::kShift; | 1380 static const int shift = Field::kShift; |
1384 static const int mask = (Field::kMask >> shift) << kSmiTagSize; | 1381 static const int mask = (Field::kMask >> shift) << kSmiTagSize; |
1385 mov(reg, Operand(reg, LSR, shift)); | 1382 mov(reg, Operand(reg, LSR, shift)); |
1386 and_(reg, reg, Operand(mask)); | 1383 and_(reg, reg, Operand(mask)); |
1387 } | 1384 } |
1388 | 1385 |
1389 // Activation support. | 1386 // Activation support. |
1390 void EnterFrame(StackFrame::Type type); | 1387 void EnterFrame(StackFrame::Type type, bool load_constant_pool = false); |
1391 // Returns the pc offset at which the frame ends. | 1388 // Returns the pc offset at which the frame ends. |
1392 int LeaveFrame(StackFrame::Type type); | 1389 int LeaveFrame(StackFrame::Type type); |
1393 | 1390 |
1394 // Expects object in r0 and returns map with validated enum cache | 1391 // Expects object in r0 and returns map with validated enum cache |
1395 // in r0. Assumes that any other register can be used as a scratch. | 1392 // in r0. Assumes that any other register can be used as a scratch. |
1396 void CheckEnumCache(Register null_value, Label* call_runtime); | 1393 void CheckEnumCache(Register null_value, Label* call_runtime); |
1397 | 1394 |
1398 // AllocationMemento support. Arrays may have an associated | 1395 // AllocationMemento support. Arrays may have an associated |
1399 // AllocationMemento object that can be checked for in order to pretransition | 1396 // AllocationMemento object that can be checked for in order to pretransition |
1400 // to another type. | 1397 // to another type. |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1457 | 1454 |
1458 // Helper for throwing exceptions. Compute a handler address and jump to | 1455 // Helper for throwing exceptions. Compute a handler address and jump to |
1459 // it. See the implementation for register usage. | 1456 // it. See the implementation for register usage. |
1460 void JumpToHandlerEntry(); | 1457 void JumpToHandlerEntry(); |
1461 | 1458 |
1462 // Compute memory operands for safepoint stack slots. | 1459 // Compute memory operands for safepoint stack slots. |
1463 static int SafepointRegisterStackIndex(int reg_code); | 1460 static int SafepointRegisterStackIndex(int reg_code); |
1464 MemOperand SafepointRegisterSlot(Register reg); | 1461 MemOperand SafepointRegisterSlot(Register reg); |
1465 MemOperand SafepointRegistersAndDoublesSlot(Register reg); | 1462 MemOperand SafepointRegistersAndDoublesSlot(Register reg); |
1466 | 1463 |
| 1464 // Loads the constant pool pointer (pp) register. |
| 1465 void LoadConstantPoolPointerRegister(); |
| 1466 |
1467 bool generating_stub_; | 1467 bool generating_stub_; |
1468 bool has_frame_; | 1468 bool has_frame_; |
1469 // This handle will be patched with the code object on installation. | 1469 // This handle will be patched with the code object on installation. |
1470 Handle<Object> code_object_; | 1470 Handle<Object> code_object_; |
1471 | 1471 |
1472 // Needs access to SafepointRegisterStackIndex for compiled frame | 1472 // Needs access to SafepointRegisterStackIndex for compiled frame |
1473 // traversal. | 1473 // traversal. |
1474 friend class StandardFrame; | 1474 friend class StandardFrame; |
1475 }; | 1475 }; |
1476 | 1476 |
(...skipping 29 matching lines...) Expand all Loading... |
1506 void EmitCondition(Condition cond); | 1506 void EmitCondition(Condition cond); |
1507 | 1507 |
1508 private: | 1508 private: |
1509 byte* address_; // The address of the code being patched. | 1509 byte* address_; // The address of the code being patched. |
1510 int size_; // Number of bytes of the expected patch size. | 1510 int size_; // Number of bytes of the expected patch size. |
1511 MacroAssembler masm_; // Macro assembler used to generate the code. | 1511 MacroAssembler masm_; // Macro assembler used to generate the code. |
1512 FlushICache flush_cache_; // Whether to flush the I cache after patching. | 1512 FlushICache flush_cache_; // Whether to flush the I cache after patching. |
1513 }; | 1513 }; |
1514 | 1514 |
1515 | 1515 |
| 1516 class FrameAndConstantPoolScope { |
| 1517 public: |
| 1518 FrameAndConstantPoolScope(MacroAssembler* masm, StackFrame::Type type) |
| 1519 : masm_(masm), |
| 1520 type_(type), |
| 1521 old_has_frame_(masm->has_frame()), |
| 1522 old_constant_pool_available_(masm->is_constant_pool_available()) { |
| 1523 masm->set_has_frame(true); |
| 1524 masm->set_constant_pool_available(true); |
| 1525 if (type_ != StackFrame::MANUAL && type_ != StackFrame::NONE) { |
| 1526 masm->EnterFrame(type, !old_constant_pool_available_); |
| 1527 } |
| 1528 } |
| 1529 |
| 1530 ~FrameAndConstantPoolScope() { |
| 1531 masm_->LeaveFrame(type_); |
| 1532 masm_->set_has_frame(old_has_frame_); |
| 1533 masm_->set_constant_pool_available(old_constant_pool_available_); |
| 1534 } |
| 1535 |
| 1536 // Normally we generate the leave-frame code when this object goes |
| 1537 // out of scope. Sometimes we may need to generate the code somewhere else |
| 1538 // in addition. Calling this will achieve that, but the object stays in |
| 1539 // scope, the MacroAssembler is still marked as being in a frame scope, and |
| 1540 // the code will be generated again when it goes out of scope. |
| 1541 void GenerateLeaveFrame() { |
| 1542 ASSERT(type_ != StackFrame::MANUAL && type_ != StackFrame::NONE); |
| 1543 masm_->LeaveFrame(type_); |
| 1544 } |
| 1545 |
| 1546 private: |
| 1547 MacroAssembler* masm_; |
| 1548 StackFrame::Type type_; |
| 1549 bool old_has_frame_; |
| 1550 bool old_constant_pool_available_; |
| 1551 |
| 1552 DISALLOW_IMPLICIT_CONSTRUCTORS(FrameAndConstantPoolScope); |
| 1553 }; |
| 1554 |
| 1555 |
| 1556 // Class for scoping the the unavailability of constant pool access. |
| 1557 class ConstantPoolUnavailableScope { |
| 1558 public: |
| 1559 explicit ConstantPoolUnavailableScope(MacroAssembler* masm) |
| 1560 : masm_(masm), |
| 1561 old_constant_pool_available_(masm->is_constant_pool_available()) { |
| 1562 if (FLAG_enable_ool_constant_pool) { |
| 1563 masm_->set_constant_pool_available(false); |
| 1564 } |
| 1565 } |
| 1566 ~ConstantPoolUnavailableScope() { |
| 1567 if (FLAG_enable_ool_constant_pool) { |
| 1568 masm_->set_constant_pool_available(old_constant_pool_available_); |
| 1569 } |
| 1570 } |
| 1571 |
| 1572 private: |
| 1573 MacroAssembler* masm_; |
| 1574 int old_constant_pool_available_; |
| 1575 |
| 1576 DISALLOW_IMPLICIT_CONSTRUCTORS(ConstantPoolUnavailableScope); |
| 1577 }; |
| 1578 |
| 1579 |
1516 // ----------------------------------------------------------------------------- | 1580 // ----------------------------------------------------------------------------- |
1517 // Static helper functions. | 1581 // Static helper functions. |
1518 | 1582 |
1519 inline MemOperand ContextOperand(Register context, int index) { | 1583 inline MemOperand ContextOperand(Register context, int index) { |
1520 return MemOperand(context, Context::SlotOffset(index)); | 1584 return MemOperand(context, Context::SlotOffset(index)); |
1521 } | 1585 } |
1522 | 1586 |
1523 | 1587 |
1524 inline MemOperand GlobalObjectOperand() { | 1588 inline MemOperand GlobalObjectOperand() { |
1525 return ContextOperand(cp, Context::GLOBAL_OBJECT_INDEX); | 1589 return ContextOperand(cp, Context::GLOBAL_OBJECT_INDEX); |
1526 } | 1590 } |
1527 | 1591 |
1528 | 1592 |
1529 #ifdef GENERATED_CODE_COVERAGE | 1593 #ifdef GENERATED_CODE_COVERAGE |
1530 #define CODE_COVERAGE_STRINGIFY(x) #x | 1594 #define CODE_COVERAGE_STRINGIFY(x) #x |
1531 #define CODE_COVERAGE_TOSTRING(x) CODE_COVERAGE_STRINGIFY(x) | 1595 #define CODE_COVERAGE_TOSTRING(x) CODE_COVERAGE_STRINGIFY(x) |
1532 #define __FILE_LINE__ __FILE__ ":" CODE_COVERAGE_TOSTRING(__LINE__) | 1596 #define __FILE_LINE__ __FILE__ ":" CODE_COVERAGE_TOSTRING(__LINE__) |
1533 #define ACCESS_MASM(masm) masm->stop(__FILE_LINE__); masm-> | 1597 #define ACCESS_MASM(masm) masm->stop(__FILE_LINE__); masm-> |
1534 #else | 1598 #else |
1535 #define ACCESS_MASM(masm) masm-> | 1599 #define ACCESS_MASM(masm) masm-> |
1536 #endif | 1600 #endif |
1537 | 1601 |
1538 | 1602 |
1539 } } // namespace v8::internal | 1603 } } // namespace v8::internal |
1540 | 1604 |
1541 #endif // V8_ARM_MACRO_ASSEMBLER_ARM_H_ | 1605 #endif // V8_ARM_MACRO_ASSEMBLER_ARM_H_ |
OLD | NEW |