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

Side by Side Diff: src/virtual-frame-ia32.cc

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 #include "v8.h"
29
30 #include "codegen.h"
31 #include "codegen-inl.h"
32 #include "virtual-frame.h"
33
34 namespace v8 { namespace internal {
35
36 // -------------------------------------------------------------------------
37 // VirtualFrame implementation.
38
39 #define __ masm_->
40
41 VirtualFrame::VirtualFrame(CodeGenerator* cgen) {
42 ASSERT(cgen->scope() != NULL);
43
44 masm_ = cgen->masm();
45 frame_local_count_ = cgen->scope()->num_stack_slots();
46 parameter_count_ = cgen->scope()->num_parameters();
Erik Corry 2008/11/07 11:55:10 I think you should be using the initalizer list sy
47 height_ = 0;
48 }
49
50
51 VirtualFrame::VirtualFrame(VirtualFrame* original) {
52 ASSERT(original != NULL);
53
54 masm_ = original->masm_;
55 frame_local_count_ = original->frame_local_count_;
56 parameter_count_ = original->parameter_count_;
57 height_ = original->height_;
58 }
59
60
61 void VirtualFrame::Forget(int count) {
62 ASSERT(count >= 0);
63 ASSERT(height_ >= count);
64 height_ -= count;
65 }
66
67
68 void VirtualFrame::MergeTo(VirtualFrame* expected) {
69 ASSERT(masm_ == expected->masm_);
70 ASSERT(frame_local_count_ == expected->frame_local_count_);
71 ASSERT(parameter_count_ == expected->parameter_count_);
72 ASSERT(height_ == expected->height_);
73 }
74
75
76 void VirtualFrame::Enter() {
77 Comment cmnt(masm_, "[ Enter JS frame");
78 __ push(ebp);
79 __ mov(ebp, Operand(esp));
80
81 // Store the context and the function in the frame.
82 __ push(esi);
83 __ push(edi);
84
85 // Clear the function slot when generating debug code.
86 if (FLAG_debug_code) {
87 __ Set(edi, Immediate(reinterpret_cast<int>(kZapValue)));
88 }
89 }
90
91
92 void VirtualFrame::Exit() {
93 Comment cmnt(masm_, "[ Exit JS frame");
94 // Record the location of the JS exit code for patching when setting
95 // break point.
96 __ RecordJSReturn();
97
98 // Avoid using the leave instruction here, because it is too
99 // short. We need the return sequence to be a least the size of a
100 // call instruction to support patching the exit code in the
101 // debugger. See VisitReturnStatement for the full return sequence.
102 __ mov(esp, Operand(ebp));
103 __ pop(ebp);
104 }
105
106
107 void VirtualFrame::AllocateLocals() {
108 if (frame_local_count_ > 0) {
109 Comment cmnt(masm_, "[ Allocate space for locals");
110 __ Set(eax, Immediate(Factory::undefined_value()));
111 for (int i = 0; i < frame_local_count_; i++) {
112 __ push(eax);
113 }
114 }
115 }
116
117
118 #undef __
119
120 } } // namespace v8::internal
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698