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

Side by Side Diff: runtime/vm/constants_mips.h

Issue 20369003: Implements far branch targets for MIPS. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 7 years, 4 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 (c) 2013, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 #ifndef VM_CONSTANTS_MIPS_H_ 5 #ifndef VM_CONSTANTS_MIPS_H_
6 #define VM_CONSTANTS_MIPS_H_ 6 #define VM_CONSTANTS_MIPS_H_
7 7
8 #include "platform/assert.h" 8 #include "platform/assert.h"
9 9
10 namespace dart { 10 namespace dart {
(...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after
179 const Register TMP = TMP1; // Arch independent flow graph compiler needs a 179 const Register TMP = TMP1; // Arch independent flow graph compiler needs a
180 // Register called TMP. 180 // Register called TMP.
181 const Register CTX = S6; // Caches current context in generated code. 181 const Register CTX = S6; // Caches current context in generated code.
182 const Register PP = S7; // Caches object pool pointer in generated code. 182 const Register PP = S7; // Caches object pool pointer in generated code.
183 const Register SPREG = SP; // Stack pointer register. 183 const Register SPREG = SP; // Stack pointer register.
184 const Register FPREG = FP; // Frame pointer register. 184 const Register FPREG = FP; // Frame pointer register.
185 const Register ICREG = S5; // IC data register. 185 const Register ICREG = S5; // IC data register.
186 186
187 // The code that generates a comparison can be far away from the code that 187 // The code that generates a comparison can be far away from the code that
188 // generates the branch that uses the result of that comparison. In this case, 188 // generates the branch that uses the result of that comparison. In this case,
189 // CMPRES is used for the result of the comparison. 189 // CMPRES1 and CMPRES2 are used for the results of the comparison. We need two
190 const Register CMPRES = T9; 190 // since TMP is clobbered by a far branch.
191 const Register CMPRES1 = T8;
192 const Register CMPRES2 = T9;
193 const Register CMPRES = CMPRES1;
191 194
192 // Exception object is passed in this register to the catch handlers when an 195 // Exception object is passed in this register to the catch handlers when an
193 // exception is thrown. 196 // exception is thrown.
194 const Register kExceptionObjectReg = V0; 197 const Register kExceptionObjectReg = V0;
195 198
196 // Stack trace object is passed in this register to the catch handlers when 199 // Stack trace object is passed in this register to the catch handlers when
197 // an exception is thrown. 200 // an exception is thrown.
198 const Register kStackTraceObjectReg = V1; 201 const Register kStackTraceObjectReg = V1;
199 202
200 203
(...skipping 296 matching lines...) Expand 10 before | Expand all | Expand 10 after
497 // Read a bit field out of the instruction bits. 500 // Read a bit field out of the instruction bits.
498 inline int32_t Bits(int shift, int count) const { 501 inline int32_t Bits(int shift, int count) const {
499 return (InstructionBits() >> shift) & ((1 << count) - 1); 502 return (InstructionBits() >> shift) & ((1 << count) - 1);
500 } 503 }
501 504
502 // Accessors to the different named fields used in the MIPS encoding. 505 // Accessors to the different named fields used in the MIPS encoding.
503 inline Opcode OpcodeField() const { 506 inline Opcode OpcodeField() const {
504 return static_cast<Opcode>(Bits(kOpcodeShift, kOpcodeBits)); 507 return static_cast<Opcode>(Bits(kOpcodeShift, kOpcodeBits));
505 } 508 }
506 509
510 inline void SetOpcodeField(Opcode b) {
511 int32_t instr = InstructionBits();
512 int32_t mask = ((1 << kOpcodeBits) - 1) << kOpcodeShift;
513 SetInstructionBits((b << kOpcodeShift) | (instr & ~mask));
514 }
515
507 inline Register RsField() const { 516 inline Register RsField() const {
508 return static_cast<Register>(Bits(kRsShift, kRsBits)); 517 return static_cast<Register>(Bits(kRsShift, kRsBits));
509 } 518 }
510 519
511 inline Register RtField() const { 520 inline Register RtField() const {
512 return static_cast<Register>(Bits(kRtShift, kRtBits)); 521 return static_cast<Register>(Bits(kRtShift, kRtBits));
513 } 522 }
514 523
515 inline Register RdField() const { 524 inline Register RdField() const {
516 return static_cast<Register>(Bits(kRdShift, kRdBits)); 525 return static_cast<Register>(Bits(kRdShift, kRdBits));
(...skipping 29 matching lines...) Expand all
546 } 555 }
547 556
548 inline SpecialFunction FunctionField() const { 557 inline SpecialFunction FunctionField() const {
549 return static_cast<SpecialFunction>(Bits(kFunctionShift, kFunctionBits)); 558 return static_cast<SpecialFunction>(Bits(kFunctionShift, kFunctionBits));
550 } 559 }
551 560
552 inline RtRegImm RegImmFnField() const { 561 inline RtRegImm RegImmFnField() const {
553 return static_cast<RtRegImm>(Bits(kRtShift, kRtBits)); 562 return static_cast<RtRegImm>(Bits(kRtShift, kRtBits));
554 } 563 }
555 564
565 inline void SetRegImmFnField(RtRegImm b) {
566 int32_t instr = InstructionBits();
567 int32_t mask = ((1 << kRtBits) - 1) << kRtShift;
568 SetInstructionBits((b << kRtShift) | (instr & ~mask));
569 }
570
556 inline bool IsBreakPoint() { 571 inline bool IsBreakPoint() {
557 return (OpcodeField() == SPECIAL) && (FunctionField() == BREAK); 572 return (OpcodeField() == SPECIAL) && (FunctionField() == BREAK);
558 } 573 }
559 574
560 inline Cop1Function Cop1FunctionField() const { 575 inline Cop1Function Cop1FunctionField() const {
561 return static_cast<Cop1Function>(Bits(kCop1FnShift, kCop1FnBits)); 576 return static_cast<Cop1Function>(Bits(kCop1FnShift, kCop1FnBits));
562 } 577 }
563 578
564 inline Cop1Sub Cop1SubField() const { 579 inline Cop1Sub Cop1SubField() const {
565 return static_cast<Cop1Sub>(Bits(kCop1SubShift, kCop1SubBits)); 580 return static_cast<Cop1Sub>(Bits(kCop1SubShift, kCop1SubBits));
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
599 #endif // defined(DEBUG) 614 #endif // defined(DEBUG)
600 615
601 private: 616 private:
602 DISALLOW_ALLOCATION(); 617 DISALLOW_ALLOCATION();
603 DISALLOW_IMPLICIT_CONSTRUCTORS(Instr); 618 DISALLOW_IMPLICIT_CONSTRUCTORS(Instr);
604 }; 619 };
605 620
606 } // namespace dart 621 } // namespace dart
607 622
608 #endif // VM_CONSTANTS_MIPS_H_ 623 #endif // VM_CONSTANTS_MIPS_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698