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 2015 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2026 void LCodeGen::DoCmpConstantEqAndBranch(LCmpConstantEqAndBranch* instr) { | 2026 void LCodeGen::DoCmpConstantEqAndBranch(LCmpConstantEqAndBranch* instr) { |
2027 Register left = ToRegister(instr->left()); | 2027 Register left = ToRegister(instr->left()); |
2028 int true_block = chunk_->LookupDestination(instr->true_block_id()); | 2028 int true_block = chunk_->LookupDestination(instr->true_block_id()); |
2029 int false_block = chunk_->LookupDestination(instr->false_block_id()); | 2029 int false_block = chunk_->LookupDestination(instr->false_block_id()); |
2030 | 2030 |
2031 EmitBranch(true_block, false_block, eq, left, | 2031 EmitBranch(true_block, false_block, eq, left, |
2032 Operand(instr->hydrogen()->right())); | 2032 Operand(instr->hydrogen()->right())); |
2033 } | 2033 } |
2034 | 2034 |
2035 | 2035 |
2036 | |
2037 void LCodeGen::DoIsNilAndBranch(LIsNilAndBranch* instr) { | |
2038 Register scratch = scratch0(); | |
2039 Register reg = ToRegister(instr->value()); | |
2040 int false_block = chunk_->LookupDestination(instr->false_block_id()); | |
2041 | |
2042 // If the expression is known to be untagged or a smi, then it's definitely | |
2043 // not null, and it can't be a an undetectable object. | |
2044 if (instr->hydrogen()->representation().IsSpecialization() || | |
2045 instr->hydrogen()->type().IsSmi()) { | |
2046 EmitGoto(false_block); | |
2047 return; | |
2048 } | |
2049 | |
2050 int true_block = chunk_->LookupDestination(instr->true_block_id()); | |
2051 | |
2052 Heap::RootListIndex nil_value = instr->nil() == kNullValue ? | |
2053 Heap::kNullValueRootIndex : | |
2054 Heap::kUndefinedValueRootIndex; | |
2055 __ LoadRoot(at, nil_value); | |
2056 if (instr->kind() == kStrictEquality) { | |
2057 EmitBranch(true_block, false_block, eq, reg, Operand(at)); | |
2058 } else { | |
2059 Heap::RootListIndex other_nil_value = instr->nil() == kNullValue ? | |
2060 Heap::kUndefinedValueRootIndex : | |
2061 Heap::kNullValueRootIndex; | |
2062 Label* true_label = chunk_->GetAssemblyLabel(true_block); | |
2063 Label* false_label = chunk_->GetAssemblyLabel(false_block); | |
2064 __ Branch(USE_DELAY_SLOT, true_label, eq, reg, Operand(at)); | |
2065 __ LoadRoot(at, other_nil_value); // In the delay slot. | |
2066 __ Branch(USE_DELAY_SLOT, true_label, eq, reg, Operand(at)); | |
2067 __ JumpIfSmi(reg, false_label); // In the delay slot. | |
2068 // Check for undetectable objects by looking in the bit field in | |
2069 // the map. The object has already been smi checked. | |
2070 __ lw(scratch, FieldMemOperand(reg, HeapObject::kMapOffset)); | |
2071 __ lbu(scratch, FieldMemOperand(scratch, Map::kBitFieldOffset)); | |
2072 __ And(scratch, scratch, 1 << Map::kIsUndetectable); | |
2073 EmitBranch(true_block, false_block, ne, scratch, Operand(zero_reg)); | |
2074 } | |
2075 } | |
2076 | |
2077 | |
2078 Condition LCodeGen::EmitIsObject(Register input, | 2036 Condition LCodeGen::EmitIsObject(Register input, |
2079 Register temp1, | 2037 Register temp1, |
2080 Register temp2, | 2038 Register temp2, |
2081 Label* is_not_object, | 2039 Label* is_not_object, |
2082 Label* is_object) { | 2040 Label* is_object) { |
2083 __ JumpIfSmi(input, is_not_object); | 2041 __ JumpIfSmi(input, is_not_object); |
2084 | 2042 |
2085 __ LoadRoot(temp2, Heap::kNullValueRootIndex); | 2043 __ LoadRoot(temp2, Heap::kNullValueRootIndex); |
2086 __ Branch(is_object, eq, input, Operand(temp2)); | 2044 __ Branch(is_object, eq, input, Operand(temp2)); |
2087 | 2045 |
(...skipping 3578 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5666 __ Subu(scratch, result, scratch); | 5624 __ Subu(scratch, result, scratch); |
5667 __ lw(result, FieldMemOperand(scratch, | 5625 __ lw(result, FieldMemOperand(scratch, |
5668 FixedArray::kHeaderSize - kPointerSize)); | 5626 FixedArray::kHeaderSize - kPointerSize)); |
5669 __ bind(&done); | 5627 __ bind(&done); |
5670 } | 5628 } |
5671 | 5629 |
5672 | 5630 |
5673 #undef __ | 5631 #undef __ |
5674 | 5632 |
5675 } } // namespace v8::internal | 5633 } } // namespace v8::internal |
OLD | NEW |