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 22 matching lines...) Expand all Loading... |
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, TypeInfo info) { | 41 Result::Result(Register reg, TypeInfo 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(Isolate::Current())->allocator()->Use(reg); |
44 value_ = TypeField::encode(REGISTER) | 44 value_ = TypeField::encode(REGISTER) |
45 | TypeInfoField::encode(info.ToInt()) | 45 | TypeInfoField::encode(info.ToInt()) |
46 | DataField::encode(reg.code_); | 46 | DataField::encode(reg.code_); |
47 } | 47 } |
48 | 48 |
49 | 49 |
50 Result::ZoneObjectList* Result::ConstantList() { | |
51 static ZoneObjectList list(10); | |
52 return &list; | |
53 } | |
54 | |
55 | |
56 // ------------------------------------------------------------------------- | 50 // ------------------------------------------------------------------------- |
57 // RegisterAllocator implementation. | 51 // RegisterAllocator implementation. |
58 | 52 |
59 | 53 |
60 Result RegisterAllocator::AllocateWithoutSpilling() { | 54 Result RegisterAllocator::AllocateWithoutSpilling() { |
61 // Return the first free register, if any. | 55 // Return the first free register, if any. |
62 int num = registers_.ScanForFreeRegister(); | 56 int num = registers_.ScanForFreeRegister(); |
63 if (num == RegisterAllocator::kInvalidRegister) { | 57 if (num == RegisterAllocator::kInvalidRegister) { |
64 return Result(); | 58 return Result(); |
65 } | 59 } |
(...skipping 29 matching lines...) Expand all Loading... |
95 cgen_->frame()->Spill(target); | 89 cgen_->frame()->Spill(target); |
96 ASSERT(!is_used(RegisterAllocator::ToNumber(target))); | 90 ASSERT(!is_used(RegisterAllocator::ToNumber(target))); |
97 return Result(target); | 91 return Result(target); |
98 } | 92 } |
99 // Otherwise (if it's referenced outside the frame) we cannot allocate it. | 93 // Otherwise (if it's referenced outside the frame) we cannot allocate it. |
100 return Result(); | 94 return Result(); |
101 } | 95 } |
102 | 96 |
103 | 97 |
104 } } // namespace v8::internal | 98 } } // namespace v8::internal |
OLD | NEW |