| OLD | NEW |
| 1 // Copyright 2010 the V8 project authors. All rights reserved. | 1 // Copyright 2010 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::Enter() { | 40 void VirtualFrame::Enter() { |
| 58 // Registers live on entry to a JS frame: | 41 // Registers live on entry to a JS frame: |
| 59 // rsp: stack pointer, points to return address from this function. | 42 // rsp: stack pointer, points to return address from this function. |
| 60 // rbp: base pointer, points to previous JS, ArgumentsAdaptor, or | 43 // rbp: base pointer, points to previous JS, ArgumentsAdaptor, or |
| 61 // Trampoline frame. | 44 // Trampoline frame. |
| 62 // rsi: context of this function call. | 45 // rsi: context of this function call. |
| 63 // rdi: pointer to this function object. | 46 // rdi: pointer to this function object. |
| 64 Comment cmnt(masm(), "[ Enter JS frame"); | 47 Comment cmnt(masm(), "[ Enter JS frame"); |
| 65 | 48 |
| 66 #ifdef DEBUG | 49 #ifdef DEBUG |
| (...skipping 1067 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1134 // Grow the expression stack by handler size less one (the return | 1117 // Grow the expression stack by handler size less one (the return |
| 1135 // address is already pushed by a call instruction). | 1118 // address is already pushed by a call instruction). |
| 1136 Adjust(kHandlerSize - 1); | 1119 Adjust(kHandlerSize - 1); |
| 1137 __ PushTryHandler(IN_JAVASCRIPT, type); | 1120 __ PushTryHandler(IN_JAVASCRIPT, type); |
| 1138 } | 1121 } |
| 1139 | 1122 |
| 1140 | 1123 |
| 1141 #undef __ | 1124 #undef __ |
| 1142 | 1125 |
| 1143 } } // namespace v8::internal | 1126 } } // namespace v8::internal |
| OLD | NEW |