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

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

Issue 7366: Split window support from V8. ... (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: '' Created 12 years, 2 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-debug.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 2006-2008 the V8 project authors. All rights reserved. 1 // Copyright 2006-2008 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 341 matching lines...) Expand 10 before | Expand all | Expand 10 after
352 bool Object::IsMapCache() { 352 bool Object::IsMapCache() {
353 return IsHashTable(); 353 return IsHashTable();
354 } 354 }
355 355
356 356
357 bool Object::IsPrimitive() { 357 bool Object::IsPrimitive() {
358 return IsOddball() || IsNumber() || IsString(); 358 return IsOddball() || IsNumber() || IsString();
359 } 359 }
360 360
361 361
362 bool Object::IsJSGlobalProxy() {
363 bool result = IsHeapObject() &&
364 (HeapObject::cast(this)->map()->instance_type() ==
365 JS_GLOBAL_PROXY_TYPE);
366 ASSERT(!result || IsAccessCheckNeeded());
367 return result;
368 }
369
370
362 bool Object::IsGlobalObject() { 371 bool Object::IsGlobalObject() {
363 return IsHeapObject() && 372 if (!IsHeapObject()) return false;
364 ((HeapObject::cast(this)->map()->instance_type() == 373
365 JS_GLOBAL_OBJECT_TYPE) || 374 InstanceType type = HeapObject::cast(this)->map()->instance_type();
366 (HeapObject::cast(this)->map()->instance_type() == 375 return type == JS_GLOBAL_OBJECT_TYPE ||
367 JS_BUILTINS_OBJECT_TYPE)); 376 type == JS_BUILTINS_OBJECT_TYPE;
368 } 377 }
369 378
370 379
371 bool Object::IsJSGlobalObject() { 380 bool Object::IsJSGlobalObject() {
372 #ifdef DEBUG
373 if (IsHeapObject() &&
374 (HeapObject::cast(this)->map()->instance_type() ==
375 JS_GLOBAL_OBJECT_TYPE)) {
376 ASSERT(IsAccessCheckNeeded());
377 }
378 #endif
379 return IsHeapObject() && 381 return IsHeapObject() &&
380 (HeapObject::cast(this)->map()->instance_type() == 382 (HeapObject::cast(this)->map()->instance_type() ==
381 JS_GLOBAL_OBJECT_TYPE); 383 JS_GLOBAL_OBJECT_TYPE);
382 } 384 }
383 385
384 386
385 bool Object::IsJSBuiltinsObject() { 387 bool Object::IsJSBuiltinsObject() {
386 return IsHeapObject() && 388 return IsHeapObject() &&
387 (HeapObject::cast(this)->map()->instance_type() == 389 (HeapObject::cast(this)->map()->instance_type() ==
388 JS_BUILTINS_OBJECT_TYPE); 390 JS_BUILTINS_OBJECT_TYPE);
389 } 391 }
390 392
391 393
392 bool Object::IsUndetectableObject() { 394 bool Object::IsUndetectableObject() {
393 return IsHeapObject() 395 return IsHeapObject()
394 && HeapObject::cast(this)->map()->is_undetectable(); 396 && HeapObject::cast(this)->map()->is_undetectable();
395 } 397 }
396 398
397 399
398 bool Object::IsAccessCheckNeeded() { 400 bool Object::IsAccessCheckNeeded() {
399 return IsHeapObject() 401 return IsHeapObject()
400 && HeapObject::cast(this)->map()->needs_access_check(); 402 && HeapObject::cast(this)->map()->is_access_check_needed();
401 } 403 }
402 404
403 405
404 bool Object::IsStruct() { 406 bool Object::IsStruct() {
405 if (!IsHeapObject()) return false; 407 if (!IsHeapObject()) return false;
406 switch (HeapObject::cast(this)->map()->instance_type()) { 408 switch (HeapObject::cast(this)->map()->instance_type()) {
407 #define MAKE_STRUCT_CASE(NAME, Name, name) case NAME##_TYPE: return true; 409 #define MAKE_STRUCT_CASE(NAME, Name, name) case NAME##_TYPE: return true;
408 STRUCT_LIST(MAKE_STRUCT_CASE) 410 STRUCT_LIST(MAKE_STRUCT_CASE)
409 #undef MAKE_STRUCT_CASE 411 #undef MAKE_STRUCT_CASE
410 default: return false; 412 default: return false;
(...skipping 438 matching lines...) Expand 10 before | Expand all | Expand 10 after
849 return READ_DOUBLE_FIELD(this, kValueOffset); 851 return READ_DOUBLE_FIELD(this, kValueOffset);
850 } 852 }
851 853
852 854
853 void HeapNumber::set_value(double value) { 855 void HeapNumber::set_value(double value) {
854 WRITE_DOUBLE_FIELD(this, kValueOffset, value); 856 WRITE_DOUBLE_FIELD(this, kValueOffset, value);
855 } 857 }
856 858
857 859
858 ACCESSORS(JSObject, properties, FixedArray, kPropertiesOffset) 860 ACCESSORS(JSObject, properties, FixedArray, kPropertiesOffset)
859 ACCESSORS(JSObject, elements, HeapObject, kElementsOffset) 861 ACCESSORS(JSObject, elements, FixedArray, kElementsOffset)
860 862
861 863
862 void JSObject::initialize_properties() { 864 void JSObject::initialize_properties() {
863 ASSERT(!Heap::InNewSpace(Heap::empty_fixed_array())); 865 ASSERT(!Heap::InNewSpace(Heap::empty_fixed_array()));
864 WRITE_FIELD(this, kPropertiesOffset, Heap::empty_fixed_array()); 866 WRITE_FIELD(this, kPropertiesOffset, Heap::empty_fixed_array());
865 } 867 }
866 868
867 869
868 void JSObject::initialize_elements() { 870 void JSObject::initialize_elements() {
869 ASSERT(!Heap::InNewSpace(Heap::empty_fixed_array())); 871 ASSERT(!Heap::InNewSpace(Heap::empty_fixed_array()));
870 WRITE_FIELD(this, kElementsOffset, Heap::empty_fixed_array()); 872 WRITE_FIELD(this, kElementsOffset, Heap::empty_fixed_array());
871 } 873 }
872 874
873 875
874 ACCESSORS(Oddball, to_string, String, kToStringOffset) 876 ACCESSORS(Oddball, to_string, String, kToStringOffset)
875 ACCESSORS(Oddball, to_number, Object, kToNumberOffset) 877 ACCESSORS(Oddball, to_number, Object, kToNumberOffset)
876 878
877 879
878 int JSObject::GetHeaderSize() { 880 int JSObject::GetHeaderSize() {
879 switch (map()->instance_type()) { 881 switch (map()->instance_type()) {
882 case JS_GLOBAL_PROXY_TYPE:
883 return JSGlobalProxy::kSize;
880 case JS_GLOBAL_OBJECT_TYPE: 884 case JS_GLOBAL_OBJECT_TYPE:
881 return JSGlobalObject::kSize; 885 return JSGlobalObject::kSize;
882 case JS_BUILTINS_OBJECT_TYPE: 886 case JS_BUILTINS_OBJECT_TYPE:
883 return JSBuiltinsObject::kSize; 887 return JSBuiltinsObject::kSize;
884 case JS_FUNCTION_TYPE: 888 case JS_FUNCTION_TYPE:
885 return JSFunction::kSize; 889 return JSFunction::kSize;
886 case JS_VALUE_TYPE: 890 case JS_VALUE_TYPE:
887 return JSValue::kSize; 891 return JSValue::kSize;
888 case JS_ARRAY_TYPE: 892 case JS_ARRAY_TYPE:
889 return JSValue::kSize; 893 return JSValue::kSize;
(...skipping 305 matching lines...) Expand 10 before | Expand all | Expand 10 after
1195 CAST_ACCESSOR(ExternalTwoByteString) 1199 CAST_ACCESSOR(ExternalTwoByteString)
1196 CAST_ACCESSOR(JSObject) 1200 CAST_ACCESSOR(JSObject)
1197 CAST_ACCESSOR(Smi) 1201 CAST_ACCESSOR(Smi)
1198 CAST_ACCESSOR(Failure) 1202 CAST_ACCESSOR(Failure)
1199 CAST_ACCESSOR(HeapObject) 1203 CAST_ACCESSOR(HeapObject)
1200 CAST_ACCESSOR(HeapNumber) 1204 CAST_ACCESSOR(HeapNumber)
1201 CAST_ACCESSOR(Oddball) 1205 CAST_ACCESSOR(Oddball)
1202 CAST_ACCESSOR(SharedFunctionInfo) 1206 CAST_ACCESSOR(SharedFunctionInfo)
1203 CAST_ACCESSOR(Map) 1207 CAST_ACCESSOR(Map)
1204 CAST_ACCESSOR(JSFunction) 1208 CAST_ACCESSOR(JSFunction)
1209 CAST_ACCESSOR(JSGlobalProxy)
1205 CAST_ACCESSOR(JSGlobalObject) 1210 CAST_ACCESSOR(JSGlobalObject)
1206 CAST_ACCESSOR(JSBuiltinsObject) 1211 CAST_ACCESSOR(JSBuiltinsObject)
1207 CAST_ACCESSOR(Code) 1212 CAST_ACCESSOR(Code)
1208 CAST_ACCESSOR(JSArray) 1213 CAST_ACCESSOR(JSArray)
1209 CAST_ACCESSOR(JSRegExp) 1214 CAST_ACCESSOR(JSRegExp)
1210 CAST_ACCESSOR(Proxy) 1215 CAST_ACCESSOR(Proxy)
1211 CAST_ACCESSOR(ByteArray) 1216 CAST_ACCESSOR(ByteArray)
1212 CAST_ACCESSOR(Struct) 1217 CAST_ACCESSOR(Struct)
1213 1218
1214 1219
(...skipping 574 matching lines...) Expand 10 before | Expand all | Expand 10 after
1789 ACCESSORS(Map, instance_descriptors, DescriptorArray, 1794 ACCESSORS(Map, instance_descriptors, DescriptorArray,
1790 kInstanceDescriptorsOffset) 1795 kInstanceDescriptorsOffset)
1791 ACCESSORS(Map, code_cache, FixedArray, kCodeCacheOffset) 1796 ACCESSORS(Map, code_cache, FixedArray, kCodeCacheOffset)
1792 ACCESSORS(Map, constructor, Object, kConstructorOffset) 1797 ACCESSORS(Map, constructor, Object, kConstructorOffset)
1793 1798
1794 ACCESSORS(JSFunction, shared, SharedFunctionInfo, kSharedFunctionInfoOffset) 1799 ACCESSORS(JSFunction, shared, SharedFunctionInfo, kSharedFunctionInfoOffset)
1795 ACCESSORS(JSFunction, literals, FixedArray, kLiteralsOffset) 1800 ACCESSORS(JSFunction, literals, FixedArray, kLiteralsOffset)
1796 1801
1797 ACCESSORS(GlobalObject, builtins, JSBuiltinsObject, kBuiltinsOffset) 1802 ACCESSORS(GlobalObject, builtins, JSBuiltinsObject, kBuiltinsOffset)
1798 ACCESSORS(GlobalObject, global_context, Context, kGlobalContextOffset) 1803 ACCESSORS(GlobalObject, global_context, Context, kGlobalContextOffset)
1804 ACCESSORS(GlobalObject, global_receiver, JSObject, kGlobalReceiverOffset)
1799 1805
1800 ACCESSORS(JSGlobalObject, security_token, Object, kSecurityTokenOffset) 1806 ACCESSORS(JSGlobalProxy, context, Object, kContextOffset)
1801 1807
1802 ACCESSORS(AccessorInfo, getter, Object, kGetterOffset) 1808 ACCESSORS(AccessorInfo, getter, Object, kGetterOffset)
1803 ACCESSORS(AccessorInfo, setter, Object, kSetterOffset) 1809 ACCESSORS(AccessorInfo, setter, Object, kSetterOffset)
1804 ACCESSORS(AccessorInfo, data, Object, kDataOffset) 1810 ACCESSORS(AccessorInfo, data, Object, kDataOffset)
1805 ACCESSORS(AccessorInfo, name, Object, kNameOffset) 1811 ACCESSORS(AccessorInfo, name, Object, kNameOffset)
1806 ACCESSORS(AccessorInfo, flag, Smi, kFlagOffset) 1812 ACCESSORS(AccessorInfo, flag, Smi, kFlagOffset)
1807 1813
1808 ACCESSORS(AccessCheckInfo, named_callback, Object, kNamedCallbackOffset) 1814 ACCESSORS(AccessCheckInfo, named_callback, Object, kNamedCallbackOffset)
1809 ACCESSORS(AccessCheckInfo, indexed_callback, Object, kIndexedCallbackOffset) 1815 ACCESSORS(AccessCheckInfo, indexed_callback, Object, kIndexedCallbackOffset)
1810 ACCESSORS(AccessCheckInfo, data, Object, kDataOffset) 1816 ACCESSORS(AccessCheckInfo, data, Object, kDataOffset)
(...skipping 517 matching lines...) Expand 10 before | Expand all | Expand 10 after
2328 #undef WRITE_INT_FIELD 2334 #undef WRITE_INT_FIELD
2329 #undef READ_SHORT_FIELD 2335 #undef READ_SHORT_FIELD
2330 #undef WRITE_SHORT_FIELD 2336 #undef WRITE_SHORT_FIELD
2331 #undef READ_BYTE_FIELD 2337 #undef READ_BYTE_FIELD
2332 #undef WRITE_BYTE_FIELD 2338 #undef WRITE_BYTE_FIELD
2333 2339
2334 2340
2335 } } // namespace v8::internal 2341 } } // namespace v8::internal
2336 2342
2337 #endif // V8_OBJECTS_INL_H_ 2343 #endif // V8_OBJECTS_INL_H_
OLDNEW
« no previous file with comments | « src/objects-debug.cc ('k') | src/runtime.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698