| 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 19 matching lines...) Expand all Loading... |
| 30 #include "codegen-inl.h" | 30 #include "codegen-inl.h" |
| 31 #include "register-allocator-inl.h" | 31 #include "register-allocator-inl.h" |
| 32 #include "scopes.h" | 32 #include "scopes.h" |
| 33 #include "virtual-frame-inl.h" | 33 #include "virtual-frame-inl.h" |
| 34 | 34 |
| 35 namespace v8 { | 35 namespace v8 { |
| 36 namespace internal { | 36 namespace internal { |
| 37 | 37 |
| 38 #define __ ACCESS_MASM(masm()) | 38 #define __ ACCESS_MASM(masm()) |
| 39 | 39 |
| 40 // ------------------------------------------------------------------------- | |
| 41 // VirtualFrame implementation. | |
| 42 | |
| 43 // On entry to a function, the virtual frame already contains the receiver, | |
| 44 // the parameters, and a return address. All frame elements are in memory. | |
| 45 VirtualFrame::VirtualFrame() | |
| 46 : elements_(parameter_count() + local_count() + kPreallocatedElements), | |
| 47 stack_pointer_(parameter_count() + 1) { // 0-based index of TOS. | |
| 48 for (int i = 0; i <= stack_pointer_; i++) { | |
| 49 elements_.Add(FrameElement::MemoryElement(NumberInfo::kUnknown)); | |
| 50 } | |
| 51 for (int i = 0; i < RegisterAllocator::kNumRegisters; i++) { | |
| 52 register_locations_[i] = kIllegalIndex; | |
| 53 } | |
| 54 } | |
| 55 | |
| 56 | |
| 57 void VirtualFrame::SyncElementBelowStackPointer(int index) { | 40 void VirtualFrame::SyncElementBelowStackPointer(int index) { |
| 58 // Emit code to write elements below the stack pointer to their | 41 // Emit code to write elements below the stack pointer to their |
| 59 // (already allocated) stack address. | 42 // (already allocated) stack address. |
| 60 ASSERT(index <= stack_pointer_); | 43 ASSERT(index <= stack_pointer_); |
| 61 FrameElement element = elements_[index]; | 44 FrameElement element = elements_[index]; |
| 62 ASSERT(!element.is_synced()); | 45 ASSERT(!element.is_synced()); |
| 63 switch (element.type()) { | 46 switch (element.type()) { |
| 64 case FrameElement::INVALID: | 47 case FrameElement::INVALID: |
| 65 break; | 48 break; |
| 66 | 49 |
| (...skipping 1127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1194 return; | 1177 return; |
| 1195 } | 1178 } |
| 1196 | 1179 |
| 1197 UNREACHABLE(); | 1180 UNREACHABLE(); |
| 1198 } | 1181 } |
| 1199 | 1182 |
| 1200 | 1183 |
| 1201 #undef __ | 1184 #undef __ |
| 1202 | 1185 |
| 1203 } } // namespace v8::internal | 1186 } } // namespace v8::internal |
| OLD | NEW |