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 288 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
299 } | 299 } |
300 | 300 |
301 PropertyAttributes attr = | 301 PropertyAttributes attr = |
302 static_cast<PropertyAttributes>(DONT_DELETE | READ_ONLY); | 302 static_cast<PropertyAttributes>(DONT_DELETE | READ_ONLY); |
303 | 303 |
304 // Strict mode handling not needed (legacy const is disallowed in strict | 304 // Strict mode handling not needed (legacy const is disallowed in strict |
305 // mode). | 305 // mode). |
306 | 306 |
307 // The declared const was configurable, and may have been deleted in the | 307 // The declared const was configurable, and may have been deleted in the |
308 // meanwhile. If so, re-introduce the variable in the context extension. | 308 // meanwhile. If so, re-introduce the variable in the context extension. |
309 DCHECK(context_arg->has_extension()); | |
310 if (attributes == ABSENT) { | 309 if (attributes == ABSENT) { |
311 holder = handle(context_arg->extension(), isolate); | 310 Handle<Context> declaration_context(context_arg->declaration_context()); |
| 311 DCHECK(declaration_context->has_extension()); |
| 312 holder = handle(declaration_context->extension(), isolate); |
| 313 CHECK(holder->IsJSObject()); |
312 } else { | 314 } else { |
313 // For JSContextExtensionObjects, the initializer can be run multiple times | 315 // For JSContextExtensionObjects, the initializer can be run multiple times |
314 // if in a for loop: for (var i = 0; i < 2; i++) { const x = i; }. Only the | 316 // if in a for loop: for (var i = 0; i < 2; i++) { const x = i; }. Only the |
315 // first assignment should go through. For JSGlobalObjects, additionally any | 317 // first assignment should go through. For JSGlobalObjects, additionally any |
316 // code can run in between that modifies the declared property. | 318 // code can run in between that modifies the declared property. |
317 DCHECK(holder->IsJSGlobalObject() || holder->IsJSContextExtensionObject()); | 319 DCHECK(holder->IsJSGlobalObject() || holder->IsJSContextExtensionObject()); |
318 | 320 |
319 LookupIterator it(holder, name, LookupIterator::HIDDEN_SKIP_INTERCEPTOR); | 321 LookupIterator it(holder, name, LookupIterator::HIDDEN_SKIP_INTERCEPTOR); |
320 Maybe<PropertyAttributes> maybe = JSReceiver::GetPropertyAttributes(&it); | 322 Maybe<PropertyAttributes> maybe = JSReceiver::GetPropertyAttributes(&it); |
321 if (!maybe.has_value) return isolate->heap()->exception(); | 323 if (!maybe.has_value) return isolate->heap()->exception(); |
(...skipping 747 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1069 return Smi::FromInt(frame->GetArgumentsLength()); | 1071 return Smi::FromInt(frame->GetArgumentsLength()); |
1070 } | 1072 } |
1071 | 1073 |
1072 | 1074 |
1073 RUNTIME_FUNCTION(RuntimeReference_Arguments) { | 1075 RUNTIME_FUNCTION(RuntimeReference_Arguments) { |
1074 SealHandleScope shs(isolate); | 1076 SealHandleScope shs(isolate); |
1075 return __RT_impl_Runtime_GetArgumentsProperty(args, isolate); | 1077 return __RT_impl_Runtime_GetArgumentsProperty(args, isolate); |
1076 } | 1078 } |
1077 } | 1079 } |
1078 } // namespace v8::internal | 1080 } // namespace v8::internal |
OLD | NEW |