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

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

Issue 360053: Change the special handling of typeof comparisons to strings for... (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: '' Created 11 years, 1 month 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/arm/codegen-arm.cc ('k') | src/macros.py » ('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 2006-2009 the V8 project authors. All rights reserved. 1 // Copyright 2006-2009 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 5759 matching lines...) Expand 10 before | Expand all | Expand 10 after
5770 FieldOperand(answer.reg(), Map::kBitFieldOffset)); 5770 FieldOperand(answer.reg(), Map::kBitFieldOffset));
5771 __ test(answer.reg(), Immediate(1 << Map::kIsUndetectable)); 5771 __ test(answer.reg(), Immediate(1 << Map::kIsUndetectable));
5772 answer.Unuse(); 5772 answer.Unuse();
5773 destination()->Split(not_zero); 5773 destination()->Split(not_zero);
5774 5774
5775 } else if (check->Equals(Heap::function_symbol())) { 5775 } else if (check->Equals(Heap::function_symbol())) {
5776 __ test(answer.reg(), Immediate(kSmiTagMask)); 5776 __ test(answer.reg(), Immediate(kSmiTagMask));
5777 destination()->false_target()->Branch(zero); 5777 destination()->false_target()->Branch(zero);
5778 frame_->Spill(answer.reg()); 5778 frame_->Spill(answer.reg());
5779 __ CmpObjectType(answer.reg(), JS_FUNCTION_TYPE, answer.reg()); 5779 __ CmpObjectType(answer.reg(), JS_FUNCTION_TYPE, answer.reg());
5780 destination()->true_target()->Branch(equal);
5781 // Regular expressions are callable so typeof == 'function'.
5782 __ CmpInstanceType(answer.reg(), JS_REGEXP_TYPE);
5780 answer.Unuse(); 5783 answer.Unuse();
5781 destination()->Split(equal); 5784 destination()->Split(equal);
5782 5785
5783 } else if (check->Equals(Heap::object_symbol())) { 5786 } else if (check->Equals(Heap::object_symbol())) {
5784 __ test(answer.reg(), Immediate(kSmiTagMask)); 5787 __ test(answer.reg(), Immediate(kSmiTagMask));
5785 destination()->false_target()->Branch(zero); 5788 destination()->false_target()->Branch(zero);
5786 __ cmp(answer.reg(), Factory::null_value()); 5789 __ cmp(answer.reg(), Factory::null_value());
5787 destination()->true_target()->Branch(equal); 5790 destination()->true_target()->Branch(equal);
5788 5791
5789 // It can be an undetectable object.
5790 Result map = allocator()->Allocate(); 5792 Result map = allocator()->Allocate();
5791 ASSERT(map.is_valid()); 5793 ASSERT(map.is_valid());
5792 __ mov(map.reg(), FieldOperand(answer.reg(), HeapObject::kMapOffset)); 5794 // Regular expressions are typeof == 'function', not 'object'.
5795 __ CmpObjectType(answer.reg(), JS_REGEXP_TYPE, map.reg());
5796 destination()->false_target()->Branch(equal);
5797
5798 // It can be an undetectable object.
5793 __ movzx_b(map.reg(), FieldOperand(map.reg(), Map::kBitFieldOffset)); 5799 __ movzx_b(map.reg(), FieldOperand(map.reg(), Map::kBitFieldOffset));
5794 __ test(map.reg(), Immediate(1 << Map::kIsUndetectable)); 5800 __ test(map.reg(), Immediate(1 << Map::kIsUndetectable));
5795 destination()->false_target()->Branch(not_zero); 5801 destination()->false_target()->Branch(not_zero);
5796 __ mov(map.reg(), FieldOperand(answer.reg(), HeapObject::kMapOffset)); 5802 __ mov(map.reg(), FieldOperand(answer.reg(), HeapObject::kMapOffset));
5797 __ movzx_b(map.reg(), FieldOperand(map.reg(), Map::kInstanceTypeOffset)); 5803 __ movzx_b(map.reg(), FieldOperand(map.reg(), Map::kInstanceTypeOffset));
5798 __ cmp(map.reg(), FIRST_JS_OBJECT_TYPE); 5804 __ cmp(map.reg(), FIRST_JS_OBJECT_TYPE);
5799 destination()->false_target()->Branch(less); 5805 destination()->false_target()->Branch(less);
5800 __ cmp(map.reg(), LAST_JS_OBJECT_TYPE); 5806 __ cmp(map.reg(), LAST_JS_OBJECT_TYPE);
5801 answer.Unuse(); 5807 answer.Unuse();
5802 map.Unuse(); 5808 map.Unuse();
(...skipping 2310 matching lines...) Expand 10 before | Expand all | Expand 10 after
8113 8119
8114 int CompareStub::MinorKey() { 8120 int CompareStub::MinorKey() {
8115 // Encode the two parameters in a unique 16 bit value. 8121 // Encode the two parameters in a unique 16 bit value.
8116 ASSERT(static_cast<unsigned>(cc_) < (1 << 15)); 8122 ASSERT(static_cast<unsigned>(cc_) < (1 << 15));
8117 return (static_cast<unsigned>(cc_) << 1) | (strict_ ? 1 : 0); 8123 return (static_cast<unsigned>(cc_) << 1) | (strict_ ? 1 : 0);
8118 } 8124 }
8119 8125
8120 #undef __ 8126 #undef __
8121 8127
8122 } } // namespace v8::internal 8128 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/arm/codegen-arm.cc ('k') | src/macros.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698