| 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 212 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 223 | 223 |
| 224 // Make the type of all elements be MEMORY. | 224 // Make the type of all elements be MEMORY. |
| 225 void VirtualFrame::SpillAll() { | 225 void VirtualFrame::SpillAll() { |
| 226 for (int i = 0; i < elements_.length(); i++) { | 226 for (int i = 0; i < elements_.length(); i++) { |
| 227 SpillElementAt(i); | 227 SpillElementAt(i); |
| 228 } | 228 } |
| 229 } | 229 } |
| 230 | 230 |
| 231 | 231 |
| 232 void VirtualFrame::PrepareMergeTo(VirtualFrame* expected) { | 232 void VirtualFrame::PrepareMergeTo(VirtualFrame* expected) { |
| 233 // No code needs to be generated to invalidate valid elements. No | 233 // Perform state changes on this frame that will make merge to the |
| 234 // code needs to be generated to move values to memory if they are | 234 // expected frame simpler or else increase the likelihood that his |
| 235 // already synced. | 235 // frame will match another. |
| 236 for (int i = 0; i < elements_.length(); i++) { | 236 for (int i = 0; i < elements_.length(); i++) { |
| 237 FrameElement source = elements_[i]; | 237 FrameElement source = elements_[i]; |
| 238 FrameElement target = expected->elements_[i]; | 238 FrameElement target = expected->elements_[i]; |
| 239 |
| 239 if (!target.is_valid() || | 240 if (!target.is_valid() || |
| 240 (target.is_memory() && !source.is_memory() && source.is_synced())) { | 241 (target.is_memory() && !source.is_memory() && source.is_synced())) { |
| 242 // No code needs to be generated to invalidate valid elements. |
| 243 // No code needs to be generated to move values to memory if |
| 244 // they are already synced. We perform those moves here, before |
| 245 // merging. |
| 241 if (source.is_register()) { | 246 if (source.is_register()) { |
| 242 // If the frame is the code generator's current frame, we have | 247 // If the frame is the code generator's current frame, we have |
| 243 // to decrement both the frame-internal and global register | 248 // to decrement both the frame-internal and global register |
| 244 // counts. | 249 // counts. |
| 245 if (cgen_->frame() == this) { | 250 if (cgen_->frame() == this) { |
| 246 Unuse(source.reg()); | 251 Unuse(source.reg()); |
| 247 } else { | 252 } else { |
| 248 frame_registers_.Unuse(source.reg()); | 253 frame_registers_.Unuse(source.reg()); |
| 249 } | 254 } |
| 250 } | 255 } |
| 251 elements_[i] = target; | 256 elements_[i] = target; |
| 257 } else if (target.is_register() && !target.is_synced() && |
| 258 !source.is_memory()) { |
| 259 // If an element's target is a register that doesn't need to be |
| 260 // synced, and the element is not in memory, then the sync state |
| 261 // of the element is irrelevant. We clear the sync bit. |
| 262 ASSERT(source.is_valid()); |
| 263 elements_[i].clear_sync(); |
| 252 } | 264 } |
| 253 } | 265 } |
| 254 } | 266 } |
| 255 | 267 |
| 256 | 268 |
| 257 void VirtualFrame::PrepareForCall(int spilled_args, int dropped_args) { | 269 void VirtualFrame::PrepareForCall(int spilled_args, int dropped_args) { |
| 258 ASSERT(height() >= dropped_args); | 270 ASSERT(height() >= dropped_args); |
| 259 ASSERT(height() >= spilled_args); | 271 ASSERT(height() >= spilled_args); |
| 260 ASSERT(dropped_args <= spilled_args); | 272 ASSERT(dropped_args <= spilled_args); |
| 261 | 273 |
| (...skipping 271 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 533 for (int i = 0; i < kNumRegisters; i++) { | 545 for (int i = 0; i < kNumRegisters; i++) { |
| 534 if (frame_registers_.count(i) != other->frame_registers_.count(i)) { | 546 if (frame_registers_.count(i) != other->frame_registers_.count(i)) { |
| 535 return false; | 547 return false; |
| 536 } | 548 } |
| 537 } | 549 } |
| 538 | 550 |
| 539 return true; | 551 return true; |
| 540 } | 552 } |
| 541 | 553 |
| 542 } } // namespace v8::internal | 554 } } // namespace v8::internal |
| OLD | NEW |