OLD | NEW |
1 // Copyright 2013 the V8 project authors. All rights reserved. | 1 // Copyright 2013 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 2066 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2077 void LCodeGen::DoCmpConstantEqAndBranch(LCmpConstantEqAndBranch* instr) { | 2077 void LCodeGen::DoCmpConstantEqAndBranch(LCmpConstantEqAndBranch* instr) { |
2078 Register left = ToRegister(instr->left()); | 2078 Register left = ToRegister(instr->left()); |
2079 int true_block = chunk_->LookupDestination(instr->true_block_id()); | 2079 int true_block = chunk_->LookupDestination(instr->true_block_id()); |
2080 int false_block = chunk_->LookupDestination(instr->false_block_id()); | 2080 int false_block = chunk_->LookupDestination(instr->false_block_id()); |
2081 | 2081 |
2082 __ cmpq(left, Immediate(instr->hydrogen()->right())); | 2082 __ cmpq(left, Immediate(instr->hydrogen()->right())); |
2083 EmitBranch(true_block, false_block, equal); | 2083 EmitBranch(true_block, false_block, equal); |
2084 } | 2084 } |
2085 | 2085 |
2086 | 2086 |
2087 void LCodeGen::DoIsNilAndBranch(LIsNilAndBranch* instr) { | |
2088 Register reg = ToRegister(instr->value()); | |
2089 int false_block = chunk_->LookupDestination(instr->false_block_id()); | |
2090 | |
2091 // If the expression is known to be untagged or a smi, then it's definitely | |
2092 // not null, and it can't be a an undetectable object. | |
2093 if (instr->hydrogen()->representation().IsSpecialization() || | |
2094 instr->hydrogen()->type().IsSmi()) { | |
2095 EmitGoto(false_block); | |
2096 return; | |
2097 } | |
2098 | |
2099 int true_block = chunk_->LookupDestination(instr->true_block_id()); | |
2100 Heap::RootListIndex nil_value = instr->nil() == kNullValue ? | |
2101 Heap::kNullValueRootIndex : | |
2102 Heap::kUndefinedValueRootIndex; | |
2103 __ CompareRoot(reg, nil_value); | |
2104 if (instr->kind() == kStrictEquality) { | |
2105 EmitBranch(true_block, false_block, equal); | |
2106 } else { | |
2107 Heap::RootListIndex other_nil_value = instr->nil() == kNullValue ? | |
2108 Heap::kUndefinedValueRootIndex : | |
2109 Heap::kNullValueRootIndex; | |
2110 Label* true_label = chunk_->GetAssemblyLabel(true_block); | |
2111 Label* false_label = chunk_->GetAssemblyLabel(false_block); | |
2112 __ j(equal, true_label); | |
2113 __ CompareRoot(reg, other_nil_value); | |
2114 __ j(equal, true_label); | |
2115 __ JumpIfSmi(reg, false_label); | |
2116 // Check for undetectable objects by looking in the bit field in | |
2117 // the map. The object has already been smi checked. | |
2118 Register scratch = ToRegister(instr->temp()); | |
2119 __ movq(scratch, FieldOperand(reg, HeapObject::kMapOffset)); | |
2120 __ testb(FieldOperand(scratch, Map::kBitFieldOffset), | |
2121 Immediate(1 << Map::kIsUndetectable)); | |
2122 EmitBranch(true_block, false_block, not_zero); | |
2123 } | |
2124 } | |
2125 | |
2126 | |
2127 Condition LCodeGen::EmitIsObject(Register input, | 2087 Condition LCodeGen::EmitIsObject(Register input, |
2128 Label* is_not_object, | 2088 Label* is_not_object, |
2129 Label* is_object) { | 2089 Label* is_object) { |
2130 ASSERT(!input.is(kScratchRegister)); | 2090 ASSERT(!input.is(kScratchRegister)); |
2131 | 2091 |
2132 __ JumpIfSmi(input, is_not_object); | 2092 __ JumpIfSmi(input, is_not_object); |
2133 | 2093 |
2134 __ CompareRoot(input, Heap::kNullValueRootIndex); | 2094 __ CompareRoot(input, Heap::kNullValueRootIndex); |
2135 __ j(equal, is_object); | 2095 __ j(equal, is_object); |
2136 | 2096 |
(...skipping 3497 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5634 FixedArray::kHeaderSize - kPointerSize)); | 5594 FixedArray::kHeaderSize - kPointerSize)); |
5635 __ bind(&done); | 5595 __ bind(&done); |
5636 } | 5596 } |
5637 | 5597 |
5638 | 5598 |
5639 #undef __ | 5599 #undef __ |
5640 | 5600 |
5641 } } // namespace v8::internal | 5601 } } // namespace v8::internal |
5642 | 5602 |
5643 #endif // V8_TARGET_ARCH_X64 | 5603 #endif // V8_TARGET_ARCH_X64 |
OLD | NEW |