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

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

Issue 14721009: Track computed literal properties. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Remove PLACEHOLDER_VALUE Created 7 years, 6 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/parser.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 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 274 matching lines...) Expand 10 before | Expand all | Expand 10 after
285 // Dictionary is covered under FixedArray. 285 // Dictionary is covered under FixedArray.
286 return IsFixedArray() || IsFixedDoubleArray() || IsExternalArray(); 286 return IsFixedArray() || IsFixedDoubleArray() || IsExternalArray();
287 } 287 }
288 288
289 289
290 MaybeObject* Object::AllocateNewStorageFor(Heap* heap, 290 MaybeObject* Object::AllocateNewStorageFor(Heap* heap,
291 Representation representation, 291 Representation representation,
292 PretenureFlag tenure) { 292 PretenureFlag tenure) {
293 if (!FLAG_track_double_fields) return this; 293 if (!FLAG_track_double_fields) return this;
294 if (!representation.IsDouble()) return this; 294 if (!representation.IsDouble()) return this;
295 if (IsUninitialized()) {
296 return heap->AllocateHeapNumber(0, tenure);
297 }
295 return heap->AllocateHeapNumber(Number(), tenure); 298 return heap->AllocateHeapNumber(Number(), tenure);
296 } 299 }
297 300
298 301
299 StringShape::StringShape(String* str) 302 StringShape::StringShape(String* str)
300 : type_(str->map()->instance_type()) { 303 : type_(str->map()->instance_type()) {
301 set_valid(); 304 set_valid();
302 ASSERT((type_ & kIsNotStringMask) == kStringTag); 305 ASSERT((type_ & kIsNotStringMask) == kStringTag);
303 } 306 }
304 307
(...skipping 218 matching lines...) Expand 10 before | Expand all | Expand 10 after
523 bool MaybeObject::IsException() { 526 bool MaybeObject::IsException() {
524 return this == Failure::Exception(); 527 return this == Failure::Exception();
525 } 528 }
526 529
527 530
528 bool MaybeObject::IsTheHole() { 531 bool MaybeObject::IsTheHole() {
529 return !IsFailure() && ToObjectUnchecked()->IsTheHole(); 532 return !IsFailure() && ToObjectUnchecked()->IsTheHole();
530 } 533 }
531 534
532 535
536 bool MaybeObject::IsUninitialized() {
537 return !IsFailure() && ToObjectUnchecked()->IsUninitialized();
538 }
539
540
533 Failure* Failure::cast(MaybeObject* obj) { 541 Failure* Failure::cast(MaybeObject* obj) {
534 ASSERT(HAS_FAILURE_TAG(obj)); 542 ASSERT(HAS_FAILURE_TAG(obj));
535 return reinterpret_cast<Failure*>(obj); 543 return reinterpret_cast<Failure*>(obj);
536 } 544 }
537 545
538 546
539 bool Object::IsJSReceiver() { 547 bool Object::IsJSReceiver() {
540 STATIC_ASSERT(LAST_JS_RECEIVER_TYPE == LAST_TYPE); 548 STATIC_ASSERT(LAST_JS_RECEIVER_TYPE == LAST_TYPE);
541 return IsHeapObject() && 549 return IsHeapObject() &&
542 HeapObject::cast(this)->map()->instance_type() >= FIRST_JS_RECEIVER_TYPE; 550 HeapObject::cast(this)->map()->instance_type() >= FIRST_JS_RECEIVER_TYPE;
(...skipping 295 matching lines...) Expand 10 before | Expand all | Expand 10 after
838 bool Object::IsNull() { 846 bool Object::IsNull() {
839 return IsOddball() && Oddball::cast(this)->kind() == Oddball::kNull; 847 return IsOddball() && Oddball::cast(this)->kind() == Oddball::kNull;
840 } 848 }
841 849
842 850
843 bool Object::IsTheHole() { 851 bool Object::IsTheHole() {
844 return IsOddball() && Oddball::cast(this)->kind() == Oddball::kTheHole; 852 return IsOddball() && Oddball::cast(this)->kind() == Oddball::kTheHole;
845 } 853 }
846 854
847 855
856 bool Object::IsUninitialized() {
857 return IsOddball() && Oddball::cast(this)->kind() == Oddball::kUninitialized;
858 }
859
860
848 bool Object::IsTrue() { 861 bool Object::IsTrue() {
849 return IsOddball() && Oddball::cast(this)->kind() == Oddball::kTrue; 862 return IsOddball() && Oddball::cast(this)->kind() == Oddball::kTrue;
850 } 863 }
851 864
852 865
853 bool Object::IsFalse() { 866 bool Object::IsFalse() {
854 return IsOddball() && Oddball::cast(this)->kind() == Oddball::kFalse; 867 return IsOddball() && Oddball::cast(this)->kind() == Oddball::kFalse;
855 } 868 }
856 869
857 870
(...skipping 676 matching lines...) Expand 10 before | Expand all | Expand 10 after
1534 } 1547 }
1535 set_map(map); 1548 set_map(map);
1536 return this; 1549 return this;
1537 } 1550 }
1538 1551
1539 1552
1540 MaybeObject* JSObject::MigrateInstance() { 1553 MaybeObject* JSObject::MigrateInstance() {
1541 // Converting any field to the most specific type will cause the 1554 // Converting any field to the most specific type will cause the
1542 // GeneralizeFieldRepresentation algorithm to create the most general existing 1555 // GeneralizeFieldRepresentation algorithm to create the most general existing
1543 // transition that matches the object. This achieves what is needed. 1556 // transition that matches the object. This achieves what is needed.
1544 return GeneralizeFieldRepresentation(0, Representation::Smi()); 1557 return GeneralizeFieldRepresentation(0, Representation::None());
1545 } 1558 }
1546 1559
1547 1560
1548 MaybeObject* JSObject::TryMigrateInstance() { 1561 MaybeObject* JSObject::TryMigrateInstance() {
1549 Map* new_map = map()->CurrentMapForDeprecated(); 1562 Map* new_map = map()->CurrentMapForDeprecated();
1550 if (new_map == NULL) return Smi::FromInt(0); 1563 if (new_map == NULL) return Smi::FromInt(0);
1551 return MigrateToMap(new_map); 1564 return MigrateToMap(new_map);
1552 } 1565 }
1553 1566
1554 1567
(...skipping 804 matching lines...) Expand 10 before | Expand all | Expand 10 after
2359 GetDetails(descriptor_number)); 2372 GetDetails(descriptor_number));
2360 } 2373 }
2361 2374
2362 2375
2363 void DescriptorArray::Set(int descriptor_number, 2376 void DescriptorArray::Set(int descriptor_number,
2364 Descriptor* desc, 2377 Descriptor* desc,
2365 const WhitenessWitness&) { 2378 const WhitenessWitness&) {
2366 // Range check. 2379 // Range check.
2367 ASSERT(descriptor_number < number_of_descriptors()); 2380 ASSERT(descriptor_number < number_of_descriptors());
2368 2381
2369 ASSERT(!desc->GetDetails().representation().IsNone());
2370 NoIncrementalWriteBarrierSet(this, 2382 NoIncrementalWriteBarrierSet(this,
2371 ToKeyIndex(descriptor_number), 2383 ToKeyIndex(descriptor_number),
2372 desc->GetKey()); 2384 desc->GetKey());
2373 NoIncrementalWriteBarrierSet(this, 2385 NoIncrementalWriteBarrierSet(this,
2374 ToValueIndex(descriptor_number), 2386 ToValueIndex(descriptor_number),
2375 desc->GetValue()); 2387 desc->GetValue());
2376 NoIncrementalWriteBarrierSet(this, 2388 NoIncrementalWriteBarrierSet(this,
2377 ToDetailsIndex(descriptor_number), 2389 ToDetailsIndex(descriptor_number),
2378 desc->GetDetails().AsSmi()); 2390 desc->GetDetails().AsSmi());
2379 } 2391 }
2380 2392
2381 2393
2382 void DescriptorArray::Set(int descriptor_number, Descriptor* desc) { 2394 void DescriptorArray::Set(int descriptor_number, Descriptor* desc) {
2383 // Range check. 2395 // Range check.
2384 ASSERT(descriptor_number < number_of_descriptors()); 2396 ASSERT(descriptor_number < number_of_descriptors());
2385 ASSERT(!desc->GetDetails().representation().IsNone());
2386 2397
2387 set(ToKeyIndex(descriptor_number), desc->GetKey()); 2398 set(ToKeyIndex(descriptor_number), desc->GetKey());
2388 set(ToValueIndex(descriptor_number), desc->GetValue()); 2399 set(ToValueIndex(descriptor_number), desc->GetValue());
2389 set(ToDetailsIndex(descriptor_number), desc->GetDetails().AsSmi()); 2400 set(ToDetailsIndex(descriptor_number), desc->GetDetails().AsSmi());
2390 } 2401 }
2391 2402
2392 2403
2393 void DescriptorArray::Append(Descriptor* desc, 2404 void DescriptorArray::Append(Descriptor* desc,
2394 const WhitenessWitness& witness) { 2405 const WhitenessWitness& witness) {
2395 int descriptor_number = number_of_descriptors(); 2406 int descriptor_number = number_of_descriptors();
(...skipping 1214 matching lines...) Expand 10 before | Expand all | Expand 10 after
3610 3621
3611 bool Map::is_frozen() { 3622 bool Map::is_frozen() {
3612 return IsFrozen::decode(bit_field3()); 3623 return IsFrozen::decode(bit_field3());
3613 } 3624 }
3614 3625
3615 3626
3616 bool Map::CanBeDeprecated() { 3627 bool Map::CanBeDeprecated() {
3617 int descriptor = LastAdded(); 3628 int descriptor = LastAdded();
3618 for (int i = 0; i <= descriptor; i++) { 3629 for (int i = 0; i <= descriptor; i++) {
3619 PropertyDetails details = instance_descriptors()->GetDetails(i); 3630 PropertyDetails details = instance_descriptors()->GetDetails(i);
3631 if (FLAG_track_fields && details.representation().IsNone()) {
3632 return true;
3633 }
3620 if (FLAG_track_fields && details.representation().IsSmi()) { 3634 if (FLAG_track_fields && details.representation().IsSmi()) {
3621 return true; 3635 return true;
3622 } 3636 }
3623 if (FLAG_track_double_fields && details.representation().IsDouble()) { 3637 if (FLAG_track_double_fields && details.representation().IsDouble()) {
3624 return true; 3638 return true;
3625 } 3639 }
3626 if (FLAG_track_heap_object_fields && 3640 if (FLAG_track_heap_object_fields &&
3627 details.representation().IsHeapObject()) { 3641 details.representation().IsHeapObject()) {
3628 return true; 3642 return true;
3629 } 3643 }
(...skipping 2591 matching lines...) Expand 10 before | Expand all | Expand 10 after
6221 #undef WRITE_UINT32_FIELD 6235 #undef WRITE_UINT32_FIELD
6222 #undef READ_SHORT_FIELD 6236 #undef READ_SHORT_FIELD
6223 #undef WRITE_SHORT_FIELD 6237 #undef WRITE_SHORT_FIELD
6224 #undef READ_BYTE_FIELD 6238 #undef READ_BYTE_FIELD
6225 #undef WRITE_BYTE_FIELD 6239 #undef WRITE_BYTE_FIELD
6226 6240
6227 6241
6228 } } // namespace v8::internal 6242 } } // namespace v8::internal
6229 6243
6230 #endif // V8_OBJECTS_INL_H_ 6244 #endif // V8_OBJECTS_INL_H_
OLDNEW
« no previous file with comments | « src/objects-debug.cc ('k') | src/parser.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698