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 654 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
665 NameDictionary); | 665 NameDictionary); |
666 } | 666 } |
667 | 667 |
668 | 668 |
669 void JSObject::SetNormalizedProperty(Handle<JSObject> object, | 669 void JSObject::SetNormalizedProperty(Handle<JSObject> object, |
670 Handle<Name> name, | 670 Handle<Name> name, |
671 Handle<Object> value, | 671 Handle<Object> value, |
672 PropertyDetails details) { | 672 PropertyDetails details) { |
673 ASSERT(!object->HasFastProperties()); | 673 ASSERT(!object->HasFastProperties()); |
674 Handle<NameDictionary> property_dictionary(object->property_dictionary()); | 674 Handle<NameDictionary> property_dictionary(object->property_dictionary()); |
675 | |
676 if (!name->IsUniqueName()) { | |
677 name = object->GetIsolate()->factory()->InternalizedStringFromString( | |
678 Handle<String>::cast(name)); | |
679 } | |
680 | |
675 int entry = property_dictionary->FindEntry(*name); | 681 int entry = property_dictionary->FindEntry(*name); |
676 if (entry == NameDictionary::kNotFound) { | 682 if (entry == NameDictionary::kNotFound) { |
677 Handle<Object> store_value = value; | 683 Handle<Object> store_value = value; |
678 if (object->IsGlobalObject()) { | 684 if (object->IsGlobalObject()) { |
679 store_value = object->GetIsolate()->factory()->NewPropertyCell(value); | 685 store_value = object->GetIsolate()->factory()->NewPropertyCell(value); |
680 } | 686 } |
687 | |
Yang
2013/09/25 14:59:51
stray edit.
| |
681 property_dictionary = | 688 property_dictionary = |
682 NameDictionaryAdd(property_dictionary, name, store_value, details); | 689 NameDictionaryAdd(property_dictionary, name, store_value, details); |
683 object->set_properties(*property_dictionary); | 690 object->set_properties(*property_dictionary); |
684 return; | 691 return; |
685 } | 692 } |
686 | 693 |
687 PropertyDetails original_details = property_dictionary->DetailsAt(entry); | 694 PropertyDetails original_details = property_dictionary->DetailsAt(entry); |
688 int enumeration_index; | 695 int enumeration_index; |
689 // Preserve the enumeration index unless the property was deleted. | 696 // Preserve the enumeration index unless the property was deleted. |
690 if (original_details.IsDeleted()) { | 697 if (original_details.IsDeleted()) { |
(...skipping 1346 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2037 Handle<Object> value, | 2044 Handle<Object> value, |
2038 PropertyAttributes attributes, | 2045 PropertyAttributes attributes, |
2039 StrictModeFlag strict_mode, | 2046 StrictModeFlag strict_mode, |
2040 JSReceiver::StoreFromKeyed store_mode, | 2047 JSReceiver::StoreFromKeyed store_mode, |
2041 ExtensibilityCheck extensibility_check, | 2048 ExtensibilityCheck extensibility_check, |
2042 ValueType value_type, | 2049 ValueType value_type, |
2043 StoreMode mode, | 2050 StoreMode mode, |
2044 TransitionFlag transition_flag) { | 2051 TransitionFlag transition_flag) { |
2045 ASSERT(!object->IsJSGlobalProxy()); | 2052 ASSERT(!object->IsJSGlobalProxy()); |
2046 Isolate* isolate = object->GetIsolate(); | 2053 Isolate* isolate = object->GetIsolate(); |
2054 | |
2055 if (!name->IsUniqueName()) { | |
2056 name = isolate->factory()->InternalizedStringFromString( | |
2057 Handle<String>::cast(name)); | |
2058 } | |
2059 | |
2047 if (extensibility_check == PERFORM_EXTENSIBILITY_CHECK && | 2060 if (extensibility_check == PERFORM_EXTENSIBILITY_CHECK && |
2048 !object->map()->is_extensible()) { | 2061 !object->map()->is_extensible()) { |
2049 if (strict_mode == kNonStrictMode) { | 2062 if (strict_mode == kNonStrictMode) { |
2050 return value; | 2063 return value; |
2051 } else { | 2064 } else { |
2052 Handle<Object> args[1] = { name }; | 2065 Handle<Object> args[1] = { name }; |
2053 Handle<Object> error = isolate->factory()->NewTypeError( | 2066 Handle<Object> error = isolate->factory()->NewTypeError( |
2054 "object_not_extensible", HandleVector(args, ARRAY_SIZE(args))); | 2067 "object_not_extensible", HandleVector(args, ARRAY_SIZE(args))); |
2055 isolate->Throw(*error); | 2068 isolate->Throw(*error); |
2056 return Handle<Object>(); | 2069 return Handle<Object>(); |
(...skipping 14049 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
16106 #define ERROR_MESSAGES_TEXTS(C, T) T, | 16119 #define ERROR_MESSAGES_TEXTS(C, T) T, |
16107 static const char* error_messages_[] = { | 16120 static const char* error_messages_[] = { |
16108 ERROR_MESSAGES_LIST(ERROR_MESSAGES_TEXTS) | 16121 ERROR_MESSAGES_LIST(ERROR_MESSAGES_TEXTS) |
16109 }; | 16122 }; |
16110 #undef ERROR_MESSAGES_TEXTS | 16123 #undef ERROR_MESSAGES_TEXTS |
16111 return error_messages_[reason]; | 16124 return error_messages_[reason]; |
16112 } | 16125 } |
16113 | 16126 |
16114 | 16127 |
16115 } } // namespace v8::internal | 16128 } } // namespace v8::internal |
OLD | NEW |