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

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

Issue 7737036: Reorganize object type enum, such that proxies are no longer in the middle (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 9 years, 3 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 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 1737 matching lines...) Expand 10 before | Expand all | Expand 10 after
1748 // Branches to a label or falls through with the answer in the z flag. 1748 // Branches to a label or falls through with the answer in the z flag.
1749 // Trashes the temp register and possibly input (if it and temp are aliased). 1749 // Trashes the temp register and possibly input (if it and temp are aliased).
1750 void LCodeGen::EmitClassOfTest(Label* is_true, 1750 void LCodeGen::EmitClassOfTest(Label* is_true,
1751 Label* is_false, 1751 Label* is_false,
1752 Handle<String> class_name, 1752 Handle<String> class_name,
1753 Register input, 1753 Register input,
1754 Register temp) { 1754 Register temp) {
1755 __ JumpIfSmi(input, is_false); 1755 __ JumpIfSmi(input, is_false);
1756 __ CmpObjectType(input, FIRST_SPEC_OBJECT_TYPE, temp); 1756 __ CmpObjectType(input, FIRST_SPEC_OBJECT_TYPE, temp);
1757 __ j(below, is_false); 1757 __ j(below, is_false);
1758 ASSERT(LAST_SPEC_OBJECT_TYPE == LAST_TYPE);
1759
1760 // Assuming the following assertions, we can do the same test for
1761 // either "Object" or "Function", only the branch conditions differ.
1762 STATIC_ASSERT(NUM_OF_CALLABLE_SPEC_OBJECT_TYPES == 2);
1763 STATIC_ASSERT(FIRST_NONCALLABLE_SPEC_OBJECT_TYPE ==
1764 FIRST_SPEC_OBJECT_TYPE + 1);
1765 STATIC_ASSERT(LAST_NONCALLABLE_SPEC_OBJECT_TYPE ==
1766 LAST_SPEC_OBJECT_TYPE - 1);
1758 1767
1759 // Map is now in temp. 1768 // Map is now in temp.
1760 // Functions have class 'Function'. 1769 // Functions have class 'Function'.
1761 __ CmpInstanceType(temp, FIRST_CALLABLE_SPEC_OBJECT_TYPE); 1770 __ CmpInstanceType(temp, FIRST_SPEC_OBJECT_TYPE);
1762 if (class_name->IsEqualTo(CStrVector("Function"))) { 1771 if (class_name->IsEqualTo(CStrVector("Function"))) {
1763 __ j(above_equal, is_true); 1772 __ j(equal, is_true);
1773 } else {
1774 __ j(below_equal, is_false);
1775 }
1776 __ CmpInstanceType(temp, LAST_SPEC_OBJECT_TYPE);
1777 if (class_name->IsEqualTo(CStrVector("Function"))) {
1778 __ j(equal, is_true);
1764 } else { 1779 } else {
1765 __ j(above_equal, is_false); 1780 __ j(above_equal, is_false);
1766 } 1781 }
1767 1782
1783 // Now we are in the FIRST-LAST_NONCALLABLE_SPEC_OBJECT_TYPE range.
1768 // Check if the constructor in the map is a function. 1784 // Check if the constructor in the map is a function.
1769 __ movq(temp, FieldOperand(temp, Map::kConstructorOffset)); 1785 __ movq(temp, FieldOperand(temp, Map::kConstructorOffset));
1770 1786
1771 // As long as LAST_CALLABLE_SPEC_OBJECT_TYPE is the last type and
1772 // FIRST_CALLABLE_SPEC_OBJECT_TYPE comes right after
1773 // LAST_NONCALLABLE_SPEC_OBJECT_TYPE, we can avoid checking for the latter.
1774 STATIC_ASSERT(LAST_TYPE == LAST_CALLABLE_SPEC_OBJECT_TYPE);
1775 STATIC_ASSERT(FIRST_CALLABLE_SPEC_OBJECT_TYPE ==
1776 LAST_NONCALLABLE_SPEC_OBJECT_TYPE + 1);
1777
1778 // Objects with a non-function constructor have class 'Object'. 1787 // Objects with a non-function constructor have class 'Object'.
1779 __ CmpObjectType(temp, JS_FUNCTION_TYPE, kScratchRegister); 1788 __ CmpObjectType(temp, JS_FUNCTION_TYPE, kScratchRegister);
1780 if (class_name->IsEqualTo(CStrVector("Object"))) { 1789 if (class_name->IsEqualTo(CStrVector("Object"))) {
1781 __ j(not_equal, is_true); 1790 __ j(not_equal, is_true);
1782 } else { 1791 } else {
1783 __ j(not_equal, is_false); 1792 __ j(not_equal, is_false);
1784 } 1793 }
1785 1794
1786 // temp now contains the constructor function. Grab the 1795 // temp now contains the constructor function. Grab the
1787 // instance class name from there. 1796 // instance class name from there.
(...skipping 2185 matching lines...) Expand 10 before | Expand all | Expand 10 after
3973 __ CompareRoot(input, Heap::kUndefinedValueRootIndex); 3982 __ CompareRoot(input, Heap::kUndefinedValueRootIndex);
3974 __ j(equal, true_label); 3983 __ j(equal, true_label);
3975 __ JumpIfSmi(input, false_label); 3984 __ JumpIfSmi(input, false_label);
3976 // Check for undetectable objects => true. 3985 // Check for undetectable objects => true.
3977 __ movq(input, FieldOperand(input, HeapObject::kMapOffset)); 3986 __ movq(input, FieldOperand(input, HeapObject::kMapOffset));
3978 __ testb(FieldOperand(input, Map::kBitFieldOffset), 3987 __ testb(FieldOperand(input, Map::kBitFieldOffset),
3979 Immediate(1 << Map::kIsUndetectable)); 3988 Immediate(1 << Map::kIsUndetectable));
3980 final_branch_condition = not_zero; 3989 final_branch_condition = not_zero;
3981 3990
3982 } else if (type_name->Equals(heap()->function_symbol())) { 3991 } else if (type_name->Equals(heap()->function_symbol())) {
3992 STATIC_ASSERT(NUM_OF_CALLABLE_SPEC_OBJECT_TYPES == 2);
3983 __ JumpIfSmi(input, false_label); 3993 __ JumpIfSmi(input, false_label);
3984 __ CmpObjectType(input, FIRST_CALLABLE_SPEC_OBJECT_TYPE, input); 3994 __ CmpObjectType(input, JS_FUNCTION_TYPE, input);
3985 final_branch_condition = above_equal; 3995 __ j(equal, true_label);
3996 __ CmpInstanceType(input, JS_FUNCTION_PROXY_TYPE);
3997 final_branch_condition = equal;
3986 3998
3987 } else if (type_name->Equals(heap()->object_symbol())) { 3999 } else if (type_name->Equals(heap()->object_symbol())) {
3988 __ JumpIfSmi(input, false_label); 4000 __ JumpIfSmi(input, false_label);
3989 if (!FLAG_harmony_typeof) { 4001 if (!FLAG_harmony_typeof) {
3990 __ CompareRoot(input, Heap::kNullValueRootIndex); 4002 __ CompareRoot(input, Heap::kNullValueRootIndex);
3991 __ j(equal, true_label); 4003 __ j(equal, true_label);
3992 } 4004 }
3993 __ CmpObjectType(input, FIRST_NONCALLABLE_SPEC_OBJECT_TYPE, input); 4005 __ CmpObjectType(input, FIRST_NONCALLABLE_SPEC_OBJECT_TYPE, input);
3994 __ j(below, false_label); 4006 __ j(below, false_label);
3995 __ CmpInstanceType(input, LAST_NONCALLABLE_SPEC_OBJECT_TYPE); 4007 __ CmpInstanceType(input, LAST_NONCALLABLE_SPEC_OBJECT_TYPE);
(...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after
4147 RegisterEnvironmentForDeoptimization(environment); 4159 RegisterEnvironmentForDeoptimization(environment);
4148 ASSERT(osr_pc_offset_ == -1); 4160 ASSERT(osr_pc_offset_ == -1);
4149 osr_pc_offset_ = masm()->pc_offset(); 4161 osr_pc_offset_ = masm()->pc_offset();
4150 } 4162 }
4151 4163
4152 #undef __ 4164 #undef __
4153 4165
4154 } } // namespace v8::internal 4166 } } // namespace v8::internal
4155 4167
4156 #endif // V8_TARGET_ARCH_X64 4168 #endif // V8_TARGET_ARCH_X64
OLDNEW
« src/ia32/lithium-codegen-ia32.cc ('K') | « src/x64/full-codegen-x64.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698