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

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

Issue 11359127: Refactoring: Make predictable code flag handling architecture-independent. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Rebased Created 8 years, 1 month 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 | « no previous file | src/arm/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 (c) 1994-2006 Sun Microsystems Inc. 1 // Copyright (c) 1994-2006 Sun Microsystems Inc.
2 // All Rights Reserved. 2 // All Rights Reserved.
3 // 3 //
4 // Redistribution and use in source and binary forms, with or without 4 // Redistribution and use in source and binary forms, with or without
5 // modification, are permitted provided that the following conditions 5 // modification, are permitted provided that the following conditions
6 // are met: 6 // are met:
7 // 7 //
8 // - Redistributions of source code must retain the above copyright notice, 8 // - Redistributions of source code must retain the above copyright notice,
9 // this list of conditions and the following disclaimer. 9 // this list of conditions and the following disclaimer.
10 // 10 //
(...skipping 634 matching lines...) Expand 10 before | Expand all | Expand 10 after
645 // If the provided buffer is not NULL, the assembler uses the provided buffer 645 // If the provided buffer is not NULL, the assembler uses the provided buffer
646 // for code generation and assumes its size to be buffer_size. If the buffer 646 // for code generation and assumes its size to be buffer_size. If the buffer
647 // is too small, a fatal error occurs. No deallocation of the buffer is done 647 // is too small, a fatal error occurs. No deallocation of the buffer is done
648 // upon destruction of the assembler. 648 // upon destruction of the assembler.
649 Assembler(Isolate* isolate, void* buffer, int buffer_size); 649 Assembler(Isolate* isolate, void* buffer, int buffer_size);
650 ~Assembler(); 650 ~Assembler();
651 651
652 // Overrides the default provided by FLAG_debug_code. 652 // Overrides the default provided by FLAG_debug_code.
653 void set_emit_debug_code(bool value) { emit_debug_code_ = value; } 653 void set_emit_debug_code(bool value) { emit_debug_code_ = value; }
654 654
655 // Avoids using instructions that vary in size in unpredictable ways between
656 // the snapshot and the running VM. This is needed by the full compiler so
657 // that it can recompile code with debug support and fix the PC.
658 void set_predictable_code_size(bool value) { predictable_code_size_ = value; }
659
660 // GetCode emits any pending (non-emitted) code and fills the descriptor 655 // GetCode emits any pending (non-emitted) code and fills the descriptor
661 // desc. GetCode() is idempotent; it returns the same result if no other 656 // desc. GetCode() is idempotent; it returns the same result if no other
662 // Assembler functions are invoked in between GetCode() calls. 657 // Assembler functions are invoked in between GetCode() calls.
663 void GetCode(CodeDesc* desc); 658 void GetCode(CodeDesc* desc);
664 659
665 // Label operations & relative jumps (PPUM Appendix D) 660 // Label operations & relative jumps (PPUM Appendix D)
666 // 661 //
667 // Takes a branch opcode (cc) and a label (L) and generates 662 // Takes a branch opcode (cc) and a label (L) and generates
668 // either a backward branch or a forward branch and links it 663 // either a backward branch or a forward branch and links it
669 // to the label fixup chain. Usage: 664 // to the label fixup chain. Usage:
(...skipping 508 matching lines...) Expand 10 before | Expand all | Expand 10 after
1178 ldr(dst, MemOperand(sp, 4, PostIndex), cond); 1173 ldr(dst, MemOperand(sp, 4, PostIndex), cond);
1179 } 1174 }
1180 1175
1181 void pop() { 1176 void pop() {
1182 add(sp, sp, Operand(kPointerSize)); 1177 add(sp, sp, Operand(kPointerSize));
1183 } 1178 }
1184 1179
1185 // Jump unconditionally to given label. 1180 // Jump unconditionally to given label.
1186 void jmp(Label* L) { b(L, al); } 1181 void jmp(Label* L) { b(L, al); }
1187 1182
1188 bool predictable_code_size() const { return predictable_code_size_; }
1189
1190 static bool use_immediate_embedded_pointer_loads( 1183 static bool use_immediate_embedded_pointer_loads(
1191 const Assembler* assembler) { 1184 const Assembler* assembler) {
1192 #ifdef USE_BLX 1185 #ifdef USE_BLX
1193 return CpuFeatures::IsSupported(MOVW_MOVT_IMMEDIATE_LOADS) && 1186 return CpuFeatures::IsSupported(MOVW_MOVT_IMMEDIATE_LOADS) &&
1194 (assembler == NULL || !assembler->predictable_code_size()); 1187 (assembler == NULL || !assembler->predictable_code_size());
1195 #else 1188 #else
1196 // If not using BLX, all loads from the constant pool cannot be immediate, 1189 // If not using BLX, all loads from the constant pool cannot be immediate,
1197 // because the ldr pc, [pc + #xxxx] used for calls must be a single 1190 // because the ldr pc, [pc + #xxxx] used for calls must be a single
1198 // instruction and cannot be easily distinguished out of context from 1191 // instruction and cannot be easily distinguished out of context from
1199 // other loads that could use movw/movt. 1192 // other loads that could use movw/movt.
(...skipping 292 matching lines...) Expand 10 before | Expand all | Expand 10 after
1492 UseConstantPoolMode mode = USE_CONSTANT_POOL); 1485 UseConstantPoolMode mode = USE_CONSTANT_POOL);
1493 1486
1494 friend class RegExpMacroAssemblerARM; 1487 friend class RegExpMacroAssemblerARM;
1495 friend class RelocInfo; 1488 friend class RelocInfo;
1496 friend class CodePatcher; 1489 friend class CodePatcher;
1497 friend class BlockConstPoolScope; 1490 friend class BlockConstPoolScope;
1498 1491
1499 PositionsRecorder positions_recorder_; 1492 PositionsRecorder positions_recorder_;
1500 1493
1501 bool emit_debug_code_; 1494 bool emit_debug_code_;
1502 bool predictable_code_size_;
1503 1495
1504 friend class PositionsRecorder; 1496 friend class PositionsRecorder;
1505 friend class EnsureSpace; 1497 friend class EnsureSpace;
1506 }; 1498 };
1507 1499
1508 1500
1509 class EnsureSpace BASE_EMBEDDED { 1501 class EnsureSpace BASE_EMBEDDED {
1510 public: 1502 public:
1511 explicit EnsureSpace(Assembler* assembler) { 1503 explicit EnsureSpace(Assembler* assembler) {
1512 assembler->CheckBuffer(); 1504 assembler->CheckBuffer();
1513 } 1505 }
1514 }; 1506 };
1515 1507
1516 1508
1517 class PredictableCodeSizeScope {
1518 public:
1519 explicit PredictableCodeSizeScope(Assembler* assembler)
1520 : asm_(assembler) {
1521 old_value_ = assembler->predictable_code_size();
1522 assembler->set_predictable_code_size(true);
1523 }
1524
1525 ~PredictableCodeSizeScope() {
1526 if (!old_value_) {
1527 asm_->set_predictable_code_size(false);
1528 }
1529 }
1530
1531 private:
1532 Assembler* asm_;
1533 bool old_value_;
1534 };
1535
1536
1537 } } // namespace v8::internal 1509 } } // namespace v8::internal
1538 1510
1539 #endif // V8_ARM_ASSEMBLER_ARM_H_ 1511 #endif // V8_ARM_ASSEMBLER_ARM_H_
OLDNEW
« no previous file with comments | « no previous file | src/arm/assembler-arm.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698