Handle constants in new space on arm by making macro-assembler smarter.

BUG=
R=jkummerow@chromium.org

Review URL: https://codereview.chromium.org/30023005

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@17376 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
This commit is contained in:
titzer@chromium.org 2013-10-24 12:40:34 +00:00
parent 56a46e591b
commit 517e15b014
7 changed files with 27 additions and 41 deletions

View File

@ -1158,7 +1158,7 @@ void FullCodeGenerator::VisitForInStatement(ForInStatement* stmt) {
Handle<Object>(Smi::FromInt(TypeFeedbackCells::kForInFastCaseMarker), Handle<Object>(Smi::FromInt(TypeFeedbackCells::kForInFastCaseMarker),
isolate())); isolate()));
RecordTypeFeedbackCell(stmt->ForInFeedbackId(), cell); RecordTypeFeedbackCell(stmt->ForInFeedbackId(), cell);
__ LoadHeapObject(r1, cell); __ Move(r1, cell);
__ mov(r2, Operand(Smi::FromInt(TypeFeedbackCells::kForInSlowCaseMarker))); __ mov(r2, Operand(Smi::FromInt(TypeFeedbackCells::kForInSlowCaseMarker)));
__ str(r2, FieldMemOperand(r1, Cell::kValueOffset)); __ str(r2, FieldMemOperand(r1, Cell::kValueOffset));

View File

