PredictableCodeSizeScope checks the expected size now.
We still have some problems on ARM, so the size check currently optional. Furthermore, we don't use PredictableCodeSizeScope at all place where we should do it. Both issues are cleaned up in upcoming CLs. Review URL: https://codereview.chromium.org/11348195 git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@13037 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
This commit is contained in:
parent
72db2287c3
commit
9de70742a6
@ -7549,7 +7549,7 @@ void StoreArrayLiteralElementStub::Generate(MacroAssembler* masm) {
|
||||
|
||||
void ProfileEntryHookStub::MaybeCallEntryHook(MacroAssembler* masm) {
|
||||
if (entry_hook_ != NULL) {
|
||||
PredictableCodeSizeScope predictable(masm);
|
||||
PredictableCodeSizeScope predictable(masm, 4 * Assembler::kInstrSize);
|
||||
ProfileEntryHookStub stub;
|
||||
__ push(lr);
|
||||
__ CallStub(&stub);
|
||||
|
@ -290,7 +290,7 @@ void FullCodeGenerator::Generate() {
|
||||
__ LoadRoot(ip, Heap::kStackLimitRootIndex);
|
||||
__ cmp(sp, Operand(ip));
|
||||
__ b(hs, &ok);
|
||||
PredictableCodeSizeScope predictable(masm_);
|
||||
PredictableCodeSizeScope predictable(masm_, 2 * Assembler::kInstrSize);
|
||||
StackCheckStub stub;
|
||||
__ CallStub(&stub);
|
||||
__ bind(&ok);
|
||||
@ -368,7 +368,7 @@ void FullCodeGenerator::EmitStackCheck(IterationStatement* stmt,
|
||||
__ LoadRoot(ip, Heap::kStackLimitRootIndex);
|
||||
__ cmp(sp, Operand(ip));
|
||||
__ b(hs, &ok);
|
||||
PredictableCodeSizeScope predictable(masm_);
|
||||
PredictableCodeSizeScope predictable(masm_, 2 * Assembler::kInstrSize);
|
||||
StackCheckStub stub;
|
||||
__ CallStub(&stub);
|
||||
}
|
||||
@ -442,7 +442,8 @@ void FullCodeGenerator::EmitReturnSequence() {
|
||||
// tool from instrumenting as we rely on the code size here.
|
||||
int32_t sp_delta = (info_->scope()->num_parameters() + 1) * kPointerSize;
|
||||
CodeGenerator::RecordPositions(masm_, function()->end_position() - 1);
|
||||
PredictableCodeSizeScope predictable(masm_);
|
||||
// TODO(svenpanne) The code below is sometimes 4 words, sometimes 5!
|
||||
PredictableCodeSizeScope predictable(masm_, -1);
|
||||
__ RecordJSReturn();
|
||||
masm_->mov(sp, fp);
|
||||
masm_->ldm(ia_w, sp, fp.bit() | lr.bit());
|
||||
|
@ -2547,7 +2547,7 @@ void LCodeGen::DoInstanceOfKnownGlobal(LInstanceOfKnownGlobal* instr) {
|
||||
// We use Factory::the_hole_value() on purpose instead of loading from the
|
||||
// root array to force relocation to be able to later patch with
|
||||
// the cached map.
|
||||
PredictableCodeSizeScope predictable(masm_);
|
||||
PredictableCodeSizeScope predictable(masm_, 5 * Assembler::kInstrSize);
|
||||
Handle<JSGlobalPropertyCell> cell =
|
||||
factory()->NewJSGlobalPropertyCell(factory()->the_hole_value());
|
||||
__ mov(ip, Operand(Handle<Object>(cell)));
|
||||
@ -2611,7 +2611,7 @@ void LCodeGen::DoDeferredInstanceOfKnownGlobal(LInstanceOfKnownGlobal* instr,
|
||||
static const int kAdditionalDelta = 5;
|
||||
// Make sure that code size is predicable, since we use specific constants
|
||||
// offsets in the code to find embedded values..
|
||||
PredictableCodeSizeScope predictable(masm_);
|
||||
PredictableCodeSizeScope predictable(masm_, 6 * Assembler::kInstrSize);
|
||||
int delta = masm_->InstructionsGeneratedSince(map_check) + kAdditionalDelta;
|
||||
Label before_push_delta;
|
||||
__ bind(&before_push_delta);
|
||||
@ -5640,7 +5640,7 @@ void LCodeGen::DoStackCheck(LStackCheck* instr) {
|
||||
__ cmp(sp, Operand(ip));
|
||||
__ b(hs, &done);
|
||||
StackCheckStub stub;
|
||||
PredictableCodeSizeScope predictable(masm_);
|
||||
PredictableCodeSizeScope predictable(masm_, 2 * Assembler::kInstrSize);
|
||||
CallCode(stub.GetCode(), RelocInfo::CODE_TARGET, instr);
|
||||
EnsureSpaceForLazyDeopt();
|
||||
__ bind(&done);
|
||||
|
@ -151,6 +151,28 @@ AssemblerBase::~AssemblerBase() {
|
||||
}
|
||||
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
// Implementation of PredictableCodeSizeScope
|
||||
|
||||
PredictableCodeSizeScope::PredictableCodeSizeScope(AssemblerBase* assembler,
|
||||
int expected_size)
|
||||
: assembler_(assembler),
|
||||
expected_size_(expected_size),
|
||||
start_offset_(assembler->pc_offset()),
|
||||
old_value_(assembler->predictable_code_size()) {
|
||||
assembler_->set_predictable_code_size(true);
|
||||
}
|
||||
|
||||
|
||||
PredictableCodeSizeScope::~PredictableCodeSizeScope() {
|
||||
// TODO(svenpanne) Remove the 'if' when everything works.
|
||||
if (expected_size_ >= 0) {
|
||||
CHECK_EQ(expected_size_, assembler_->pc_offset() - start_offset_);
|
||||
}
|
||||
assembler_->set_predictable_code_size(old_value_);
|
||||
}
|
||||
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
// Implementation of Label
|
||||
|
||||
|
@ -98,18 +98,13 @@ class AssemblerBase: public Malloced {
|
||||
// snapshot and the running VM.
|
||||
class PredictableCodeSizeScope {
|
||||
public:
|
||||
explicit PredictableCodeSizeScope(AssemblerBase* assembler)
|
||||
: assembler_(assembler) {
|
||||
old_value_ = assembler_->predictable_code_size();
|
||||
assembler_->set_predictable_code_size(true);
|
||||
}
|
||||
|
||||
~PredictableCodeSizeScope() {
|
||||
assembler_->set_predictable_code_size(old_value_);
|
||||
}
|
||||
PredictableCodeSizeScope(AssemblerBase* assembler, int expected_size);
|
||||
~PredictableCodeSizeScope();
|
||||
|
||||
private:
|
||||
AssemblerBase* assembler_;
|
||||
int expected_size_;
|
||||
int start_offset_;
|
||||
bool old_value_;
|
||||
};
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user