| 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/v8.h" | 5 #include "src/v8.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/frames-inl.h" | 9 #include "src/frames-inl.h" |
| 10 #include "src/runtime/runtime-utils.h" | 10 #include "src/runtime/runtime-utils.h" |
| (...skipping 280 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 291 } | 291 } |
| 292 | 292 |
| 293 PropertyAttributes attr = | 293 PropertyAttributes attr = |
| 294 static_cast<PropertyAttributes>(DONT_DELETE | READ_ONLY); | 294 static_cast<PropertyAttributes>(DONT_DELETE | READ_ONLY); |
| 295 | 295 |
| 296 // Strict mode handling not needed (legacy const is disallowed in strict | 296 // Strict mode handling not needed (legacy const is disallowed in strict |
| 297 // mode). | 297 // mode). |
| 298 | 298 |
| 299 // The declared const was configurable, and may have been deleted in the | 299 // The declared const was configurable, and may have been deleted in the |
| 300 // meanwhile. If so, re-introduce the variable in the context extension. | 300 // meanwhile. If so, re-introduce the variable in the context extension. |
| 301 DCHECK(context_arg->has_extension()); | |
| 302 if (attributes == ABSENT) { | 301 if (attributes == ABSENT) { |
| 303 holder = handle(context_arg->extension(), isolate); | 302 Handle<Context> declaration_context(context_arg->declaration_context()); |
| 303 DCHECK(declaration_context->has_extension()); |
| 304 holder = handle(declaration_context->extension(), isolate); |
| 305 CHECK(holder->IsJSObject()); |
| 304 } else { | 306 } else { |
| 305 // For JSContextExtensionObjects, the initializer can be run multiple times | 307 // For JSContextExtensionObjects, the initializer can be run multiple times |
| 306 // if in a for loop: for (var i = 0; i < 2; i++) { const x = i; }. Only the | 308 // if in a for loop: for (var i = 0; i < 2; i++) { const x = i; }. Only the |
| 307 // first assignment should go through. For JSGlobalObjects, additionally any | 309 // first assignment should go through. For JSGlobalObjects, additionally any |
| 308 // code can run in between that modifies the declared property. | 310 // code can run in between that modifies the declared property. |
| 309 DCHECK(holder->IsJSGlobalObject() || holder->IsJSContextExtensionObject()); | 311 DCHECK(holder->IsJSGlobalObject() || holder->IsJSContextExtensionObject()); |
| 310 | 312 |
| 311 LookupIterator it(holder, name, LookupIterator::HIDDEN_SKIP_INTERCEPTOR); | 313 LookupIterator it(holder, name, LookupIterator::HIDDEN_SKIP_INTERCEPTOR); |
| 312 Maybe<PropertyAttributes> maybe = JSReceiver::GetPropertyAttributes(&it); | 314 Maybe<PropertyAttributes> maybe = JSReceiver::GetPropertyAttributes(&it); |
| 313 if (!maybe.has_value) return isolate->heap()->exception(); | 315 if (!maybe.has_value) return isolate->heap()->exception(); |
| (...skipping 705 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1019 return Smi::FromInt(frame->GetArgumentsLength()); | 1021 return Smi::FromInt(frame->GetArgumentsLength()); |
| 1020 } | 1022 } |
| 1021 | 1023 |
| 1022 | 1024 |
| 1023 RUNTIME_FUNCTION(RuntimeReference_Arguments) { | 1025 RUNTIME_FUNCTION(RuntimeReference_Arguments) { |
| 1024 SealHandleScope shs(isolate); | 1026 SealHandleScope shs(isolate); |
| 1025 return __RT_impl_Runtime_GetArgumentsProperty(args, isolate); | 1027 return __RT_impl_Runtime_GetArgumentsProperty(args, isolate); |
| 1026 } | 1028 } |
| 1027 } | 1029 } |
| 1028 } // namespace v8::internal | 1030 } // namespace v8::internal |
| OLD | NEW |