| 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 211 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 222 | 222 |
| 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) { |
| 233 // No code needs to be generated to invalidate valid elements. No |
| 234 // code needs to be generated to move values to memory if they are |
| 235 // already synced. |
| 236 for (int i = 0; i < elements_.length(); i++) { |
| 237 FrameElement source = elements_[i]; |
| 238 FrameElement target = expected->elements_[i]; |
| 239 if (!target.is_valid() || |
| 240 (target.is_memory() && !source.is_memory() && source.is_synced())) { |
| 241 if (source.is_register()) { |
| 242 // If the frame is the code generator's current frame, we have |
| 243 // to decrement both the frame-internal and global register |
| 244 // counts. |
| 245 if (cgen_->frame() == this) { |
| 246 Unuse(source.reg()); |
| 247 } else { |
| 248 frame_registers_.Unuse(source.reg()); |
| 249 } |
| 250 } |
| 251 elements_[i] = target; |
| 252 } |
| 253 } |
| 254 } |
| 255 |
| 256 |
| 232 void VirtualFrame::PrepareForCall(int spilled_args, int dropped_args) { | 257 void VirtualFrame::PrepareForCall(int spilled_args, int dropped_args) { |
| 233 ASSERT(height() >= dropped_args); | 258 ASSERT(height() >= dropped_args); |
| 234 ASSERT(height() >= spilled_args); | 259 ASSERT(height() >= spilled_args); |
| 235 ASSERT(dropped_args <= spilled_args); | 260 ASSERT(dropped_args <= spilled_args); |
| 236 | 261 |
| 237 int arg_base_index = elements_.length() - spilled_args; | 262 int arg_base_index = elements_.length() - spilled_args; |
| 238 // Spill the arguments. We spill from the top down so that the | 263 // Spill the arguments. We spill from the top down so that the |
| 239 // backing stores of register copies will be spilled only after all | 264 // backing stores of register copies will be spilled only after all |
| 240 // the copies are spilled---it is better to spill via a | 265 // the copies are spilled---it is better to spill via a |
| 241 // register-to-memory move than a memory-to-memory move. | 266 // register-to-memory move than a memory-to-memory move. |
| (...skipping 266 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 508 for (int i = 0; i < kNumRegisters; i++) { | 533 for (int i = 0; i < kNumRegisters; i++) { |
| 509 if (frame_registers_.count(i) != other->frame_registers_.count(i)) { | 534 if (frame_registers_.count(i) != other->frame_registers_.count(i)) { |
| 510 return false; | 535 return false; |
| 511 } | 536 } |
| 512 } | 537 } |
| 513 | 538 |
| 514 return true; | 539 return true; |
| 515 } | 540 } |
| 516 | 541 |
| 517 } } // namespace v8::internal | 542 } } // namespace v8::internal |
| OLD | NEW |