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

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

Issue 18712002: Convert UnaryOpStub to a HydrogenCodeStub (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: fix builtin leakage Created 7 years, 5 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
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 1846 matching lines...) Expand 10 before | Expand all | Expand 10 after
1857 int LCodeGen::GetNextEmittedBlock() const { 1857 int LCodeGen::GetNextEmittedBlock() const {
1858 for (int i = current_block_ + 1; i < graph()->blocks()->length(); ++i) { 1858 for (int i = current_block_ + 1; i < graph()->blocks()->length(); ++i) {
1859 if (!chunk_->GetLabel(i)->HasReplacement()) return i; 1859 if (!chunk_->GetLabel(i)->HasReplacement()) return i;
1860 } 1860 }
1861 return -1; 1861 return -1;
1862 } 1862 }
1863 1863
1864 1864
1865 template<class InstrType> 1865 template<class InstrType>
1866 void LCodeGen::EmitBranch(InstrType instr, Condition cc) { 1866 void LCodeGen::EmitBranch(InstrType instr, Condition cc) {
1867 int left_block = instr->TrueDestination(chunk_);
1867 int right_block = instr->FalseDestination(chunk_); 1868 int right_block = instr->FalseDestination(chunk_);
1868 int left_block = instr->TrueDestination(chunk_);
1869 1869
1870 int next_block = GetNextEmittedBlock(); 1870 int next_block = GetNextEmittedBlock();
1871 1871
1872 if (right_block == left_block) { 1872 if (right_block == left_block || cc == no_condition) {
1873 EmitGoto(left_block); 1873 EmitGoto(left_block);
1874 } else if (left_block == next_block) { 1874 } else if (left_block == next_block) {
1875 __ j(NegateCondition(cc), chunk_->GetAssemblyLabel(right_block)); 1875 __ j(NegateCondition(cc), chunk_->GetAssemblyLabel(right_block));
1876 } else if (right_block == next_block) { 1876 } else if (right_block == next_block) {
1877 __ j(cc, chunk_->GetAssemblyLabel(left_block)); 1877 __ j(cc, chunk_->GetAssemblyLabel(left_block));
1878 } else { 1878 } else {
1879 __ j(cc, chunk_->GetAssemblyLabel(left_block)); 1879 __ j(cc, chunk_->GetAssemblyLabel(left_block));
1880 if (cc != always) { 1880 if (cc != always) {
1881 __ jmp(chunk_->GetAssemblyLabel(right_block)); 1881 __ jmp(chunk_->GetAssemblyLabel(right_block));
1882 } 1882 }
1883 } 1883 }
1884 } 1884 }
1885 1885
1886 1886
1887 void LCodeGen::DoDebugBreak(LDebugBreak* instr) { 1887 void LCodeGen::DoDebugBreak(LDebugBreak* instr) {
1888 __ int3(); 1888 __ int3();
1889 } 1889 }
1890 1890
1891 1891
1892 void LCodeGen::DoIsNumberAndBranch(LIsNumberAndBranch* instr) {
1893 Representation r = instr->hydrogen()->value()->representation();
1894 if (r.IsSmiOrInteger32() || r.IsDouble()) {
1895 EmitBranch(instr, no_condition);
1896 } else {
1897 ASSERT(r.IsTagged());
1898 Register reg = ToRegister(instr->value());
1899 HType type = instr->hydrogen()->value()->type();
1900 if (type.IsTaggedNumber()) {
1901 EmitBranch(instr, no_condition);
1902 }
1903 __ JumpIfSmi(reg, instr->TrueLabel(chunk_));
1904 __ CompareRoot(FieldOperand(reg, HeapObject::kMapOffset),
1905 Heap::kHeapNumberMapRootIndex);
1906 EmitBranch(instr, equal);
1907 }
1908 }
1909
1910
1892 void LCodeGen::DoBranch(LBranch* instr) { 1911 void LCodeGen::DoBranch(LBranch* instr) {
1893 Representation r = instr->hydrogen()->value()->representation(); 1912 Representation r = instr->hydrogen()->value()->representation();
1894 if (r.IsInteger32()) { 1913 if (r.IsInteger32()) {
1895 ASSERT(!info()->IsStub()); 1914 ASSERT(!info()->IsStub());
1896 Register reg = ToRegister(instr->value()); 1915 Register reg = ToRegister(instr->value());
1897 __ testl(reg, reg); 1916 __ testl(reg, reg);
1898 EmitBranch(instr, not_zero); 1917 EmitBranch(instr, not_zero);
1899 } else if (r.IsSmi()) { 1918 } else if (r.IsSmi()) {
1900 ASSERT(!info()->IsStub()); 1919 ASSERT(!info()->IsStub());
1901 Register reg = ToRegister(instr->value()); 1920 Register reg = ToRegister(instr->value());
(...skipping 3759 matching lines...) Expand 10 before | Expand all | Expand 10 after
5661 FixedArray::kHeaderSize - kPointerSize)); 5680 FixedArray::kHeaderSize - kPointerSize));
5662 __ bind(&done); 5681 __ bind(&done);
5663 } 5682 }
5664 5683
5665 5684
5666 #undef __ 5685 #undef __
5667 5686
5668 } } // namespace v8::internal 5687 } } // namespace v8::internal
5669 5688
5670 #endif // V8_TARGET_ARCH_X64 5689 #endif // V8_TARGET_ARCH_X64
OLDNEW
« src/hydrogen.cc ('K') | « 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