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

Side by Side Diff: src/register-allocator.cc

Issue 844006: Merge changes up to V8 version 2.1.3 into the partial snapshots (Closed) Base URL: http://v8.googlecode.com/svn/branches/experimental/partial_snapshots/
Patch Set: Created 10 years, 9 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') | src/register-allocator-inl.h » ('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 11 matching lines...) Expand all
22 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 22 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
23 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 23 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
24 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 24 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 25 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
26 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 26 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27 27
28 #include "v8.h" 28 #include "v8.h"
29 29
30 #include "codegen-inl.h" 30 #include "codegen-inl.h"
31 #include "register-allocator-inl.h" 31 #include "register-allocator-inl.h"
32 #include "virtual-frame-inl.h"
32 33
33 namespace v8 { 34 namespace v8 {
34 namespace internal { 35 namespace internal {
35 36
36 // ------------------------------------------------------------------------- 37 // -------------------------------------------------------------------------
37 // Result implementation. 38 // Result implementation.
38 39
39 40
40 Result::Result(Register reg, NumberInfo::Type info) { 41 Result::Result(Register reg, NumberInfo info) {
41 ASSERT(reg.is_valid() && !RegisterAllocator::IsReserved(reg)); 42 ASSERT(reg.is_valid() && !RegisterAllocator::IsReserved(reg));
42 CodeGeneratorScope::Current()->allocator()->Use(reg); 43 CodeGeneratorScope::Current()->allocator()->Use(reg);
43 value_ = TypeField::encode(REGISTER) 44 value_ = TypeField::encode(REGISTER)
44 | NumberInfoField::encode(info) 45 | NumberInfoField::encode(info.ToInt())
45 | DataField::encode(reg.code_); 46 | DataField::encode(reg.code_);
46 } 47 }
47 48
48 49
49 Result::ZoneObjectList* Result::ConstantList() { 50 Result::ZoneObjectList* Result::ConstantList() {
50 static ZoneObjectList list(10); 51 static ZoneObjectList list(10);
51 return &list; 52 return &list;
52 } 53 }
53 54
54 55
55 NumberInfo::Type Result::number_info() {
56 ASSERT(is_valid());
57 if (!is_constant()) return NumberInfoField::decode(value_);
58 Handle<Object> value = handle();
59 if (value->IsSmi()) return NumberInfo::kSmi;
60 if (value->IsHeapNumber()) return NumberInfo::kHeapNumber;
61 return NumberInfo::kUnknown;
62 }
63
64
65 void Result::set_number_info(NumberInfo::Type info) {
66 ASSERT(is_valid());
67 value_ = value_ & ~NumberInfoField::mask();
68 value_ = value_ | NumberInfoField::encode(info);
69 }
70
71
72 // ------------------------------------------------------------------------- 56 // -------------------------------------------------------------------------
73 // RegisterAllocator implementation. 57 // RegisterAllocator implementation.
74 58
75 59
76 Result RegisterAllocator::AllocateWithoutSpilling() { 60 Result RegisterAllocator::AllocateWithoutSpilling() {
77 // Return the first free register, if any. 61 // Return the first free register, if any.
78 int num = registers_.ScanForFreeRegister(); 62 int num = registers_.ScanForFreeRegister();
79 if (num == RegisterAllocator::kInvalidRegister) { 63 if (num == RegisterAllocator::kInvalidRegister) {
80 return Result(); 64 return Result();
81 } 65 }
(...skipping 28 matching lines...) Expand all
110 cgen_->frame()->Spill(target); 94 cgen_->frame()->Spill(target);
111 ASSERT(!is_used(target)); 95 ASSERT(!is_used(target));
112 return Result(target); 96 return Result(target);
113 } 97 }
114 // Otherwise (if it's referenced outside the frame) we cannot allocate it. 98 // Otherwise (if it's referenced outside the frame) we cannot allocate it.
115 return Result(); 99 return Result();
116 } 100 }
117 101
118 102
119 } } // namespace v8::internal 103 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/register-allocator.h ('k') | src/register-allocator-inl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698