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

Side by Side Diff: src/objects-inl.h

Issue 7473028: Implement a type recording ToBoolean IC. (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: Created 9 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 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 140 matching lines...) Expand 10 before | Expand all | Expand 10 after
151 && HeapObject::cast(this)->map()->instance_type() == HEAP_NUMBER_TYPE; 151 && HeapObject::cast(this)->map()->instance_type() == HEAP_NUMBER_TYPE;
152 } 152 }
153 153
154 154
155 bool Object::IsString() { 155 bool Object::IsString() {
156 return Object::IsHeapObject() 156 return Object::IsHeapObject()
157 && HeapObject::cast(this)->map()->instance_type() < FIRST_NONSTRING_TYPE; 157 && HeapObject::cast(this)->map()->instance_type() < FIRST_NONSTRING_TYPE;
158 } 158 }
159 159
160 160
161 bool Object::IsSpecObject() {
162 return Object::IsHeapObject()
163 && HeapObject::cast(this)->map()->instance_type() >= FIRST_SPEC_OBJECT_TYPE;
164 }
165
166
161 bool Object::IsSymbol() { 167 bool Object::IsSymbol() {
162 if (!this->IsHeapObject()) return false; 168 if (!this->IsHeapObject()) return false;
163 uint32_t type = HeapObject::cast(this)->map()->instance_type(); 169 uint32_t type = HeapObject::cast(this)->map()->instance_type();
164 // Because the symbol tag is non-zero and no non-string types have the 170 // Because the symbol tag is non-zero and no non-string types have the
165 // symbol bit set we can test for symbols with a very simple test 171 // symbol bit set we can test for symbols with a very simple test
166 // operation. 172 // operation.
167 ASSERT(kSymbolTag != 0); 173 ASSERT(kSymbolTag != 0);
168 ASSERT(kNotStringTag + kIsSymbolMask > LAST_TYPE); 174 ASSERT(kNotStringTag + kIsSymbolMask > LAST_TYPE);
169 return (type & kIsSymbolMask) != 0; 175 return (type & kIsSymbolMask) != 0;
170 } 176 }
(...skipping 2579 matching lines...) Expand 10 before | Expand all | Expand 10 after
2750 int Code::arguments_count() { 2756 int Code::arguments_count() {
2751 ASSERT(is_call_stub() || is_keyed_call_stub() || kind() == STUB); 2757 ASSERT(is_call_stub() || is_keyed_call_stub() || kind() == STUB);
2752 return ExtractArgumentsCountFromFlags(flags()); 2758 return ExtractArgumentsCountFromFlags(flags());
2753 } 2759 }
2754 2760
2755 2761
2756 int Code::major_key() { 2762 int Code::major_key() {
2757 ASSERT(kind() == STUB || 2763 ASSERT(kind() == STUB ||
2758 kind() == UNARY_OP_IC || 2764 kind() == UNARY_OP_IC ||
2759 kind() == BINARY_OP_IC || 2765 kind() == BINARY_OP_IC ||
2760 kind() == COMPARE_IC); 2766 kind() == COMPARE_IC ||
2767 kind() == TO_BOOLEAN_IC);
2761 return READ_BYTE_FIELD(this, kStubMajorKeyOffset); 2768 return READ_BYTE_FIELD(this, kStubMajorKeyOffset);
2762 } 2769 }
2763 2770
2764 2771
2765 void Code::set_major_key(int major) { 2772 void Code::set_major_key(int major) {
2766 ASSERT(kind() == STUB || 2773 ASSERT(kind() == STUB ||
2767 kind() == UNARY_OP_IC || 2774 kind() == UNARY_OP_IC ||
2768 kind() == BINARY_OP_IC || 2775 kind() == BINARY_OP_IC ||
2769 kind() == COMPARE_IC); 2776 kind() == COMPARE_IC ||
2777 kind() == TO_BOOLEAN_IC);
2770 ASSERT(0 <= major && major < 256); 2778 ASSERT(0 <= major && major < 256);
2771 WRITE_BYTE_FIELD(this, kStubMajorKeyOffset, major); 2779 WRITE_BYTE_FIELD(this, kStubMajorKeyOffset, major);
2772 } 2780 }
2773 2781
2774 2782
2775 bool Code::optimizable() { 2783 bool Code::optimizable() {
2776 ASSERT(kind() == FUNCTION); 2784 ASSERT(kind() == FUNCTION);
2777 return READ_BYTE_FIELD(this, kOptimizableOffset) == 1; 2785 return READ_BYTE_FIELD(this, kOptimizableOffset) == 1;
2778 } 2786 }
2779 2787
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after
2901 return READ_BYTE_FIELD(this, kCompareStateOffset); 2909 return READ_BYTE_FIELD(this, kCompareStateOffset);
2902 } 2910 }
2903 2911
2904 2912
2905 void Code::set_compare_state(byte value) { 2913 void Code::set_compare_state(byte value) {
2906 ASSERT(is_compare_ic_stub()); 2914 ASSERT(is_compare_ic_stub());
2907 WRITE_BYTE_FIELD(this, kCompareStateOffset, value); 2915 WRITE_BYTE_FIELD(this, kCompareStateOffset, value);
2908 } 2916 }
2909 2917
2910 2918
2919 byte Code::to_boolean_state() {
2920 ASSERT(is_to_boolean_ic_stub());
2921 return READ_BYTE_FIELD(this, kToBooleanTypeOffset);
2922 }
2923
2924
2925 void Code::set_to_boolean_state(byte value) {
2926 ASSERT(is_to_boolean_ic_stub());
2927 WRITE_BYTE_FIELD(this, kToBooleanTypeOffset, value);
2928 }
2929
2911 bool Code::is_inline_cache_stub() { 2930 bool Code::is_inline_cache_stub() {
2912 Kind kind = this->kind(); 2931 Kind kind = this->kind();
2913 return kind >= FIRST_IC_KIND && kind <= LAST_IC_KIND; 2932 return kind >= FIRST_IC_KIND && kind <= LAST_IC_KIND;
2914 } 2933 }
2915 2934
2916 2935
2917 Code::Flags Code::ComputeFlags(Kind kind, 2936 Code::Flags Code::ComputeFlags(Kind kind,
2918 InLoopFlag in_loop, 2937 InLoopFlag in_loop,
2919 InlineCacheState ic_state, 2938 InlineCacheState ic_state,
2920 ExtraICState extra_ic_state, 2939 ExtraICState extra_ic_state,
(...skipping 1560 matching lines...) Expand 10 before | Expand all | Expand 10 after
4481 #undef WRITE_INT_FIELD 4500 #undef WRITE_INT_FIELD
4482 #undef READ_SHORT_FIELD 4501 #undef READ_SHORT_FIELD
4483 #undef WRITE_SHORT_FIELD 4502 #undef WRITE_SHORT_FIELD
4484 #undef READ_BYTE_FIELD 4503 #undef READ_BYTE_FIELD
4485 #undef WRITE_BYTE_FIELD 4504 #undef WRITE_BYTE_FIELD
4486 4505
4487 4506
4488 } } // namespace v8::internal 4507 } } // namespace v8::internal
4489 4508
4490 #endif // V8_OBJECTS_INL_H_ 4509 #endif // V8_OBJECTS_INL_H_
OLDNEW
« src/ia32/code-stubs-ia32.cc ('K') | « src/objects.cc ('k') | src/spaces.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698