OLD | NEW |
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 26 matching lines...) Expand all Loading... |
37 // Result implementation. | 37 // Result implementation. |
38 | 38 |
39 | 39 |
40 Result::Result(Register reg) { | 40 Result::Result(Register reg) { |
41 ASSERT(reg.is_valid() && !RegisterAllocator::IsReserved(reg)); | 41 ASSERT(reg.is_valid() && !RegisterAllocator::IsReserved(reg)); |
42 CodeGeneratorScope::Current()->allocator()->Use(reg); | 42 CodeGeneratorScope::Current()->allocator()->Use(reg); |
43 value_ = TypeField::encode(REGISTER) | DataField::encode(reg.code_); | 43 value_ = TypeField::encode(REGISTER) | DataField::encode(reg.code_); |
44 } | 44 } |
45 | 45 |
46 | 46 |
| 47 Result::ZoneObjectList* Result::ConstantList() { |
| 48 static ZoneObjectList list(10); |
| 49 return &list; |
| 50 } |
| 51 |
| 52 |
47 // ------------------------------------------------------------------------- | 53 // ------------------------------------------------------------------------- |
48 // RegisterAllocator implementation. | 54 // RegisterAllocator implementation. |
49 | 55 |
50 | 56 |
51 Result RegisterAllocator::AllocateWithoutSpilling() { | 57 Result RegisterAllocator::AllocateWithoutSpilling() { |
52 // Return the first free register, if any. | 58 // Return the first free register, if any. |
53 int num = registers_.ScanForFreeRegister(); | 59 int num = registers_.ScanForFreeRegister(); |
54 if (num == RegisterAllocator::kInvalidRegister) { | 60 if (num == RegisterAllocator::kInvalidRegister) { |
55 return Result(); | 61 return Result(); |
56 } | 62 } |
(...skipping 28 matching lines...) Expand all Loading... |
85 cgen_->frame()->Spill(target); | 91 cgen_->frame()->Spill(target); |
86 ASSERT(!is_used(target)); | 92 ASSERT(!is_used(target)); |
87 return Result(target); | 93 return Result(target); |
88 } | 94 } |
89 // Otherwise (if it's referenced outside the frame) we cannot allocate it. | 95 // Otherwise (if it's referenced outside the frame) we cannot allocate it. |
90 return Result(); | 96 return Result(); |
91 } | 97 } |
92 | 98 |
93 | 99 |
94 } } // namespace v8::internal | 100 } } // namespace v8::internal |
OLD | NEW |