| 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 2098 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2109 // String value -> false iff empty. | 2109 // String value -> false iff empty. |
| 2110 Label not_string; | 2110 Label not_string; |
| 2111 __ CmpInstanceType(map, FIRST_NONSTRING_TYPE); | 2111 __ CmpInstanceType(map, FIRST_NONSTRING_TYPE); |
| 2112 __ j(above_equal, ¬_string, Label::kNear); | 2112 __ j(above_equal, ¬_string, Label::kNear); |
| 2113 __ cmp(FieldOperand(reg, String::kLengthOffset), Immediate(0)); | 2113 __ cmp(FieldOperand(reg, String::kLengthOffset), Immediate(0)); |
| 2114 __ j(not_zero, true_label); | 2114 __ j(not_zero, true_label); |
| 2115 __ jmp(false_label); | 2115 __ jmp(false_label); |
| 2116 __ bind(¬_string); | 2116 __ bind(¬_string); |
| 2117 } | 2117 } |
| 2118 | 2118 |
| 2119 if (expected.Contains(ToBooleanStub::SYMBOL)) { |
| 2120 // Symbol value -> true. |
| 2121 __ CmpInstanceType(map, SYMBOL_TYPE); |
| 2122 __ j(equal, true_label); |
| 2123 } |
| 2124 |
| 2119 if (expected.Contains(ToBooleanStub::HEAP_NUMBER)) { | 2125 if (expected.Contains(ToBooleanStub::HEAP_NUMBER)) { |
| 2120 // heap number -> false iff +0, -0, or NaN. | 2126 // heap number -> false iff +0, -0, or NaN. |
| 2121 Label not_heap_number; | 2127 Label not_heap_number; |
| 2122 __ cmp(FieldOperand(reg, HeapObject::kMapOffset), | 2128 __ cmp(FieldOperand(reg, HeapObject::kMapOffset), |
| 2123 factory()->heap_number_map()); | 2129 factory()->heap_number_map()); |
| 2124 __ j(not_equal, ¬_heap_number, Label::kNear); | 2130 __ j(not_equal, ¬_heap_number, Label::kNear); |
| 2125 __ xorps(xmm0, xmm0); | 2131 __ xorps(xmm0, xmm0); |
| 2126 __ ucomisd(xmm0, FieldOperand(reg, HeapNumber::kValueOffset)); | 2132 __ ucomisd(xmm0, FieldOperand(reg, HeapNumber::kValueOffset)); |
| 2127 __ j(zero, false_label); | 2133 __ j(zero, false_label); |
| 2128 __ jmp(true_label); | 2134 __ jmp(true_label); |
| (...skipping 3843 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5972 final_branch_condition = equal; | 5978 final_branch_condition = equal; |
| 5973 | 5979 |
| 5974 } else if (type_name->Equals(heap()->string_string())) { | 5980 } else if (type_name->Equals(heap()->string_string())) { |
| 5975 __ JumpIfSmi(input, false_label); | 5981 __ JumpIfSmi(input, false_label); |
| 5976 __ CmpObjectType(input, FIRST_NONSTRING_TYPE, input); | 5982 __ CmpObjectType(input, FIRST_NONSTRING_TYPE, input); |
| 5977 __ j(above_equal, false_label); | 5983 __ j(above_equal, false_label); |
| 5978 __ test_b(FieldOperand(input, Map::kBitFieldOffset), | 5984 __ test_b(FieldOperand(input, Map::kBitFieldOffset), |
| 5979 1 << Map::kIsUndetectable); | 5985 1 << Map::kIsUndetectable); |
| 5980 final_branch_condition = zero; | 5986 final_branch_condition = zero; |
| 5981 | 5987 |
| 5988 } else if (type_name->Equals(heap()->symbol_string())) { |
| 5989 __ JumpIfSmi(input, false_label); |
| 5990 __ CmpObjectType(input, SYMBOL_TYPE, input); |
| 5991 final_branch_condition = equal; |
| 5992 |
| 5982 } else if (type_name->Equals(heap()->boolean_string())) { | 5993 } else if (type_name->Equals(heap()->boolean_string())) { |
| 5983 __ cmp(input, factory()->true_value()); | 5994 __ cmp(input, factory()->true_value()); |
| 5984 __ j(equal, true_label); | 5995 __ j(equal, true_label); |
| 5985 __ cmp(input, factory()->false_value()); | 5996 __ cmp(input, factory()->false_value()); |
| 5986 final_branch_condition = equal; | 5997 final_branch_condition = equal; |
| 5987 | 5998 |
| 5988 } else if (FLAG_harmony_typeof && type_name->Equals(heap()->null_string())) { | 5999 } else if (FLAG_harmony_typeof && type_name->Equals(heap()->null_string())) { |
| 5989 __ cmp(input, factory()->null_value()); | 6000 __ cmp(input, factory()->null_value()); |
| 5990 final_branch_condition = equal; | 6001 final_branch_condition = equal; |
| 5991 | 6002 |
| (...skipping 14 matching lines...) Expand all Loading... |
| 6006 __ j(equal, true_label); | 6017 __ j(equal, true_label); |
| 6007 __ CmpInstanceType(input, JS_FUNCTION_PROXY_TYPE); | 6018 __ CmpInstanceType(input, JS_FUNCTION_PROXY_TYPE); |
| 6008 final_branch_condition = equal; | 6019 final_branch_condition = equal; |
| 6009 | 6020 |
| 6010 } else if (type_name->Equals(heap()->object_string())) { | 6021 } else if (type_name->Equals(heap()->object_string())) { |
| 6011 __ JumpIfSmi(input, false_label); | 6022 __ JumpIfSmi(input, false_label); |
| 6012 if (!FLAG_harmony_typeof) { | 6023 if (!FLAG_harmony_typeof) { |
| 6013 __ cmp(input, factory()->null_value()); | 6024 __ cmp(input, factory()->null_value()); |
| 6014 __ j(equal, true_label); | 6025 __ j(equal, true_label); |
| 6015 } | 6026 } |
| 6016 if (FLAG_harmony_symbols) { | 6027 __ CmpObjectType(input, FIRST_NONCALLABLE_SPEC_OBJECT_TYPE, input); |
| 6017 __ CmpObjectType(input, SYMBOL_TYPE, input); | |
| 6018 __ j(equal, true_label); | |
| 6019 __ CmpInstanceType(input, FIRST_NONCALLABLE_SPEC_OBJECT_TYPE); | |
| 6020 } else { | |
| 6021 __ CmpObjectType(input, FIRST_NONCALLABLE_SPEC_OBJECT_TYPE, input); | |
| 6022 } | |
| 6023 __ j(below, false_label); | 6028 __ j(below, false_label); |
| 6024 __ CmpInstanceType(input, LAST_NONCALLABLE_SPEC_OBJECT_TYPE); | 6029 __ CmpInstanceType(input, LAST_NONCALLABLE_SPEC_OBJECT_TYPE); |
| 6025 __ j(above, false_label); | 6030 __ j(above, false_label); |
| 6026 // Check for undetectable objects => false. | 6031 // Check for undetectable objects => false. |
| 6027 __ test_b(FieldOperand(input, Map::kBitFieldOffset), | 6032 __ test_b(FieldOperand(input, Map::kBitFieldOffset), |
| 6028 1 << Map::kIsUndetectable); | 6033 1 << Map::kIsUndetectable); |
| 6029 final_branch_condition = zero; | 6034 final_branch_condition = zero; |
| 6030 | 6035 |
| 6031 } else { | 6036 } else { |
| 6032 __ jmp(false_label); | 6037 __ jmp(false_label); |
| (...skipping 261 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6294 FixedArray::kHeaderSize - kPointerSize)); | 6299 FixedArray::kHeaderSize - kPointerSize)); |
| 6295 __ bind(&done); | 6300 __ bind(&done); |
| 6296 } | 6301 } |
| 6297 | 6302 |
| 6298 | 6303 |
| 6299 #undef __ | 6304 #undef __ |
| 6300 | 6305 |
| 6301 } } // namespace v8::internal | 6306 } } // namespace v8::internal |
| 6302 | 6307 |
| 6303 #endif // V8_TARGET_ARCH_IA32 | 6308 #endif // V8_TARGET_ARCH_IA32 |
| OLD | NEW |