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 "src/accessors.h" | 7 #include "src/accessors.h" |
8 #include "src/arguments.h" | 8 #include "src/arguments.h" |
9 #include "src/ast/scopeinfo.h" | 9 #include "src/ast/scopeinfo.h" |
10 #include "src/ast/scopes.h" | 10 #include "src/ast/scopes.h" |
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
71 if (old_details.IsReadOnly() || old_details.IsDontEnum() || | 71 if (old_details.IsReadOnly() || old_details.IsDontEnum() || |
72 old_details.type() == ACCESSOR_CONSTANT) { | 72 old_details.type() == ACCESSOR_CONSTANT) { |
73 return ThrowRedeclarationError(isolate, name); | 73 return ThrowRedeclarationError(isolate, name); |
74 } | 74 } |
75 // If the existing property is not configurable, keep its attributes. Do | 75 // If the existing property is not configurable, keep its attributes. Do |
76 attr = old_attributes; | 76 attr = old_attributes; |
77 } | 77 } |
78 } | 78 } |
79 | 79 |
80 // Define or redefine own property. | 80 // Define or redefine own property. |
81 RETURN_FAILURE_ON_EXCEPTION( | 81 RETURN_FAILURE_ON_EXCEPTION(isolate, JSObject::SetOwnPropertyIgnoreAttributes( |
82 isolate, JSObject::DefineOwnPropertyIgnoreAttributes(&it, value, attr)); | 82 global, name, value, attr)); |
83 | 83 |
84 return isolate->heap()->undefined_value(); | 84 return isolate->heap()->undefined_value(); |
85 } | 85 } |
86 | 86 |
87 | 87 |
88 RUNTIME_FUNCTION(Runtime_DeclareGlobals) { | 88 RUNTIME_FUNCTION(Runtime_DeclareGlobals) { |
89 HandleScope scope(isolate); | 89 HandleScope scope(isolate); |
90 DCHECK_EQ(2, args.length()); | 90 DCHECK_EQ(2, args.length()); |
91 Handle<JSGlobalObject> global(isolate->global_object()); | 91 Handle<JSGlobalObject> global(isolate->global_object()); |
92 Handle<Context> context(isolate->context()); | 92 Handle<Context> context(isolate->context()); |
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
189 // Ignore if we can't reconfigure the value. | 189 // Ignore if we can't reconfigure the value. |
190 if ((old_attributes & DONT_DELETE) != 0) { | 190 if ((old_attributes & DONT_DELETE) != 0) { |
191 if ((old_attributes & READ_ONLY) != 0 || | 191 if ((old_attributes & READ_ONLY) != 0 || |
192 it.state() == LookupIterator::ACCESSOR) { | 192 it.state() == LookupIterator::ACCESSOR) { |
193 return *value; | 193 return *value; |
194 } | 194 } |
195 attr = static_cast<PropertyAttributes>(old_attributes | READ_ONLY); | 195 attr = static_cast<PropertyAttributes>(old_attributes | READ_ONLY); |
196 } | 196 } |
197 } | 197 } |
198 | 198 |
199 RETURN_FAILURE_ON_EXCEPTION( | 199 RETURN_FAILURE_ON_EXCEPTION(isolate, JSObject::SetOwnPropertyIgnoreAttributes( |
200 isolate, JSObject::DefineOwnPropertyIgnoreAttributes(&it, value, attr)); | 200 global, name, value, attr)); |
201 | 201 |
202 return *value; | 202 return *value; |
203 } | 203 } |
204 | 204 |
205 | 205 |
206 namespace { | 206 namespace { |
207 | 207 |
208 Object* DeclareLookupSlot(Isolate* isolate, Handle<String> name, | 208 Object* DeclareLookupSlot(Isolate* isolate, Handle<String> name, |
209 Handle<Object> initial_value, | 209 Handle<Object> initial_value, |
210 PropertyAttributes attr) { | 210 PropertyAttributes attr) { |
(...skipping 1037 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1248 | 1248 |
1249 // Lookup in the initial Object.prototype object. | 1249 // Lookup in the initial Object.prototype object. |
1250 Handle<Object> result; | 1250 Handle<Object> result; |
1251 ASSIGN_RETURN_FAILURE_ON_EXCEPTION( | 1251 ASSIGN_RETURN_FAILURE_ON_EXCEPTION( |
1252 isolate, result, | 1252 isolate, result, |
1253 Object::GetProperty(isolate->initial_object_prototype(), key)); | 1253 Object::GetProperty(isolate->initial_object_prototype(), key)); |
1254 return *result; | 1254 return *result; |
1255 } | 1255 } |
1256 } // namespace internal | 1256 } // namespace internal |
1257 } // namespace v8 | 1257 } // namespace v8 |
OLD | NEW |