Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(804)

Side by Side Diff: src/x64/lithium-codegen-x64.cc

Issue 13728002: Add an IC for CompareNil operations (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Fix SunSpider regression Created 7 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « src/x64/full-codegen-x64.cc ('k') | src/x64/lithium-x64.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 2057 matching lines...) Expand 10 before | Expand all | Expand 10 after
2068 void LCodeGen::DoCmpConstantEqAndBranch(LCmpConstantEqAndBranch* instr) { 2068 void LCodeGen::DoCmpConstantEqAndBranch(LCmpConstantEqAndBranch* instr) {
2069 Register left = ToRegister(instr->left()); 2069 Register left = ToRegister(instr->left());
2070 int true_block = chunk_->LookupDestination(instr->true_block_id()); 2070 int true_block = chunk_->LookupDestination(instr->true_block_id());
2071 int false_block = chunk_->LookupDestination(instr->false_block_id()); 2071 int false_block = chunk_->LookupDestination(instr->false_block_id());
2072 2072
2073 __ cmpq(left, Immediate(instr->hydrogen()->right())); 2073 __ cmpq(left, Immediate(instr->hydrogen()->right()));
2074 EmitBranch(true_block, false_block, equal); 2074 EmitBranch(true_block, false_block, equal);
2075 } 2075 }
2076 2076
2077 2077
2078 void LCodeGen::DoIsNilAndBranch(LIsNilAndBranch* instr) {
2079 Register reg = ToRegister(instr->value());
2080 int false_block = chunk_->LookupDestination(instr->false_block_id());
2081
2082 // If the expression is known to be untagged or a smi, then it's definitely
2083 // not null, and it can't be a an undetectable object.
2084 if (instr->hydrogen()->representation().IsSpecialization() ||
2085 instr->hydrogen()->type().IsSmi()) {
2086 EmitGoto(false_block);
2087 return;
2088 }
2089
2090 int true_block = chunk_->LookupDestination(instr->true_block_id());
2091 Heap::RootListIndex nil_value = instr->nil() == kNullValue ?
2092 Heap::kNullValueRootIndex :
2093 Heap::kUndefinedValueRootIndex;
2094 __ CompareRoot(reg, nil_value);
2095 if (instr->kind() == kStrictEquality) {
2096 EmitBranch(true_block, false_block, equal);
2097 } else {
2098 Heap::RootListIndex other_nil_value = instr->nil() == kNullValue ?
2099 Heap::kUndefinedValueRootIndex :
2100 Heap::kNullValueRootIndex;
2101 Label* true_label = chunk_->GetAssemblyLabel(true_block);
2102 Label* false_label = chunk_->GetAssemblyLabel(false_block);
2103 __ j(equal, true_label);
2104 __ CompareRoot(reg, other_nil_value);
2105 __ j(equal, true_label);
2106 __ JumpIfSmi(reg, false_label);
2107 // Check for undetectable objects by looking in the bit field in
2108 // the map. The object has already been smi checked.
2109 Register scratch = ToRegister(instr->temp());
2110 __ movq(scratch, FieldOperand(reg, HeapObject::kMapOffset));
2111 __ testb(FieldOperand(scratch, Map::kBitFieldOffset),
2112 Immediate(1 << Map::kIsUndetectable));
2113 EmitBranch(true_block, false_block, not_zero);
2114 }
2115 }
2116
2117
2118 Condition LCodeGen::EmitIsObject(Register input, 2078 Condition LCodeGen::EmitIsObject(Register input,
2119 Label* is_not_object, 2079 Label* is_not_object,
2120 Label* is_object) { 2080 Label* is_object) {
2121 ASSERT(!input.is(kScratchRegister)); 2081 ASSERT(!input.is(kScratchRegister));
2122 2082
2123 __ JumpIfSmi(input, is_not_object); 2083 __ JumpIfSmi(input, is_not_object);
2124 2084
2125 __ CompareRoot(input, Heap::kNullValueRootIndex); 2085 __ CompareRoot(input, Heap::kNullValueRootIndex);
2126 __ j(equal, is_object); 2086 __ j(equal, is_object);
2127 2087
(...skipping 3533 matching lines...) Expand 10 before | Expand all | Expand 10 after
5661 FixedArray::kHeaderSize - kPointerSize)); 5621 FixedArray::kHeaderSize - kPointerSize));
5662 __ bind(&done); 5622 __ bind(&done);
5663 } 5623 }
5664 5624
5665 5625
5666 #undef __ 5626 #undef __
5667 5627
5668 } } // namespace v8::internal 5628 } } // namespace v8::internal
5669 5629
5670 #endif // V8_TARGET_ARCH_X64 5630 #endif // V8_TARGET_ARCH_X64
OLDNEW
« no previous file with comments | « src/x64/full-codegen-x64.cc ('k') | src/x64/lithium-x64.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698