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/register-allocator.cc

Issue 668151: Make more use of the NumberInfo data.... (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
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
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 "register-allocator-inl.h" 31 #include "register-allocator-inl.h"
32 #include "virtual-frame-inl.h" 32 #include "virtual-frame-inl.h"
33 33
34 namespace v8 { 34 namespace v8 {
35 namespace internal { 35 namespace internal {
36 36
37 // ------------------------------------------------------------------------- 37 // -------------------------------------------------------------------------
38 // Result implementation. 38 // Result implementation.
39 39
40 40
41 Result::Result(Register reg, NumberInfo::Type info) { 41 Result::Result(Register reg, NumberInfo info) {
42 ASSERT(reg.is_valid() && !RegisterAllocator::IsReserved(reg)); 42 ASSERT(reg.is_valid() && !RegisterAllocator::IsReserved(reg));
43 CodeGeneratorScope::Current()->allocator()->Use(reg); 43 CodeGeneratorScope::Current()->allocator()->Use(reg);
44 value_ = TypeField::encode(REGISTER) 44 value_ = TypeField::encode(REGISTER)
45 | NumberInfoField::encode(info) 45 | NumberInfoField::encode(info.ToInt())
46 | DataField::encode(reg.code_); 46 | DataField::encode(reg.code_);
47 } 47 }
48 48
49 49
50 Result::ZoneObjectList* Result::ConstantList() { 50 Result::ZoneObjectList* Result::ConstantList() {
51 static ZoneObjectList list(10); 51 static ZoneObjectList list(10);
52 return &list; 52 return &list;
53 } 53 }
54 54
55 55
56 NumberInfo::Type Result::number_info() { 56 NumberInfo Result::number_info() const {
fschneider 2010/03/05 15:01:07 Move this to register-allocator-inl.h.
57 ASSERT(is_valid()); 57 ASSERT(is_valid());
58 if (!is_constant()) return NumberInfoField::decode(value_); 58 if (!is_constant()) return NumberInfo::FromInt(NumberInfoField::decode(value_) );
fschneider 2010/03/05 15:01:07 Long line.
59 Handle<Object> value = handle(); 59 Handle<Object> value = handle();
60 if (value->IsSmi()) return NumberInfo::kSmi; 60 if (value->IsSmi()) return NumberInfo::Smi();
61 if (value->IsHeapNumber()) return NumberInfo::kHeapNumber; 61 if (value->IsHeapNumber()) return NumberInfo::HeapNumber();
62 return NumberInfo::kUnknown; 62 return NumberInfo::Unknown();
63 } 63 }
64 64
65 65
66 void Result::set_number_info(NumberInfo::Type info) { 66 void Result::set_number_info(NumberInfo info) {
fschneider 2010/03/05 15:01:07 Move this to register-allocator-inl.h.
67 ASSERT(is_valid()); 67 ASSERT(is_valid());
68 value_ = value_ & ~NumberInfoField::mask(); 68 value_ &= ~NumberInfoField::mask();
69 value_ = value_ | NumberInfoField::encode(info); 69 value_ |= NumberInfoField::encode(info.ToInt());
70 } 70 }
71 71
72 72
73 // ------------------------------------------------------------------------- 73 // -------------------------------------------------------------------------
74 // RegisterAllocator implementation. 74 // RegisterAllocator implementation.
75 75
76 76
77 Result RegisterAllocator::AllocateWithoutSpilling() { 77 Result RegisterAllocator::AllocateWithoutSpilling() {
78 // Return the first free register, if any. 78 // Return the first free register, if any.
79 int num = registers_.ScanForFreeRegister(); 79 int num = registers_.ScanForFreeRegister();
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
111 cgen_->frame()->Spill(target); 111 cgen_->frame()->Spill(target);
112 ASSERT(!is_used(target)); 112 ASSERT(!is_used(target));
113 return Result(target); 113 return Result(target);
114 } 114 }
115 // Otherwise (if it's referenced outside the frame) we cannot allocate it. 115 // Otherwise (if it's referenced outside the frame) we cannot allocate it.
116 return Result(); 116 return Result();
117 } 117 }
118 118
119 119
120 } } // namespace v8::internal 120 } } // namespace v8::internal
OLDNEW
« src/register-allocator.h ('K') | « src/register-allocator.h ('k') | src/virtual-frame.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698