@ -388,7 +388,7 @@ Register LCodeGen::EmitLoadRegister(LOperand* op, Register scratch) {
Abort(kEmitLoadRegisterUnsupportedDoubleImmediate); Abort(kEmitLoadRegisterUnsupportedDoubleImmediate);
} else { } else {
ASSERT(r.IsSmiOrTagged()); ASSERT(r.IsSmiOrTagged());
__ LoadObject(scratch, literal); __ Move(scratch, literal);
} }
return scratch; return scratch;
} else if (op->IsStackSlot() || op->IsArgument()) { } else if (op->IsStackSlot() || op->IsArgument()) {
@ -704,7 +704,7 @@ void LCodeGen::LoadContextFromDeferred(LOperand* context) {
} else if (context->IsConstantOperand()) { } else if (context->IsConstantOperand()) {
HConstant* constant = HConstant* constant =
chunk_->LookupConstant(LConstantOperand::cast(context)); chunk_->LookupConstant(LConstantOperand::cast(context));
__ LoadObject(cp, Handle<Object>::cast(constant->handle(isolate()))); __ Move(cp, Handle<Object>::cast(constant->handle(isolate())));
} else { } else {
UNREACHABLE(); UNREACHABLE();
} }
@ -1840,7 +1840,7 @@ void LCodeGen::DoConstantE(LConstantE* instr) {
void LCodeGen::DoConstantT(LConstantT* instr) { void LCodeGen::DoConstantT(LConstantT* instr) {
Handle<Object> value = instr->value(isolate()); Handle<Object> value = instr->value(isolate());
AllowDeferredHandleDereference smi_check; AllowDeferredHandleDereference smi_check;
__ LoadObject(ToRegister(instr->result()), value); __ Move(ToRegister(instr->result()), value);
} }
@ -2797,7 +2797,7 @@ void LCodeGen::DoDeferredInstanceOfKnownGlobal(LInstanceOfKnownGlobal* instr,
// offset to the location of the map check. // offset to the location of the map check.
Register temp = ToRegister(instr->temp()); Register temp = ToRegister(instr->temp());
ASSERT(temp.is(r4)); ASSERT(temp.is(r4));
__ LoadHeapObject(InstanceofStub::right(), instr->function()); __ Move(InstanceofStub::right(), instr->function());
static const int kAdditionalDelta = 5; static const int kAdditionalDelta = 5;
// Make sure that code size is predicable, since we use specific constants // Make sure that code size is predicable, since we use specific constants
// offsets in the code to find embedded values.. // offsets in the code to find embedded values..
@ -3537,7 +3537,7 @@ void LCodeGen::DoOuterContext(LOuterContext* instr) {
void LCodeGen::DoDeclareGlobals(LDeclareGlobals* instr) { void LCodeGen::DoDeclareGlobals(LDeclareGlobals* instr) {
ASSERT(ToRegister(instr->context()).is(cp)); ASSERT(ToRegister(instr->context()).is(cp));
__ push(cp); // The context is the first argument. __ push(cp); // The context is the first argument.
__ LoadHeapObject(scratch0(), instr->hydrogen()->pairs()); __ Move(scratch0(), instr->hydrogen()->pairs());
__ push(scratch0()); __ push(scratch0());
__ mov(scratch0(), Operand(Smi::FromInt(instr->hydrogen()->flags()))); __ mov(scratch0(), Operand(Smi::FromInt(instr->hydrogen()->flags())));
__ push(scratch0()); __ push(scratch0());
@ -3574,7 +3574,7 @@ void LCodeGen::CallKnownFunction(Handle<JSFunction> function,
if (can_invoke_directly) { if (can_invoke_directly) {
if (r1_state == R1_UNINITIALIZED) { if (r1_state == R1_UNINITIALIZED) {
__ LoadHeapObject(r1, function); __ Move(r1, function);
} }
// Change context. // Change context.
@ -5421,7 +5421,7 @@ void LCodeGen::DoRegExpLiteral(LRegExpLiteral* instr) {
// r2-5 are used as temporaries. // r2-5 are used as temporaries.
int literal_offset = int literal_offset =
FixedArray::OffsetOfElementAt(instr->hydrogen()->literal_index()); FixedArray::OffsetOfElementAt(instr->hydrogen()->literal_index());
__ LoadHeapObject(r6, instr->hydrogen()->literals()); __ Move(r6, instr->hydrogen()->literals());
__ ldr(r1, FieldMemOperand(r6, literal_offset)); __ ldr(r1, FieldMemOperand(r6, literal_offset));
__ LoadRoot(ip, Heap::kUndefinedValueRootIndex); __ LoadRoot(ip, Heap::kUndefinedValueRootIndex);
__ cmp(r1, ip); __ cmp(r1, ip);

View File

@ -246,8 +246,6 @@ class LCodeGen: public LCodeGenBase {
CallKind call_kind, CallKind call_kind,
R1State r1_state); R1State r1_state);
void LoadHeapObject(Register result, Handle<HeapObject> object);
void RecordSafepointWithLazyDeopt(LInstruction* instr, void RecordSafepointWithLazyDeopt(LInstruction* instr,
SafepointMode safepoint_mode); SafepointMode safepoint_mode);

View File

@ -252,7 +252,7 @@ void LGapResolver::EmitMove(int index) {
if (cgen_->IsInteger32(constant_source)) { if (cgen_->IsInteger32(constant_source)) {
__ mov(dst, Operand(cgen_->ToRepresentation(constant_source, r))); __ mov(dst, Operand(cgen_->ToRepresentation(constant_source, r)));
} else { } else {
__ LoadObject(dst, cgen_->ToHandle(constant_source)); __ Move(dst, cgen_->ToHandle(constant_source));
} }
} else if (destination->IsDoubleRegister()) { } else if (destination->IsDoubleRegister()) {
DwVfpRegister result = cgen_->ToDoubleRegister(destination); DwVfpRegister result = cgen_->ToDoubleRegister(destination);
@ -267,7 +267,7 @@ void LGapResolver::EmitMove(int index) {
__ mov(kSavedValueRegister, __ mov(kSavedValueRegister,
Operand(cgen_->ToRepresentation(constant_source, r))); Operand(cgen_->ToRepresentation(constant_source, r)));
} else { } else {
__ LoadObject(kSavedValueRegister, __ Move(kSavedValueRegister,
cgen_->ToHandle(constant_source)); cgen_->ToHandle(constant_source));
} }
__ str(kSavedValueRegister, cgen_->ToMemOperand(destination)); __ str(kSavedValueRegister, cgen_->ToMemOperand(destination));

View File

@ -233,7 +233,19 @@ void MacroAssembler::Push(Handle<Object> handle) {
void MacroAssembler::Move(Register dst, Handle<Object> value) { void MacroAssembler::Move(Register dst, Handle<Object> value) {
AllowDeferredHandleDereference smi_check;
if (value->IsSmi()) {
mov(dst, Operand(value)); mov(dst, Operand(value));
} else {
ASSERT(value->IsHeapObject());
if (isolate()->heap()->InNewSpace(*value)) {
Handle<Cell> cell = isolate()->factory()->NewCell(value);
mov(dst, Operand(cell));
ldr(dst, FieldMemOperand(dst, Cell::kValueOffset));
} else {
mov(dst, Operand(value));
}
}
} }
@ -394,19 +406,6 @@ void MacroAssembler::StoreRoot(Register source,
} }
void MacroAssembler::LoadHeapObject(Register result,
Handle<HeapObject> object) {
AllowDeferredHandleDereference using_raw_address;
if (isolate()->heap()->InNewSpace(*object)) {
Handle<Cell> cell = isolate()->factory()->NewCell(object);
mov(result, Operand(cell));
ldr(result, FieldMemOperand(result, Cell::kValueOffset));
} else {
mov(result, Operand(object));
}
}
void MacroAssembler::InNewSpace(Register object, void MacroAssembler::InNewSpace(Register object,
Register scratch, Register scratch,
Condition cond, Condition cond,
@ -1285,7 +1284,7 @@ void MacroAssembler::InvokeFunction(Handle<JSFunction> function,
ASSERT(flag == JUMP_FUNCTION || has_frame()); ASSERT(flag == JUMP_FUNCTION || has_frame());
// Get the function and setup the context. // Get the function and setup the context.
LoadHeapObject(r1, function); Move(r1, function);
ldr(cp, FieldMemOperand(r1, JSFunction::kContextOffset)); ldr(cp, FieldMemOperand(r1, JSFunction::kContextOffset));
// We call indirectly through the code field in the function to // We call indirectly through the code field in the function to

View File

@ -170,17 +170,6 @@ class MacroAssembler: public Assembler {
Heap::RootListIndex index, Heap::RootListIndex index,
Condition cond = al); Condition cond = al);
void LoadHeapObject(Register dst, Handle<HeapObject> object);
void LoadObject(Register result, Handle<Object> object) {
AllowDeferredHandleDereference heap_object_check;
if (object->IsHeapObject()) {
LoadHeapObject(result, Handle<HeapObject>::cast(object));
} else {
Move(result, object);
}
}
// --------------------------------------------------------------------------- // ---------------------------------------------------------------------------
// GC Support // GC Support

View File

@ -477,7 +477,7 @@ void StoreStubCompiler::GenerateStoreTransition(MacroAssembler* masm,
if (details.type() == CONSTANT) { if (details.type() == CONSTANT) {
Handle<Object> constant(descriptors->GetValue(descriptor), masm->isolate()); Handle<Object> constant(descriptors->GetValue(descriptor), masm->isolate());
__ LoadObject(scratch1, constant); __ Move(scratch1, constant);
__ cmp(value_reg, scratch1); __ cmp(value_reg, scratch1);
__ b(ne, miss_label); __ b(ne, miss_label);
} else if (FLAG_track_fields && representation.IsSmi()) { } else if (FLAG_track_fields && representation.IsSmi()) {
@ -854,7 +854,7 @@ static void GenerateFastApiDirectCall(MacroAssembler* masm,
__ str(cp, MemOperand(sp, FCA::kContextSaveIndex * kPointerSize)); __ str(cp, MemOperand(sp, FCA::kContextSaveIndex * kPointerSize));
// Get the function and setup the context. // Get the function and setup the context.
Handle<JSFunction> function = optimization.constant_function(); Handle<JSFunction> function = optimization.constant_function();
__ LoadHeapObject(r5, function); __ Move(r5, function);
__ ldr(cp, FieldMemOperand(r5, JSFunction::kContextOffset)); __ ldr(cp, FieldMemOperand(r5, JSFunction::kContextOffset));
__ str(r5, MemOperand(sp, FCA::kCalleeIndex * kPointerSize)); __ str(r5, MemOperand(sp, FCA::kCalleeIndex * kPointerSize));
@ -1414,7 +1414,7 @@ void LoadStubCompiler::GenerateLoadField(Register reg,
void LoadStubCompiler::GenerateLoadConstant(Handle<Object> value) { void LoadStubCompiler::GenerateLoadConstant(Handle<Object> value) {
// Return the constant value. // Return the constant value.
__ LoadObject(r0, value); __ Move(r0, value);
__ Ret(); __ Ret();
} }