| OLD | NEW |
| 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 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 59 // forces initialization stubs in MSVC, making us dependent on initialization | 59 // forces initialization stubs in MSVC, making us dependent on initialization |
| 60 // order. | 60 // order. |
| 61 // | 61 // |
| 62 // 3) By not using an enum, we are possibly preventing the compiler from | 62 // 3) By not using an enum, we are possibly preventing the compiler from |
| 63 // doing certain constant folds, which may significantly reduce the | 63 // doing certain constant folds, which may significantly reduce the |
| 64 // code generated for some assembly instructions (because they boil down | 64 // code generated for some assembly instructions (because they boil down |
| 65 // to a few constants). If this is a problem, we could change the code | 65 // to a few constants). If this is a problem, we could change the code |
| 66 // such that we use an enum in optimized mode, and the struct in debug | 66 // such that we use an enum in optimized mode, and the struct in debug |
| 67 // mode. This way we get the compile-time error checking in debug mode | 67 // mode. This way we get the compile-time error checking in debug mode |
| 68 // and best performance in optimized code. | 68 // and best performance in optimized code. |
| 69 // | 69 |
| 70 // Core register | 70 // Core register |
| 71 struct Register { | 71 struct Register { |
| 72 static const int kNumRegisters = 16; | 72 static const int kNumRegisters = 16; |
| 73 static const int kNumAllocatableRegisters = 8; | 73 static const int kNumAllocatableRegisters = 8; |
| 74 | 74 |
| 75 static int ToAllocationIndex(Register reg) { | 75 static int ToAllocationIndex(Register reg) { |
| 76 ASSERT(reg.code() < kNumAllocatableRegisters); |
| 76 return reg.code(); | 77 return reg.code(); |
| 77 } | 78 } |
| 78 | 79 |
| 79 static Register FromAllocationIndex(int index) { | 80 static Register FromAllocationIndex(int index) { |
| 80 ASSERT(index >= 0 && index < kNumAllocatableRegisters); | 81 ASSERT(index >= 0 && index < kNumAllocatableRegisters); |
| 81 return from_code(index); | 82 return from_code(index); |
| 82 } | 83 } |
| 83 | 84 |
| 84 static const char* AllocationIndexToString(int index) { | 85 static const char* AllocationIndexToString(int index) { |
| 85 ASSERT(index >= 0 && index < kNumAllocatableRegisters); | 86 ASSERT(index >= 0 && index < kNumAllocatableRegisters); |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 125 | 126 |
| 126 const Register r0 = { 0 }; | 127 const Register r0 = { 0 }; |
| 127 const Register r1 = { 1 }; | 128 const Register r1 = { 1 }; |
| 128 const Register r2 = { 2 }; | 129 const Register r2 = { 2 }; |
| 129 const Register r3 = { 3 }; | 130 const Register r3 = { 3 }; |
| 130 const Register r4 = { 4 }; | 131 const Register r4 = { 4 }; |
| 131 const Register r5 = { 5 }; | 132 const Register r5 = { 5 }; |
| 132 const Register r6 = { 6 }; | 133 const Register r6 = { 6 }; |
| 133 const Register r7 = { 7 }; | 134 const Register r7 = { 7 }; |
| 134 const Register r8 = { 8 }; // Used as context register. | 135 const Register r8 = { 8 }; // Used as context register. |
| 135 const Register r9 = { 9 }; | 136 const Register r9 = { 9 }; // Used as lithium codegen scratch register. |
| 136 const Register r10 = { 10 }; // Used as roots register. | 137 const Register r10 = { 10 }; // Used as roots register. |
| 137 const Register fp = { 11 }; | 138 const Register fp = { 11 }; |
| 138 const Register ip = { 12 }; | 139 const Register ip = { 12 }; |
| 139 const Register sp = { 13 }; | 140 const Register sp = { 13 }; |
| 140 const Register lr = { 14 }; | 141 const Register lr = { 14 }; |
| 141 const Register pc = { 15 }; | 142 const Register pc = { 15 }; |
| 142 | 143 |
| 143 // Single word VFP register. | 144 // Single word VFP register. |
| 144 struct SwVfpRegister { | 145 struct SwVfpRegister { |
| 145 bool is_valid() const { return 0 <= code_ && code_ < 32; } | 146 bool is_valid() const { return 0 <= code_ && code_ < 32; } |
| (...skipping 1265 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1411 public: | 1412 public: |
| 1412 explicit EnsureSpace(Assembler* assembler) { | 1413 explicit EnsureSpace(Assembler* assembler) { |
| 1413 assembler->CheckBuffer(); | 1414 assembler->CheckBuffer(); |
| 1414 } | 1415 } |
| 1415 }; | 1416 }; |
| 1416 | 1417 |
| 1417 | 1418 |
| 1418 } } // namespace v8::internal | 1419 } } // namespace v8::internal |
| 1419 | 1420 |
| 1420 #endif // V8_ARM_ASSEMBLER_ARM_H_ | 1421 #endif // V8_ARM_ASSEMBLER_ARM_H_ |
| OLD | NEW |