Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(101)

Side by Side Diff: src/virtual-frame-arm.h

Issue 9328: Initial (stub) port of jump targets to the ARM platform.... (Closed) Base URL: http://v8.googlecode.com/svn/branches/experimental/toiger/
Patch Set: '' Created 12 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
(Empty)
1 // Copyright 2008 the V8 project authors. All rights reserved.
2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are
4 // met:
5 //
6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided
11 // with the distribution.
12 // * Neither the name of Google Inc. nor the names of its
13 // contributors may be used to endorse or promote products derived
14 // from this software without specific prior written permission.
15 //
16 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
17 // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
18 // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
19 // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
20 // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
21 // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
22 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
23 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
24 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
26 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27
28 #ifndef V8_VIRTUAL_FRAME_ARM_H_
29 #define V8_VIRTUAL_FRAME_ARM_H_
30
31 #include "macro-assembler.h"
32
33 namespace v8 { namespace internal {
34
35 // -------------------------------------------------------------------------
36 // Virtual frames
37 //
38 // The virtual frame is an abstraction of the physical stack frame. It
39 // encapsulates the parameters, frame-allocated locals, and the expression
40 // stack. It supports push/pop operations on the expression stack, as well
41 // as random access to the expression stack elements, locals, and
42 // parameters.
43
44 class VirtualFrame {
45 public:
46 // Construct a virtual frame with the given code generator used to
47 // generate code.
48 explicit VirtualFrame(CodeGenerator* cgen);
49
50 // Construct a virtual frame that is a clone of an existing one, initially
51 // with an identical state.
52 explicit VirtualFrame(VirtualFrame* original);
53
54 // Make this virtual frame have a state identical to an expected virtual
55 // frame. As a side effect, code may be emitted to make this frame match
56 // the expected one.
57 void MergeTo(VirtualFrame* expected);
58
59 // The current top of the expression stack as an assembly operand.
60 MemOperand Top() const { return MemOperand(sp, 0); }
61
62 // An element of the expression stack as an assembly operand.
63 MemOperand Element(int index) const {
64 return MemOperand(sp, index * kPointerSize);
65 }
66
67 // A frame-allocated local as an assembly operand.
68 MemOperand Local(int index) const {
69 ASSERT(0 <= index && index < frame_local_count_);
70 return MemOperand(fp, kLocal0Offset - index * kPointerSize);
71 }
72
73 // The function frame slot.
74 MemOperand Function() const { return MemOperand(fp, kFunctionOffset); }
75
76 // The context frame slot.
77 MemOperand Context() const { return MemOperand(fp, kContextOffset); }
78
79 // A parameter as an assembly operand.
80 MemOperand Parameter(int index) const {
81 // Index -1 corresponds to the receiver.
82 ASSERT(-1 <= index && index <= parameter_count_);
83 return MemOperand(fp, (1 + parameter_count_ - index) * kPointerSize);
84 }
85
86 private:
87 static const int kLocal0Offset = JavaScriptFrameConstants::kLocal0Offset;
88 static const int kFunctionOffset = JavaScriptFrameConstants::kFunctionOffset;
89 static const int kContextOffset = StandardFrameConstants::kContextOffset;
90
91 MacroAssembler* masm_;
92
93 // The number of frame-allocated locals and parameters respectively.
94 int frame_local_count_;
95 int parameter_count_;
96 };
97
98
99 } } // namespace v8::internal
100
101 #endif // V8_VIRTUAL_FRAME_ARM_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698