OLD | NEW |
1 // Copyright 2013 the V8 project authors. All rights reserved. | 1 // Copyright 2013 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 4002 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4013 box->set_value(value->Number()); | 4013 box->set_value(value->Number()); |
4014 } else { | 4014 } else { |
4015 object->FastPropertyAtPut(field_index, *value); | 4015 object->FastPropertyAtPut(field_index, *value); |
4016 } | 4016 } |
4017 | 4017 |
4018 return value; | 4018 return value; |
4019 } | 4019 } |
4020 | 4020 |
4021 | 4021 |
4022 static void SetPropertyToField(LookupResult* lookup, | 4022 static void SetPropertyToField(LookupResult* lookup, |
4023 Handle<Name> name, | |
4024 Handle<Object> value) { | 4023 Handle<Object> value) { |
4025 Representation representation = lookup->representation(); | 4024 Representation representation = lookup->representation(); |
4026 if (!lookup->CanHoldValue(value) || | 4025 if (!lookup->CanHoldValue(value) || |
4027 lookup->type() == CONSTANT) { | 4026 lookup->type() == CONSTANT) { |
4028 JSObject::GeneralizeFieldRepresentation(handle(lookup->holder()), | 4027 JSObject::GeneralizeFieldRepresentation(handle(lookup->holder()), |
4029 lookup->GetDescriptorIndex(), | 4028 lookup->GetDescriptorIndex(), |
4030 value->OptimalRepresentation(), | 4029 value->OptimalRepresentation(), |
4031 FORCE_FIELD); | 4030 FORCE_FIELD); |
4032 DescriptorArray* desc = lookup->holder()->map()->instance_descriptors(); | 4031 DescriptorArray* desc = lookup->holder()->map()->instance_descriptors(); |
4033 int descriptor = lookup->GetDescriptorIndex(); | 4032 int descriptor = lookup->GetDescriptorIndex(); |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4076 object->FastPropertyAtPut(index, *value); | 4075 object->FastPropertyAtPut(index, *value); |
4077 } | 4076 } |
4078 | 4077 |
4079 | 4078 |
4080 static void SetPropertyToFieldWithAttributes(LookupResult* lookup, | 4079 static void SetPropertyToFieldWithAttributes(LookupResult* lookup, |
4081 Handle<Name> name, | 4080 Handle<Name> name, |
4082 Handle<Object> value, | 4081 Handle<Object> value, |
4083 PropertyAttributes attributes) { | 4082 PropertyAttributes attributes) { |
4084 if (lookup->GetAttributes() == attributes) { | 4083 if (lookup->GetAttributes() == attributes) { |
4085 if (value->IsUninitialized()) return; | 4084 if (value->IsUninitialized()) return; |
4086 SetPropertyToField(lookup, name, value); | 4085 SetPropertyToField(lookup, value); |
4087 } else { | 4086 } else { |
4088 ConvertAndSetLocalProperty(lookup, name, value, attributes); | 4087 ConvertAndSetLocalProperty(lookup, name, value, attributes); |
4089 } | 4088 } |
4090 } | 4089 } |
4091 | 4090 |
4092 | 4091 |
4093 MaybeHandle<Object> JSObject::SetPropertyForResult( | 4092 MaybeHandle<Object> JSObject::SetPropertyForResult( |
4094 Handle<JSObject> object, | 4093 Handle<JSObject> object, |
4095 LookupResult* lookup, | 4094 LookupResult* lookup, |
4096 Handle<Name> name, | 4095 Handle<Name> name, |
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4171 MaybeHandle<Object> maybe_result = value; | 4170 MaybeHandle<Object> maybe_result = value; |
4172 if (lookup->IsTransition()) { | 4171 if (lookup->IsTransition()) { |
4173 maybe_result = SetPropertyUsingTransition(handle(lookup->holder()), lookup, | 4172 maybe_result = SetPropertyUsingTransition(handle(lookup->holder()), lookup, |
4174 name, value, attributes); | 4173 name, value, attributes); |
4175 } else { | 4174 } else { |
4176 switch (lookup->type()) { | 4175 switch (lookup->type()) { |
4177 case NORMAL: | 4176 case NORMAL: |
4178 SetNormalizedProperty(handle(lookup->holder()), lookup, value); | 4177 SetNormalizedProperty(handle(lookup->holder()), lookup, value); |
4179 break; | 4178 break; |
4180 case FIELD: | 4179 case FIELD: |
4181 SetPropertyToField(lookup, name, value); | 4180 SetPropertyToField(lookup, value); |
4182 break; | 4181 break; |
4183 case CONSTANT: | 4182 case CONSTANT: |
4184 // Only replace the constant if necessary. | 4183 // Only replace the constant if necessary. |
4185 if (*value == lookup->GetConstant()) return value; | 4184 if (*value == lookup->GetConstant()) return value; |
4186 SetPropertyToField(lookup, name, value); | 4185 SetPropertyToField(lookup, value); |
4187 break; | 4186 break; |
4188 case CALLBACKS: { | 4187 case CALLBACKS: { |
4189 Handle<Object> callback_object(lookup->GetCallbackObject(), isolate); | 4188 Handle<Object> callback_object(lookup->GetCallbackObject(), isolate); |
4190 return SetPropertyWithCallback(object, callback_object, name, value, | 4189 return SetPropertyWithCallback(object, callback_object, name, value, |
4191 handle(lookup->holder()), strict_mode); | 4190 handle(lookup->holder()), strict_mode); |
4192 } | 4191 } |
4193 case INTERCEPTOR: | 4192 case INTERCEPTOR: |
4194 maybe_result = SetPropertyWithInterceptor( | 4193 maybe_result = SetPropertyWithInterceptor( |
4195 handle(lookup->holder()), name, value, attributes, strict_mode); | 4194 handle(lookup->holder()), name, value, attributes, strict_mode); |
4196 break; | 4195 break; |
(...skipping 12432 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
16629 #define ERROR_MESSAGES_TEXTS(C, T) T, | 16628 #define ERROR_MESSAGES_TEXTS(C, T) T, |
16630 static const char* error_messages_[] = { | 16629 static const char* error_messages_[] = { |
16631 ERROR_MESSAGES_LIST(ERROR_MESSAGES_TEXTS) | 16630 ERROR_MESSAGES_LIST(ERROR_MESSAGES_TEXTS) |
16632 }; | 16631 }; |
16633 #undef ERROR_MESSAGES_TEXTS | 16632 #undef ERROR_MESSAGES_TEXTS |
16634 return error_messages_[reason]; | 16633 return error_messages_[reason]; |
16635 } | 16634 } |
16636 | 16635 |
16637 | 16636 |
16638 } } // namespace v8::internal | 16637 } } // namespace v8::internal |
OLD | NEW |