Make macro-assembler-x64 deal with handles to objects in new space by default.
BUG= R=mstarzinger@chromium.org Review URL: https://codereview.chromium.org/34753004 git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@17333 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
This commit is contained in:
parent
6eeb141a37
commit
e942696a35
@ -1129,7 +1129,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(rbx, cell);
|
__ Move(rbx, cell);
|
||||||
__ Move(FieldOperand(rbx, Cell::kValueOffset),
|
__ Move(FieldOperand(rbx, Cell::kValueOffset),
|
||||||
Smi::FromInt(TypeFeedbackCells::kForInSlowCaseMarker));
|
Smi::FromInt(TypeFeedbackCells::kForInSlowCaseMarker));
|
||||||
|
|
||||||
|
@ -1556,8 +1556,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;
|
__ Move(ToRegister(instr->result()), value);
|
||||||
__ LoadObject(ToRegister(instr->result()), value);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -2129,7 +2128,7 @@ void LCodeGen::DoCmpObjectEqAndBranch(LCmpObjectEqAndBranch* instr) {
|
|||||||
|
|
||||||
if (instr->right()->IsConstantOperand()) {
|
if (instr->right()->IsConstantOperand()) {
|
||||||
Handle<Object> right = ToHandle(LConstantOperand::cast(instr->right()));
|
Handle<Object> right = ToHandle(LConstantOperand::cast(instr->right()));
|
||||||
__ CmpObject(left, right);
|
__ Cmp(left, right);
|
||||||
} else {
|
} else {
|
||||||
Register right = ToRegister(instr->right());
|
Register right = ToRegister(instr->right());
|
||||||
__ cmpq(left, right);
|
__ cmpq(left, right);
|
||||||
@ -2497,7 +2496,7 @@ void LCodeGen::DoDeferredInstanceOfKnownGlobal(LInstanceOfKnownGlobal* instr,
|
|||||||
InstanceofStub stub(flags);
|
InstanceofStub stub(flags);
|
||||||
|
|
||||||
__ push(ToRegister(instr->value()));
|
__ push(ToRegister(instr->value()));
|
||||||
__ PushHeapObject(instr->function());
|
__ Push(instr->function());
|
||||||
|
|
||||||
static const int kAdditionalDelta = 10;
|
static const int kAdditionalDelta = 10;
|
||||||
int delta =
|
int delta =
|
||||||
@ -3208,7 +3207,7 @@ void LCodeGen::DoOuterContext(LOuterContext* instr) {
|
|||||||
|
|
||||||
void LCodeGen::DoDeclareGlobals(LDeclareGlobals* instr) {
|
void LCodeGen::DoDeclareGlobals(LDeclareGlobals* instr) {
|
||||||
__ push(rsi); // The context is the first argument.
|
__ push(rsi); // The context is the first argument.
|
||||||
__ PushHeapObject(instr->hydrogen()->pairs());
|
__ Push(instr->hydrogen()->pairs());
|
||||||
__ Push(Smi::FromInt(instr->hydrogen()->flags()));
|
__ Push(Smi::FromInt(instr->hydrogen()->flags()));
|
||||||
CallRuntime(Runtime::kDeclareGlobals, 3, instr);
|
CallRuntime(Runtime::kDeclareGlobals, 3, instr);
|
||||||
}
|
}
|
||||||
@ -3242,7 +3241,7 @@ void LCodeGen::CallKnownFunction(Handle<JSFunction> function,
|
|||||||
|
|
||||||
if (can_invoke_directly) {
|
if (can_invoke_directly) {
|
||||||
if (rdi_state == RDI_UNINITIALIZED) {
|
if (rdi_state == RDI_UNINITIALIZED) {
|
||||||
__ LoadHeapObject(rdi, function);
|
__ Move(rdi, function);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Change context.
|
// Change context.
|
||||||
@ -4838,8 +4837,7 @@ void LCodeGen::DoCheckInstanceType(LCheckInstanceType* instr) {
|
|||||||
|
|
||||||
void LCodeGen::DoCheckValue(LCheckValue* instr) {
|
void LCodeGen::DoCheckValue(LCheckValue* instr) {
|
||||||
Register reg = ToRegister(instr->value());
|
Register reg = ToRegister(instr->value());
|
||||||
Handle<HeapObject> object = instr->hydrogen()->object().handle();
|
__ Cmp(reg, instr->hydrogen()->object().handle());
|
||||||
__ CmpHeapObject(reg, object);
|
|
||||||
DeoptimizeIf(not_equal, instr->environment());
|
DeoptimizeIf(not_equal, instr->environment());
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -5066,7 +5064,7 @@ void LCodeGen::DoRegExpLiteral(LRegExpLiteral* instr) {
|
|||||||
// rax = regexp literal clone.
|
// rax = regexp literal clone.
|
||||||
int literal_offset =
|
int literal_offset =
|
||||||
FixedArray::OffsetOfElementAt(instr->hydrogen()->literal_index());
|
FixedArray::OffsetOfElementAt(instr->hydrogen()->literal_index());
|
||||||
__ LoadHeapObject(rcx, instr->hydrogen()->literals());
|
__ Move(rcx, instr->hydrogen()->literals());
|
||||||
__ movq(rbx, FieldOperand(rcx, literal_offset));
|
__ movq(rbx, FieldOperand(rcx, literal_offset));
|
||||||
__ CompareRoot(rbx, Heap::kUndefinedValueRootIndex);
|
__ CompareRoot(rbx, Heap::kUndefinedValueRootIndex);
|
||||||
__ j(not_equal, &materialized, Label::kNear);
|
__ j(not_equal, &materialized, Label::kNear);
|
||||||
@ -5137,13 +5135,7 @@ void LCodeGen::DoTypeof(LTypeof* instr) {
|
|||||||
void LCodeGen::EmitPushTaggedOperand(LOperand* operand) {
|
void LCodeGen::EmitPushTaggedOperand(LOperand* operand) {
|
||||||
ASSERT(!operand->IsDoubleRegister());
|
ASSERT(!operand->IsDoubleRegister());
|
||||||
if (operand->IsConstantOperand()) {
|
if (operand->IsConstantOperand()) {
|
||||||
Handle<Object> object = ToHandle(LConstantOperand::cast(operand));
|
__ Push(ToHandle(LConstantOperand::cast(operand)));
|
||||||
AllowDeferredHandleDereference smi_check;
|
|
||||||
if (object->IsSmi()) {
|
|
||||||
__ Push(Handle<Smi>::cast(object));
|
|
||||||
} else {
|
|
||||||
__ PushHeapObject(Handle<HeapObject>::cast(object));
|
|
||||||
}
|
|
||||||
} else if (operand->IsRegister()) {
|
} else if (operand->IsRegister()) {
|
||||||
__ push(ToRegister(operand));
|
__ push(ToRegister(operand));
|
||||||
} else {
|
} else {
|
||||||
|
@ -200,7 +200,7 @@ void LGapResolver::EmitMove(int index) {
|
|||||||
} else if (cgen_->IsInteger32Constant(constant_source)) {
|
} else if (cgen_->IsInteger32Constant(constant_source)) {
|
||||||
__ movl(dst, Immediate(cgen_->ToInteger32(constant_source)));
|
__ movl(dst, Immediate(cgen_->ToInteger32(constant_source)));
|
||||||
} else {
|
} else {
|
||||||
__ LoadObject(dst, cgen_->ToHandle(constant_source));
|
__ Move(dst, cgen_->ToHandle(constant_source));
|
||||||
}
|
}
|
||||||
} else if (destination->IsDoubleRegister()) {
|
} else if (destination->IsDoubleRegister()) {
|
||||||
double v = cgen_->ToDouble(constant_source);
|
double v = cgen_->ToDouble(constant_source);
|
||||||
@ -222,7 +222,7 @@ void LGapResolver::EmitMove(int index) {
|
|||||||
// value.
|
// value.
|
||||||
__ movq(dst, Immediate(cgen_->ToInteger32(constant_source)));
|
__ movq(dst, Immediate(cgen_->ToInteger32(constant_source)));
|
||||||
} else {
|
} else {
|
||||||
__ LoadObject(kScratchRegister, cgen_->ToHandle(constant_source));
|
__ Move(kScratchRegister, cgen_->ToHandle(constant_source));
|
||||||
__ movq(dst, kScratchRegister);
|
__ movq(dst, kScratchRegister);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2492,8 +2492,7 @@ void MacroAssembler::Move(Register dst, Handle<Object> source) {
|
|||||||
if (source->IsSmi()) {
|
if (source->IsSmi()) {
|
||||||
Move(dst, Smi::cast(*source));
|
Move(dst, Smi::cast(*source));
|
||||||
} else {
|
} else {
|
||||||
ASSERT(source->IsHeapObject());
|
MoveHeapObject(dst, source);
|
||||||
movq(dst, source, RelocInfo::EMBEDDED_OBJECT);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2503,8 +2502,7 @@ void MacroAssembler::Move(const Operand& dst, Handle<Object> source) {
|
|||||||
if (source->IsSmi()) {
|
if (source->IsSmi()) {
|
||||||
Move(dst, Smi::cast(*source));
|
Move(dst, Smi::cast(*source));
|
||||||
} else {
|
} else {
|
||||||
ASSERT(source->IsHeapObject());
|
MoveHeapObject(kScratchRegister, source);
|
||||||
movq(kScratchRegister, source, RelocInfo::EMBEDDED_OBJECT);
|
|
||||||
movq(dst, kScratchRegister);
|
movq(dst, kScratchRegister);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -2515,8 +2513,7 @@ void MacroAssembler::Cmp(Register dst, Handle<Object> source) {
|
|||||||
if (source->IsSmi()) {
|
if (source->IsSmi()) {
|
||||||
Cmp(dst, Smi::cast(*source));
|
Cmp(dst, Smi::cast(*source));
|
||||||
} else {
|
} else {
|
||||||
ASSERT(source->IsHeapObject());
|
MoveHeapObject(kScratchRegister, source);
|
||||||
movq(kScratchRegister, source, RelocInfo::EMBEDDED_OBJECT);
|
|
||||||
cmpq(dst, kScratchRegister);
|
cmpq(dst, kScratchRegister);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -2527,8 +2524,7 @@ void MacroAssembler::Cmp(const Operand& dst, Handle<Object> source) {
|
|||||||
if (source->IsSmi()) {
|
if (source->IsSmi()) {
|
||||||
Cmp(dst, Smi::cast(*source));
|
Cmp(dst, Smi::cast(*source));
|
||||||
} else {
|
} else {
|
||||||
ASSERT(source->IsHeapObject());
|
MoveHeapObject(kScratchRegister, source);
|
||||||
movq(kScratchRegister, source, RelocInfo::EMBEDDED_OBJECT);
|
|
||||||
cmpq(dst, kScratchRegister);
|
cmpq(dst, kScratchRegister);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -2539,47 +2535,22 @@ void MacroAssembler::Push(Handle<Object> source) {
|
|||||||
if (source->IsSmi()) {
|
if (source->IsSmi()) {
|
||||||
Push(Smi::cast(*source));
|
Push(Smi::cast(*source));
|
||||||
} else {
|
} else {
|
||||||
ASSERT(source->IsHeapObject());
|
MoveHeapObject(kScratchRegister, source);
|
||||||
movq(kScratchRegister, source, RelocInfo::EMBEDDED_OBJECT);
|
|
||||||
push(kScratchRegister);
|
push(kScratchRegister);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void MacroAssembler::LoadHeapObject(Register result,
|
void MacroAssembler::MoveHeapObject(Register result,
|
||||||
Handle<HeapObject> object) {
|
Handle<Object> object) {
|
||||||
AllowDeferredHandleDereference using_raw_address;
|
AllowDeferredHandleDereference using_raw_address;
|
||||||
|
ASSERT(object->IsHeapObject());
|
||||||
if (isolate()->heap()->InNewSpace(*object)) {
|
if (isolate()->heap()->InNewSpace(*object)) {
|
||||||
Handle<Cell> cell = isolate()->factory()->NewCell(object);
|
Handle<Cell> cell = isolate()->factory()->NewCell(object);
|
||||||
movq(result, cell, RelocInfo::CELL);
|
movq(result, cell, RelocInfo::CELL);
|
||||||
movq(result, Operand(result, 0));
|
movq(result, Operand(result, 0));
|
||||||
} else {
|
} else {
|
||||||
Move(result, object);
|
movq(result, object, RelocInfo::EMBEDDED_OBJECT);
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void MacroAssembler::CmpHeapObject(Register reg, Handle<HeapObject> object) {
|
|
||||||
AllowDeferredHandleDereference using_raw_address;
|
|
||||||
if (isolate()->heap()->InNewSpace(*object)) {
|
|
||||||
Handle<Cell> cell = isolate()->factory()->NewCell(object);
|
|
||||||
movq(kScratchRegister, cell, RelocInfo::CELL);
|
|
||||||
cmpq(reg, Operand(kScratchRegister, 0));
|
|
||||||
} else {
|
|
||||||
Cmp(reg, object);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void MacroAssembler::PushHeapObject(Handle<HeapObject> object) {
|
|
||||||
AllowDeferredHandleDereference using_raw_address;
|
|
||||||
if (isolate()->heap()->InNewSpace(*object)) {
|
|
||||||
Handle<Cell> cell = isolate()->factory()->NewCell(object);
|
|
||||||
movq(kScratchRegister, cell, RelocInfo::CELL);
|
|
||||||
movq(kScratchRegister, Operand(kScratchRegister, 0));
|
|
||||||
push(kScratchRegister);
|
|
||||||
} else {
|
|
||||||
Push(object);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -3591,7 +3562,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(rdi, function);
|
Move(rdi, function);
|
||||||
movq(rsi, FieldOperand(rdi, JSFunction::kContextOffset));
|
movq(rsi, FieldOperand(rdi, JSFunction::kContextOffset));
|
||||||
|
|
||||||
// We call indirectly through the code field in the function to
|
// We call indirectly through the code field in the function to
|
||||||
|
@ -812,27 +812,7 @@ class MacroAssembler: public Assembler {
|
|||||||
|
|
||||||
// Load a heap object and handle the case of new-space objects by
|
// Load a heap object and handle the case of new-space objects by
|
||||||
// indirecting via a global cell.
|
// indirecting via a global cell.
|
||||||
void LoadHeapObject(Register result, Handle<HeapObject> object);
|
void MoveHeapObject(Register result, Handle<Object> object);
|
||||||
void CmpHeapObject(Register reg, Handle<HeapObject> object);
|
|
||||||
void PushHeapObject(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);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void CmpObject(Register reg, Handle<Object> object) {
|
|
||||||
AllowDeferredHandleDereference heap_object_check;
|
|
||||||
if (object->IsHeapObject()) {
|
|
||||||
CmpHeapObject(reg, Handle<HeapObject>::cast(object));
|
|
||||||
} else {
|
|
||||||
Cmp(reg, object);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Load a global cell into a register.
|
// Load a global cell into a register.
|
||||||
void LoadGlobalCell(Register dst, Handle<Cell> cell);
|
void LoadGlobalCell(Register dst, Handle<Cell> cell);
|
||||||
|
@ -464,7 +464,7 @@ static void GenerateFastApiCall(MacroAssembler* masm,
|
|||||||
|
|
||||||
// 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(rdi, function);
|
__ Move(rdi, function);
|
||||||
__ movq(rsi, FieldOperand(rdi, JSFunction::kContextOffset));
|
__ movq(rsi, FieldOperand(rdi, JSFunction::kContextOffset));
|
||||||
// Construct the FunctionCallbackInfo on the stack.
|
// Construct the FunctionCallbackInfo on the stack.
|
||||||
__ movq(args.GetArgumentOperand(offset - FCA::kCalleeIndex), rdi);
|
__ movq(args.GetArgumentOperand(offset - FCA::kCalleeIndex), rdi);
|
||||||
@ -834,7 +834,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());
|
||||||
__ CmpObject(value_reg, constant);
|
__ Cmp(value_reg, constant);
|
||||||
__ j(not_equal, miss_label);
|
__ j(not_equal, miss_label);
|
||||||
} else if (FLAG_track_fields && representation.IsSmi()) {
|
} else if (FLAG_track_fields && representation.IsSmi()) {
|
||||||
__ JumpIfNotSmi(value_reg, miss_label);
|
__ JumpIfNotSmi(value_reg, miss_label);
|
||||||
@ -1411,7 +1411,7 @@ void LoadStubCompiler::GenerateLoadCallback(
|
|||||||
|
|
||||||
void LoadStubCompiler::GenerateLoadConstant(Handle<Object> value) {
|
void LoadStubCompiler::GenerateLoadConstant(Handle<Object> value) {
|
||||||
// Return the constant value.
|
// Return the constant value.
|
||||||
__ LoadObject(rax, value);
|
__ Move(rax, value);
|
||||||
__ ret(0);
|
__ ret(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user