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 23 matching lines...) Expand all Loading... |
34 | 34 |
35 // ------------------------------------------------------------------------- | 35 // ------------------------------------------------------------------------- |
36 // Virtual frames | 36 // Virtual frames |
37 // | 37 // |
38 // The virtual frame is an abstraction of the physical stack frame. It | 38 // The virtual frame is an abstraction of the physical stack frame. It |
39 // encapsulates the parameters, frame-allocated locals, and the expression | 39 // encapsulates the parameters, frame-allocated locals, and the expression |
40 // stack. It supports push/pop operations on the expression stack, as well | 40 // stack. It supports push/pop operations on the expression stack, as well |
41 // as random access to the expression stack elements, locals, and | 41 // as random access to the expression stack elements, locals, and |
42 // parameters. | 42 // parameters. |
43 | 43 |
44 class VirtualFrame : public Malloced { | 44 class VirtualFrame : public ZoneObject { |
45 public: | 45 public: |
46 // A utility class to introduce a scope where the virtual frame is | 46 // A utility class to introduce a scope where the virtual frame is |
47 // expected to remain spilled. The constructor spills the code | 47 // expected to remain spilled. The constructor spills the code |
48 // generator's current frame, but no attempt is made to require it | 48 // generator's current frame, but no attempt is made to require it |
49 // to stay spilled. It is intended as documentation while the code | 49 // to stay spilled. It is intended as documentation while the code |
50 // generator is being transformed. | 50 // generator is being transformed. |
51 class SpilledScope BASE_EMBEDDED { | 51 class SpilledScope BASE_EMBEDDED { |
52 public: | 52 public: |
53 explicit SpilledScope(CodeGenerator* cgen); | 53 explicit SpilledScope(CodeGenerator* cgen); |
54 | 54 |
(...skipping 287 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
342 static const int kLocal0Offset = JavaScriptFrameConstants::kLocal0Offset; | 342 static const int kLocal0Offset = JavaScriptFrameConstants::kLocal0Offset; |
343 static const int kFunctionOffset = JavaScriptFrameConstants::kFunctionOffset; | 343 static const int kFunctionOffset = JavaScriptFrameConstants::kFunctionOffset; |
344 static const int kContextOffset = StandardFrameConstants::kContextOffset; | 344 static const int kContextOffset = StandardFrameConstants::kContextOffset; |
345 | 345 |
346 static const int kHandlerSize = StackHandlerConstants::kSize / kPointerSize; | 346 static const int kHandlerSize = StackHandlerConstants::kSize / kPointerSize; |
347 static const int kPreallocatedElements = 5 + 8; // 8 expression stack slots. | 347 static const int kPreallocatedElements = 5 + 8; // 8 expression stack slots. |
348 | 348 |
349 CodeGenerator* cgen_; | 349 CodeGenerator* cgen_; |
350 MacroAssembler* masm_; | 350 MacroAssembler* masm_; |
351 | 351 |
352 List<FrameElement> elements_; | 352 ZoneList<FrameElement> elements_; |
353 | 353 |
354 // The number of frame-allocated locals and parameters respectively. | 354 // The number of frame-allocated locals and parameters respectively. |
355 int parameter_count_; | 355 int16_t parameter_count_; |
356 int local_count_; | 356 int16_t local_count_; |
357 | 357 |
358 // The index of the element that is at the processor's stack pointer | 358 // The index of the element that is at the processor's stack pointer |
359 // (the esp register). | 359 // (the esp register). |
360 int stack_pointer_; | 360 int16_t stack_pointer_; |
361 | 361 |
362 // The index of the element that is at the processor's frame pointer | 362 // The index of the element that is at the processor's frame pointer |
363 // (the ebp register). | 363 // (the ebp register). |
364 int frame_pointer_; | 364 int16_t frame_pointer_; |
365 | 365 |
366 // The index of the register frame element using each register, or | 366 // The index of the register frame element using each register, or |
367 // kIllegalIndex if a register is not on the frame. | 367 // kIllegalIndex if a register is not on the frame. |
368 int register_locations_[kNumRegisters]; | 368 int16_t register_locations_[kNumRegisters]; |
369 | 369 |
370 // The index of the first parameter. The receiver lies below the first | 370 // The index of the first parameter. The receiver lies below the first |
371 // parameter. | 371 // parameter. |
372 int param0_index() const { return 1; } | 372 int param0_index() const { return 1; } |
373 | 373 |
374 // The index of the context slot in the frame. | 374 // The index of the context slot in the frame. |
375 int context_index() const { | 375 int context_index() const { |
376 ASSERT(frame_pointer_ != kIllegalIndex); | 376 ASSERT(frame_pointer_ != kIllegalIndex); |
377 return frame_pointer_ + 1; | 377 return frame_pointer_ + 1; |
378 } | 378 } |
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
496 elements_[target->index()].set_copied(); | 496 elements_[target->index()].set_copied(); |
497 } | 497 } |
498 } | 498 } |
499 | 499 |
500 friend class JumpTarget; | 500 friend class JumpTarget; |
501 }; | 501 }; |
502 | 502 |
503 } } // namespace v8::internal | 503 } } // namespace v8::internal |
504 | 504 |
505 #endif // V8_IA32_VIRTUAL_FRAME_IA32_H_ | 505 #endif // V8_IA32_VIRTUAL_FRAME_IA32_H_ |
OLD | NEW |