| 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 18 matching lines...) Expand all Loading... |
| 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 | 32 |
| 33 namespace v8 { namespace internal { | 33 namespace v8 { namespace internal { |
| 34 | 34 |
| 35 // ------------------------------------------------------------------------- | 35 // ------------------------------------------------------------------------- |
| 36 // Result implementation. | 36 // Result implementation. |
| 37 | 37 |
| 38 Result::Result(Register reg, CodeGenerator* cgen) | 38 Result::Result(Register reg, CodeGenerator* cgen) |
| 39 : type_(REGISTER), | 39 : static_type_(), |
| 40 cgen_(cgen) { | 40 type_(REGISTER), |
| 41 cgen_(cgen) { |
| 41 data_.reg_ = reg; | 42 data_.reg_ = reg; |
| 42 ASSERT(reg.is_valid()); | 43 ASSERT(reg.is_valid()); |
| 43 cgen_->allocator()->Use(reg); | 44 cgen_->allocator()->Use(reg); |
| 45 } |
| 46 |
| 47 |
| 48 Result::Result(Register reg, CodeGenerator* cgen, StaticType static_type) |
| 49 : static_type_(static_type), |
| 50 type_(REGISTER), |
| 51 cgen_(cgen) { |
| 52 data_.reg_ = reg; |
| 53 ASSERT(reg.is_valid()); |
| 54 cgen_->allocator()->Use(reg); |
| 44 } | 55 } |
| 45 | 56 |
| 46 | 57 |
| 47 void Result::CopyTo(Result* destination) const { | 58 void Result::CopyTo(Result* destination) const { |
| 59 destination->static_type_ = static_type_; |
| 48 destination->type_ = type(); | 60 destination->type_ = type(); |
| 49 destination->cgen_ = cgen_; | 61 destination->cgen_ = cgen_; |
| 50 | 62 |
| 51 if (is_register()) { | 63 if (is_register()) { |
| 52 destination->data_.reg_ = reg(); | 64 destination->data_.reg_ = reg(); |
| 53 cgen_->allocator()->Use(reg()); | 65 cgen_->allocator()->Use(reg()); |
| 54 } else if (is_constant()) { | 66 } else if (is_constant()) { |
| 55 destination->data_.handle_ = data_.handle_; | 67 destination->data_.handle_ = data_.handle_; |
| 56 } else { | 68 } else { |
| 57 ASSERT(!is_valid()); | 69 ASSERT(!is_valid()); |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 111 cgen_->frame()->Spill(target); | 123 cgen_->frame()->Spill(target); |
| 112 ASSERT(!is_used(target)); | 124 ASSERT(!is_used(target)); |
| 113 return Result(target, cgen_); | 125 return Result(target, cgen_); |
| 114 } | 126 } |
| 115 // Otherwise (if it's referenced outside the frame) we cannot allocate it. | 127 // Otherwise (if it's referenced outside the frame) we cannot allocate it. |
| 116 return Result(cgen_); | 128 return Result(cgen_); |
| 117 } | 129 } |
| 118 | 130 |
| 119 | 131 |
| 120 } } // namespace v8::internal | 132 } } // namespace v8::internal |
| OLD | NEW |