| 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 2401 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2412 void LCodeGen::DoCmpConstantEqAndBranch(LCmpConstantEqAndBranch* instr) { | 2412 void LCodeGen::DoCmpConstantEqAndBranch(LCmpConstantEqAndBranch* instr) { |
| 2413 Register left = ToRegister(instr->left()); | 2413 Register left = ToRegister(instr->left()); |
| 2414 int true_block = chunk_->LookupDestination(instr->true_block_id()); | 2414 int true_block = chunk_->LookupDestination(instr->true_block_id()); |
| 2415 int false_block = chunk_->LookupDestination(instr->false_block_id()); | 2415 int false_block = chunk_->LookupDestination(instr->false_block_id()); |
| 2416 | 2416 |
| 2417 __ cmp(left, Operand(instr->hydrogen()->right())); | 2417 __ cmp(left, Operand(instr->hydrogen()->right())); |
| 2418 EmitBranch(true_block, false_block, eq); | 2418 EmitBranch(true_block, false_block, eq); |
| 2419 } | 2419 } |
| 2420 | 2420 |
| 2421 | 2421 |
| 2422 void LCodeGen::DoIsNilAndBranch(LIsNilAndBranch* instr) { | |
| 2423 Register scratch = scratch0(); | |
| 2424 Register reg = ToRegister(instr->value()); | |
| 2425 int false_block = chunk_->LookupDestination(instr->false_block_id()); | |
| 2426 | |
| 2427 // If the expression is known to be untagged or a smi, then it's definitely | |
| 2428 // not null, and it can't be a an undetectable object. | |
| 2429 if (instr->hydrogen()->representation().IsSpecialization() || | |
| 2430 instr->hydrogen()->type().IsSmi()) { | |
| 2431 EmitGoto(false_block); | |
| 2432 return; | |
| 2433 } | |
| 2434 | |
| 2435 int true_block = chunk_->LookupDestination(instr->true_block_id()); | |
| 2436 Heap::RootListIndex nil_value = instr->nil() == kNullValue ? | |
| 2437 Heap::kNullValueRootIndex : | |
| 2438 Heap::kUndefinedValueRootIndex; | |
| 2439 __ LoadRoot(ip, nil_value); | |
| 2440 __ cmp(reg, ip); | |
| 2441 if (instr->kind() == kStrictEquality) { | |
| 2442 EmitBranch(true_block, false_block, eq); | |
| 2443 } else { | |
| 2444 Heap::RootListIndex other_nil_value = instr->nil() == kNullValue ? | |
| 2445 Heap::kUndefinedValueRootIndex : | |
| 2446 Heap::kNullValueRootIndex; | |
| 2447 Label* true_label = chunk_->GetAssemblyLabel(true_block); | |
| 2448 Label* false_label = chunk_->GetAssemblyLabel(false_block); | |
| 2449 __ b(eq, true_label); | |
| 2450 __ LoadRoot(ip, other_nil_value); | |
| 2451 __ cmp(reg, ip); | |
| 2452 __ b(eq, true_label); | |
| 2453 __ JumpIfSmi(reg, false_label); | |
| 2454 // Check for undetectable objects by looking in the bit field in | |
| 2455 // the map. The object has already been smi checked. | |
| 2456 __ ldr(scratch, FieldMemOperand(reg, HeapObject::kMapOffset)); | |
| 2457 __ ldrb(scratch, FieldMemOperand(scratch, Map::kBitFieldOffset)); | |
| 2458 __ tst(scratch, Operand(1 << Map::kIsUndetectable)); | |
| 2459 EmitBranch(true_block, false_block, ne); | |
| 2460 } | |
| 2461 } | |
| 2462 | |
| 2463 | |
| 2464 Condition LCodeGen::EmitIsObject(Register input, | 2422 Condition LCodeGen::EmitIsObject(Register input, |
| 2465 Register temp1, | 2423 Register temp1, |
| 2466 Label* is_not_object, | 2424 Label* is_not_object, |
| 2467 Label* is_object) { | 2425 Label* is_object) { |
| 2468 Register temp2 = scratch0(); | 2426 Register temp2 = scratch0(); |
| 2469 __ JumpIfSmi(input, is_not_object); | 2427 __ JumpIfSmi(input, is_not_object); |
| 2470 | 2428 |
| 2471 __ LoadRoot(temp2, Heap::kNullValueRootIndex); | 2429 __ LoadRoot(temp2, Heap::kNullValueRootIndex); |
| 2472 __ cmp(input, temp2); | 2430 __ cmp(input, temp2); |
| 2473 __ b(eq, is_object); | 2431 __ b(eq, is_object); |
| (...skipping 3467 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5941 __ sub(scratch, result, Operand(index, LSL, kPointerSizeLog2 - kSmiTagSize)); | 5899 __ sub(scratch, result, Operand(index, LSL, kPointerSizeLog2 - kSmiTagSize)); |
| 5942 __ ldr(result, FieldMemOperand(scratch, | 5900 __ ldr(result, FieldMemOperand(scratch, |
| 5943 FixedArray::kHeaderSize - kPointerSize)); | 5901 FixedArray::kHeaderSize - kPointerSize)); |
| 5944 __ bind(&done); | 5902 __ bind(&done); |
| 5945 } | 5903 } |
| 5946 | 5904 |
| 5947 | 5905 |
| 5948 #undef __ | 5906 #undef __ |
| 5949 | 5907 |
| 5950 } } // namespace v8::internal | 5908 } } // namespace v8::internal |
| OLD | NEW |