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

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

Issue 585009: Eliminate unnecessary depencencies in some header files.... (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: Created 10 years, 10 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/register-allocator.h ('k') | no next file » | 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 30 matching lines...) Expand all
41 #elif V8_TARGET_ARCH_MIPS 41 #elif V8_TARGET_ARCH_MIPS
42 #include "mips/register-allocator-mips-inl.h" 42 #include "mips/register-allocator-mips-inl.h"
43 #else 43 #else
44 #error Unsupported target architecture. 44 #error Unsupported target architecture.
45 #endif 45 #endif
46 46
47 47
48 namespace v8 { 48 namespace v8 {
49 namespace internal { 49 namespace internal {
50 50
51 Result::Result(const Result& other) {
52 other.CopyTo(this);
53 }
54
55
56 Result& Result::operator=(const Result& other) {
57 if (this != &other) {
58 Unuse();
59 other.CopyTo(this);
60 }
61 return *this;
62 }
63
64
51 Result::~Result() { 65 Result::~Result() {
52 if (is_register()) { 66 if (is_register()) {
53 CodeGeneratorScope::Current()->allocator()->Unuse(reg()); 67 CodeGeneratorScope::Current()->allocator()->Unuse(reg());
54 } 68 }
55 } 69 }
56 70
57 71
58 void Result::Unuse() { 72 void Result::Unuse() {
59 if (is_register()) { 73 if (is_register()) {
60 CodeGeneratorScope::Current()->allocator()->Unuse(reg()); 74 CodeGeneratorScope::Current()->allocator()->Unuse(reg());
61 } 75 }
62 invalidate(); 76 invalidate();
63 } 77 }
64 78
65 79
66 void Result::CopyTo(Result* destination) const { 80 void Result::CopyTo(Result* destination) const {
67 destination->value_ = value_; 81 destination->value_ = value_;
68 if (is_register()) { 82 if (is_register()) {
69 CodeGeneratorScope::Current()->allocator()->Use(reg()); 83 CodeGeneratorScope::Current()->allocator()->Use(reg());
70 } 84 }
71 } 85 }
72 86
73 87
88 bool RegisterAllocator::is_used(Register reg) {
89 return registers_.is_used(ToNumber(reg));
90 }
91
92
93 int RegisterAllocator::count(Register reg) {
94 return registers_.count(ToNumber(reg));
95 }
96
97
98 void RegisterAllocator::Use(Register reg) {
99 registers_.Use(ToNumber(reg));
100 }
101
102
103 void RegisterAllocator::Unuse(Register reg) {
104 registers_.Unuse(ToNumber(reg));
105 }
106
74 } } // namespace v8::internal 107 } } // namespace v8::internal
75 108
76 #endif // V8_REGISTER_ALLOCATOR_INL_H_ 109 #endif // V8_REGISTER_ALLOCATOR_INL_H_
OLDNEW
« no previous file with comments | « src/register-allocator.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698