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

Side by Side Diff: src/jump-target-arm.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 "jump-target.h"
32
33 namespace v8 { namespace internal {
34
35 // -------------------------------------------------------------------------
36 // JumpTarget implementation.
37
38 #define __ masm_->
39
40 JumpTarget::JumpTarget(CodeGenerator* cgen) {
41 ASSERT(cgen != NULL);
42 expected_frame_ = NULL;
43 code_generator_ = cgen;
44 masm_ = cgen->masm();
45 }
46
47
48 JumpTarget::JumpTarget()
49 : expected_frame_(NULL),
50 code_generator_(NULL),
51 masm_(NULL) {
52 }
53
54
55 void JumpTarget::set_code_generator(CodeGenerator* cgen) {
56 ASSERT(cgen != NULL);
57 ASSERT(code_generator_ == NULL);
58 code_generator_ = cgen;
59 masm_ = cgen->masm();
60 }
61
62
63 void JumpTarget::Jump() {
64 __ b(&label_);
65 }
66
67 void JumpTarget::Branch(Condition cc) {
68 __ b(cc, &label_);
69 }
70
71 void JumpTarget::Bind() {
72 __ bind(&label_);
73 }
74
75
76 // -------------------------------------------------------------------------
77 // ShadowTarget implementation.
78
79 ShadowTarget::ShadowTarget(JumpTarget* original) {
80 ASSERT(original != NULL);
81 original_target_ = original;
82 original_pos_ = original->label()->pos_;
83 original_expected_frame_ = original->expected_frame();
84
85 // We do not call Unuse() on the orginal jump target, because we do not
86 // want to delete the expected frame.
87 original->label()->pos_ = 0;
88 original->set_expected_frame(NULL);
89 #ifdef DEBUG
90 is_shadowing_ = true;
91 #endif
92 }
93
94
95 void ShadowTarget::StopShadowing() {
96 ASSERT(is_shadowing_);
97 ASSERT(is_unused());
98
99 set_code_generator(original_target_->code_generator());
100 label_.pos_ = original_target_->label()->pos_;
101 expected_frame_ = original_target_->expected_frame();
102
103 original_target_->label()->pos_ = original_pos_;
104 original_target_->set_expected_frame(original_expected_frame_);
105
106 #ifdef DEBUG
107 is_shadowing_ = false;
108 #endif
109 }
110
111 #undef __
112
113
114 } } // namespace v8::internal
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698