X64: Use CmpObjectType macro everywhere, fix problem with sign of instance types.
Review URL: http://codereview.chromium.org/155132 git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@2374 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
This commit is contained in:
parent
0f7b263bdd
commit
e9580c61ba
@ -3144,11 +3144,9 @@ void CodeGenerator::VisitCompareOperation(CompareOperation* node) {
|
|||||||
__ testb(FieldOperand(kScratchRegister, Map::kBitFieldOffset),
|
__ testb(FieldOperand(kScratchRegister, Map::kBitFieldOffset),
|
||||||
Immediate(1 << Map::kIsUndetectable));
|
Immediate(1 << Map::kIsUndetectable));
|
||||||
destination()->false_target()->Branch(not_zero);
|
destination()->false_target()->Branch(not_zero);
|
||||||
__ movb(kScratchRegister,
|
__ CmpInstanceType(kScratchRegister, FIRST_JS_OBJECT_TYPE);
|
||||||
FieldOperand(kScratchRegister, Map::kInstanceTypeOffset));
|
|
||||||
__ cmpb(kScratchRegister, Immediate(FIRST_JS_OBJECT_TYPE));
|
|
||||||
destination()->false_target()->Branch(below);
|
destination()->false_target()->Branch(below);
|
||||||
__ cmpb(kScratchRegister, Immediate(LAST_JS_OBJECT_TYPE));
|
__ CmpInstanceType(kScratchRegister, LAST_JS_OBJECT_TYPE);
|
||||||
answer.Unuse();
|
answer.Unuse();
|
||||||
destination()->Split(below_equal);
|
destination()->Split(below_equal);
|
||||||
} else {
|
} else {
|
||||||
@ -3393,27 +3391,22 @@ void CodeGenerator::GenerateClassOf(ZoneList<Expression*>* args) {
|
|||||||
|
|
||||||
// Check that the object is a JS object but take special care of JS
|
// Check that the object is a JS object but take special care of JS
|
||||||
// functions to make sure they have 'Function' as their class.
|
// functions to make sure they have 'Function' as their class.
|
||||||
{ Result tmp = allocator()->Allocate();
|
|
||||||
__ movq(obj.reg(), FieldOperand(obj.reg(), HeapObject::kMapOffset));
|
|
||||||
__ movb(tmp.reg(), FieldOperand(obj.reg(), Map::kInstanceTypeOffset));
|
|
||||||
__ cmpb(tmp.reg(), Immediate(FIRST_JS_OBJECT_TYPE));
|
|
||||||
null.Branch(less);
|
|
||||||
|
|
||||||
// As long as JS_FUNCTION_TYPE is the last instance type and it is
|
__ CmpObjectType(obj.reg(), FIRST_JS_OBJECT_TYPE, obj.reg());
|
||||||
// right after LAST_JS_OBJECT_TYPE, we can avoid checking for
|
null.Branch(less);
|
||||||
// LAST_JS_OBJECT_TYPE.
|
|
||||||
ASSERT(LAST_TYPE == JS_FUNCTION_TYPE);
|
// As long as JS_FUNCTION_TYPE is the last instance type and it is
|
||||||
ASSERT(JS_FUNCTION_TYPE == LAST_JS_OBJECT_TYPE + 1);
|
// right after LAST_JS_OBJECT_TYPE, we can avoid checking for
|
||||||
__ cmpb(tmp.reg(), Immediate(JS_FUNCTION_TYPE));
|
// LAST_JS_OBJECT_TYPE.
|
||||||
function.Branch(equal);
|
ASSERT(LAST_TYPE == JS_FUNCTION_TYPE);
|
||||||
}
|
ASSERT(JS_FUNCTION_TYPE == LAST_JS_OBJECT_TYPE + 1);
|
||||||
|
__ CmpInstanceType(obj.reg(), JS_FUNCTION_TYPE);
|
||||||
|
function.Branch(equal);
|
||||||
|
|
||||||
// Check if the constructor in the map is a function.
|
// Check if the constructor in the map is a function.
|
||||||
{ Result tmp = allocator()->Allocate();
|
__ movq(obj.reg(), FieldOperand(obj.reg(), Map::kConstructorOffset));
|
||||||
__ movq(obj.reg(), FieldOperand(obj.reg(), Map::kConstructorOffset));
|
__ CmpObjectType(obj.reg(), JS_FUNCTION_TYPE, kScratchRegister);
|
||||||
__ CmpObjectType(obj.reg(), JS_FUNCTION_TYPE, tmp.reg());
|
non_function_constructor.Branch(not_equal);
|
||||||
non_function_constructor.Branch(not_equal);
|
|
||||||
}
|
|
||||||
|
|
||||||
// The obj register now contains the constructor function. Grab the
|
// The obj register now contains the constructor function. Grab the
|
||||||
// instance class name from there.
|
// instance class name from there.
|
||||||
@ -5428,6 +5421,7 @@ void ToBooleanStub::Generate(MacroAssembler* masm) {
|
|||||||
__ j(equal, &false_result);
|
__ j(equal, &false_result);
|
||||||
|
|
||||||
// Get the map and type of the heap object.
|
// Get the map and type of the heap object.
|
||||||
|
// We don't use CmpObjectType because we manipulate the type field.
|
||||||
__ movq(rdx, FieldOperand(rax, HeapObject::kMapOffset));
|
__ movq(rdx, FieldOperand(rax, HeapObject::kMapOffset));
|
||||||
__ movzxbq(rcx, FieldOperand(rdx, Map::kInstanceTypeOffset));
|
__ movzxbq(rcx, FieldOperand(rdx, Map::kInstanceTypeOffset));
|
||||||
|
|
||||||
|
@ -212,11 +212,9 @@ void CallIC::Generate(MacroAssembler* masm,
|
|||||||
__ movq(rdx, Operand(rsp, (argc + 1) * kPointerSize)); // receiver
|
__ movq(rdx, Operand(rsp, (argc + 1) * kPointerSize)); // receiver
|
||||||
__ testl(rdx, Immediate(kSmiTagMask));
|
__ testl(rdx, Immediate(kSmiTagMask));
|
||||||
__ j(zero, &invoke);
|
__ j(zero, &invoke);
|
||||||
__ movq(rcx, FieldOperand(rdx, HeapObject::kMapOffset));
|
__ CmpObjectType(rdx, JS_GLOBAL_OBJECT_TYPE, rcx);
|
||||||
__ movzxbq(rcx, FieldOperand(rcx, Map::kInstanceTypeOffset));
|
|
||||||
__ cmpq(rcx, Immediate(static_cast<int8_t>(JS_GLOBAL_OBJECT_TYPE)));
|
|
||||||
__ j(equal, &global);
|
__ j(equal, &global);
|
||||||
__ cmpq(rcx, Immediate(static_cast<int8_t>(JS_BUILTINS_OBJECT_TYPE)));
|
__ CmpInstanceType(rcx, JS_BUILTINS_OBJECT_TYPE);
|
||||||
__ j(not_equal, &invoke);
|
__ j(not_equal, &invoke);
|
||||||
|
|
||||||
// Patch the receiver on the stack.
|
// Patch the receiver on the stack.
|
||||||
|
Loading…
Reference in New Issue
Block a user