OLD | NEW |
1 // Copyright 2013 the V8 project authors. All rights reserved. | 1 // Copyright 2013 the V8 project authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "v8.h" | 5 #include "v8.h" |
6 | 6 |
7 #include "accessors.h" | 7 #include "accessors.h" |
8 #include "allocation-site-scopes.h" | 8 #include "allocation-site-scopes.h" |
9 #include "api.h" | 9 #include "api.h" |
10 #include "arguments.h" | 10 #include "arguments.h" |
(...skipping 2063 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2074 Handle<Object> value, | 2074 Handle<Object> value, |
2075 PropertyAttributes attributes, | 2075 PropertyAttributes attributes, |
2076 StrictMode strict_mode) { | 2076 StrictMode strict_mode) { |
2077 // Check own property, ignore interceptor. | 2077 // Check own property, ignore interceptor. |
2078 Isolate* isolate = object->GetIsolate(); | 2078 Isolate* isolate = object->GetIsolate(); |
2079 LookupResult result(isolate); | 2079 LookupResult result(isolate); |
2080 object->LookupOwnRealNamedProperty(name, &result); | 2080 object->LookupOwnRealNamedProperty(name, &result); |
2081 if (!result.IsFound()) { | 2081 if (!result.IsFound()) { |
2082 object->map()->LookupTransition(*object, *name, &result); | 2082 object->map()->LookupTransition(*object, *name, &result); |
2083 } | 2083 } |
2084 if (result.IsFound()) { | 2084 return SetPropertyForResult(object, &result, name, value, attributes, |
2085 // An existing property or a map transition was found. Use set property to | 2085 strict_mode, MAY_BE_STORE_FROM_KEYED); |
2086 // handle all these cases. | |
2087 return SetPropertyForResult(object, &result, name, value, attributes, | |
2088 strict_mode, MAY_BE_STORE_FROM_KEYED); | |
2089 } | |
2090 bool done = false; | |
2091 Handle<Object> result_object; | |
2092 ASSIGN_RETURN_ON_EXCEPTION( | |
2093 isolate, result_object, | |
2094 SetPropertyViaPrototypes( | |
2095 object, name, value, attributes, strict_mode, &done), | |
2096 Object); | |
2097 if (done) return result_object; | |
2098 // Add a new real property. | |
2099 return AddProperty(object, name, value, attributes, strict_mode); | |
2100 } | 2086 } |
2101 | 2087 |
2102 | 2088 |
2103 static void ReplaceSlowProperty(Handle<JSObject> object, | 2089 static void ReplaceSlowProperty(Handle<JSObject> object, |
2104 Handle<Name> name, | 2090 Handle<Name> name, |
2105 Handle<Object> value, | 2091 Handle<Object> value, |
2106 PropertyAttributes attributes) { | 2092 PropertyAttributes attributes) { |
2107 NameDictionary* dictionary = object->property_dictionary(); | 2093 NameDictionary* dictionary = object->property_dictionary(); |
2108 int old_index = dictionary->FindEntry(name); | 2094 int old_index = dictionary->FindEntry(name); |
2109 int new_enumeration_index = 0; // 0 means "Use the next available index." | 2095 int new_enumeration_index = 0; // 0 means "Use the next available index." |
(...skipping 15052 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
17162 #define ERROR_MESSAGES_TEXTS(C, T) T, | 17148 #define ERROR_MESSAGES_TEXTS(C, T) T, |
17163 static const char* error_messages_[] = { | 17149 static const char* error_messages_[] = { |
17164 ERROR_MESSAGES_LIST(ERROR_MESSAGES_TEXTS) | 17150 ERROR_MESSAGES_LIST(ERROR_MESSAGES_TEXTS) |
17165 }; | 17151 }; |
17166 #undef ERROR_MESSAGES_TEXTS | 17152 #undef ERROR_MESSAGES_TEXTS |
17167 return error_messages_[reason]; | 17153 return error_messages_[reason]; |
17168 } | 17154 } |
17169 | 17155 |
17170 | 17156 |
17171 } } // namespace v8::internal | 17157 } } // namespace v8::internal |
OLD | NEW |