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.cc

Issue 11365221: Allow property indexes to refer to slots inside the object header. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 8 years, 1 month 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
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 623 matching lines...) Expand 10 before | Expand all | Expand 10 after
634 return heap->undefined_value(); 634 return heap->undefined_value();
635 } 635 }
636 *attributes = result->GetAttributes(); 636 *attributes = result->GetAttributes();
637 Object* value; 637 Object* value;
638 switch (result->type()) { 638 switch (result->type()) {
639 case NORMAL: 639 case NORMAL:
640 value = result->holder()->GetNormalizedProperty(result); 640 value = result->holder()->GetNormalizedProperty(result);
641 ASSERT(!value->IsTheHole() || result->IsReadOnly()); 641 ASSERT(!value->IsTheHole() || result->IsReadOnly());
642 return value->IsTheHole() ? heap->undefined_value() : value; 642 return value->IsTheHole() ? heap->undefined_value() : value;
643 case FIELD: 643 case FIELD:
644 value = result->holder()->FastPropertyAt(result->GetFieldIndex()); 644 value = result->holder()->FastPropertyAt(
645 result->GetFieldIndex().FieldIndex());
645 ASSERT(!value->IsTheHole() || result->IsReadOnly()); 646 ASSERT(!value->IsTheHole() || result->IsReadOnly());
646 return value->IsTheHole() ? heap->undefined_value() : value; 647 return value->IsTheHole() ? heap->undefined_value() : value;
647 case CONSTANT_FUNCTION: 648 case CONSTANT_FUNCTION:
648 return result->GetConstantFunction(); 649 return result->GetConstantFunction();
649 case CALLBACKS: 650 case CALLBACKS:
650 return result->holder()->GetPropertyWithCallback( 651 return result->holder()->GetPropertyWithCallback(
651 receiver, result->GetCallbackObject(), name); 652 receiver, result->GetCallbackObject(), name);
652 case HANDLER: 653 case HANDLER:
653 return result->proxy()->GetPropertyWithHandler(receiver, name); 654 return result->proxy()->GetPropertyWithHandler(receiver, name);
654 case INTERCEPTOR: 655 case INTERCEPTOR:
(...skipping 1774 matching lines...) Expand 10 before | Expand all | Expand 10 after
2429 map()->LookupDescriptor(this, name, result); 2430 map()->LookupDescriptor(this, name, result);
2430 // A property or a map transition was found. We return all of these result 2431 // A property or a map transition was found. We return all of these result
2431 // types because LocalLookupRealNamedProperty is used when setting 2432 // types because LocalLookupRealNamedProperty is used when setting
2432 // properties where map transitions are handled. 2433 // properties where map transitions are handled.
2433 ASSERT(!result->IsFound() || 2434 ASSERT(!result->IsFound() ||
2434 (result->holder() == this && result->IsFastPropertyType())); 2435 (result->holder() == this && result->IsFastPropertyType()));
2435 // Disallow caching for uninitialized constants. These can only 2436 // Disallow caching for uninitialized constants. These can only
2436 // occur as fields. 2437 // occur as fields.
2437 if (result->IsField() && 2438 if (result->IsField() &&
2438 result->IsReadOnly() && 2439 result->IsReadOnly() &&
2439 FastPropertyAt(result->GetFieldIndex())->IsTheHole()) { 2440 FastPropertyAt(result->GetFieldIndex().FieldIndex())->IsTheHole()) {
2440 result->DisallowCaching(); 2441 result->DisallowCaching();
2441 } 2442 }
2442 return; 2443 return;
2443 } 2444 }
2444 2445
2445 int entry = property_dictionary()->FindEntry(name); 2446 int entry = property_dictionary()->FindEntry(name);
2446 if (entry != StringDictionary::kNotFound) { 2447 if (entry != StringDictionary::kNotFound) {
2447 Object* value = property_dictionary()->ValueAt(entry); 2448 Object* value = property_dictionary()->ValueAt(entry);
2448 if (IsGlobalObject()) { 2449 if (IsGlobalObject()) {
2449 PropertyDetails d = property_dictionary()->DetailsAt(entry); 2450 PropertyDetails d = property_dictionary()->DetailsAt(entry);
(...skipping 472 matching lines...) Expand 10 before | Expand all | Expand 10 after
2922 } 2923 }
2923 2924
2924 // This is a real property that is not read-only, or it is a 2925 // This is a real property that is not read-only, or it is a
2925 // transition or null descriptor and there are no setters in the prototypes. 2926 // transition or null descriptor and there are no setters in the prototypes.
2926 MaybeObject* result = *value; 2927 MaybeObject* result = *value;
2927 switch (lookup->type()) { 2928 switch (lookup->type()) {
2928 case NORMAL: 2929 case NORMAL:
2929 result = self->SetNormalizedProperty(lookup, *value); 2930 result = self->SetNormalizedProperty(lookup, *value);
2930 break; 2931 break;
2931 case FIELD: 2932 case FIELD:
2932 result = self->FastPropertyAtPut(lookup->GetFieldIndex(), *value); 2933 result = self->FastPropertyAtPut(
2934 lookup->GetFieldIndex().FieldIndex(), *value);
2933 break; 2935 break;
2934 case CONSTANT_FUNCTION: 2936 case CONSTANT_FUNCTION:
2935 // Only replace the function if necessary. 2937 // Only replace the function if necessary.
2936 if (*value == lookup->GetConstantFunction()) return *value; 2938 if (*value == lookup->GetConstantFunction()) return *value;
2937 // Preserve the attributes of this existing property. 2939 // Preserve the attributes of this existing property.
2938 attributes = lookup->GetAttributes(); 2940 attributes = lookup->GetAttributes();
2939 result = self->ConvertDescriptorToField(*name, *value, attributes); 2941 result = self->ConvertDescriptorToField(*name, *value, attributes);
2940 break; 2942 break;
2941 case CALLBACKS: { 2943 case CALLBACKS: {
2942 Object* callback_object = lookup->GetCallbackObject(); 2944 Object* callback_object = lookup->GetCallbackObject();
(...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after
3088 3090
3089 // Check of IsReadOnly removed from here in clone. 3091 // Check of IsReadOnly removed from here in clone.
3090 MaybeObject* result = *value; 3092 MaybeObject* result = *value;
3091 switch (lookup.type()) { 3093 switch (lookup.type()) {
3092 case NORMAL: { 3094 case NORMAL: {
3093 PropertyDetails details = PropertyDetails(attributes, NORMAL); 3095 PropertyDetails details = PropertyDetails(attributes, NORMAL);
3094 result = self->SetNormalizedProperty(*name, *value, details); 3096 result = self->SetNormalizedProperty(*name, *value, details);
3095 break; 3097 break;
3096 } 3098 }
3097 case FIELD: 3099 case FIELD:
3098 result = self->FastPropertyAtPut(lookup.GetFieldIndex(), *value); 3100 result = self->FastPropertyAtPut(
3101 lookup.GetFieldIndex().FieldIndex(), *value);
3099 break; 3102 break;
3100 case CONSTANT_FUNCTION: 3103 case CONSTANT_FUNCTION:
3101 // Only replace the function if necessary. 3104 // Only replace the function if necessary.
3102 if (*value != lookup.GetConstantFunction()) { 3105 if (*value != lookup.GetConstantFunction()) {
3103 // Preserve the attributes of this existing property. 3106 // Preserve the attributes of this existing property.
3104 attributes = lookup.GetAttributes(); 3107 attributes = lookup.GetAttributes();
3105 result = self->ConvertDescriptorToField(*name, *value, attributes); 3108 result = self->ConvertDescriptorToField(*name, *value, attributes);
3106 } 3109 }
3107 break; 3110 break;
3108 case CALLBACKS: 3111 case CALLBACKS:
(...skipping 10751 matching lines...) Expand 10 before | Expand all | Expand 10 after
13860 set_year(Smi::FromInt(year), SKIP_WRITE_BARRIER); 13863 set_year(Smi::FromInt(year), SKIP_WRITE_BARRIER);
13861 set_month(Smi::FromInt(month), SKIP_WRITE_BARRIER); 13864 set_month(Smi::FromInt(month), SKIP_WRITE_BARRIER);
13862 set_day(Smi::FromInt(day), SKIP_WRITE_BARRIER); 13865 set_day(Smi::FromInt(day), SKIP_WRITE_BARRIER);
13863 set_weekday(Smi::FromInt(weekday), SKIP_WRITE_BARRIER); 13866 set_weekday(Smi::FromInt(weekday), SKIP_WRITE_BARRIER);
13864 set_hour(Smi::FromInt(hour), SKIP_WRITE_BARRIER); 13867 set_hour(Smi::FromInt(hour), SKIP_WRITE_BARRIER);
13865 set_min(Smi::FromInt(min), SKIP_WRITE_BARRIER); 13868 set_min(Smi::FromInt(min), SKIP_WRITE_BARRIER);
13866 set_sec(Smi::FromInt(sec), SKIP_WRITE_BARRIER); 13869 set_sec(Smi::FromInt(sec), SKIP_WRITE_BARRIER);
13867 } 13870 }
13868 13871
13869 } } // namespace v8::internal 13872 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/mips/stub-cache-mips.cc ('k') | src/property.h » ('j') | src/property.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698