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

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

Issue 12296026: ES6 symbols: Implement Symbol intrinsic and basic functionality (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Addressed more comments Created 7 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/objects.cc ('k') | src/runtime.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 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 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 163 matching lines...) Expand 10 before | Expand all | Expand 10 after
174 bool Object::NonFailureIsHeapObject() { 174 bool Object::NonFailureIsHeapObject() {
175 ASSERT(!this->IsFailure()); 175 ASSERT(!this->IsFailure());
176 return (reinterpret_cast<intptr_t>(this) & kSmiTagMask) != 0; 176 return (reinterpret_cast<intptr_t>(this) & kSmiTagMask) != 0;
177 } 177 }
178 178
179 179
180 TYPE_CHECKER(HeapNumber, HEAP_NUMBER_TYPE) 180 TYPE_CHECKER(HeapNumber, HEAP_NUMBER_TYPE)
181 TYPE_CHECKER(Symbol, SYMBOL_TYPE) 181 TYPE_CHECKER(Symbol, SYMBOL_TYPE)
182 182
183 183
184 bool Object::IsName() {
185 return Object::IsHeapObject()
186 && HeapObject::cast(this)->map()->instance_type() <= LAST_NAME_TYPE;
187 }
188
189
190 bool Object::IsString() { 184 bool Object::IsString() {
191 return Object::IsHeapObject() 185 return Object::IsHeapObject()
192 && HeapObject::cast(this)->map()->instance_type() < FIRST_NONSTRING_TYPE; 186 && HeapObject::cast(this)->map()->instance_type() < FIRST_NONSTRING_TYPE;
193 } 187 }
194 188
195 189
190 bool Object::IsName() {
191 return IsString() || IsSymbol();
192 }
193
194
195 bool Object::IsUniqueName() {
196 return IsInternalizedString() || IsSymbol();
197 }
198
199
196 bool Object::IsSpecObject() { 200 bool Object::IsSpecObject() {
197 return Object::IsHeapObject() 201 return Object::IsHeapObject()
198 && HeapObject::cast(this)->map()->instance_type() >= FIRST_SPEC_OBJECT_TYPE; 202 && HeapObject::cast(this)->map()->instance_type() >= FIRST_SPEC_OBJECT_TYPE;
199 } 203 }
200 204
201 205
202 bool Object::IsSpecFunction() { 206 bool Object::IsSpecFunction() {
203 if (!Object::IsHeapObject()) return false; 207 if (!Object::IsHeapObject()) return false;
204 InstanceType type = HeapObject::cast(this)->map()->instance_type(); 208 InstanceType type = HeapObject::cast(this)->map()->instance_type();
205 return type == JS_FUNCTION_TYPE || type == JS_FUNCTION_PROXY_TYPE; 209 return type == JS_FUNCTION_TYPE || type == JS_FUNCTION_PROXY_TYPE;
(...skipping 2211 matching lines...) Expand 10 before | Expand all | Expand 10 after
2417 CAST_ACCESSOR(ConsString) 2421 CAST_ACCESSOR(ConsString)
2418 CAST_ACCESSOR(ExternalString) 2422 CAST_ACCESSOR(ExternalString)
2419 CAST_ACCESSOR(ExternalAsciiString) 2423 CAST_ACCESSOR(ExternalAsciiString)
2420 CAST_ACCESSOR(ExternalTwoByteString) 2424 CAST_ACCESSOR(ExternalTwoByteString)
2421 CAST_ACCESSOR(Symbol) 2425 CAST_ACCESSOR(Symbol)
2422 CAST_ACCESSOR(JSReceiver) 2426 CAST_ACCESSOR(JSReceiver)
2423 CAST_ACCESSOR(JSObject) 2427 CAST_ACCESSOR(JSObject)
2424 CAST_ACCESSOR(Smi) 2428 CAST_ACCESSOR(Smi)
2425 CAST_ACCESSOR(HeapObject) 2429 CAST_ACCESSOR(HeapObject)
2426 CAST_ACCESSOR(HeapNumber) 2430 CAST_ACCESSOR(HeapNumber)
2431 CAST_ACCESSOR(Name)
2427 CAST_ACCESSOR(Oddball) 2432 CAST_ACCESSOR(Oddball)
2428 CAST_ACCESSOR(JSGlobalPropertyCell) 2433 CAST_ACCESSOR(JSGlobalPropertyCell)
2429 CAST_ACCESSOR(SharedFunctionInfo) 2434 CAST_ACCESSOR(SharedFunctionInfo)
2430 CAST_ACCESSOR(Map) 2435 CAST_ACCESSOR(Map)
2431 CAST_ACCESSOR(JSFunction) 2436 CAST_ACCESSOR(JSFunction)
2432 CAST_ACCESSOR(GlobalObject) 2437 CAST_ACCESSOR(GlobalObject)
2433 CAST_ACCESSOR(JSGlobalProxy) 2438 CAST_ACCESSOR(JSGlobalProxy)
2434 CAST_ACCESSOR(JSGlobalObject) 2439 CAST_ACCESSOR(JSGlobalObject)
2435 CAST_ACCESSOR(JSBuiltinsObject) 2440 CAST_ACCESSOR(JSBuiltinsObject)
2436 CAST_ACCESSOR(Code) 2441 CAST_ACCESSOR(Code)
(...skipping 3463 matching lines...) Expand 10 before | Expand all | Expand 10 after
5900 #undef WRITE_UINT32_FIELD 5905 #undef WRITE_UINT32_FIELD
5901 #undef READ_SHORT_FIELD 5906 #undef READ_SHORT_FIELD
5902 #undef WRITE_SHORT_FIELD 5907 #undef WRITE_SHORT_FIELD
5903 #undef READ_BYTE_FIELD 5908 #undef READ_BYTE_FIELD
5904 #undef WRITE_BYTE_FIELD 5909 #undef WRITE_BYTE_FIELD
5905 5910
5906 5911
5907 } } // namespace v8::internal 5912 } } // namespace v8::internal
5908 5913
5909 #endif // V8_OBJECTS_INL_H_ 5914 #endif // V8_OBJECTS_INL_H_
OLDNEW
« no previous file with comments | « src/objects.cc ('k') | src/runtime.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698