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

Side by Side Diff: src/macro-assembler.h

Issue 8139027: Version 3.6.5 (Closed) Base URL: http://v8.googlecode.com/svn/trunk/
Patch Set: '' Created 9 years, 2 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
« no previous file with comments | « src/log.cc ('k') | src/mark-compact.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2006-2008 the V8 project authors. All rights reserved. 1 // Copyright 2011 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
11 // with the distribution. 11 // with the distribution.
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
86 #include "mips/assembler-mips-inl.h" 86 #include "mips/assembler-mips-inl.h"
87 #include "code.h" // must be after assembler_*.h 87 #include "code.h" // must be after assembler_*.h
88 #include "mips/macro-assembler-mips.h" 88 #include "mips/macro-assembler-mips.h"
89 #else 89 #else
90 #error Unsupported target architecture. 90 #error Unsupported target architecture.
91 #endif 91 #endif
92 92
93 namespace v8 { 93 namespace v8 {
94 namespace internal { 94 namespace internal {
95 95
96 class FrameScope {
97 public:
98 explicit FrameScope(MacroAssembler* masm, StackFrame::Type type)
99 : masm_(masm), type_(type), old_has_frame_(masm->has_frame()) {
100 masm->set_has_frame(true);
101 if (type != StackFrame::MANUAL && type_ != StackFrame::NONE) {
102 masm->EnterFrame(type);
103 }
104 }
105
106 ~FrameScope() {
107 if (type_ != StackFrame::MANUAL && type_ != StackFrame::NONE) {
108 masm_->LeaveFrame(type_);
109 }
110 masm_->set_has_frame(old_has_frame_);
111 }
112
113 // Normally we generate the leave-frame code when this object goes
114 // out of scope. Sometimes we may need to generate the code somewhere else
115 // in addition. Calling this will achieve that, but the object stays in
116 // scope, the MacroAssembler is still marked as being in a frame scope, and
117 // the code will be generated again when it goes out of scope.
118 void GenerateLeaveFrame() {
119 masm_->LeaveFrame(type_);
120 }
121
122 private:
123 MacroAssembler* masm_;
124 StackFrame::Type type_;
125 bool old_has_frame_;
126 };
127
128
129 class AllowExternalCallThatCantCauseGC: public FrameScope {
130 public:
131 explicit AllowExternalCallThatCantCauseGC(MacroAssembler* masm)
132 : FrameScope(masm, StackFrame::NONE) { }
133 };
134
135
136 class NoCurrentFrameScope {
137 public:
138 explicit NoCurrentFrameScope(MacroAssembler* masm)
139 : masm_(masm), saved_(masm->has_frame()) {
140 masm->set_has_frame(false);
141 }
142
143 ~NoCurrentFrameScope() {
144 masm_->set_has_frame(saved_);
145 }
146
147 private:
148 MacroAssembler* masm_;
149 bool saved_;
150 };
151
152
96 // Support for "structured" code comments. 153 // Support for "structured" code comments.
97 #ifdef DEBUG 154 #ifdef DEBUG
98 155
99 class Comment { 156 class Comment {
100 public: 157 public:
101 Comment(MacroAssembler* masm, const char* msg); 158 Comment(MacroAssembler* masm, const char* msg);
102 ~Comment(); 159 ~Comment();
103 160
104 private: 161 private:
105 MacroAssembler* masm_; 162 MacroAssembler* masm_;
106 const char* msg_; 163 const char* msg_;
107 }; 164 };
108 165
109 #else 166 #else
110 167
111 class Comment { 168 class Comment {
112 public: 169 public:
113 Comment(MacroAssembler*, const char*) {} 170 Comment(MacroAssembler*, const char*) {}
114 }; 171 };
115 172
116 #endif // DEBUG 173 #endif // DEBUG
117 174
118 } } // namespace v8::internal 175 } } // namespace v8::internal
119 176
120 #endif // V8_MACRO_ASSEMBLER_H_ 177 #endif // V8_MACRO_ASSEMBLER_H_
OLDNEW
« no previous file with comments | « src/log.cc ('k') | src/mark-compact.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698