| 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 255 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 266 // The arguments are spilled. | 266 // The arguments are spilled. |
| 267 for (int i = arg_base_index; i < elements_.length(); i++) { | 267 for (int i = arg_base_index; i < elements_.length(); i++) { |
| 268 SpillElementAt(i); | 268 SpillElementAt(i); |
| 269 } | 269 } |
| 270 | 270 |
| 271 // Forget the frame elements that will be popped by the call. | 271 // Forget the frame elements that will be popped by the call. |
| 272 Forget(frame_arg_count); | 272 Forget(frame_arg_count); |
| 273 } | 273 } |
| 274 | 274 |
| 275 | 275 |
| 276 bool VirtualFrame::RequiresMergeCode() { | |
| 277 // A frame requires code to be generated to make the frame mergable if | |
| 278 // there are duplicated non-synched registers or else valid elements not | |
| 279 // in a (memory or register) location in the frame. We look for valid | |
| 280 // non-synced non-location elements and count occurrences of non-synced | |
| 281 // registers. | |
| 282 RegisterFile non_synced_regs; | |
| 283 for (int i = 0; i < elements_.length(); i++) { | |
| 284 FrameElement element = elements_[i]; | |
| 285 if (element.is_valid() && !element.is_synced()) { | |
| 286 if (element.is_register()) { | |
| 287 non_synced_regs.Use(elements_[i].reg()); | |
| 288 } else if (!element.is_memory()) { | |
| 289 // Not memory or register and not synced. | |
| 290 return true; | |
| 291 } | |
| 292 } | |
| 293 } | |
| 294 | |
| 295 for (int i = 0; i < RegisterFile::kNumRegisters; i++) { | |
| 296 if (non_synced_regs.count(i) > 1) { | |
| 297 return true; | |
| 298 } | |
| 299 } | |
| 300 | |
| 301 return false; | |
| 302 } | |
| 303 | |
| 304 | |
| 305 void VirtualFrame::MakeMergable() { | 276 void VirtualFrame::MakeMergable() { |
| 306 Comment cmnt(masm_, "[ Make frame mergable"); | 277 Comment cmnt(masm_, "[ Make frame mergable"); |
| 307 // We should always be merging the code generator's current frame to an | 278 // We should always be merging the code generator's current frame to an |
| 308 // expected frame. | 279 // expected frame. |
| 309 ASSERT(cgen_->frame() == this); | 280 ASSERT(cgen_->frame() == this); |
| 310 ASSERT(cgen_->HasValidEntryRegisters()); | 281 ASSERT(cgen_->HasValidEntryRegisters()); |
| 311 | 282 |
| 312 // Remove constants from the frame and ensure that no registers are | 283 // Remove constants from the frame and ensure that no registers are |
| 313 // multiply referenced within the frame. Allocate elements to their new | 284 // multiply referenced within the frame. Allocate elements to their new |
| 314 // locations from the top down so that the topmost elements have a chance | 285 // locations from the top down so that the topmost elements have a chance |
| (...skipping 742 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1057 return false; | 1028 return false; |
| 1058 } | 1029 } |
| 1059 } | 1030 } |
| 1060 return true; | 1031 return true; |
| 1061 } | 1032 } |
| 1062 #endif | 1033 #endif |
| 1063 | 1034 |
| 1064 #undef __ | 1035 #undef __ |
| 1065 | 1036 |
| 1066 } } // namespace v8::internal | 1037 } } // namespace v8::internal |
| OLD | NEW |