first_const_pool_32_use_ = -1;
first_const_pool_64_use_ = -1;
last_bound_pos_ = 0;
- constant_pool_available_ = !FLAG_enable_ool_constant_pool;
ClearRecordedAstId();
}
static bool use_mov_immediate_load(const Operand& x,
const Assembler* assembler) {
- if (assembler != NULL && !assembler->is_constant_pool_available()) {
+ if (FLAG_enable_ool_constant_pool && assembler != NULL &&
+ !assembler->is_ool_constant_pool_available()) {
return true;
} else if (CpuFeatures::IsSupported(MOVW_MOVT_IMMEDIATE_LOADS) &&
(assembler == NULL || !assembler->predictable_code_size())) {
mov(rd, target, LeaveCC, cond);
}
} else {
- DCHECK(is_constant_pool_available());
+ DCHECK(!FLAG_enable_ool_constant_pool || is_ool_constant_pool_available());
ConstantPoolArray::LayoutSection section = ConstantPoolAddEntry(rinfo);
if (section == ConstantPoolArray::EXTENDED_SECTION) {
DCHECK(FLAG_enable_ool_constant_pool);
int vd, d;
dst.split_code(&vd, &d);
emit(al | 0x1D*B23 | d*B22 | 0x3*B20 | vd*B12 | 0x5*B9 | B8 | enc);
- } else if (FLAG_enable_vldr_imm && is_constant_pool_available()) {
+ } else if (FLAG_enable_vldr_imm && is_ool_constant_pool_available()) {
// TODO(jfb) Temporarily turned off until we have constant blinding or
// some equivalent mitigation: an attacker can otherwise control
// generated data which also happens to be executable, a Very Bad
// Generate the constant pool for the generated code.
void PopulateConstantPool(ConstantPoolArray* constant_pool);
- bool is_constant_pool_available() const { return constant_pool_available_; }
-
bool use_extended_constant_pool() const {
return constant_pool_builder_.current_section() ==
ConstantPoolArray::EXTENDED_SECTION;
(pc_offset() < no_const_pool_before_);
}
- void set_constant_pool_available(bool available) {
- constant_pool_available_ = available;
- }
-
private:
int next_buffer_check_; // pc offset of next buffer check
// The bound position, before this we cannot do instruction elimination.
int last_bound_pos_;
- // Indicates whether the constant pool can be accessed, which is only possible
- // if the pp register points to the current code object's constant pool.
- bool constant_pool_available_;
-
// Code emission
inline void CheckBuffer();
void GrowBuffer();
friend class RelocInfo;
friend class CodePatcher;
friend class BlockConstPoolScope;
- friend class FrameAndConstantPoolScope;
- friend class ConstantPoolUnavailableScope;
-
PositionsRecorder positions_recorder_;
friend class PositionsRecorder;
friend class EnsureSpace;
add(fp, sp, Operand(StandardFrameConstants::kFixedFrameSizeFromFp));
if (FLAG_enable_ool_constant_pool) {
LoadConstantPoolPointerRegister();
- set_constant_pool_available(true);
+ set_ool_constant_pool_available(true);
}
}
}
if (FLAG_enable_ool_constant_pool) {
LoadConstantPoolPointerRegister();
- set_constant_pool_available(true);
+ set_ool_constant_pool_available(true);
}
}
void MacroAssembler::EnterFrame(StackFrame::Type type,
- bool load_constant_pool) {
+ bool load_constant_pool_pointer_reg) {
// r0-r3: preserved
PushFixedFrame();
- if (FLAG_enable_ool_constant_pool && load_constant_pool) {
+ if (FLAG_enable_ool_constant_pool && load_constant_pool_pointer_reg) {
LoadConstantPoolPointerRegister();
}
mov(ip, Operand(Smi::FromInt(type)));
}
// Activation support.
- void EnterFrame(StackFrame::Type type, bool load_constant_pool = false);
+ void EnterFrame(StackFrame::Type type,
+ bool load_constant_pool_pointer_reg = false);
// Returns the pc offset at which the frame ends.
int LeaveFrame(StackFrame::Type type);
};
-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:
- explicit ConstantPoolUnavailableScope(MacroAssembler* masm)
- : masm_(masm),
- old_constant_pool_available_(masm->is_constant_pool_available()) {
- if (FLAG_enable_ool_constant_pool) {
- masm_->set_constant_pool_available(false);
- }
- }
- ~ConstantPoolUnavailableScope() {
- if (FLAG_enable_ool_constant_pool) {
- masm_->set_constant_pool_available(old_constant_pool_available_);
- }
- }
-
- private:
- MacroAssembler* masm_;
- int old_constant_pool_available_;
-
- DISALLOW_IMPLICIT_CONSTRUCTORS(ConstantPoolUnavailableScope);
-};
-
-
// -----------------------------------------------------------------------------
// Static helper functions.
}
+void MacroAssembler::EnterFrame(StackFrame::Type type,
+ bool load_constant_pool_pointer_reg) {
+ // Out-of-line constant pool not implemented on arm64.
+ UNREACHABLE();
+}
+
+
void MacroAssembler::EnterFrame(StackFrame::Type type) {
DCHECK(jssp.Is(StackPointer()));
UseScratchRegisterScope temps(this);
// Activation support.
void EnterFrame(StackFrame::Type type);
+ void EnterFrame(StackFrame::Type type, bool load_constant_pool_pointer_reg);
void LeaveFrame(StackFrame::Type type);
// Returns map with validated enum cache in object register.
emit_debug_code_(FLAG_debug_code),
predictable_code_size_(false),
// We may use the assembler without an isolate.
- serializer_enabled_(isolate && isolate->serializer_enabled()) {
+ serializer_enabled_(isolate && isolate->serializer_enabled()),
+ ool_constant_pool_available_(false) {
if (FLAG_mask_constants_with_cookie && isolate != NULL) {
jit_cookie_ = isolate->random_number_generator()->NextInt();
}
return (enabled_cpu_features_ & (static_cast<uint64_t>(1) << f)) != 0;
}
+ bool is_ool_constant_pool_available() const {
+ if (FLAG_enable_ool_constant_pool) {
+ return ool_constant_pool_available_;
+ } else {
+ // Out-of-line constant pool not supported on this architecture.
+ UNREACHABLE();
+ return false;
+ }
+ }
+
// Overwrite a host NaN with a quiet target NaN. Used by mksnapshot for
// cross-snapshotting.
static void QuietNaN(HeapObject* nan) { }
int buffer_size_;
bool own_buffer_;
+ void set_ool_constant_pool_available(bool available) {
+ if (FLAG_enable_ool_constant_pool) {
+ ool_constant_pool_available_ = available;
+ } else {
+ // Out-of-line constant pool not supported on this architecture.
+ UNREACHABLE();
+ }
+ }
+
// The program counter, which points into the buffer above and moves forward.
byte* pc_;
bool emit_debug_code_;
bool predictable_code_size_;
bool serializer_enabled_;
+
+ // Indicates whether the constant pool can be accessed, which is only possible
+ // if the pp register points to the current code object's constant pool.
+ bool ool_constant_pool_available_;
+
+ // Constant pool.
+ friend class FrameAndConstantPoolScope;
+ friend class ConstantPoolUnavailableScope;
};
#undef FLAG
#define FLAG FLAG_READONLY
-// assembler-arm.h
+// assembler.h
DEFINE_BOOL(enable_ool_constant_pool, V8_OOL_CONSTANT_POOL,
"enable use of out-of-line constant pools (ARM only)")
}
+void MacroAssembler::EnterFrame(StackFrame::Type type,
+ bool load_constant_pool_pointer_reg) {
+ // Out-of-line constant pool not implemented on ia32.
+ UNREACHABLE();
+}
+
+
void MacroAssembler::EnterFrame(StackFrame::Type type) {
push(ebp);
mov(ebp, esp);
// Activation support.
void EnterFrame(StackFrame::Type type);
+ void EnterFrame(StackFrame::Type type, bool load_constant_pool_pointer_reg);
void LeaveFrame(StackFrame::Type type);
// Expects object in eax and returns map with validated enum cache
bool old_has_frame_;
};
+class FrameAndConstantPoolScope {
+ public:
+ FrameAndConstantPoolScope(MacroAssembler* masm, StackFrame::Type type)
+ : masm_(masm),
+ type_(type),
+ old_has_frame_(masm->has_frame()),
+ old_constant_pool_available_(FLAG_enable_ool_constant_pool &&
+ masm->is_ool_constant_pool_available()) {
+ masm->set_has_frame(true);
+ if (FLAG_enable_ool_constant_pool) {
+ masm->set_ool_constant_pool_available(true);
+ }
+ if (type_ != StackFrame::MANUAL && type_ != StackFrame::NONE) {
+ masm->EnterFrame(type, !old_constant_pool_available_);
+ }
+ }
+
+ ~FrameAndConstantPoolScope() {
+ masm_->LeaveFrame(type_);
+ masm_->set_has_frame(old_has_frame_);
+ if (FLAG_enable_ool_constant_pool) {
+ masm_->set_ool_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:
+ explicit ConstantPoolUnavailableScope(MacroAssembler* masm)
+ : masm_(masm),
+ old_constant_pool_available_(FLAG_enable_ool_constant_pool &&
+ masm->is_ool_constant_pool_available()) {
+ if (FLAG_enable_ool_constant_pool) {
+ masm_->set_ool_constant_pool_available(false);
+ }
+ }
+ ~ConstantPoolUnavailableScope() {
+ if (FLAG_enable_ool_constant_pool) {
+ masm_->set_ool_constant_pool_available(old_constant_pool_available_);
+ }
+ }
+
+ private:
+ MacroAssembler* masm_;
+ int old_constant_pool_available_;
+
+ DISALLOW_IMPLICIT_CONSTRUCTORS(ConstantPoolUnavailableScope);
+};
+
class AllowExternalCallThatCantCauseGC: public FrameScope {
public:
}
+void MacroAssembler::EnterFrame(StackFrame::Type type,
+ bool load_constant_pool_pointer_reg) {
+ // Out-of-line constant pool not implemented on mips.
+ UNREACHABLE();
+}
+
+
void MacroAssembler::EnterFrame(StackFrame::Type type) {
addiu(sp, sp, -5 * kPointerSize);
li(t8, Operand(Smi::FromInt(type)));
// Activation support.
void EnterFrame(StackFrame::Type type);
+ void EnterFrame(StackFrame::Type type, bool load_constant_pool_pointer_reg);
void LeaveFrame(StackFrame::Type type);
// Patch the relocated value (lui/ori pair).
}
+void MacroAssembler::EnterFrame(StackFrame::Type type,
+ bool load_constant_pool_pointer_reg) {
+ // Out-of-line constant pool not implemented on mips64.
+ UNREACHABLE();
+}
+
+
void MacroAssembler::EnterFrame(StackFrame::Type type) {
daddiu(sp, sp, -5 * kPointerSize);
li(t8, Operand(Smi::FromInt(type)));
// Activation support.
void EnterFrame(StackFrame::Type type);
+ void EnterFrame(StackFrame::Type type, bool load_constant_pool_pointer_reg);
void LeaveFrame(StackFrame::Type type);
// Patch the relocated value (lui/ori pair).
}
+void MacroAssembler::EnterFrame(StackFrame::Type type,
+ bool load_constant_pool_pointer_reg) {
+ // Out-of-line constant pool not implemented on x64.
+ UNREACHABLE();
+}
+
+
void MacroAssembler::EnterFrame(StackFrame::Type type) {
pushq(rbp);
movp(rbp, rsp);
// Activation support.
void EnterFrame(StackFrame::Type type);
+ void EnterFrame(StackFrame::Type type, bool load_constant_pool_pointer_reg);
void LeaveFrame(StackFrame::Type type);
// Expects object in rax and returns map with validated enum cache
}
+void MacroAssembler::EnterFrame(StackFrame::Type type,
+ bool load_constant_pool_pointer_reg) {
+ // Out-of-line constant pool not implemented on x87.
+ UNREACHABLE();
+}
+
+
void MacroAssembler::EnterFrame(StackFrame::Type type) {
push(ebp);
mov(ebp, esp);
// Activation support.
void EnterFrame(StackFrame::Type type);
+ void EnterFrame(StackFrame::Type type, bool load_constant_pool_pointer_reg);
void LeaveFrame(StackFrame::Type type);
// Expects object in eax and returns map with validated enum cache