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

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

Issue 7529007: Preliminary Harmony weak maps API implementation. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Make sure the constructor can be called directly. Created 9 years, 4 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/objects-printer.cc » ('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 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 462 matching lines...) Expand 10 before | Expand all | Expand 10 after
473 HeapObject::cast(this)->map()->instance_type() == JS_FUNCTION_PROXY_TYPE); 473 HeapObject::cast(this)->map()->instance_type() == JS_FUNCTION_PROXY_TYPE);
474 } 474 }
475 475
476 476
477 bool Object::IsJSFunctionProxy() { 477 bool Object::IsJSFunctionProxy() {
478 return Object::IsHeapObject() && 478 return Object::IsHeapObject() &&
479 HeapObject::cast(this)->map()->instance_type() == JS_FUNCTION_PROXY_TYPE; 479 HeapObject::cast(this)->map()->instance_type() == JS_FUNCTION_PROXY_TYPE;
480 } 480 }
481 481
482 482
483 bool Object::IsJSWeakMap() {
484 return Object::IsJSObject() &&
485 HeapObject::cast(this)->map()->instance_type() == JS_WEAK_MAP_TYPE;
486 }
487
488
483 bool Object::IsJSContextExtensionObject() { 489 bool Object::IsJSContextExtensionObject() {
484 return IsHeapObject() 490 return IsHeapObject()
485 && (HeapObject::cast(this)->map()->instance_type() == 491 && (HeapObject::cast(this)->map()->instance_type() ==
486 JS_CONTEXT_EXTENSION_OBJECT_TYPE); 492 JS_CONTEXT_EXTENSION_OBJECT_TYPE);
487 } 493 }
488 494
489 495
490 bool Object::IsMap() { 496 bool Object::IsMap() {
491 return Object::IsHeapObject() 497 return Object::IsHeapObject()
492 && HeapObject::cast(this)->map()->instance_type() == MAP_TYPE; 498 && HeapObject::cast(this)->map()->instance_type() == MAP_TYPE;
(...skipping 914 matching lines...) Expand 10 before | Expand all | Expand 10 after
1407 case JS_GLOBAL_OBJECT_TYPE: 1413 case JS_GLOBAL_OBJECT_TYPE:
1408 return JSGlobalObject::kSize; 1414 return JSGlobalObject::kSize;
1409 case JS_BUILTINS_OBJECT_TYPE: 1415 case JS_BUILTINS_OBJECT_TYPE:
1410 return JSBuiltinsObject::kSize; 1416 return JSBuiltinsObject::kSize;
1411 case JS_FUNCTION_TYPE: 1417 case JS_FUNCTION_TYPE:
1412 return JSFunction::kSize; 1418 return JSFunction::kSize;
1413 case JS_VALUE_TYPE: 1419 case JS_VALUE_TYPE:
1414 return JSValue::kSize; 1420 return JSValue::kSize;
1415 case JS_ARRAY_TYPE: 1421 case JS_ARRAY_TYPE:
1416 return JSValue::kSize; 1422 return JSValue::kSize;
1423 case JS_WEAK_MAP_TYPE:
1424 return JSWeakMap::kSize;
1417 case JS_REGEXP_TYPE: 1425 case JS_REGEXP_TYPE:
1418 return JSValue::kSize; 1426 return JSValue::kSize;
1419 case JS_CONTEXT_EXTENSION_OBJECT_TYPE: 1427 case JS_CONTEXT_EXTENSION_OBJECT_TYPE:
1420 return JSObject::kHeaderSize; 1428 return JSObject::kHeaderSize;
1421 case JS_MESSAGE_OBJECT_TYPE: 1429 case JS_MESSAGE_OBJECT_TYPE:
1422 return JSMessageObject::kSize; 1430 return JSMessageObject::kSize;
1423 default: 1431 default:
1424 UNREACHABLE(); 1432 UNREACHABLE();
1425 return 0; 1433 return 0;
1426 } 1434 }
(...skipping 630 matching lines...) Expand 10 before | Expand all | Expand 10 after
2057 CAST_ACCESSOR(JSFunction) 2065 CAST_ACCESSOR(JSFunction)
2058 CAST_ACCESSOR(GlobalObject) 2066 CAST_ACCESSOR(GlobalObject)
2059 CAST_ACCESSOR(JSGlobalProxy) 2067 CAST_ACCESSOR(JSGlobalProxy)
2060 CAST_ACCESSOR(JSGlobalObject) 2068 CAST_ACCESSOR(JSGlobalObject)
2061 CAST_ACCESSOR(JSBuiltinsObject) 2069 CAST_ACCESSOR(JSBuiltinsObject)
2062 CAST_ACCESSOR(Code) 2070 CAST_ACCESSOR(Code)
2063 CAST_ACCESSOR(JSArray) 2071 CAST_ACCESSOR(JSArray)
2064 CAST_ACCESSOR(JSRegExp) 2072 CAST_ACCESSOR(JSRegExp)
2065 CAST_ACCESSOR(JSProxy) 2073 CAST_ACCESSOR(JSProxy)
2066 CAST_ACCESSOR(JSFunctionProxy) 2074 CAST_ACCESSOR(JSFunctionProxy)
2075 CAST_ACCESSOR(JSWeakMap)
2067 CAST_ACCESSOR(Foreign) 2076 CAST_ACCESSOR(Foreign)
2068 CAST_ACCESSOR(ByteArray) 2077 CAST_ACCESSOR(ByteArray)
2069 CAST_ACCESSOR(ExternalArray) 2078 CAST_ACCESSOR(ExternalArray)
2070 CAST_ACCESSOR(ExternalByteArray) 2079 CAST_ACCESSOR(ExternalByteArray)
2071 CAST_ACCESSOR(ExternalUnsignedByteArray) 2080 CAST_ACCESSOR(ExternalUnsignedByteArray)
2072 CAST_ACCESSOR(ExternalShortArray) 2081 CAST_ACCESSOR(ExternalShortArray)
2073 CAST_ACCESSOR(ExternalUnsignedShortArray) 2082 CAST_ACCESSOR(ExternalUnsignedShortArray)
2074 CAST_ACCESSOR(ExternalIntArray) 2083 CAST_ACCESSOR(ExternalIntArray)
2075 CAST_ACCESSOR(ExternalUnsignedIntArray) 2084 CAST_ACCESSOR(ExternalUnsignedIntArray)
2076 CAST_ACCESSOR(ExternalFloatArray) 2085 CAST_ACCESSOR(ExternalFloatArray)
(...skipping 1710 matching lines...) Expand 10 before | Expand all | Expand 10 after
3787 ASSERT(id < kJSBuiltinsCount); // id is unsigned. 3796 ASSERT(id < kJSBuiltinsCount); // id is unsigned.
3788 WRITE_FIELD(this, OffsetOfCodeWithId(id), value); 3797 WRITE_FIELD(this, OffsetOfCodeWithId(id), value);
3789 ASSERT(!HEAP->InNewSpace(value)); 3798 ASSERT(!HEAP->InNewSpace(value));
3790 } 3799 }
3791 3800
3792 3801
3793 ACCESSORS(JSProxy, handler, Object, kHandlerOffset) 3802 ACCESSORS(JSProxy, handler, Object, kHandlerOffset)
3794 ACCESSORS(JSProxy, padding, Object, kPaddingOffset) 3803 ACCESSORS(JSProxy, padding, Object, kPaddingOffset)
3795 3804
3796 3805
3806 ACCESSORS(JSWeakMap, table, ObjectHashTable, kTableOffset)
3807
3808
3797 Address Foreign::address() { 3809 Address Foreign::address() {
3798 return AddressFrom<Address>(READ_INTPTR_FIELD(this, kAddressOffset)); 3810 return AddressFrom<Address>(READ_INTPTR_FIELD(this, kAddressOffset));
3799 } 3811 }
3800 3812
3801 3813
3802 void Foreign::set_address(Address value) { 3814 void Foreign::set_address(Address value) {
3803 WRITE_INTPTR_FIELD(this, kAddressOffset, OffsetFrom(value)); 3815 WRITE_INTPTR_FIELD(this, kAddressOffset, OffsetFrom(value));
3804 } 3816 }
3805 3817
3806 3818
(...skipping 734 matching lines...) Expand 10 before | Expand all | Expand 10 after
4541 #undef WRITE_INT_FIELD 4553 #undef WRITE_INT_FIELD
4542 #undef READ_SHORT_FIELD 4554 #undef READ_SHORT_FIELD
4543 #undef WRITE_SHORT_FIELD 4555 #undef WRITE_SHORT_FIELD
4544 #undef READ_BYTE_FIELD 4556 #undef READ_BYTE_FIELD
4545 #undef WRITE_BYTE_FIELD 4557 #undef WRITE_BYTE_FIELD
4546 4558
4547 4559
4548 } } // namespace v8::internal 4560 } } // namespace v8::internal
4549 4561
4550 #endif // V8_OBJECTS_INL_H_ 4562 #endif // V8_OBJECTS_INL_H_
OLDNEW
« no previous file with comments | « src/objects-debug.cc ('k') | src/objects-printer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698