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

Side by Side Diff: src/jump-target.cc

Issue 1961004: First step towards making JumpTarget work on ARM. Instead... (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: Created 10 years, 7 months 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
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 19 matching lines...) Expand all
30 #include "codegen-inl.h" 30 #include "codegen-inl.h"
31 #include "jump-target-inl.h" 31 #include "jump-target-inl.h"
32 #include "register-allocator-inl.h" 32 #include "register-allocator-inl.h"
33 33
34 namespace v8 { 34 namespace v8 {
35 namespace internal { 35 namespace internal {
36 36
37 // ------------------------------------------------------------------------- 37 // -------------------------------------------------------------------------
38 // JumpTarget implementation. 38 // JumpTarget implementation.
39 39
40 bool JumpTarget::compiling_deferred_code_ = false;
41
42
43 void JumpTarget::Unuse() {
44 reaching_frames_.Clear();
45 merge_labels_.Clear();
46 entry_frame_ = NULL;
47 entry_label_.Unuse();
48 }
49
50
51 void JumpTarget::Jump() { 40 void JumpTarget::Jump() {
52 DoJump(); 41 DoJump();
53 } 42 }
54 43
55 44
56 void JumpTarget::Branch(Condition cc, Hint hint) { 45 void JumpTarget::Branch(Condition cc, Hint hint) {
57 DoBranch(cc, hint); 46 DoBranch(cc, hint);
58 } 47 }
59 48
60 49
61 void JumpTarget::Bind() { 50 void JumpTarget::Bind() {
62 DoBind(); 51 DoBind();
63 } 52 }
64 53
65 54
66 void JumpTarget::AddReachingFrame(VirtualFrame* frame) {
67 ASSERT(reaching_frames_.length() == merge_labels_.length());
68 ASSERT(entry_frame_ == NULL);
69 Label fresh;
70 merge_labels_.Add(fresh);
71 reaching_frames_.Add(frame);
72 }
73
74
75 // -------------------------------------------------------------------------
76 // BreakTarget implementation.
77
78 void BreakTarget::set_direction(Directionality direction) {
79 JumpTarget::set_direction(direction);
80 ASSERT(cgen()->has_valid_frame());
81 expected_height_ = cgen()->frame()->height();
82 }
83
84
85 void BreakTarget::CopyTo(BreakTarget* destination) {
86 ASSERT(destination != NULL);
87 destination->direction_ = direction_;
88 destination->reaching_frames_.Rewind(0);
89 destination->reaching_frames_.AddAll(reaching_frames_);
90 destination->merge_labels_.Rewind(0);
91 destination->merge_labels_.AddAll(merge_labels_);
92 destination->entry_frame_ = entry_frame_;
93 destination->entry_label_ = entry_label_;
94 destination->expected_height_ = expected_height_;
95 }
96
97
98 void BreakTarget::Branch(Condition cc, Hint hint) {
99 ASSERT(cgen()->has_valid_frame());
100
101 int count = cgen()->frame()->height() - expected_height_;
102 if (count > 0) {
103 // We negate and branch here rather than using DoBranch's negate
104 // and branch. This gives us a hook to remove statement state
105 // from the frame.
106 JumpTarget fall_through;
107 // Branch to fall through will not negate, because it is a
108 // forward-only target.
109 fall_through.Branch(NegateCondition(cc), NegateHint(hint));
110 Jump(); // May emit merge code here.
111 fall_through.Bind();
112 } else {
113 DoBranch(cc, hint);
114 }
115 }
116
117
118 // ------------------------------------------------------------------------- 55 // -------------------------------------------------------------------------
119 // ShadowTarget implementation. 56 // ShadowTarget implementation.
120 57
121 ShadowTarget::ShadowTarget(BreakTarget* shadowed) { 58 ShadowTarget::ShadowTarget(BreakTarget* shadowed) {
122 ASSERT(shadowed != NULL); 59 ASSERT(shadowed != NULL);
123 other_target_ = shadowed; 60 other_target_ = shadowed;
124 61
125 #ifdef DEBUG 62 #ifdef DEBUG
126 is_shadowing_ = true; 63 is_shadowing_ = true;
127 #endif 64 #endif
(...skipping 16 matching lines...) Expand all
144 other_target_->CopyTo(&temp); 81 other_target_->CopyTo(&temp);
145 CopyTo(other_target_); 82 CopyTo(other_target_);
146 temp.CopyTo(this); 83 temp.CopyTo(this);
147 temp.Unuse(); 84 temp.Unuse();
148 85
149 #ifdef DEBUG 86 #ifdef DEBUG
150 is_shadowing_ = false; 87 is_shadowing_ = false;
151 #endif 88 #endif
152 } 89 }
153 90
154
155 } } // namespace v8::internal 91 } } // namespace v8::internal
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698