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 2283 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2294 Label not_string; | 2294 Label not_string; |
2295 __ CompareInstanceType(map, ip, FIRST_NONSTRING_TYPE); | 2295 __ CompareInstanceType(map, ip, FIRST_NONSTRING_TYPE); |
2296 __ b(ge, ¬_string); | 2296 __ b(ge, ¬_string); |
2297 __ ldr(ip, FieldMemOperand(reg, String::kLengthOffset)); | 2297 __ ldr(ip, FieldMemOperand(reg, String::kLengthOffset)); |
2298 __ cmp(ip, Operand::Zero()); | 2298 __ cmp(ip, Operand::Zero()); |
2299 __ b(ne, true_label); | 2299 __ b(ne, true_label); |
2300 __ b(false_label); | 2300 __ b(false_label); |
2301 __ bind(¬_string); | 2301 __ bind(¬_string); |
2302 } | 2302 } |
2303 | 2303 |
| 2304 if (expected.Contains(ToBooleanStub::SYMBOL)) { |
| 2305 // Symbol value -> true. |
| 2306 __ CompareInstanceType(map, ip, SYMBOL_TYPE); |
| 2307 __ b(eq, true_label); |
| 2308 } |
| 2309 |
2304 if (expected.Contains(ToBooleanStub::HEAP_NUMBER)) { | 2310 if (expected.Contains(ToBooleanStub::HEAP_NUMBER)) { |
2305 CpuFeatureScope scope(masm(), VFP2); | 2311 CpuFeatureScope scope(masm(), VFP2); |
2306 // heap number -> false iff +0, -0, or NaN. | 2312 // heap number -> false iff +0, -0, or NaN. |
2307 DwVfpRegister dbl_scratch = double_scratch0(); | 2313 DwVfpRegister dbl_scratch = double_scratch0(); |
2308 Label not_heap_number; | 2314 Label not_heap_number; |
2309 __ CompareRoot(map, Heap::kHeapNumberMapRootIndex); | 2315 __ CompareRoot(map, Heap::kHeapNumberMapRootIndex); |
2310 __ b(ne, ¬_heap_number); | 2316 __ b(ne, ¬_heap_number); |
2311 __ vldr(dbl_scratch, FieldMemOperand(reg, HeapNumber::kValueOffset)); | 2317 __ vldr(dbl_scratch, FieldMemOperand(reg, HeapNumber::kValueOffset)); |
2312 __ VFPCompareAndSetFlags(dbl_scratch, 0.0); | 2318 __ VFPCompareAndSetFlags(dbl_scratch, 0.0); |
2313 __ b(vs, false_label); // NaN -> false. | 2319 __ b(vs, false_label); // NaN -> false. |
(...skipping 3753 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6067 final_branch_condition = eq; | 6073 final_branch_condition = eq; |
6068 | 6074 |
6069 } else if (type_name->Equals(heap()->string_string())) { | 6075 } else if (type_name->Equals(heap()->string_string())) { |
6070 __ JumpIfSmi(input, false_label); | 6076 __ JumpIfSmi(input, false_label); |
6071 __ CompareObjectType(input, input, scratch, FIRST_NONSTRING_TYPE); | 6077 __ CompareObjectType(input, input, scratch, FIRST_NONSTRING_TYPE); |
6072 __ b(ge, false_label); | 6078 __ b(ge, false_label); |
6073 __ ldrb(ip, FieldMemOperand(input, Map::kBitFieldOffset)); | 6079 __ ldrb(ip, FieldMemOperand(input, Map::kBitFieldOffset)); |
6074 __ tst(ip, Operand(1 << Map::kIsUndetectable)); | 6080 __ tst(ip, Operand(1 << Map::kIsUndetectable)); |
6075 final_branch_condition = eq; | 6081 final_branch_condition = eq; |
6076 | 6082 |
| 6083 } else if (type_name->Equals(heap()->symbol_string())) { |
| 6084 __ JumpIfSmi(input, false_label); |
| 6085 __ CompareObjectType(input, input, scratch, SYMBOL_TYPE); |
| 6086 final_branch_condition = eq; |
| 6087 |
6077 } else if (type_name->Equals(heap()->boolean_string())) { | 6088 } else if (type_name->Equals(heap()->boolean_string())) { |
6078 __ CompareRoot(input, Heap::kTrueValueRootIndex); | 6089 __ CompareRoot(input, Heap::kTrueValueRootIndex); |
6079 __ b(eq, true_label); | 6090 __ b(eq, true_label); |
6080 __ CompareRoot(input, Heap::kFalseValueRootIndex); | 6091 __ CompareRoot(input, Heap::kFalseValueRootIndex); |
6081 final_branch_condition = eq; | 6092 final_branch_condition = eq; |
6082 | 6093 |
6083 } else if (FLAG_harmony_typeof && type_name->Equals(heap()->null_string())) { | 6094 } else if (FLAG_harmony_typeof && type_name->Equals(heap()->null_string())) { |
6084 __ CompareRoot(input, Heap::kNullValueRootIndex); | 6095 __ CompareRoot(input, Heap::kNullValueRootIndex); |
6085 final_branch_condition = eq; | 6096 final_branch_condition = eq; |
6086 | 6097 |
(...skipping 14 matching lines...) Expand all Loading... |
6101 __ b(eq, true_label); | 6112 __ b(eq, true_label); |
6102 __ cmp(input, Operand(JS_FUNCTION_PROXY_TYPE)); | 6113 __ cmp(input, Operand(JS_FUNCTION_PROXY_TYPE)); |
6103 final_branch_condition = eq; | 6114 final_branch_condition = eq; |
6104 | 6115 |
6105 } else if (type_name->Equals(heap()->object_string())) { | 6116 } else if (type_name->Equals(heap()->object_string())) { |
6106 __ JumpIfSmi(input, false_label); | 6117 __ JumpIfSmi(input, false_label); |
6107 if (!FLAG_harmony_typeof) { | 6118 if (!FLAG_harmony_typeof) { |
6108 __ CompareRoot(input, Heap::kNullValueRootIndex); | 6119 __ CompareRoot(input, Heap::kNullValueRootIndex); |
6109 __ b(eq, true_label); | 6120 __ b(eq, true_label); |
6110 } | 6121 } |
6111 if (FLAG_harmony_symbols) { | 6122 __ CompareObjectType(input, input, scratch, |
6112 __ CompareObjectType(input, input, scratch, SYMBOL_TYPE); | 6123 FIRST_NONCALLABLE_SPEC_OBJECT_TYPE); |
6113 __ b(eq, true_label); | |
6114 __ CompareInstanceType(input, scratch, | |
6115 FIRST_NONCALLABLE_SPEC_OBJECT_TYPE); | |
6116 } else { | |
6117 __ CompareObjectType(input, input, scratch, | |
6118 FIRST_NONCALLABLE_SPEC_OBJECT_TYPE); | |
6119 } | |
6120 __ b(lt, false_label); | 6124 __ b(lt, false_label); |
6121 __ CompareInstanceType(input, scratch, LAST_NONCALLABLE_SPEC_OBJECT_TYPE); | 6125 __ CompareInstanceType(input, scratch, LAST_NONCALLABLE_SPEC_OBJECT_TYPE); |
6122 __ b(gt, false_label); | 6126 __ b(gt, false_label); |
6123 // Check for undetectable objects => false. | 6127 // Check for undetectable objects => false. |
6124 __ ldrb(ip, FieldMemOperand(input, Map::kBitFieldOffset)); | 6128 __ ldrb(ip, FieldMemOperand(input, Map::kBitFieldOffset)); |
6125 __ tst(ip, Operand(1 << Map::kIsUndetectable)); | 6129 __ tst(ip, Operand(1 << Map::kIsUndetectable)); |
6126 final_branch_condition = eq; | 6130 final_branch_condition = eq; |
6127 | 6131 |
6128 } else { | 6132 } else { |
6129 __ b(false_label); | 6133 __ b(false_label); |
(...skipping 263 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6393 __ sub(scratch, result, Operand(index, LSL, kPointerSizeLog2 - kSmiTagSize)); | 6397 __ sub(scratch, result, Operand(index, LSL, kPointerSizeLog2 - kSmiTagSize)); |
6394 __ ldr(result, FieldMemOperand(scratch, | 6398 __ ldr(result, FieldMemOperand(scratch, |
6395 FixedArray::kHeaderSize - kPointerSize)); | 6399 FixedArray::kHeaderSize - kPointerSize)); |
6396 __ bind(&done); | 6400 __ bind(&done); |
6397 } | 6401 } |
6398 | 6402 |
6399 | 6403 |
6400 #undef __ | 6404 #undef __ |
6401 | 6405 |
6402 } } // namespace v8::internal | 6406 } } // namespace v8::internal |
OLD | NEW |