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

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

Issue 196133017: Experimental parser: merge r19949 (Closed) Base URL: https://v8.googlecode.com/svn/branches/experimental/parser
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
« no previous file with comments | « src/arm/lithium-codegen-arm.cc ('k') | src/arm/macro-assembler-arm.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 592 matching lines...) Expand 10 before | Expand all | Expand 10 after
1148 1145
1149 // Store the function for the given builtin in the target register. 1146 // Store the function for the given builtin in the target register.
1150 void GetBuiltinFunction(Register target, Builtins::JavaScript id); 1147 void GetBuiltinFunction(Register target, Builtins::JavaScript id);
1151 1148
1152 Handle<Object> CodeObject() { 1149 Handle<Object> CodeObject() {
1153 ASSERT(!code_object_.is_null()); 1150 ASSERT(!code_object_.is_null());
1154 return code_object_; 1151 return code_object_;
1155 } 1152 }
1156 1153
1157 1154
1155 // Emit code for a flooring division by a constant. The dividend register is
1156 // unchanged and ip gets clobbered. Dividend and result must be different.
1157 void FlooringDiv(Register result, Register dividend, int32_t divisor);
1158
1158 // --------------------------------------------------------------------------- 1159 // ---------------------------------------------------------------------------
1159 // StatsCounter support 1160 // StatsCounter support
1160 1161
1161 void SetCounter(StatsCounter* counter, int value, 1162 void SetCounter(StatsCounter* counter, int value,
1162 Register scratch1, Register scratch2); 1163 Register scratch1, Register scratch2);
1163 void IncrementCounter(StatsCounter* counter, int value, 1164 void IncrementCounter(StatsCounter* counter, int value,
1164 Register scratch1, Register scratch2); 1165 Register scratch1, Register scratch2);
1165 void DecrementCounter(StatsCounter* counter, int value, 1166 void DecrementCounter(StatsCounter* counter, int value,
1166 Register scratch1, Register scratch2); 1167 Register scratch1, Register scratch2);
1167 1168
(...skipping 208 matching lines...) Expand 10 before | Expand all | Expand 10 after
1376 1377
1377 template<typename Field> 1378 template<typename Field>
1378 void DecodeField(Register reg) { 1379 void DecodeField(Register reg) {
1379 static const int shift = Field::kShift; 1380 static const int shift = Field::kShift;
1380 static const int mask = (Field::kMask >> shift) << kSmiTagSize; 1381 static const int mask = (Field::kMask >> shift) << kSmiTagSize;
1381 mov(reg, Operand(reg, LSR, shift)); 1382 mov(reg, Operand(reg, LSR, shift));
1382 and_(reg, reg, Operand(mask)); 1383 and_(reg, reg, Operand(mask));
1383 } 1384 }
1384 1385
1385 // Activation support. 1386 // Activation support.
1386 void EnterFrame(StackFrame::Type type); 1387 void EnterFrame(StackFrame::Type type, bool load_constant_pool = false);
1387 // Returns the pc offset at which the frame ends. 1388 // Returns the pc offset at which the frame ends.
1388 int LeaveFrame(StackFrame::Type type); 1389 int LeaveFrame(StackFrame::Type type);
1389 1390
1390 // Expects object in r0 and returns map with validated enum cache 1391 // 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. 1392 // in r0. Assumes that any other register can be used as a scratch.
1392 void CheckEnumCache(Register null_value, Label* call_runtime); 1393 void CheckEnumCache(Register null_value, Label* call_runtime);
1393 1394
1394 // AllocationMemento support. Arrays may have an associated 1395 // AllocationMemento support. Arrays may have an associated
1395 // AllocationMemento object that can be checked for in order to pretransition 1396 // AllocationMemento object that can be checked for in order to pretransition
1396 // to another type. 1397 // to another type.
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
1453 1454
1454 // Helper for throwing exceptions. Compute a handler address and jump to 1455 // Helper for throwing exceptions. Compute a handler address and jump to
1455 // it. See the implementation for register usage. 1456 // it. See the implementation for register usage.
1456 void JumpToHandlerEntry(); 1457 void JumpToHandlerEntry();
1457 1458
1458 // Compute memory operands for safepoint stack slots. 1459 // Compute memory operands for safepoint stack slots.
1459 static int SafepointRegisterStackIndex(int reg_code); 1460 static int SafepointRegisterStackIndex(int reg_code);
1460 MemOperand SafepointRegisterSlot(Register reg); 1461 MemOperand SafepointRegisterSlot(Register reg);
1461 MemOperand SafepointRegistersAndDoublesSlot(Register reg); 1462 MemOperand SafepointRegistersAndDoublesSlot(Register reg);
1462 1463
1464 // Loads the constant pool pointer (pp) register.
1465 void LoadConstantPoolPointerRegister();
1466
1463 bool generating_stub_; 1467 bool generating_stub_;
1464 bool has_frame_; 1468 bool has_frame_;
1465 // This handle will be patched with the code object on installation. 1469 // This handle will be patched with the code object on installation.
1466 Handle<Object> code_object_; 1470 Handle<Object> code_object_;
1467 1471
1468 // Needs access to SafepointRegisterStackIndex for compiled frame 1472 // Needs access to SafepointRegisterStackIndex for compiled frame
1469 // traversal. 1473 // traversal.
1470 friend class StandardFrame; 1474 friend class StandardFrame;
1471 }; 1475 };
1472 1476
(...skipping 29 matching lines...) Expand all
1502 void EmitCondition(Condition cond); 1506 void EmitCondition(Condition cond);
1503 1507
1504 private: 1508 private:
1505 byte* address_; // The address of the code being patched. 1509 byte* address_; // The address of the code being patched.
1506 int size_; // Number of bytes of the expected patch size. 1510 int size_; // Number of bytes of the expected patch size.
1507 MacroAssembler masm_; // Macro assembler used to generate the code. 1511 MacroAssembler masm_; // Macro assembler used to generate the code.
1508 FlushICache flush_cache_; // Whether to flush the I cache after patching. 1512 FlushICache flush_cache_; // Whether to flush the I cache after patching.
1509 }; 1513 };
1510 1514
1511 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
1512 // ----------------------------------------------------------------------------- 1580 // -----------------------------------------------------------------------------
1513 // Static helper functions. 1581 // Static helper functions.
1514 1582
1515 inline MemOperand ContextOperand(Register context, int index) { 1583 inline MemOperand ContextOperand(Register context, int index) {
1516 return MemOperand(context, Context::SlotOffset(index)); 1584 return MemOperand(context, Context::SlotOffset(index));
1517 } 1585 }
1518 1586
1519 1587
1520 inline MemOperand GlobalObjectOperand() { 1588 inline MemOperand GlobalObjectOperand() {
1521 return ContextOperand(cp, Context::GLOBAL_OBJECT_INDEX); 1589 return ContextOperand(cp, Context::GLOBAL_OBJECT_INDEX);
1522 } 1590 }
1523 1591
1524 1592
1525 #ifdef GENERATED_CODE_COVERAGE 1593 #ifdef GENERATED_CODE_COVERAGE
1526 #define CODE_COVERAGE_STRINGIFY(x) #x 1594 #define CODE_COVERAGE_STRINGIFY(x) #x
1527 #define CODE_COVERAGE_TOSTRING(x) CODE_COVERAGE_STRINGIFY(x) 1595 #define CODE_COVERAGE_TOSTRING(x) CODE_COVERAGE_STRINGIFY(x)
1528 #define __FILE_LINE__ __FILE__ ":" CODE_COVERAGE_TOSTRING(__LINE__) 1596 #define __FILE_LINE__ __FILE__ ":" CODE_COVERAGE_TOSTRING(__LINE__)
1529 #define ACCESS_MASM(masm) masm->stop(__FILE_LINE__); masm-> 1597 #define ACCESS_MASM(masm) masm->stop(__FILE_LINE__); masm->
1530 #else 1598 #else
1531 #define ACCESS_MASM(masm) masm-> 1599 #define ACCESS_MASM(masm) masm->
1532 #endif 1600 #endif
1533 1601
1534 1602
1535 } } // namespace v8::internal 1603 } } // namespace v8::internal
1536 1604
1537 #endif // V8_ARM_MACRO_ASSEMBLER_ARM_H_ 1605 #endif // V8_ARM_MACRO_ASSEMBLER_ARM_H_
OLDNEW
« no previous file with comments | « src/arm/lithium-codegen-arm.cc ('k') | src/arm/macro-assembler-arm.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698