OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
4 // met: | 4 // met: |
5 // | 5 // |
6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
(...skipping 1850 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1861 STATIC_ASSERT(LAST_SPEC_OBJECT_TYPE == LAST_TYPE); | 1861 STATIC_ASSERT(LAST_SPEC_OBJECT_TYPE == LAST_TYPE); |
1862 __ CmpObjectType(input, FIRST_SPEC_OBJECT_TYPE, temp); | 1862 __ CmpObjectType(input, FIRST_SPEC_OBJECT_TYPE, temp); |
1863 __ j(below, is_false); | 1863 __ j(below, is_false); |
1864 __ j(equal, is_true); | 1864 __ j(equal, is_true); |
1865 __ CmpInstanceType(temp, LAST_SPEC_OBJECT_TYPE); | 1865 __ CmpInstanceType(temp, LAST_SPEC_OBJECT_TYPE); |
1866 __ j(equal, is_true); | 1866 __ j(equal, is_true); |
1867 } else { | 1867 } else { |
1868 // Faster code path to avoid two compares: subtract lower bound from the | 1868 // Faster code path to avoid two compares: subtract lower bound from the |
1869 // actual type and do a signed compare with the width of the type range. | 1869 // actual type and do a signed compare with the width of the type range. |
1870 __ mov(temp, FieldOperand(input, HeapObject::kMapOffset)); | 1870 __ mov(temp, FieldOperand(input, HeapObject::kMapOffset)); |
1871 __ mov(temp2, FieldOperand(temp, Map::kInstanceTypeOffset)); | 1871 __ movzx_b(temp2, FieldOperand(temp, Map::kInstanceTypeOffset)); |
1872 __ sub(Operand(temp2), Immediate(FIRST_NONCALLABLE_SPEC_OBJECT_TYPE)); | 1872 __ sub(Operand(temp2), Immediate(FIRST_NONCALLABLE_SPEC_OBJECT_TYPE)); |
1873 __ cmpb(Operand(temp2), | 1873 __ cmp(Operand(temp2), Immediate(LAST_NONCALLABLE_SPEC_OBJECT_TYPE - |
1874 static_cast<int8_t>(LAST_NONCALLABLE_SPEC_OBJECT_TYPE - | 1874 FIRST_NONCALLABLE_SPEC_OBJECT_TYPE)); |
1875 FIRST_NONCALLABLE_SPEC_OBJECT_TYPE)); | |
1876 __ j(above, is_false); | 1875 __ j(above, is_false); |
1877 } | 1876 } |
1878 | 1877 |
1879 // Now we are in the FIRST-LAST_NONCALLABLE_SPEC_OBJECT_TYPE range. | 1878 // Now we are in the FIRST-LAST_NONCALLABLE_SPEC_OBJECT_TYPE range. |
1880 // Check if the constructor in the map is a function. | 1879 // Check if the constructor in the map is a function. |
1881 __ mov(temp, FieldOperand(temp, Map::kConstructorOffset)); | 1880 __ mov(temp, FieldOperand(temp, Map::kConstructorOffset)); |
1882 // Objects with a non-function constructor have class 'Object'. | 1881 // Objects with a non-function constructor have class 'Object'. |
1883 __ CmpObjectType(temp, JS_FUNCTION_TYPE, temp2); | 1882 __ CmpObjectType(temp, JS_FUNCTION_TYPE, temp2); |
1884 if (class_name->IsEqualTo(CStrVector("Object"))) { | 1883 if (class_name->IsEqualTo(CStrVector("Object"))) { |
1885 __ j(not_equal, is_true); | 1884 __ j(not_equal, is_true); |
(...skipping 2186 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4072 uint8_t tag; | 4071 uint8_t tag; |
4073 instr->hydrogen()->GetCheckMaskAndTag(&mask, &tag); | 4072 instr->hydrogen()->GetCheckMaskAndTag(&mask, &tag); |
4074 | 4073 |
4075 if (IsPowerOf2(mask)) { | 4074 if (IsPowerOf2(mask)) { |
4076 ASSERT(tag == 0 || IsPowerOf2(tag)); | 4075 ASSERT(tag == 0 || IsPowerOf2(tag)); |
4077 __ test_b(FieldOperand(temp, Map::kInstanceTypeOffset), mask); | 4076 __ test_b(FieldOperand(temp, Map::kInstanceTypeOffset), mask); |
4078 DeoptimizeIf(tag == 0 ? not_zero : zero, instr->environment()); | 4077 DeoptimizeIf(tag == 0 ? not_zero : zero, instr->environment()); |
4079 } else { | 4078 } else { |
4080 __ movzx_b(temp, FieldOperand(temp, Map::kInstanceTypeOffset)); | 4079 __ movzx_b(temp, FieldOperand(temp, Map::kInstanceTypeOffset)); |
4081 __ and_(temp, mask); | 4080 __ and_(temp, mask); |
4082 __ cmpb(Operand(temp), tag); | 4081 __ cmp(temp, tag); |
4083 DeoptimizeIf(not_equal, instr->environment()); | 4082 DeoptimizeIf(not_equal, instr->environment()); |
4084 } | 4083 } |
4085 } | 4084 } |
4086 } | 4085 } |
4087 | 4086 |
4088 | 4087 |
4089 void LCodeGen::DoCheckFunction(LCheckFunction* instr) { | 4088 void LCodeGen::DoCheckFunction(LCheckFunction* instr) { |
4090 Handle<JSFunction> target = instr->hydrogen()->target(); | 4089 Handle<JSFunction> target = instr->hydrogen()->target(); |
4091 if (isolate()->heap()->InNewSpace(*target)) { | 4090 if (isolate()->heap()->InNewSpace(*target)) { |
4092 Register reg = ToRegister(instr->value()); | 4091 Register reg = ToRegister(instr->value()); |
(...skipping 596 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4689 this, pointers, Safepoint::kLazyDeopt); | 4688 this, pointers, Safepoint::kLazyDeopt); |
4690 __ InvokeBuiltin(Builtins::IN, CALL_FUNCTION, safepoint_generator); | 4689 __ InvokeBuiltin(Builtins::IN, CALL_FUNCTION, safepoint_generator); |
4691 } | 4690 } |
4692 | 4691 |
4693 | 4692 |
4694 #undef __ | 4693 #undef __ |
4695 | 4694 |
4696 } } // namespace v8::internal | 4695 } } // namespace v8::internal |
4697 | 4696 |
4698 #endif // V8_TARGET_ARCH_IA32 | 4697 #endif // V8_TARGET_ARCH_IA32 |
OLD | NEW |