OLD | NEW |
1 // Copyright 2008 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 |
11 // with the distribution. | 11 // with the distribution. |
(...skipping 24 matching lines...) Expand all Loading... |
36 #define __ masm_-> | 36 #define __ masm_-> |
37 | 37 |
38 // ------------------------------------------------------------------------- | 38 // ------------------------------------------------------------------------- |
39 // VirtualFrame implementation. | 39 // VirtualFrame implementation. |
40 | 40 |
41 // On entry to a function, the virtual frame already contains the receiver, | 41 // On entry to a function, the virtual frame already contains the receiver, |
42 // the parameters, and a return address. All frame elements are in memory. | 42 // the parameters, and a return address. All frame elements are in memory. |
43 VirtualFrame::VirtualFrame(CodeGenerator* cgen) | 43 VirtualFrame::VirtualFrame(CodeGenerator* cgen) |
44 : cgen_(cgen), | 44 : cgen_(cgen), |
45 masm_(cgen->masm()), | 45 masm_(cgen->masm()), |
46 elements_(0), | 46 elements_(cgen->scope()->num_parameters() |
| 47 + cgen->scope()->num_stack_slots() |
| 48 + kPreallocatedElements), |
47 parameter_count_(cgen->scope()->num_parameters()), | 49 parameter_count_(cgen->scope()->num_parameters()), |
48 local_count_(0), | 50 local_count_(0), |
49 stack_pointer_(parameter_count_ + 1), // 0-based index of TOS. | 51 stack_pointer_(parameter_count_ + 1), // 0-based index of TOS. |
50 frame_pointer_(kIllegalIndex) { | 52 frame_pointer_(kIllegalIndex) { |
51 for (int i = 0; i < parameter_count_ + 2; i++) { | 53 for (int i = 0; i < parameter_count_ + 2; i++) { |
52 elements_.Add(FrameElement::MemoryElement()); | 54 elements_.Add(FrameElement::MemoryElement()); |
53 } | 55 } |
54 for (int i = 0; i < kNumRegisters; i++) { | 56 for (int i = 0; i < kNumRegisters; i++) { |
55 register_locations_[i] = kIllegalIndex; | 57 register_locations_[i] = kIllegalIndex; |
56 } | 58 } |
(...skipping 968 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1025 ASSERT(stack_pointer_ == elements_.length() - 1); | 1027 ASSERT(stack_pointer_ == elements_.length() - 1); |
1026 elements_.Add(FrameElement::MemoryElement()); | 1028 elements_.Add(FrameElement::MemoryElement()); |
1027 stack_pointer_++; | 1029 stack_pointer_++; |
1028 __ push(immediate); | 1030 __ push(immediate); |
1029 } | 1031 } |
1030 | 1032 |
1031 | 1033 |
1032 #undef __ | 1034 #undef __ |
1033 | 1035 |
1034 } } // namespace v8::internal | 1036 } } // namespace v8::internal |
OLD | NEW |