OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #if V8_TARGET_ARCH_X87 | 5 #if V8_TARGET_ARCH_X87 |
6 | 6 |
7 #include "src/crankshaft/x87/lithium-codegen-x87.h" | 7 #include "src/crankshaft/x87/lithium-codegen-x87.h" |
8 | 8 |
9 #include "src/base/bits.h" | 9 #include "src/base/bits.h" |
10 #include "src/code-factory.h" | 10 #include "src/code-factory.h" |
(...skipping 2398 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2409 if (expected.CanBeUndetectable()) { | 2409 if (expected.CanBeUndetectable()) { |
2410 // Undetectable -> false. | 2410 // Undetectable -> false. |
2411 __ test_b(FieldOperand(map, Map::kBitFieldOffset), | 2411 __ test_b(FieldOperand(map, Map::kBitFieldOffset), |
2412 1 << Map::kIsUndetectable); | 2412 1 << Map::kIsUndetectable); |
2413 __ j(not_zero, instr->FalseLabel(chunk_)); | 2413 __ j(not_zero, instr->FalseLabel(chunk_)); |
2414 } | 2414 } |
2415 } | 2415 } |
2416 | 2416 |
2417 if (expected.Contains(ToBooleanStub::SPEC_OBJECT)) { | 2417 if (expected.Contains(ToBooleanStub::SPEC_OBJECT)) { |
2418 // spec object -> true. | 2418 // spec object -> true. |
2419 __ CmpInstanceType(map, FIRST_SPEC_OBJECT_TYPE); | 2419 __ CmpInstanceType(map, FIRST_JS_RECEIVER_TYPE); |
2420 __ j(above_equal, instr->TrueLabel(chunk_)); | 2420 __ j(above_equal, instr->TrueLabel(chunk_)); |
2421 } | 2421 } |
2422 | 2422 |
2423 if (expected.Contains(ToBooleanStub::STRING)) { | 2423 if (expected.Contains(ToBooleanStub::STRING)) { |
2424 // String value -> false iff empty. | 2424 // String value -> false iff empty. |
2425 Label not_string; | 2425 Label not_string; |
2426 __ CmpInstanceType(map, FIRST_NONSTRING_TYPE); | 2426 __ CmpInstanceType(map, FIRST_NONSTRING_TYPE); |
2427 __ j(above_equal, ¬_string, Label::kNear); | 2427 __ j(above_equal, ¬_string, Label::kNear); |
2428 __ cmp(FieldOperand(reg, String::kLengthOffset), Immediate(0)); | 2428 __ cmp(FieldOperand(reg, String::kLengthOffset), Immediate(0)); |
2429 __ j(not_zero, instr->TrueLabel(chunk_)); | 2429 __ j(not_zero, instr->TrueLabel(chunk_)); |
(...skipping 346 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2776 DCHECK(!input.is(temp)); | 2776 DCHECK(!input.is(temp)); |
2777 DCHECK(!input.is(temp2)); | 2777 DCHECK(!input.is(temp2)); |
2778 DCHECK(!temp.is(temp2)); | 2778 DCHECK(!temp.is(temp2)); |
2779 __ JumpIfSmi(input, is_false); | 2779 __ JumpIfSmi(input, is_false); |
2780 | 2780 |
2781 if (String::Equals(isolate()->factory()->Function_string(), class_name)) { | 2781 if (String::Equals(isolate()->factory()->Function_string(), class_name)) { |
2782 // Assuming the following assertions, we can use the same compares to test | 2782 // Assuming the following assertions, we can use the same compares to test |
2783 // for both being a function type and being in the object type range. | 2783 // for both being a function type and being in the object type range. |
2784 STATIC_ASSERT(NUM_OF_CALLABLE_SPEC_OBJECT_TYPES == 2); | 2784 STATIC_ASSERT(NUM_OF_CALLABLE_SPEC_OBJECT_TYPES == 2); |
2785 STATIC_ASSERT(FIRST_NONCALLABLE_SPEC_OBJECT_TYPE == | 2785 STATIC_ASSERT(FIRST_NONCALLABLE_SPEC_OBJECT_TYPE == |
2786 FIRST_SPEC_OBJECT_TYPE + 1); | 2786 FIRST_JS_RECEIVER_TYPE + 1); |
2787 STATIC_ASSERT(LAST_NONCALLABLE_SPEC_OBJECT_TYPE == | 2787 STATIC_ASSERT(LAST_NONCALLABLE_SPEC_OBJECT_TYPE == |
2788 LAST_SPEC_OBJECT_TYPE - 1); | 2788 LAST_JS_RECEIVER_TYPE - 1); |
2789 STATIC_ASSERT(LAST_SPEC_OBJECT_TYPE == LAST_TYPE); | 2789 STATIC_ASSERT(LAST_JS_RECEIVER_TYPE == LAST_TYPE); |
2790 __ CmpObjectType(input, FIRST_SPEC_OBJECT_TYPE, temp); | 2790 __ CmpObjectType(input, FIRST_JS_RECEIVER_TYPE, temp); |
2791 __ j(below, is_false); | 2791 __ j(below, is_false); |
2792 __ j(equal, is_true); | 2792 __ j(equal, is_true); |
2793 __ CmpInstanceType(temp, LAST_SPEC_OBJECT_TYPE); | 2793 __ CmpInstanceType(temp, LAST_JS_RECEIVER_TYPE); |
2794 __ j(equal, is_true); | 2794 __ j(equal, is_true); |
2795 } else { | 2795 } else { |
2796 // Faster code path to avoid two compares: subtract lower bound from the | 2796 // Faster code path to avoid two compares: subtract lower bound from the |
2797 // actual type and do a signed compare with the width of the type range. | 2797 // actual type and do a signed compare with the width of the type range. |
2798 __ mov(temp, FieldOperand(input, HeapObject::kMapOffset)); | 2798 __ mov(temp, FieldOperand(input, HeapObject::kMapOffset)); |
2799 __ movzx_b(temp2, FieldOperand(temp, Map::kInstanceTypeOffset)); | 2799 __ movzx_b(temp2, FieldOperand(temp, Map::kInstanceTypeOffset)); |
2800 __ sub(Operand(temp2), Immediate(FIRST_NONCALLABLE_SPEC_OBJECT_TYPE)); | 2800 __ sub(Operand(temp2), Immediate(FIRST_NONCALLABLE_SPEC_OBJECT_TYPE)); |
2801 __ cmp(Operand(temp2), Immediate(LAST_NONCALLABLE_SPEC_OBJECT_TYPE - | 2801 __ cmp(Operand(temp2), Immediate(LAST_NONCALLABLE_SPEC_OBJECT_TYPE - |
2802 FIRST_NONCALLABLE_SPEC_OBJECT_TYPE)); | 2802 FIRST_NONCALLABLE_SPEC_OBJECT_TYPE)); |
2803 __ j(above, is_false); | 2803 __ j(above, is_false); |
(...skipping 642 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3446 | 3446 |
3447 // Normal function. Replace undefined or null with global receiver. | 3447 // Normal function. Replace undefined or null with global receiver. |
3448 __ cmp(receiver, factory()->null_value()); | 3448 __ cmp(receiver, factory()->null_value()); |
3449 __ j(equal, &global_object); | 3449 __ j(equal, &global_object); |
3450 __ cmp(receiver, factory()->undefined_value()); | 3450 __ cmp(receiver, factory()->undefined_value()); |
3451 __ j(equal, &global_object); | 3451 __ j(equal, &global_object); |
3452 | 3452 |
3453 // The receiver should be a JS object. | 3453 // The receiver should be a JS object. |
3454 __ test(receiver, Immediate(kSmiTagMask)); | 3454 __ test(receiver, Immediate(kSmiTagMask)); |
3455 DeoptimizeIf(equal, instr, Deoptimizer::kSmi); | 3455 DeoptimizeIf(equal, instr, Deoptimizer::kSmi); |
3456 __ CmpObjectType(receiver, FIRST_SPEC_OBJECT_TYPE, scratch); | 3456 __ CmpObjectType(receiver, FIRST_JS_RECEIVER_TYPE, scratch); |
3457 DeoptimizeIf(below, instr, Deoptimizer::kNotAJavaScriptObject); | 3457 DeoptimizeIf(below, instr, Deoptimizer::kNotAJavaScriptObject); |
3458 | 3458 |
3459 __ jmp(&receiver_ok, Label::kNear); | 3459 __ jmp(&receiver_ok, Label::kNear); |
3460 __ bind(&global_object); | 3460 __ bind(&global_object); |
3461 __ mov(receiver, FieldOperand(function, JSFunction::kContextOffset)); | 3461 __ mov(receiver, FieldOperand(function, JSFunction::kContextOffset)); |
3462 __ mov(receiver, ContextOperand(receiver, Context::NATIVE_CONTEXT_INDEX)); | 3462 __ mov(receiver, ContextOperand(receiver, Context::NATIVE_CONTEXT_INDEX)); |
3463 __ mov(receiver, ContextOperand(receiver, Context::GLOBAL_PROXY_INDEX)); | 3463 __ mov(receiver, ContextOperand(receiver, Context::GLOBAL_PROXY_INDEX)); |
3464 __ bind(&receiver_ok); | 3464 __ bind(&receiver_ok); |
3465 } | 3465 } |
3466 | 3466 |
(...skipping 2355 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5822 __ mov(input, FieldOperand(input, HeapObject::kMapOffset)); | 5822 __ mov(input, FieldOperand(input, HeapObject::kMapOffset)); |
5823 __ movzx_b(input, FieldOperand(input, Map::kBitFieldOffset)); | 5823 __ movzx_b(input, FieldOperand(input, Map::kBitFieldOffset)); |
5824 __ and_(input, (1 << Map::kIsCallable) | (1 << Map::kIsUndetectable)); | 5824 __ and_(input, (1 << Map::kIsCallable) | (1 << Map::kIsUndetectable)); |
5825 __ cmp(input, 1 << Map::kIsCallable); | 5825 __ cmp(input, 1 << Map::kIsCallable); |
5826 final_branch_condition = equal; | 5826 final_branch_condition = equal; |
5827 | 5827 |
5828 } else if (String::Equals(type_name, factory()->object_string())) { | 5828 } else if (String::Equals(type_name, factory()->object_string())) { |
5829 __ JumpIfSmi(input, false_label, false_distance); | 5829 __ JumpIfSmi(input, false_label, false_distance); |
5830 __ cmp(input, factory()->null_value()); | 5830 __ cmp(input, factory()->null_value()); |
5831 __ j(equal, true_label, true_distance); | 5831 __ j(equal, true_label, true_distance); |
5832 STATIC_ASSERT(LAST_SPEC_OBJECT_TYPE == LAST_TYPE); | 5832 STATIC_ASSERT(LAST_JS_RECEIVER_TYPE == LAST_TYPE); |
5833 __ CmpObjectType(input, FIRST_SPEC_OBJECT_TYPE, input); | 5833 __ CmpObjectType(input, FIRST_JS_RECEIVER_TYPE, input); |
5834 __ j(below, false_label, false_distance); | 5834 __ j(below, false_label, false_distance); |
5835 // Check for callable or undetectable objects => false. | 5835 // Check for callable or undetectable objects => false. |
5836 __ test_b(FieldOperand(input, Map::kBitFieldOffset), | 5836 __ test_b(FieldOperand(input, Map::kBitFieldOffset), |
5837 (1 << Map::kIsCallable) | (1 << Map::kIsUndetectable)); | 5837 (1 << Map::kIsCallable) | (1 << Map::kIsUndetectable)); |
5838 final_branch_condition = zero; | 5838 final_branch_condition = zero; |
5839 | 5839 |
5840 // clang-format off | 5840 // clang-format off |
5841 #define SIMD128_TYPE(TYPE, Type, type, lane_count, lane_type) \ | 5841 #define SIMD128_TYPE(TYPE, Type, type, lane_count, lane_type) \ |
5842 } else if (String::Equals(type_name, factory()->type##_string())) { \ | 5842 } else if (String::Equals(type_name, factory()->type##_string())) { \ |
5843 __ JumpIfSmi(input, false_label, false_distance); \ | 5843 __ JumpIfSmi(input, false_label, false_distance); \ |
(...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6004 | 6004 |
6005 GenerateOsrPrologue(); | 6005 GenerateOsrPrologue(); |
6006 } | 6006 } |
6007 | 6007 |
6008 | 6008 |
6009 void LCodeGen::DoForInPrepareMap(LForInPrepareMap* instr) { | 6009 void LCodeGen::DoForInPrepareMap(LForInPrepareMap* instr) { |
6010 DCHECK(ToRegister(instr->context()).is(esi)); | 6010 DCHECK(ToRegister(instr->context()).is(esi)); |
6011 __ test(eax, Immediate(kSmiTagMask)); | 6011 __ test(eax, Immediate(kSmiTagMask)); |
6012 DeoptimizeIf(zero, instr, Deoptimizer::kSmi); | 6012 DeoptimizeIf(zero, instr, Deoptimizer::kSmi); |
6013 | 6013 |
6014 STATIC_ASSERT(FIRST_JS_PROXY_TYPE == FIRST_SPEC_OBJECT_TYPE); | 6014 STATIC_ASSERT(FIRST_JS_PROXY_TYPE == FIRST_JS_RECEIVER_TYPE); |
6015 __ CmpObjectType(eax, LAST_JS_PROXY_TYPE, ecx); | 6015 __ CmpObjectType(eax, LAST_JS_PROXY_TYPE, ecx); |
6016 DeoptimizeIf(below_equal, instr, Deoptimizer::kWrongInstanceType); | 6016 DeoptimizeIf(below_equal, instr, Deoptimizer::kWrongInstanceType); |
6017 | 6017 |
6018 Label use_cache, call_runtime; | 6018 Label use_cache, call_runtime; |
6019 __ CheckEnumCache(&call_runtime); | 6019 __ CheckEnumCache(&call_runtime); |
6020 | 6020 |
6021 __ mov(eax, FieldOperand(eax, HeapObject::kMapOffset)); | 6021 __ mov(eax, FieldOperand(eax, HeapObject::kMapOffset)); |
6022 __ jmp(&use_cache, Label::kNear); | 6022 __ jmp(&use_cache, Label::kNear); |
6023 | 6023 |
6024 // Get the set of properties to enumerate. | 6024 // Get the set of properties to enumerate. |
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6149 RecordSafepoint(Safepoint::kNoLazyDeopt); | 6149 RecordSafepoint(Safepoint::kNoLazyDeopt); |
6150 } | 6150 } |
6151 | 6151 |
6152 | 6152 |
6153 #undef __ | 6153 #undef __ |
6154 | 6154 |
6155 } // namespace internal | 6155 } // namespace internal |
6156 } // namespace v8 | 6156 } // namespace v8 |
6157 | 6157 |
6158 #endif // V8_TARGET_ARCH_X87 | 6158 #endif // V8_TARGET_ARCH_X87 |
OLD | NEW |