Reviewers: rmcilroy,
Message:
Please take a look.
Description:
Refactor FrameAndConstantPoolScope
Please review this at https://codereview.chromium.org/609843002/
SVN Base: https://v8.googlecode.com/svn/branches/bleeding_edge
Affected files (+48, -46 lines):
M src/arm/macro-assembler-arm.h
M src/ia32/assembler-ia32.h
M src/ia32/macro-assembler-ia32.h
M src/ia32/macro-assembler-ia32.cc
M src/macro-assembler.h
Index: src/arm/macro-assembler-arm.h
diff --git a/src/arm/macro-assembler-arm.h b/src/arm/macro-assembler-arm.h
index
d2a178664e0f18796e422670050a30e73ad76ec3..287d4d5f1aa983d0bc28575f11b3dad896dedc96
100644
--- a/src/arm/macro-assembler-arm.h
+++ b/src/arm/macro-assembler-arm.h
@@ -1530,47 +1530,6 @@ class CodePatcher {
};
-class FrameAndConstantPoolScope {
- public:
- FrameAndConstantPoolScope(MacroAssembler* masm, StackFrame::Type type)
- : masm_(masm),
- type_(type),
- old_has_frame_(masm->has_frame()),
- 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_has_frame(true);
- masm->set_constant_pool_available(true);
- masm->EnterFrame(type, !old_constant_pool_available_);
- }
-
- ~FrameAndConstantPoolScope() {
- masm_->LeaveFrame(type_);
- masm_->set_has_frame(old_has_frame_);
- masm_->set_constant_pool_available(old_constant_pool_available_);
- }
-
- // Normally we generate the leave-frame code when this object goes
- // out of scope. Sometimes we may need to generate the code somewhere
else
- // in addition. Calling this will achieve that, but the object stays in
- // scope, the MacroAssembler is still marked as being in a frame scope,
and
- // the code will be generated again when it goes out of scope.
- void GenerateLeaveFrame() {
- DCHECK(type_ != StackFrame::MANUAL && type_ != StackFrame::NONE);
- masm_->LeaveFrame(type_);
- }
-
- private:
- MacroAssembler* masm_;
- StackFrame::Type type_;
- bool old_has_frame_;
- bool old_constant_pool_available_;
-
- DISALLOW_IMPLICIT_CONSTRUCTORS(FrameAndConstantPoolScope);
-};
-
-
// Class for scoping the the unavailability of constant pool access.
class ConstantPoolUnavailableScope {
public:
Index: src/ia32/assembler-ia32.h
diff --git a/src/ia32/assembler-ia32.h b/src/ia32/assembler-ia32.h
index
7a828c796779ec11ba336a56676a16ea632cd102..04d9b54ab97eed4b7c50fc0583b4264948c4c286
100644
--- a/src/ia32/assembler-ia32.h
+++ b/src/ia32/assembler-ia32.h
@@ -1098,6 +1098,12 @@ class Assembler : public AssemblerBase {
// Generate the constant pool for the generated code.
void PopulateConstantPool(ConstantPoolArray* constant_pool);
+ bool is_constant_pool_available() const {
+ // Support not implemented in ia32 yet.
+ UNREACHABLE();
+ return false;
+ }
+
protected:
void emit_sse_operand(XMMRegister reg, const Operand& adr);
void emit_sse_operand(XMMRegister dst, XMMRegister src);
@@ -1106,6 +1112,17 @@ class Assembler : public AssemblerBase {
byte* addr_at(int pos) { return buffer_ + pos; }
+ bool is_const_pool_blocked() const {
+ // Support not implemented in ia32 yet.
+ UNREACHABLE();
+ return false;
+ }
+
+ void set_constant_pool_available(bool available) {
+ // Support not implemented in ia32 yet.
+ UNREACHABLE();
+ }
+
private:
uint32_t long_at(int pos) {
@@ -1159,6 +1176,7 @@ class Assembler : public AssemblerBase {
friend class CodePatcher;
friend class EnsureSpace;
+ friend class FrameAndConstantPoolScope;
// code generation
RelocInfoWriter reloc_info_writer;
Index: src/ia32/macro-assembler-ia32.cc
diff --git a/src/ia32/macro-assembler-ia32.cc
b/src/ia32/macro-assembler-ia32.cc
index
7480a6f9ef9b992b27f92c6139c38d0d6b048984..ff485e30e7eafffd5e46bd24e279be90f12a8f73
100644
--- a/src/ia32/macro-assembler-ia32.cc
+++ b/src/ia32/macro-assembler-ia32.cc
@@ -898,7 +898,8 @@ void MacroAssembler::Prologue(bool code_pre_aging) {
}
-void MacroAssembler::EnterFrame(StackFrame::Type type) {
+void MacroAssembler::EnterFrame(StackFrame::Type type,
+ bool load_constant_pool) {
push(ebp);
mov(ebp, esp);
push(esi);
Index: src/ia32/macro-assembler-ia32.h
diff --git a/src/ia32/macro-assembler-ia32.h
b/src/ia32/macro-assembler-ia32.h
index
81347e58f2e3d114879766ce96ca8de36cf69010..bf9c34485b973ee61bd203bff44f8f6e7f12a3aa
100644
--- a/src/ia32/macro-assembler-ia32.h
+++ b/src/ia32/macro-assembler-ia32.h
@@ -935,7 +935,7 @@ class MacroAssembler: public Assembler {
}
// Activation support.
- void EnterFrame(StackFrame::Type type);
+ void EnterFrame(StackFrame::Type type, bool load_constant_pool = false);
void LeaveFrame(StackFrame::Type type);
// Expects object in eax and returns map with validated enum cache
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)
: 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:
--
--
v8-dev mailing list
v8-dev@googlegroups.com
http://groups.google.com/group/v8-dev
---
You received this message because you are subscribed to the Google Groups "v8-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to v8-dev+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.