| OLD | NEW |
| 1 // Copyright 2008 the V8 project authors. All rights reserved. | 1 // Copyright 2008 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 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 44 | 44 |
| 45 // Construct a Result whose value is a compile-time constant. | 45 // Construct a Result whose value is a compile-time constant. |
| 46 Result(Handle<Object> value, CodeGenerator * cgen) : | 46 Result(Handle<Object> value, CodeGenerator * cgen) : |
| 47 type_(CONSTANT), | 47 type_(CONSTANT), |
| 48 cgen_(cgen) { | 48 cgen_(cgen) { |
| 49 data_.handle_ = value.location(); | 49 data_.handle_ = value.location(); |
| 50 } | 50 } |
| 51 | 51 |
| 52 ~Result() { | 52 ~Result() { |
| 53 // We have called Unuse() before Result goes out of scope. | 53 // We have called Unuse() before Result goes out of scope. |
| 54 ASSERT(reg_.is(no_reg)); | 54 ASSERT(!is_register() || reg().is(no_reg)); |
| 55 } | 55 } |
| 56 | 56 |
| 57 void Unuse(); | 57 void Unuse(); |
| 58 | 58 |
| 59 bool is_register() const { return type() == REGISTER; } | 59 bool is_register() const { return type() == REGISTER; } |
| 60 bool is_constant() const { return type() == CONSTANT; } | 60 bool is_constant() const { return type() == CONSTANT; } |
| 61 | 61 |
| 62 Register reg() const { | 62 Register reg() const { |
| 63 ASSERT(type() == REGISTER); | 63 ASSERT(type() == REGISTER); |
| 64 return data_.reg_; | 64 return data_.reg_; |
| (...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 204 | 204 |
| 205 // Spill a register if possible. Return the register spilled or no_reg if | 205 // Spill a register if possible. Return the register spilled or no_reg if |
| 206 // it was not possible to spill one. | 206 // it was not possible to spill one. |
| 207 Register SpillAnyRegister(); | 207 Register SpillAnyRegister(); |
| 208 | 208 |
| 209 // True if an arbitrary frame of the same size could be merged to this | 209 // True if an arbitrary frame of the same size could be merged to this |
| 210 // one. Requires all values to be in a unique register or memory | 210 // one. Requires all values to be in a unique register or memory |
| 211 // location. | 211 // location. |
| 212 bool IsMergable(); | 212 bool IsMergable(); |
| 213 | 213 |
| 214 // True if making the frame mergable via MakeMergable will generate code. |
| 215 // This differs from !IsMergable() because there are some non-mergable |
| 216 // frames that can be made mergable simply by changing internal state (eg, |
| 217 // forgetting about constants that are synced to memory) without |
| 218 // generating code. |
| 219 bool RequiresMergeCode(); |
| 220 |
| 214 // Ensure that this frame is in a state where an arbitrary frame of the | 221 // Ensure that this frame is in a state where an arbitrary frame of the |
| 215 // right size could be merged to it. May emit code. | 222 // right size could be merged to it. May emit code. |
| 216 void MakeMergable(); | 223 void MakeMergable(); |
| 217 | 224 |
| 218 // Make this virtual frame have a state identical to an expected virtual | 225 // Make this virtual frame have a state identical to an expected virtual |
| 219 // frame. As a side effect, code may be emitted to make this frame match | 226 // frame. As a side effect, code may be emitted to make this frame match |
| 220 // the expected one. | 227 // the expected one. |
| 221 void MergeTo(VirtualFrame* expected); | 228 void MergeTo(VirtualFrame* expected); |
| 222 | 229 |
| 230 // Detach a frame from its code generator, perhaps temporarily. This |
| 231 // tells the register allocator that it is free to use frame-internal |
| 232 // registers. Used when the code generator's frame is switched from this |
| 233 // one to NULL by an unconditional jump. |
| 234 void DetachFromCodeGenerator(); |
| 235 |
| 236 // (Re)attach a frame to its code generator. This informs the register |
| 237 // allocator that the frame-internal register references are active again. |
| 238 // Used when a code generator's frame is switched from NULL to this one by |
| 239 // binding a label. |
| 240 void AttachToCodeGenerator(); |
| 241 |
| 223 // Emit code for the physical JS entry and exit frame sequences. After | 242 // Emit code for the physical JS entry and exit frame sequences. After |
| 224 // calling Enter, the virtual frame is ready for use; and after calling | 243 // calling Enter, the virtual frame is ready for use; and after calling |
| 225 // Exit it should not be used. Note that Enter does not allocate space in | 244 // Exit it should not be used. Note that Enter does not allocate space in |
| 226 // the physical frame for storing frame-allocated locals. | 245 // the physical frame for storing frame-allocated locals. |
| 227 void Enter(); | 246 void Enter(); |
| 228 void Exit(); | 247 void Exit(); |
| 229 | 248 |
| 230 // Allocate and initialize the frame-allocated locals. The eax register | 249 // Allocate and initialize the frame-allocated locals. The eax register |
| 231 // us clobbered. | 250 // us clobbered. |
| 232 void AllocateStackSlots(int count); | 251 void AllocateStackSlots(int count); |
| (...skipping 190 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 423 | 442 |
| 424 // Spill the topmost elements of the frame to memory (eg, they are the | 443 // Spill the topmost elements of the frame to memory (eg, they are the |
| 425 // arguments to a call) and all registers. | 444 // arguments to a call) and all registers. |
| 426 void PrepareForCall(int count); | 445 void PrepareForCall(int count); |
| 427 }; | 446 }; |
| 428 | 447 |
| 429 | 448 |
| 430 } } // namespace v8::internal | 449 } } // namespace v8::internal |
| 431 | 450 |
| 432 #endif // V8_VIRTUAL_FRAME_IA32_H_ | 451 #endif // V8_VIRTUAL_FRAME_IA32_H_ |
| OLD | NEW |