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

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

Issue 5828004: IA32: Optimize instanceof... (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: '' Created 10 years 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 2010 the V8 project authors. All rights reserved. 1 // Copyright 2010 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 1681 matching lines...) Expand 10 before | Expand all | Expand 10 after
1692 Register reg = ToRegister(instr->input()); 1692 Register reg = ToRegister(instr->input());
1693 int true_block = instr->true_block_id(); 1693 int true_block = instr->true_block_id();
1694 int false_block = instr->false_block_id(); 1694 int false_block = instr->false_block_id();
1695 1695
1696 __ cmp(FieldOperand(reg, HeapObject::kMapOffset), instr->map()); 1696 __ cmp(FieldOperand(reg, HeapObject::kMapOffset), instr->map());
1697 EmitBranch(true_block, false_block, equal); 1697 EmitBranch(true_block, false_block, equal);
1698 } 1698 }
1699 1699
1700 1700
1701 void LCodeGen::DoInstanceOf(LInstanceOf* instr) { 1701 void LCodeGen::DoInstanceOf(LInstanceOf* instr) {
1702 InstanceofStub stub; 1702 // Object and function are in fixed registers eax and edx.
1703 __ push(ToOperand(instr->left())); 1703 InstanceofStub stub(InstanceofStub::kArgsInRegisters);
1704 __ push(ToOperand(instr->right()));
1705 CallCode(stub.GetCode(), RelocInfo::CODE_TARGET, instr); 1704 CallCode(stub.GetCode(), RelocInfo::CODE_TARGET, instr);
1706 1705
1707 NearLabel true_value, done; 1706 NearLabel true_value, done;
1708 __ test(eax, Operand(eax)); 1707 __ test(eax, Operand(eax));
1709 __ j(zero, &true_value); 1708 __ j(zero, &true_value);
1710 __ mov(ToRegister(instr->result()), Factory::false_value()); 1709 __ mov(ToRegister(instr->result()), Factory::false_value());
1711 __ jmp(&done); 1710 __ jmp(&done);
1712 __ bind(&true_value); 1711 __ bind(&true_value);
1713 __ mov(ToRegister(instr->result()), Factory::true_value()); 1712 __ mov(ToRegister(instr->result()), Factory::true_value());
1714 __ bind(&done); 1713 __ bind(&done);
1715 } 1714 }
1716 1715
1717 1716
1718 void LCodeGen::DoInstanceOfAndBranch(LInstanceOfAndBranch* instr) { 1717 void LCodeGen::DoInstanceOfAndBranch(LInstanceOfAndBranch* instr) {
1719 int true_block = chunk_->LookupDestination(instr->true_block_id()); 1718 int true_block = chunk_->LookupDestination(instr->true_block_id());
1720 int false_block = chunk_->LookupDestination(instr->false_block_id()); 1719 int false_block = chunk_->LookupDestination(instr->false_block_id());
1721 1720
1722 InstanceofStub stub; 1721 InstanceofStub stub(InstanceofStub::kArgsInRegisters);
1723 __ push(ToOperand(instr->left()));
1724 __ push(ToOperand(instr->right()));
1725 CallCode(stub.GetCode(), RelocInfo::CODE_TARGET, instr); 1722 CallCode(stub.GetCode(), RelocInfo::CODE_TARGET, instr);
1726 __ test(eax, Operand(eax)); 1723 __ test(eax, Operand(eax));
1727 EmitBranch(true_block, false_block, zero); 1724 EmitBranch(true_block, false_block, zero);
1728 } 1725 }
1729 1726
1730 1727
1731 static Condition ComputeCompareCondition(Token::Value op) { 1728 static Condition ComputeCompareCondition(Token::Value op) {
1732 switch (op) { 1729 switch (op) {
1733 case Token::EQ_STRICT: 1730 case Token::EQ_STRICT:
1734 case Token::EQ: 1731 case Token::EQ:
(...skipping 1511 matching lines...) Expand 10 before | Expand all | Expand 10 after
3246 ASSERT(!environment->HasBeenRegistered()); 3243 ASSERT(!environment->HasBeenRegistered());
3247 RegisterEnvironmentForDeoptimization(environment); 3244 RegisterEnvironmentForDeoptimization(environment);
3248 ASSERT(osr_pc_offset_ == -1); 3245 ASSERT(osr_pc_offset_ == -1);
3249 osr_pc_offset_ = masm()->pc_offset(); 3246 osr_pc_offset_ = masm()->pc_offset();
3250 } 3247 }
3251 3248
3252 3249
3253 #undef __ 3250 #undef __
3254 3251
3255 } } // namespace v8::internal 3252 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/ia32/full-codegen-ia32.cc ('k') | src/ia32/lithium-ia32.cc » ('j') | src/v8-counters.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698