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 2463 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2474 __ j(not_equal, is_true); | 2474 __ j(not_equal, is_true); |
2475 } else { | 2475 } else { |
2476 __ j(not_equal, is_false); | 2476 __ j(not_equal, is_false); |
2477 } | 2477 } |
2478 | 2478 |
2479 // temp now contains the constructor function. Grab the | 2479 // temp now contains the constructor function. Grab the |
2480 // instance class name from there. | 2480 // instance class name from there. |
2481 __ mov(temp, FieldOperand(temp, JSFunction::kSharedFunctionInfoOffset)); | 2481 __ mov(temp, FieldOperand(temp, JSFunction::kSharedFunctionInfoOffset)); |
2482 __ mov(temp, FieldOperand(temp, | 2482 __ mov(temp, FieldOperand(temp, |
2483 SharedFunctionInfo::kInstanceClassNameOffset)); | 2483 SharedFunctionInfo::kInstanceClassNameOffset)); |
2484 // The class name we are testing against is a symbol because it's a literal. | 2484 // The class name we are testing against is internalized since it's a literal. |
2485 // The name in the constructor is a symbol because of the way the context is | 2485 // The name in the constructor is internalized because of the way the context |
2486 // booted. This routine isn't expected to work for random API-created | 2486 // is booted. This routine isn't expected to work for random API-created |
2487 // classes and it doesn't have to because you can't access it with natives | 2487 // classes and it doesn't have to because you can't access it with natives |
2488 // syntax. Since both sides are symbols it is sufficient to use an identity | 2488 // syntax. Since both sides are internalized it is sufficient to use an |
2489 // comparison. | 2489 // identity comparison. |
2490 __ cmp(temp, class_name); | 2490 __ cmp(temp, class_name); |
2491 // End with the answer in the z flag. | 2491 // End with the answer in the z flag. |
2492 } | 2492 } |
2493 | 2493 |
2494 | 2494 |
2495 void LCodeGen::DoClassOfTestAndBranch(LClassOfTestAndBranch* instr) { | 2495 void LCodeGen::DoClassOfTestAndBranch(LClassOfTestAndBranch* instr) { |
2496 Register input = ToRegister(instr->value()); | 2496 Register input = ToRegister(instr->value()); |
2497 Register temp = ToRegister(instr->temp()); | 2497 Register temp = ToRegister(instr->temp()); |
2498 Register temp2 = ToRegister(instr->temp2()); | 2498 Register temp2 = ToRegister(instr->temp2()); |
2499 | 2499 |
(...skipping 3348 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5848 EmitBranch(true_block, false_block, final_branch_condition); | 5848 EmitBranch(true_block, false_block, final_branch_condition); |
5849 } | 5849 } |
5850 } | 5850 } |
5851 | 5851 |
5852 | 5852 |
5853 Condition LCodeGen::EmitTypeofIs(Label* true_label, | 5853 Condition LCodeGen::EmitTypeofIs(Label* true_label, |
5854 Label* false_label, | 5854 Label* false_label, |
5855 Register input, | 5855 Register input, |
5856 Handle<String> type_name) { | 5856 Handle<String> type_name) { |
5857 Condition final_branch_condition = no_condition; | 5857 Condition final_branch_condition = no_condition; |
5858 if (type_name->Equals(heap()->number_symbol())) { | 5858 if (type_name->Equals(heap()->number_string())) { |
5859 __ JumpIfSmi(input, true_label); | 5859 __ JumpIfSmi(input, true_label); |
5860 __ cmp(FieldOperand(input, HeapObject::kMapOffset), | 5860 __ cmp(FieldOperand(input, HeapObject::kMapOffset), |
5861 factory()->heap_number_map()); | 5861 factory()->heap_number_map()); |
5862 final_branch_condition = equal; | 5862 final_branch_condition = equal; |
5863 | 5863 |
5864 } else if (type_name->Equals(heap()->string_symbol())) { | 5864 } else if (type_name->Equals(heap()->string_string())) { |
5865 __ JumpIfSmi(input, false_label); | 5865 __ JumpIfSmi(input, false_label); |
5866 __ CmpObjectType(input, FIRST_NONSTRING_TYPE, input); | 5866 __ CmpObjectType(input, FIRST_NONSTRING_TYPE, input); |
5867 __ j(above_equal, false_label); | 5867 __ j(above_equal, false_label); |
5868 __ test_b(FieldOperand(input, Map::kBitFieldOffset), | 5868 __ test_b(FieldOperand(input, Map::kBitFieldOffset), |
5869 1 << Map::kIsUndetectable); | 5869 1 << Map::kIsUndetectable); |
5870 final_branch_condition = zero; | 5870 final_branch_condition = zero; |
5871 | 5871 |
5872 } else if (type_name->Equals(heap()->boolean_symbol())) { | 5872 } else if (type_name->Equals(heap()->boolean_string())) { |
5873 __ cmp(input, factory()->true_value()); | 5873 __ cmp(input, factory()->true_value()); |
5874 __ j(equal, true_label); | 5874 __ j(equal, true_label); |
5875 __ cmp(input, factory()->false_value()); | 5875 __ cmp(input, factory()->false_value()); |
5876 final_branch_condition = equal; | 5876 final_branch_condition = equal; |
5877 | 5877 |
5878 } else if (FLAG_harmony_typeof && type_name->Equals(heap()->null_symbol())) { | 5878 } else if (FLAG_harmony_typeof && type_name->Equals(heap()->null_string())) { |
5879 __ cmp(input, factory()->null_value()); | 5879 __ cmp(input, factory()->null_value()); |
5880 final_branch_condition = equal; | 5880 final_branch_condition = equal; |
5881 | 5881 |
5882 } else if (type_name->Equals(heap()->undefined_symbol())) { | 5882 } else if (type_name->Equals(heap()->undefined_string())) { |
5883 __ cmp(input, factory()->undefined_value()); | 5883 __ cmp(input, factory()->undefined_value()); |
5884 __ j(equal, true_label); | 5884 __ j(equal, true_label); |
5885 __ JumpIfSmi(input, false_label); | 5885 __ JumpIfSmi(input, false_label); |
5886 // Check for undetectable objects => true. | 5886 // Check for undetectable objects => true. |
5887 __ mov(input, FieldOperand(input, HeapObject::kMapOffset)); | 5887 __ mov(input, FieldOperand(input, HeapObject::kMapOffset)); |
5888 __ test_b(FieldOperand(input, Map::kBitFieldOffset), | 5888 __ test_b(FieldOperand(input, Map::kBitFieldOffset), |
5889 1 << Map::kIsUndetectable); | 5889 1 << Map::kIsUndetectable); |
5890 final_branch_condition = not_zero; | 5890 final_branch_condition = not_zero; |
5891 | 5891 |
5892 } else if (type_name->Equals(heap()->function_symbol())) { | 5892 } else if (type_name->Equals(heap()->function_string())) { |
5893 STATIC_ASSERT(NUM_OF_CALLABLE_SPEC_OBJECT_TYPES == 2); | 5893 STATIC_ASSERT(NUM_OF_CALLABLE_SPEC_OBJECT_TYPES == 2); |
5894 __ JumpIfSmi(input, false_label); | 5894 __ JumpIfSmi(input, false_label); |
5895 __ CmpObjectType(input, JS_FUNCTION_TYPE, input); | 5895 __ CmpObjectType(input, JS_FUNCTION_TYPE, input); |
5896 __ j(equal, true_label); | 5896 __ j(equal, true_label); |
5897 __ CmpInstanceType(input, JS_FUNCTION_PROXY_TYPE); | 5897 __ CmpInstanceType(input, JS_FUNCTION_PROXY_TYPE); |
5898 final_branch_condition = equal; | 5898 final_branch_condition = equal; |
5899 | 5899 |
5900 } else if (type_name->Equals(heap()->object_symbol())) { | 5900 } else if (type_name->Equals(heap()->object_string())) { |
5901 __ JumpIfSmi(input, false_label); | 5901 __ JumpIfSmi(input, false_label); |
5902 if (!FLAG_harmony_typeof) { | 5902 if (!FLAG_harmony_typeof) { |
5903 __ cmp(input, factory()->null_value()); | 5903 __ cmp(input, factory()->null_value()); |
5904 __ j(equal, true_label); | 5904 __ j(equal, true_label); |
5905 } | 5905 } |
5906 __ CmpObjectType(input, FIRST_NONCALLABLE_SPEC_OBJECT_TYPE, input); | 5906 __ CmpObjectType(input, FIRST_NONCALLABLE_SPEC_OBJECT_TYPE, input); |
5907 __ j(below, false_label); | 5907 __ j(below, false_label); |
5908 __ CmpInstanceType(input, LAST_NONCALLABLE_SPEC_OBJECT_TYPE); | 5908 __ CmpInstanceType(input, LAST_NONCALLABLE_SPEC_OBJECT_TYPE); |
5909 __ j(above, false_label); | 5909 __ j(above, false_label); |
5910 // Check for undetectable objects => false. | 5910 // Check for undetectable objects => false. |
(...skipping 267 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6178 FixedArray::kHeaderSize - kPointerSize)); | 6178 FixedArray::kHeaderSize - kPointerSize)); |
6179 __ bind(&done); | 6179 __ bind(&done); |
6180 } | 6180 } |
6181 | 6181 |
6182 | 6182 |
6183 #undef __ | 6183 #undef __ |
6184 | 6184 |
6185 } } // namespace v8::internal | 6185 } } // namespace v8::internal |
6186 | 6186 |
6187 #endif // V8_TARGET_ARCH_IA32 | 6187 #endif // V8_TARGET_ARCH_IA32 |
OLD | NEW |