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

Side by Side Diff: src/x64/register-allocator-x64-inl.h

Issue 2885018: X64: Added register holding Smi::FromInt(1). (Closed)
Patch Set: Addressed review comments Created 10 years, 5 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
« no previous file with comments | « src/x64/register-allocator-x64.h ('k') | test/cctest/test-macro-assembler-x64.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 2009 the V8 project authors. All rights reserved. 1 // Copyright 2009 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 20 matching lines...) Expand all
31 #include "v8.h" 31 #include "v8.h"
32 32
33 namespace v8 { 33 namespace v8 {
34 namespace internal { 34 namespace internal {
35 35
36 // ------------------------------------------------------------------------- 36 // -------------------------------------------------------------------------
37 // RegisterAllocator implementation. 37 // RegisterAllocator implementation.
38 38
39 bool RegisterAllocator::IsReserved(Register reg) { 39 bool RegisterAllocator::IsReserved(Register reg) {
40 return reg.is(rsp) || reg.is(rbp) || reg.is(rsi) || 40 return reg.is(rsp) || reg.is(rbp) || reg.is(rsi) ||
41 reg.is(kScratchRegister) || reg.is(kRootRegister); 41 reg.is(kScratchRegister) || reg.is(kRootRegister) ||
42 reg.is(kSmiConstantRegister);
42 } 43 }
43 44
44 45
45 // The register allocator uses small integers to represent the 46 // The register allocator uses small integers to represent the
46 // non-reserved assembler registers. 47 // non-reserved assembler registers.
47 int RegisterAllocator::ToNumber(Register reg) { 48 int RegisterAllocator::ToNumber(Register reg) {
48 ASSERT(reg.is_valid() && !IsReserved(reg)); 49 ASSERT(reg.is_valid() && !IsReserved(reg));
49 const int kNumbers[] = { 50 const int kNumbers[] = {
50 0, // rax 51 0, // rax
51 2, // rcx 52 2, // rcx
52 3, // rdx 53 3, // rdx
53 1, // rbx 54 1, // rbx
54 -1, // rsp Stack pointer. 55 -1, // rsp Stack pointer.
55 -1, // rbp Frame pointer. 56 -1, // rbp Frame pointer.
56 -1, // rsi Context. 57 -1, // rsi Context.
57 4, // rdi 58 4, // rdi
58 5, // r8 59 5, // r8
59 6, // r9 60 6, // r9
60 -1, // r10 Scratch register. 61 -1, // r10 Scratch register.
61 9, // r11 62 8, // r11
62 10, // r12 63 9, // r12
63 -1, // r13 Roots array. This is callee saved. 64 -1, // r13 Roots array. This is callee saved.
64 7, // r14 65 7, // r14
65 8 // r15 66 -1 // r15 Smi constant register.
66 }; 67 };
67 return kNumbers[reg.code()]; 68 return kNumbers[reg.code()];
68 } 69 }
69 70
70 71
71 Register RegisterAllocator::ToRegister(int num) { 72 Register RegisterAllocator::ToRegister(int num) {
72 ASSERT(num >= 0 && num < kNumRegisters); 73 ASSERT(num >= 0 && num < kNumRegisters);
73 const Register kRegisters[] = 74 const Register kRegisters[] =
74 { rax, rbx, rcx, rdx, rdi, r8, r9, r14, r15, r11, r12 }; 75 { rax, rbx, rcx, rdx, rdi, r8, r9, r14, r11, r12 };
75 return kRegisters[num]; 76 return kRegisters[num];
76 } 77 }
77 78
78 79
79 void RegisterAllocator::Initialize() { 80 void RegisterAllocator::Initialize() {
80 Reset(); 81 Reset();
81 // The non-reserved rdi register is live on JS function entry. 82 // The non-reserved rdi register is live on JS function entry.
82 Use(rdi); // JS function. 83 Use(rdi); // JS function.
83 } 84 }
84 } } // namespace v8::internal 85 } } // namespace v8::internal
85 86
86 #endif // V8_X64_REGISTER_ALLOCATOR_X64_INL_H_ 87 #endif // V8_X64_REGISTER_ALLOCATOR_X64_INL_H_
OLDNEW
« no previous file with comments | « src/x64/register-allocator-x64.h ('k') | test/cctest/test-macro-assembler-x64.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698