OLD | NEW |
1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 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 3462 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3473 Handle<String> type_name) { | 3473 Handle<String> type_name) { |
3474 Condition final_branch_condition = no_condition; | 3474 Condition final_branch_condition = no_condition; |
3475 if (type_name->Equals(Heap::number_symbol())) { | 3475 if (type_name->Equals(Heap::number_symbol())) { |
3476 __ JumpIfSmi(input, true_label); | 3476 __ JumpIfSmi(input, true_label); |
3477 __ Cmp(FieldOperand(input, HeapObject::kMapOffset), | 3477 __ Cmp(FieldOperand(input, HeapObject::kMapOffset), |
3478 Factory::heap_number_map()); | 3478 Factory::heap_number_map()); |
3479 final_branch_condition = equal; | 3479 final_branch_condition = equal; |
3480 | 3480 |
3481 } else if (type_name->Equals(Heap::string_symbol())) { | 3481 } else if (type_name->Equals(Heap::string_symbol())) { |
3482 __ JumpIfSmi(input, false_label); | 3482 __ JumpIfSmi(input, false_label); |
3483 __ movq(input, FieldOperand(input, HeapObject::kMapOffset)); | 3483 __ CmpObjectType(input, FIRST_NONSTRING_TYPE, input); |
| 3484 __ j(above_equal, false_label); |
3484 __ testb(FieldOperand(input, Map::kBitFieldOffset), | 3485 __ testb(FieldOperand(input, Map::kBitFieldOffset), |
3485 Immediate(1 << Map::kIsUndetectable)); | 3486 Immediate(1 << Map::kIsUndetectable)); |
3486 __ j(not_zero, false_label); | 3487 final_branch_condition = zero; |
3487 __ CmpInstanceType(input, FIRST_NONSTRING_TYPE); | |
3488 final_branch_condition = below; | |
3489 | 3488 |
3490 } else if (type_name->Equals(Heap::boolean_symbol())) { | 3489 } else if (type_name->Equals(Heap::boolean_symbol())) { |
3491 __ CompareRoot(input, Heap::kTrueValueRootIndex); | 3490 __ CompareRoot(input, Heap::kTrueValueRootIndex); |
3492 __ j(equal, true_label); | 3491 __ j(equal, true_label); |
3493 __ CompareRoot(input, Heap::kFalseValueRootIndex); | 3492 __ CompareRoot(input, Heap::kFalseValueRootIndex); |
3494 final_branch_condition = equal; | 3493 final_branch_condition = equal; |
3495 | 3494 |
3496 } else if (type_name->Equals(Heap::undefined_symbol())) { | 3495 } else if (type_name->Equals(Heap::undefined_symbol())) { |
3497 __ CompareRoot(input, Heap::kUndefinedValueRootIndex); | 3496 __ CompareRoot(input, Heap::kUndefinedValueRootIndex); |
3498 __ j(equal, true_label); | 3497 __ j(equal, true_label); |
3499 __ JumpIfSmi(input, false_label); | 3498 __ JumpIfSmi(input, false_label); |
3500 // Check for undetectable objects => true. | 3499 // Check for undetectable objects => true. |
3501 __ movq(input, FieldOperand(input, HeapObject::kMapOffset)); | 3500 __ movq(input, FieldOperand(input, HeapObject::kMapOffset)); |
3502 __ testb(FieldOperand(input, Map::kBitFieldOffset), | 3501 __ testb(FieldOperand(input, Map::kBitFieldOffset), |
3503 Immediate(1 << Map::kIsUndetectable)); | 3502 Immediate(1 << Map::kIsUndetectable)); |
3504 final_branch_condition = not_zero; | 3503 final_branch_condition = not_zero; |
3505 | 3504 |
3506 } else if (type_name->Equals(Heap::function_symbol())) { | 3505 } else if (type_name->Equals(Heap::function_symbol())) { |
3507 __ JumpIfSmi(input, false_label); | 3506 __ JumpIfSmi(input, false_label); |
3508 __ CmpObjectType(input, FIRST_FUNCTION_CLASS_TYPE, input); | 3507 __ CmpObjectType(input, FIRST_FUNCTION_CLASS_TYPE, input); |
3509 final_branch_condition = above_equal; | 3508 final_branch_condition = above_equal; |
3510 | 3509 |
3511 } else if (type_name->Equals(Heap::object_symbol())) { | 3510 } else if (type_name->Equals(Heap::object_symbol())) { |
3512 __ JumpIfSmi(input, false_label); | 3511 __ JumpIfSmi(input, false_label); |
3513 __ Cmp(input, Factory::null_value()); | 3512 __ CompareRoot(input, Heap::kNullValueRootIndex); |
3514 __ j(equal, true_label); | 3513 __ j(equal, true_label); |
| 3514 __ CmpObjectType(input, FIRST_JS_OBJECT_TYPE, input); |
| 3515 __ j(below, false_label); |
| 3516 __ CmpInstanceType(input, FIRST_FUNCTION_CLASS_TYPE); |
| 3517 __ j(above_equal, false_label); |
3515 // Check for undetectable objects => false. | 3518 // Check for undetectable objects => false. |
3516 __ testb(FieldOperand(input, Map::kBitFieldOffset), | 3519 __ testb(FieldOperand(input, Map::kBitFieldOffset), |
3517 Immediate(1 << Map::kIsUndetectable)); | 3520 Immediate(1 << Map::kIsUndetectable)); |
3518 __ j(not_zero, false_label); | 3521 final_branch_condition = zero; |
3519 // Check for JS objects that are not RegExp or Function => true. | |
3520 __ CmpInstanceType(input, FIRST_JS_OBJECT_TYPE); | |
3521 __ j(below, false_label); | |
3522 __ CmpInstanceType(input, FIRST_FUNCTION_CLASS_TYPE); | |
3523 final_branch_condition = below_equal; | |
3524 | 3522 |
3525 } else { | 3523 } else { |
3526 final_branch_condition = never; | 3524 final_branch_condition = never; |
3527 __ jmp(false_label); | 3525 __ jmp(false_label); |
3528 } | 3526 } |
3529 | 3527 |
3530 return final_branch_condition; | 3528 return final_branch_condition; |
3531 } | 3529 } |
3532 | 3530 |
3533 | 3531 |
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3650 RegisterEnvironmentForDeoptimization(environment); | 3648 RegisterEnvironmentForDeoptimization(environment); |
3651 ASSERT(osr_pc_offset_ == -1); | 3649 ASSERT(osr_pc_offset_ == -1); |
3652 osr_pc_offset_ = masm()->pc_offset(); | 3650 osr_pc_offset_ = masm()->pc_offset(); |
3653 } | 3651 } |
3654 | 3652 |
3655 #undef __ | 3653 #undef __ |
3656 | 3654 |
3657 } } // namespace v8::internal | 3655 } } // namespace v8::internal |
3658 | 3656 |
3659 #endif // V8_TARGET_ARCH_X64 | 3657 #endif // V8_TARGET_ARCH_X64 |
OLD | NEW |