Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(773)

Side by Side Diff: src/arm/macro-assembler-arm.h

Issue 190793002: Introduce FrameAndConstantPoolScope and ConstantPoolUnavailableScope. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 6 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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
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 820 matching lines...) Expand 10 before | Expand all | Expand 10 after
1376 1373
1377 template<typename Field> 1374 template<typename Field>
1378 void DecodeField(Register reg) { 1375 void DecodeField(Register reg) {
1379 static const int shift = Field::kShift; 1376 static const int shift = Field::kShift;
1380 static const int mask = (Field::kMask >> shift) << kSmiTagSize; 1377 static const int mask = (Field::kMask >> shift) << kSmiTagSize;
1381 mov(reg, Operand(reg, LSR, shift)); 1378 mov(reg, Operand(reg, LSR, shift));
1382 and_(reg, reg, Operand(mask)); 1379 and_(reg, reg, Operand(mask));
1383 } 1380 }
1384 1381
1385 // Activation support. 1382 // Activation support.
1386 void EnterFrame(StackFrame::Type type); 1383 void EnterFrame(StackFrame::Type type, bool load_constant_pool = false);
1387 // Returns the pc offset at which the frame ends. 1384 // Returns the pc offset at which the frame ends.
1388 int LeaveFrame(StackFrame::Type type); 1385 int LeaveFrame(StackFrame::Type type);
1389 1386
1390 // Expects object in r0 and returns map with validated enum cache 1387 // Expects object in r0 and returns map with validated enum cache
1391 // in r0. Assumes that any other register can be used as a scratch. 1388 // in r0. Assumes that any other register can be used as a scratch.
1392 void CheckEnumCache(Register null_value, Label* call_runtime); 1389 void CheckEnumCache(Register null_value, Label* call_runtime);
1393 1390
1394 // AllocationMemento support. Arrays may have an associated 1391 // AllocationMemento support. Arrays may have an associated
1395 // AllocationMemento object that can be checked for in order to pretransition 1392 // AllocationMemento object that can be checked for in order to pretransition
1396 // to another type. 1393 // to another type.
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
1453 1450
1454 // Helper for throwing exceptions. Compute a handler address and jump to 1451 // Helper for throwing exceptions. Compute a handler address and jump to
1455 // it. See the implementation for register usage. 1452 // it. See the implementation for register usage.
1456 void JumpToHandlerEntry(); 1453 void JumpToHandlerEntry();
1457 1454
1458 // Compute memory operands for safepoint stack slots. 1455 // Compute memory operands for safepoint stack slots.
1459 static int SafepointRegisterStackIndex(int reg_code); 1456 static int SafepointRegisterStackIndex(int reg_code);
1460 MemOperand SafepointRegisterSlot(Register reg); 1457 MemOperand SafepointRegisterSlot(Register reg);
1461 MemOperand SafepointRegistersAndDoublesSlot(Register reg); 1458 MemOperand SafepointRegistersAndDoublesSlot(Register reg);
1462 1459
1460 // Loads the constant pool pointer (pp) register.
1461 void LoadConstantPoolPointerRegister();
1462
1463 bool generating_stub_; 1463 bool generating_stub_;
1464 bool has_frame_; 1464 bool has_frame_;
1465 // This handle will be patched with the code object on installation. 1465 // This handle will be patched with the code object on installation.
1466 Handle<Object> code_object_; 1466 Handle<Object> code_object_;
1467 1467
1468 // Needs access to SafepointRegisterStackIndex for compiled frame 1468 // Needs access to SafepointRegisterStackIndex for compiled frame
1469 // traversal. 1469 // traversal.
1470 friend class StandardFrame; 1470 friend class StandardFrame;
1471 }; 1471 };
1472 1472
(...skipping 29 matching lines...) Expand all
1502 void EmitCondition(Condition cond); 1502 void EmitCondition(Condition cond);
1503 1503
1504 private: 1504 private:
1505 byte* address_; // The address of the code being patched. 1505 byte* address_; // The address of the code being patched.
1506 int size_; // Number of bytes of the expected patch size. 1506 int size_; // Number of bytes of the expected patch size.
1507 MacroAssembler masm_; // Macro assembler used to generate the code. 1507 MacroAssembler masm_; // Macro assembler used to generate the code.
1508 FlushICache flush_cache_; // Whether to flush the I cache after patching. 1508 FlushICache flush_cache_; // Whether to flush the I cache after patching.
1509 }; 1509 };
1510 1510
1511 1511
1512 class FrameAndConstantPoolScope {
1513 public:
1514 FrameAndConstantPoolScope(MacroAssembler* masm, StackFrame::Type type)
1515 : masm_(masm),
1516 type_(type),
1517 old_has_frame_(masm->has_frame()),
1518 old_constant_pool_available_(masm->is_constant_pool_available()) {
1519 // The constant pool load happens in EnterFrame, so this must not be a
1520 // manual or none frame type.
ulan 2014/03/11 13:00:46 Did you mean to assert (type_ != StackFrame::MANUA
rmcilroy 2014/03/11 16:36:34 Ahh originally had this assert, but changed it to
1521 masm->set_has_frame(true);
1522 masm->set_constant_pool_available(true);
1523 if (type_ != StackFrame::MANUAL && type_ != StackFrame::NONE) {
1524 masm->EnterFrame(type, !old_constant_pool_available_);
1525 }
1526 }
1527
1528 ~FrameAndConstantPoolScope() {
1529 masm_->LeaveFrame(type_);
1530 masm_->set_has_frame(old_has_frame_);
1531 masm_->set_constant_pool_available(old_has_frame_);
Rodolph Perfetta (ARM) 2014/03/11 13:28:34 old_constant_pool_available_
rmcilroy 2014/03/11 16:36:34 Done thanks (I had this change, but it seemed to h
1532 }
1533
1534 // Normally we generate the leave-frame code when this object goes
1535 // out of scope. Sometimes we may need to generate the code somewhere else
1536 // in addition. Calling this will achieve that, but the object stays in
1537 // scope, the MacroAssembler is still marked as being in a frame scope, and
1538 // the code will be generated again when it goes out of scope.
1539 void GenerateLeaveFrame() {
1540 ASSERT(type_ != StackFrame::MANUAL && type_ != StackFrame::NONE);
1541 masm_->LeaveFrame(type_);
1542 }
1543
1544 private:
1545 MacroAssembler* masm_;
1546 StackFrame::Type type_;
1547 bool old_has_frame_;
1548 bool old_constant_pool_available_;
1549
1550 DISALLOW_IMPLICIT_CONSTRUCTORS(FrameAndConstantPoolScope);
1551 };
1552
1553
1554 // Class for scoping the the unavailability of constant pool access.
1555 class ConstantPoolUnavailableScope {
1556 public:
1557 explicit ConstantPoolUnavailableScope(MacroAssembler* masm)
1558 : masm_(masm),
1559 old_constant_pool_available_(masm->is_constant_pool_available()) {
1560 if (FLAG_enable_ool_constant_pool) {
1561 masm_->set_constant_pool_available(false);
1562 }
1563 }
1564 ~ConstantPoolUnavailableScope() {
1565 if (FLAG_enable_ool_constant_pool) {
1566 masm_->set_constant_pool_available(old_constant_pool_available_);
1567 }
1568 }
1569
1570 private:
1571 MacroAssembler* masm_;
1572 int old_constant_pool_available_;
1573
1574 DISALLOW_IMPLICIT_CONSTRUCTORS(ConstantPoolUnavailableScope);
1575 };
1576
1577
1512 // ----------------------------------------------------------------------------- 1578 // -----------------------------------------------------------------------------
1513 // Static helper functions. 1579 // Static helper functions.
1514 1580
1515 inline MemOperand ContextOperand(Register context, int index) { 1581 inline MemOperand ContextOperand(Register context, int index) {
1516 return MemOperand(context, Context::SlotOffset(index)); 1582 return MemOperand(context, Context::SlotOffset(index));
1517 } 1583 }
1518 1584
1519 1585
1520 inline MemOperand GlobalObjectOperand() { 1586 inline MemOperand GlobalObjectOperand() {
1521 return ContextOperand(cp, Context::GLOBAL_OBJECT_INDEX); 1587 return ContextOperand(cp, Context::GLOBAL_OBJECT_INDEX);
1522 } 1588 }
1523 1589
1524 1590
1525 #ifdef GENERATED_CODE_COVERAGE 1591 #ifdef GENERATED_CODE_COVERAGE
1526 #define CODE_COVERAGE_STRINGIFY(x) #x 1592 #define CODE_COVERAGE_STRINGIFY(x) #x
1527 #define CODE_COVERAGE_TOSTRING(x) CODE_COVERAGE_STRINGIFY(x) 1593 #define CODE_COVERAGE_TOSTRING(x) CODE_COVERAGE_STRINGIFY(x)
1528 #define __FILE_LINE__ __FILE__ ":" CODE_COVERAGE_TOSTRING(__LINE__) 1594 #define __FILE_LINE__ __FILE__ ":" CODE_COVERAGE_TOSTRING(__LINE__)
1529 #define ACCESS_MASM(masm) masm->stop(__FILE_LINE__); masm-> 1595 #define ACCESS_MASM(masm) masm->stop(__FILE_LINE__); masm->
1530 #else 1596 #else
1531 #define ACCESS_MASM(masm) masm-> 1597 #define ACCESS_MASM(masm) masm->
1532 #endif 1598 #endif
1533 1599
1534 1600
1535 } } // namespace v8::internal 1601 } } // namespace v8::internal
1536 1602
1537 #endif // V8_ARM_MACRO_ASSEMBLER_ARM_H_ 1603 #endif // V8_ARM_MACRO_ASSEMBLER_ARM_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698