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

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

Issue 7618040: Version 3.5.5. (Closed) Base URL: http://v8.googlecode.com/svn/trunk/
Patch Set: 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.cc ('k') | src/parser.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 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 534 matching lines...) Expand 10 before | Expand all | Expand 10 after
545 } 545 }
546 546
547 547
548 bool Object::IsContext() { 548 bool Object::IsContext() {
549 if (Object::IsHeapObject()) { 549 if (Object::IsHeapObject()) {
550 Map* map = HeapObject::cast(this)->map(); 550 Map* map = HeapObject::cast(this)->map();
551 Heap* heap = map->GetHeap(); 551 Heap* heap = map->GetHeap();
552 return (map == heap->function_context_map() || 552 return (map == heap->function_context_map() ||
553 map == heap->catch_context_map() || 553 map == heap->catch_context_map() ||
554 map == heap->with_context_map() || 554 map == heap->with_context_map() ||
555 map == heap->global_context_map()); 555 map == heap->global_context_map() ||
556 map == heap->block_context_map());
556 } 557 }
557 return false; 558 return false;
558 } 559 }
559 560
560 561
561 bool Object::IsGlobalContext() { 562 bool Object::IsGlobalContext() {
562 return Object::IsHeapObject() && 563 return Object::IsHeapObject() &&
563 HeapObject::cast(this)->map() == 564 HeapObject::cast(this)->map() ==
564 HeapObject::cast(this)->GetHeap()->global_context_map(); 565 HeapObject::cast(this)->GetHeap()->global_context_map();
565 } 566 }
566 567
567 568
569 bool Object::IsSerializedScopeInfo() {
570 return Object::IsHeapObject() &&
571 HeapObject::cast(this)->map() ==
572 HeapObject::cast(this)->GetHeap()->serialized_scope_info_map();
573 }
574
575
568 bool Object::IsJSFunction() { 576 bool Object::IsJSFunction() {
569 return Object::IsHeapObject() 577 return Object::IsHeapObject()
570 && HeapObject::cast(this)->map()->instance_type() == JS_FUNCTION_TYPE; 578 && HeapObject::cast(this)->map()->instance_type() == JS_FUNCTION_TYPE;
571 } 579 }
572 580
573 581
574 template <> inline bool Is<JSFunction>(Object* obj) { 582 template <> inline bool Is<JSFunction>(Object* obj) {
575 return obj->IsJSFunction(); 583 return obj->IsJSFunction();
576 } 584 }
577 585
(...skipping 750 matching lines...) Expand 10 before | Expand all | Expand 10 after
1328 1336
1329 1337
1330 int HeapNumber::get_sign() { 1338 int HeapNumber::get_sign() {
1331 return READ_INT_FIELD(this, kExponentOffset) & kSignMask; 1339 return READ_INT_FIELD(this, kExponentOffset) & kSignMask;
1332 } 1340 }
1333 1341
1334 1342
1335 ACCESSORS(JSObject, properties, FixedArray, kPropertiesOffset) 1343 ACCESSORS(JSObject, properties, FixedArray, kPropertiesOffset)
1336 1344
1337 1345
1338 HeapObject* JSObject::elements() { 1346 FixedArrayBase* JSObject::elements() {
1339 Object* array = READ_FIELD(this, kElementsOffset); 1347 Object* array = READ_FIELD(this, kElementsOffset);
1340 ASSERT(array->HasValidElements()); 1348 ASSERT(array->HasValidElements());
1341 return reinterpret_cast<HeapObject*>(array); 1349 return static_cast<FixedArrayBase*>(array);
1342 } 1350 }
1343 1351
1344 1352
1345 void JSObject::set_elements(HeapObject* value, WriteBarrierMode mode) { 1353 void JSObject::set_elements(FixedArrayBase* value, WriteBarrierMode mode) {
1346 ASSERT(map()->has_fast_elements() == 1354 ASSERT(map()->has_fast_elements() ==
1347 (value->map() == GetHeap()->fixed_array_map() || 1355 (value->map() == GetHeap()->fixed_array_map() ||
1348 value->map() == GetHeap()->fixed_cow_array_map())); 1356 value->map() == GetHeap()->fixed_cow_array_map()));
1349 ASSERT(map()->has_fast_double_elements() == 1357 ASSERT(map()->has_fast_double_elements() ==
1350 value->IsFixedDoubleArray()); 1358 value->IsFixedDoubleArray());
1351 ASSERT(value->HasValidElements()); 1359 ASSERT(value->HasValidElements());
1352 WRITE_FIELD(this, kElementsOffset, value); 1360 WRITE_FIELD(this, kElementsOffset, value);
1353 CONDITIONAL_WRITE_BARRIER(GetHeap(), this, kElementsOffset, mode); 1361 CONDITIONAL_WRITE_BARRIER(GetHeap(), this, kElementsOffset, mode);
1354 } 1362 }
1355 1363
(...skipping 751 matching lines...) Expand 10 before | Expand all | Expand 10 after
2107 2115
2108 2116
2109 template <typename Shape, typename Key> 2117 template <typename Shape, typename Key>
2110 HashTable<Shape, Key>* HashTable<Shape, Key>::cast(Object* obj) { 2118 HashTable<Shape, Key>* HashTable<Shape, Key>::cast(Object* obj) {
2111 ASSERT(obj->IsHashTable()); 2119 ASSERT(obj->IsHashTable());
2112 return reinterpret_cast<HashTable*>(obj); 2120 return reinterpret_cast<HashTable*>(obj);
2113 } 2121 }
2114 2122
2115 2123
2116 SMI_ACCESSORS(FixedArrayBase, length, kLengthOffset) 2124 SMI_ACCESSORS(FixedArrayBase, length, kLengthOffset)
2117 SMI_ACCESSORS(ByteArray, length, kLengthOffset)
2118
2119 // TODO(1493): Investigate if it's possible to s/INT/SMI/ here (and
2120 // subsequently unify H{Fixed,External}ArrayLength).
2121 INT_ACCESSORS(ExternalArray, length, kLengthOffset)
2122
2123 2125
2124 SMI_ACCESSORS(String, length, kLengthOffset) 2126 SMI_ACCESSORS(String, length, kLengthOffset)
2125 2127
2126 2128
2127 uint32_t String::hash_field() { 2129 uint32_t String::hash_field() {
2128 return READ_UINT32_FIELD(this, kHashFieldOffset); 2130 return READ_UINT32_FIELD(this, kHashFieldOffset);
2129 } 2131 }
2130 2132
2131 2133
2132 void String::set_hash_field(uint32_t value) { 2134 void String::set_hash_field(uint32_t value) {
(...skipping 2473 matching lines...) Expand 10 before | Expand all | Expand 10 after
4606 #undef WRITE_INT_FIELD 4608 #undef WRITE_INT_FIELD
4607 #undef READ_SHORT_FIELD 4609 #undef READ_SHORT_FIELD
4608 #undef WRITE_SHORT_FIELD 4610 #undef WRITE_SHORT_FIELD
4609 #undef READ_BYTE_FIELD 4611 #undef READ_BYTE_FIELD
4610 #undef WRITE_BYTE_FIELD 4612 #undef WRITE_BYTE_FIELD
4611 4613
4612 4614
4613 } } // namespace v8::internal 4615 } } // namespace v8::internal
4614 4616
4615 #endif // V8_OBJECTS_INL_H_ 4617 #endif // V8_OBJECTS_INL_H_
OLDNEW
« no previous file with comments | « src/objects.cc ('k') | src/parser.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698