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

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

Issue 6603028: Merge revisions 7030:7051 from bleeding_edge to isolates branch.... (Closed) Base URL: http://v8.googlecode.com/svn/branches/experimental/isolates/
Patch Set: '' Created 9 years, 9 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/ia32/full-codegen-ia32.cc ('k') | src/ia32/lithium-ia32.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 2011 the V8 project authors. All rights reserved. 1 // Copyright 2011 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 1636 matching lines...) Expand 10 before | Expand all | Expand 10 after
1647 Label* false_label = chunk_->GetAssemblyLabel(false_block); 1647 Label* false_label = chunk_->GetAssemblyLabel(false_block);
1648 1648
1649 __ test(input, Immediate(kSmiTagMask)); 1649 __ test(input, Immediate(kSmiTagMask));
1650 __ j(zero, false_label); 1650 __ j(zero, false_label);
1651 1651
1652 __ CmpObjectType(input, TestType(instr->hydrogen()), temp); 1652 __ CmpObjectType(input, TestType(instr->hydrogen()), temp);
1653 EmitBranch(true_block, false_block, BranchCondition(instr->hydrogen())); 1653 EmitBranch(true_block, false_block, BranchCondition(instr->hydrogen()));
1654 } 1654 }
1655 1655
1656 1656
1657 void LCodeGen::DoGetCachedArrayIndex(LGetCachedArrayIndex* instr) {
1658 Register input = ToRegister(instr->InputAt(0));
1659 Register result = ToRegister(instr->result());
1660
1661 if (FLAG_debug_code) {
1662 __ AbortIfNotString(input);
1663 }
1664
1665 __ mov(result, FieldOperand(input, String::kHashFieldOffset));
1666 __ IndexFromHash(result, result);
1667 }
1668
1669
1657 void LCodeGen::DoHasCachedArrayIndex(LHasCachedArrayIndex* instr) { 1670 void LCodeGen::DoHasCachedArrayIndex(LHasCachedArrayIndex* instr) {
1658 Register input = ToRegister(instr->InputAt(0)); 1671 Register input = ToRegister(instr->InputAt(0));
1659 Register result = ToRegister(instr->result()); 1672 Register result = ToRegister(instr->result());
1660 1673
1661 ASSERT(instr->hydrogen()->value()->representation().IsTagged()); 1674 ASSERT(instr->hydrogen()->value()->representation().IsTagged());
1662 __ mov(result, FACTORY->true_value()); 1675 __ mov(result, FACTORY->true_value());
1663 __ test(FieldOperand(input, String::kHashFieldOffset), 1676 __ test(FieldOperand(input, String::kHashFieldOffset),
1664 Immediate(String::kContainsCachedArrayIndexMask)); 1677 Immediate(String::kContainsCachedArrayIndexMask));
1665 NearLabel done; 1678 NearLabel done;
1666 __ j(not_zero, &done); 1679 __ j(zero, &done);
1667 __ mov(result, FACTORY->false_value()); 1680 __ mov(result, FACTORY->false_value());
1668 __ bind(&done); 1681 __ bind(&done);
1669 } 1682 }
1670 1683
1671 1684
1672 void LCodeGen::DoHasCachedArrayIndexAndBranch( 1685 void LCodeGen::DoHasCachedArrayIndexAndBranch(
1673 LHasCachedArrayIndexAndBranch* instr) { 1686 LHasCachedArrayIndexAndBranch* instr) {
1674 Register input = ToRegister(instr->InputAt(0)); 1687 Register input = ToRegister(instr->InputAt(0));
1675 1688
1676 int true_block = chunk_->LookupDestination(instr->true_block_id()); 1689 int true_block = chunk_->LookupDestination(instr->true_block_id());
1677 int false_block = chunk_->LookupDestination(instr->false_block_id()); 1690 int false_block = chunk_->LookupDestination(instr->false_block_id());
1678 1691
1679 __ test(FieldOperand(input, String::kHashFieldOffset), 1692 __ test(FieldOperand(input, String::kHashFieldOffset),
1680 Immediate(String::kContainsCachedArrayIndexMask)); 1693 Immediate(String::kContainsCachedArrayIndexMask));
1681 EmitBranch(true_block, false_block, not_equal); 1694 EmitBranch(true_block, false_block, equal);
1682 } 1695 }
1683 1696
1684 1697
1685 // Branches to a label or falls through with the answer in the z flag. Trashes 1698 // Branches to a label or falls through with the answer in the z flag. Trashes
1686 // the temp registers, but not the input. Only input and temp2 may alias. 1699 // the temp registers, but not the input. Only input and temp2 may alias.
1687 void LCodeGen::EmitClassOfTest(Label* is_true, 1700 void LCodeGen::EmitClassOfTest(Label* is_true,
1688 Label* is_false, 1701 Label* is_false,
1689 Handle<String>class_name, 1702 Handle<String>class_name,
1690 Register input, 1703 Register input,
1691 Register temp, 1704 Register temp,
(...skipping 1996 matching lines...) Expand 10 before | Expand all | Expand 10 after
3688 EmitBranch(true_block, false_block, final_branch_condition); 3701 EmitBranch(true_block, false_block, final_branch_condition);
3689 } 3702 }
3690 3703
3691 3704
3692 Condition LCodeGen::EmitTypeofIs(Label* true_label, 3705 Condition LCodeGen::EmitTypeofIs(Label* true_label,
3693 Label* false_label, 3706 Label* false_label,
3694 Register input, 3707 Register input,
3695 Handle<String> type_name) { 3708 Handle<String> type_name) {
3696 Condition final_branch_condition = no_condition; 3709 Condition final_branch_condition = no_condition;
3697 if (type_name->Equals(HEAP->number_symbol())) { 3710 if (type_name->Equals(HEAP->number_symbol())) {
3698 __ test(input, Immediate(kSmiTagMask)); 3711 __ JumpIfSmi(input, true_label);
3699 __ j(zero, true_label);
3700 __ cmp(FieldOperand(input, HeapObject::kMapOffset), 3712 __ cmp(FieldOperand(input, HeapObject::kMapOffset),
3701 FACTORY->heap_number_map()); 3713 FACTORY->heap_number_map());
3702 final_branch_condition = equal; 3714 final_branch_condition = equal;
3703 3715
3704 } else if (type_name->Equals(HEAP->string_symbol())) { 3716 } else if (type_name->Equals(HEAP->string_symbol())) {
3705 __ test(input, Immediate(kSmiTagMask)); 3717 __ JumpIfSmi(input, false_label);
3706 __ j(zero, false_label); 3718 __ CmpObjectType(input, FIRST_NONSTRING_TYPE, input);
3707 __ mov(input, FieldOperand(input, HeapObject::kMapOffset)); 3719 __ j(above_equal, false_label);
3708 __ test_b(FieldOperand(input, Map::kBitFieldOffset), 3720 __ test_b(FieldOperand(input, Map::kBitFieldOffset),
3709 1 << Map::kIsUndetectable); 3721 1 << Map::kIsUndetectable);
3710 __ j(not_zero, false_label); 3722 final_branch_condition = zero;
3711 __ CmpInstanceType(input, FIRST_NONSTRING_TYPE);
3712 final_branch_condition = below;
3713 3723
3714 } else if (type_name->Equals(HEAP->boolean_symbol())) { 3724 } else if (type_name->Equals(HEAP->boolean_symbol())) {
3715 __ cmp(input, FACTORY->true_value()); 3725 __ cmp(input, FACTORY->true_value());
3716 __ j(equal, true_label); 3726 __ j(equal, true_label);
3717 __ cmp(input, FACTORY->false_value()); 3727 __ cmp(input, FACTORY->false_value());
3718 final_branch_condition = equal; 3728 final_branch_condition = equal;
3719 3729
3720 } else if (type_name->Equals(HEAP->undefined_symbol())) { 3730 } else if (type_name->Equals(HEAP->undefined_symbol())) {
3721 __ cmp(input, FACTORY->undefined_value()); 3731 __ cmp(input, FACTORY->undefined_value());
3722 __ j(equal, true_label); 3732 __ j(equal, true_label);
3723 __ test(input, Immediate(kSmiTagMask)); 3733 __ JumpIfSmi(input, false_label);
3724 __ j(zero, false_label);
3725 // Check for undetectable objects => true. 3734 // Check for undetectable objects => true.
3726 __ mov(input, FieldOperand(input, HeapObject::kMapOffset)); 3735 __ mov(input, FieldOperand(input, HeapObject::kMapOffset));
3727 __ test_b(FieldOperand(input, Map::kBitFieldOffset), 3736 __ test_b(FieldOperand(input, Map::kBitFieldOffset),
3728 1 << Map::kIsUndetectable); 3737 1 << Map::kIsUndetectable);
3729 final_branch_condition = not_zero; 3738 final_branch_condition = not_zero;
3730 3739
3731 } else if (type_name->Equals(HEAP->function_symbol())) { 3740 } else if (type_name->Equals(HEAP->function_symbol())) {
3732 __ test(input, Immediate(kSmiTagMask)); 3741 __ JumpIfSmi(input, false_label);
3733 __ j(zero, false_label);
3734 __ CmpObjectType(input, JS_FUNCTION_TYPE, input); 3742 __ CmpObjectType(input, JS_FUNCTION_TYPE, input);
3735 __ j(equal, true_label); 3743 __ j(equal, true_label);
3736 // Regular expressions => 'function' (they are callable). 3744 // Regular expressions => 'function' (they are callable).
3737 __ CmpInstanceType(input, JS_REGEXP_TYPE); 3745 __ CmpInstanceType(input, JS_REGEXP_TYPE);
3738 final_branch_condition = equal; 3746 final_branch_condition = equal;
3739 3747
3740 } else if (type_name->Equals(HEAP->object_symbol())) { 3748 } else if (type_name->Equals(HEAP->object_symbol())) {
3741 __ test(input, Immediate(kSmiTagMask)); 3749 __ JumpIfSmi(input, false_label);
3742 __ j(zero, false_label);
3743 __ cmp(input, FACTORY->null_value()); 3750 __ cmp(input, FACTORY->null_value());
3744 __ j(equal, true_label); 3751 __ j(equal, true_label);
3745 // Regular expressions => 'function', not 'object'. 3752 // Regular expressions => 'function', not 'object'.
3746 __ CmpObjectType(input, JS_REGEXP_TYPE, input); 3753 __ CmpObjectType(input, FIRST_JS_OBJECT_TYPE, input);
3747 __ j(equal, false_label); 3754 __ j(below, false_label);
3755 __ CmpInstanceType(input, FIRST_FUNCTION_CLASS_TYPE);
3756 __ j(above_equal, false_label);
3748 // Check for undetectable objects => false. 3757 // Check for undetectable objects => false.
3749 __ test_b(FieldOperand(input, Map::kBitFieldOffset), 3758 __ test_b(FieldOperand(input, Map::kBitFieldOffset),
3750 1 << Map::kIsUndetectable); 3759 1 << Map::kIsUndetectable);
3751 __ j(not_zero, false_label); 3760 final_branch_condition = zero;
3752 // Check for JS objects => true.
3753 __ CmpInstanceType(input, FIRST_JS_OBJECT_TYPE);
3754 __ j(below, false_label);
3755 __ CmpInstanceType(input, LAST_JS_OBJECT_TYPE);
3756 final_branch_condition = below_equal;
3757 3761
3758 } else { 3762 } else {
3759 final_branch_condition = not_equal; 3763 final_branch_condition = not_equal;
3760 __ jmp(false_label); 3764 __ jmp(false_label);
3761 // A dead branch instruction will be generated after this point. 3765 // A dead branch instruction will be generated after this point.
3762 } 3766 }
3763 3767
3764 return final_branch_condition; 3768 return final_branch_condition;
3765 } 3769 }
3766 3770
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after
3878 ASSERT(osr_pc_offset_ == -1); 3882 ASSERT(osr_pc_offset_ == -1);
3879 osr_pc_offset_ = masm()->pc_offset(); 3883 osr_pc_offset_ = masm()->pc_offset();
3880 } 3884 }
3881 3885
3882 3886
3883 #undef __ 3887 #undef __
3884 3888
3885 } } // namespace v8::internal 3889 } } // namespace v8::internal
3886 3890
3887 #endif // V8_TARGET_ARCH_IA32 3891 #endif // V8_TARGET_ARCH_IA32
OLDNEW
« no previous file with comments | « src/ia32/full-codegen-ia32.cc ('k') | src/ia32/lithium-ia32.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698