OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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 <stdlib.h> | 5 #include <stdlib.h> |
6 #include <limits> | 6 #include <limits> |
7 | 7 |
8 #include "src/v8.h" | 8 #include "src/v8.h" |
9 | 9 |
10 #include "src/accessors.h" | 10 #include "src/accessors.h" |
(...skipping 5008 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5019 CONVERT_SMI_ARG_CHECKED(unchecked, 3); | 5019 CONVERT_SMI_ARG_CHECKED(unchecked, 3); |
5020 RUNTIME_ASSERT((unchecked & ~(READ_ONLY | DONT_ENUM | DONT_DELETE)) == 0); | 5020 RUNTIME_ASSERT((unchecked & ~(READ_ONLY | DONT_ENUM | DONT_DELETE)) == 0); |
5021 PropertyAttributes attr = static_cast<PropertyAttributes>(unchecked); | 5021 PropertyAttributes attr = static_cast<PropertyAttributes>(unchecked); |
5022 | 5022 |
5023 // Check access rights if needed. | 5023 // Check access rights if needed. |
5024 if (js_object->IsAccessCheckNeeded() && | 5024 if (js_object->IsAccessCheckNeeded() && |
5025 !isolate->MayNamedAccess(js_object, name, v8::ACCESS_SET)) { | 5025 !isolate->MayNamedAccess(js_object, name, v8::ACCESS_SET)) { |
5026 return isolate->heap()->undefined_value(); | 5026 return isolate->heap()->undefined_value(); |
5027 } | 5027 } |
5028 | 5028 |
5029 LookupResult lookup(isolate); | 5029 LookupIterator it(js_object, name, LookupIterator::CHECK_PROPERTY); |
5030 js_object->LookupOwnRealNamedProperty(name, &lookup); | |
5031 | 5030 |
5032 // Take special care when attributes are different and there is already | 5031 // Take special care when attributes are different and there is already |
5033 // a property. For simplicity we normalize the property which enables us | 5032 // a property. |
5034 // to not worry about changing the instance_descriptor and creating a new | 5033 if (it.IsFound() && it.HasProperty() && |
5035 // map. | 5034 it.property_kind() == LookupIterator::ACCESSOR) { |
5036 if (lookup.IsFound() && | |
5037 (attr != lookup.GetAttributes() || lookup.IsPropertyCallbacks())) { | |
5038 // Use IgnoreAttributes version since a readonly property may be | 5035 // Use IgnoreAttributes version since a readonly property may be |
5039 // overridden and SetProperty does not allow this. | 5036 // overridden and SetProperty does not allow this. |
5040 Handle<Object> result; | 5037 Handle<Object> result; |
5041 ASSIGN_RETURN_FAILURE_ON_EXCEPTION( | 5038 ASSIGN_RETURN_FAILURE_ON_EXCEPTION( |
5042 isolate, result, | 5039 isolate, result, |
5043 JSObject::SetOwnPropertyIgnoreAttributes( | 5040 JSObject::SetOwnPropertyIgnoreAttributes( |
5044 js_object, name, obj_value, attr, | 5041 js_object, name, obj_value, attr, |
5045 JSObject::DONT_FORCE_FIELD)); | 5042 JSObject::DONT_FORCE_FIELD)); |
5046 return *result; | 5043 return *result; |
5047 } | 5044 } |
(...skipping 10578 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
15626 } | 15623 } |
15627 return NULL; | 15624 return NULL; |
15628 } | 15625 } |
15629 | 15626 |
15630 | 15627 |
15631 const Runtime::Function* Runtime::FunctionForId(Runtime::FunctionId id) { | 15628 const Runtime::Function* Runtime::FunctionForId(Runtime::FunctionId id) { |
15632 return &(kIntrinsicFunctions[static_cast<int>(id)]); | 15629 return &(kIntrinsicFunctions[static_cast<int>(id)]); |
15633 } | 15630 } |
15634 | 15631 |
15635 } } // namespace v8::internal | 15632 } } // namespace v8::internal |
OLD | NEW |