OLD | NEW |
1 // Copyright 2014 the V8 project authors. All rights reserved. | 1 // Copyright 2014 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 "src/runtime/runtime-utils.h" | 5 #include "src/runtime/runtime-utils.h" |
6 | 6 |
7 #include <memory> | 7 #include <memory> |
8 | 8 |
9 #include "src/accessors.h" | 9 #include "src/accessors.h" |
10 #include "src/arguments.h" | 10 #include "src/arguments.h" |
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
81 DCHECK(is_function_declaration); | 81 DCHECK(is_function_declaration); |
82 if ((old_attributes & DONT_DELETE) != 0) { | 82 if ((old_attributes & DONT_DELETE) != 0) { |
83 // Only allow reconfiguring globals to functions in user code (no | 83 // Only allow reconfiguring globals to functions in user code (no |
84 // natives, which are marked as read-only). | 84 // natives, which are marked as read-only). |
85 DCHECK((attr & READ_ONLY) == 0); | 85 DCHECK((attr & READ_ONLY) == 0); |
86 | 86 |
87 // Check whether we can reconfigure the existing property into a | 87 // Check whether we can reconfigure the existing property into a |
88 // function. | 88 // function. |
89 PropertyDetails old_details = it.property_details(); | 89 PropertyDetails old_details = it.property_details(); |
90 if (old_details.IsReadOnly() || old_details.IsDontEnum() || | 90 if (old_details.IsReadOnly() || old_details.IsDontEnum() || |
91 (it.state() == LookupIterator::ACCESSOR && | 91 (it.state() == LookupIterator::ACCESSOR)) { |
92 it.GetAccessors()->IsAccessorPair())) { | |
93 // ECMA-262 section 15.1.11 GlobalDeclarationInstantiation 5.d: | 92 // ECMA-262 section 15.1.11 GlobalDeclarationInstantiation 5.d: |
94 // If hasRestrictedGlobal is true, throw a SyntaxError exception. | 93 // If hasRestrictedGlobal is true, throw a SyntaxError exception. |
95 // ECMA-262 section 18.2.1.3 EvalDeclarationInstantiation 8.a.iv.1.b: | 94 // ECMA-262 section 18.2.1.3 EvalDeclarationInstantiation 8.a.iv.1.b: |
96 // If fnDefinable is false, throw a TypeError exception. | 95 // If fnDefinable is false, throw a TypeError exception. |
97 return ThrowRedeclarationError(isolate, name, redeclaration_type); | 96 return ThrowRedeclarationError(isolate, name, redeclaration_type); |
98 } | 97 } |
99 // If the existing property is not configurable, keep its attributes. Do | 98 // If the existing property is not configurable, keep its attributes. Do |
100 attr = old_attributes; | 99 attr = old_attributes; |
101 } | 100 } |
102 | 101 |
(...skipping 871 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
974 RUNTIME_FUNCTION(Runtime_StoreLookupSlot_Strict) { | 973 RUNTIME_FUNCTION(Runtime_StoreLookupSlot_Strict) { |
975 HandleScope scope(isolate); | 974 HandleScope scope(isolate); |
976 DCHECK_EQ(2, args.length()); | 975 DCHECK_EQ(2, args.length()); |
977 CONVERT_ARG_HANDLE_CHECKED(String, name, 0); | 976 CONVERT_ARG_HANDLE_CHECKED(String, name, 0); |
978 CONVERT_ARG_HANDLE_CHECKED(Object, value, 1); | 977 CONVERT_ARG_HANDLE_CHECKED(Object, value, 1); |
979 RETURN_RESULT_OR_FAILURE(isolate, StoreLookupSlot(name, value, STRICT)); | 978 RETURN_RESULT_OR_FAILURE(isolate, StoreLookupSlot(name, value, STRICT)); |
980 } | 979 } |
981 | 980 |
982 } // namespace internal | 981 } // namespace internal |
983 } // namespace v8 | 982 } // namespace v8 |
OLD | NEW |