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 25 matching lines...) Expand all Loading... |
37 // VirtualFrame implementation. | 37 // VirtualFrame implementation. |
38 | 38 |
39 #define __ masm_-> | 39 #define __ masm_-> |
40 | 40 |
41 // On entry to a function, the virtual frame already contains the | 41 // On entry to a function, the virtual frame already contains the |
42 // receiver and the parameters. All initial frame elements are in | 42 // receiver and the parameters. All initial frame elements are in |
43 // memory. | 43 // memory. |
44 VirtualFrame::VirtualFrame(CodeGenerator* cgen) | 44 VirtualFrame::VirtualFrame(CodeGenerator* cgen) |
45 : cgen_(cgen), | 45 : cgen_(cgen), |
46 masm_(cgen->masm()), | 46 masm_(cgen->masm()), |
47 elements_(0), | 47 elements_(cgen->scope()->num_parameters() |
| 48 + cgen->scope()->num_stack_slots() |
| 49 + kPreallocatedElements), |
48 parameter_count_(cgen->scope()->num_parameters()), | 50 parameter_count_(cgen->scope()->num_parameters()), |
49 local_count_(0), | 51 local_count_(0), |
50 stack_pointer_(parameter_count_), // 0-based index of TOS. | 52 stack_pointer_(parameter_count_), // 0-based index of TOS. |
51 frame_pointer_(kIllegalIndex) { | 53 frame_pointer_(kIllegalIndex) { |
52 for (int i = 0; i < parameter_count_ + 1; i++) { | 54 for (int i = 0; i < parameter_count_ + 1; i++) { |
53 elements_.Add(FrameElement::MemoryElement()); | 55 elements_.Add(FrameElement::MemoryElement()); |
54 } | 56 } |
55 for (int i = 0; i < kNumRegisters; i++) { | 57 for (int i = 0; i < kNumRegisters; i++) { |
56 register_locations_[i] = kIllegalIndex; | 58 register_locations_[i] = kIllegalIndex; |
57 } | 59 } |
(...skipping 368 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
426 ASSERT(stack_pointer_ == elements_.length() - 1); | 428 ASSERT(stack_pointer_ == elements_.length() - 1); |
427 elements_.Add(FrameElement::MemoryElement()); | 429 elements_.Add(FrameElement::MemoryElement()); |
428 stack_pointer_++; | 430 stack_pointer_++; |
429 __ push(reg); | 431 __ push(reg); |
430 } | 432 } |
431 | 433 |
432 | 434 |
433 #undef __ | 435 #undef __ |
434 | 436 |
435 } } // namespace v8::internal | 437 } } // namespace v8::internal |
OLD | NEW |