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 3056 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3067 *done = result.IsReadOnly(); | 3067 *done = result.IsReadOnly(); |
3068 break; | 3068 break; |
3069 case INTERCEPTOR: { | 3069 case INTERCEPTOR: { |
3070 PropertyAttributes attr = | 3070 PropertyAttributes attr = |
3071 result.holder()->GetPropertyAttributeWithInterceptor( | 3071 result.holder()->GetPropertyAttributeWithInterceptor( |
3072 *object, *name, true); | 3072 *object, *name, true); |
3073 *done = !!(attr & READ_ONLY); | 3073 *done = !!(attr & READ_ONLY); |
3074 break; | 3074 break; |
3075 } | 3075 } |
3076 case CALLBACKS: { | 3076 case CALLBACKS: { |
3077 if (!FLAG_es5_readonly && result.IsReadOnly()) break; | |
3078 *done = true; | 3077 *done = true; |
3079 Handle<Object> callback_object(result.GetCallbackObject(), isolate); | 3078 Handle<Object> callback_object(result.GetCallbackObject(), isolate); |
3080 return SetPropertyWithCallback(object, callback_object, name, value, | 3079 return SetPropertyWithCallback(object, callback_object, name, value, |
3081 handle(result.holder()), strict_mode); | 3080 handle(result.holder()), strict_mode); |
3082 } | 3081 } |
3083 case HANDLER: { | 3082 case HANDLER: { |
3084 Handle<JSProxy> proxy(result.proxy()); | 3083 Handle<JSProxy> proxy(result.proxy()); |
3085 return JSProxy::SetPropertyViaPrototypesWithHandler( | 3084 return JSProxy::SetPropertyViaPrototypesWithHandler( |
3086 proxy, object, name, value, attributes, strict_mode, done); | 3085 proxy, object, name, value, attributes, strict_mode, done); |
3087 } | 3086 } |
3088 case TRANSITION: | 3087 case TRANSITION: |
3089 case NONEXISTENT: | 3088 case NONEXISTENT: |
3090 UNREACHABLE(); | 3089 UNREACHABLE(); |
3091 break; | 3090 break; |
3092 } | 3091 } |
3093 } | 3092 } |
3094 | 3093 |
3095 // If we get here with *done true, we have encountered a read-only property. | 3094 // If we get here with *done true, we have encountered a read-only property. |
3096 if (!FLAG_es5_readonly) *done = false; | |
3097 if (*done) { | 3095 if (*done) { |
3098 if (strict_mode == kNonStrictMode) return value; | 3096 if (strict_mode == kNonStrictMode) return value; |
3099 Handle<Object> args[] = { name, object }; | 3097 Handle<Object> args[] = { name, object }; |
3100 Handle<Object> error = isolate->factory()->NewTypeError( | 3098 Handle<Object> error = isolate->factory()->NewTypeError( |
3101 "strict_read_only_property", HandleVector(args, ARRAY_SIZE(args))); | 3099 "strict_read_only_property", HandleVector(args, ARRAY_SIZE(args))); |
3102 isolate->Throw(*error); | 3100 isolate->Throw(*error); |
3103 return Handle<Object>(); | 3101 return Handle<Object>(); |
3104 } | 3102 } |
3105 return isolate->factory()->the_hole_value(); | 3103 return isolate->factory()->the_hole_value(); |
3106 } | 3104 } |
(...skipping 13375 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
16482 #define ERROR_MESSAGES_TEXTS(C, T) T, | 16480 #define ERROR_MESSAGES_TEXTS(C, T) T, |
16483 static const char* error_messages_[] = { | 16481 static const char* error_messages_[] = { |
16484 ERROR_MESSAGES_LIST(ERROR_MESSAGES_TEXTS) | 16482 ERROR_MESSAGES_LIST(ERROR_MESSAGES_TEXTS) |
16485 }; | 16483 }; |
16486 #undef ERROR_MESSAGES_TEXTS | 16484 #undef ERROR_MESSAGES_TEXTS |
16487 return error_messages_[reason]; | 16485 return error_messages_[reason]; |
16488 } | 16486 } |
16489 | 16487 |
16490 | 16488 |
16491 } } // namespace v8::internal | 16489 } } // namespace v8::internal |
OLD | NEW |