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

Unified Diff: src/macro-assembler.h

Issue 609843002: Refactor FrameAndConstantPoolScope and ConstantPoolUnavailableScope to be architecture independent (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 6 years, 3 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 side-by-side diff with in-line comments
Download patch
« src/ia32/macro-assembler-ia32.cc ('K') | « src/ia32/macro-assembler-ia32.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/macro-assembler.h
diff --git a/src/macro-assembler.h b/src/macro-assembler.h
index 54cebca90f879fed0bb4e74aa737014704b6bbd4..ae2a39be4b2d78728099e324878db24fb0d848b3 100644
--- a/src/macro-assembler.h
+++ b/src/macro-assembler.h
@@ -93,10 +93,12 @@ namespace internal {
class FrameScope {
public:
- explicit FrameScope(MacroAssembler* masm, StackFrame::Type type)
+ explicit FrameScope(MacroAssembler* masm, StackFrame::Type type,
+ bool enter_frame = true)
rmcilroy 2014/09/26 15:54:57 I don't like this default argument. Rethinking thi
baixo 2014/10/02 09:18:21 I was worried about code duplication, since this c
: masm_(masm), type_(type), old_has_frame_(masm->has_frame()) {
masm->set_has_frame(true);
- if (type != StackFrame::MANUAL && type_ != StackFrame::NONE) {
+ if (enter_frame && type != StackFrame::MANUAL &&
+ type_ != StackFrame::NONE) {
masm->EnterFrame(type);
}
}
@@ -118,12 +120,34 @@ class FrameScope {
masm_->LeaveFrame(type_);
}
- private:
+ protected:
MacroAssembler* masm_;
StackFrame::Type type_;
bool old_has_frame_;
};
+class FrameAndConstantPoolScope : public FrameScope {
+ public:
+ FrameAndConstantPoolScope(MacroAssembler* masm, StackFrame::Type type)
+ : FrameScope(masm, type, false),
+ old_constant_pool_available_(masm->is_constant_pool_available()) {
+ // We only want to enable constant pool access for non-manual frame scopes
+ // to ensure the constant pool pointer is valid throughout the scope.
+ DCHECK(type_ != StackFrame::MANUAL && type_ != StackFrame::NONE);
+ masm->set_constant_pool_available(true);
+ masm->EnterFrame(type, !old_constant_pool_available_);
+ }
+
+ ~FrameAndConstantPoolScope() {
+ masm_->set_constant_pool_available(old_constant_pool_available_);
+ }
+
+ private:
+ bool old_constant_pool_available_;
+
+ DISALLOW_IMPLICIT_CONSTRUCTORS(FrameAndConstantPoolScope);
+};
+
class AllowExternalCallThatCantCauseGC: public FrameScope {
public:
« src/ia32/macro-assembler-ia32.cc ('K') | « src/ia32/macro-assembler-ia32.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698