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 837 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
848 Handle<JSObject> object = Handle<JSObject>::cast(holder); | 848 Handle<JSObject> object = Handle<JSObject>::cast(holder); |
849 Handle<Object> result; | 849 Handle<Object> result; |
850 ASSIGN_RETURN_FAILURE_ON_EXCEPTION(isolate, result, | 850 ASSIGN_RETURN_FAILURE_ON_EXCEPTION(isolate, result, |
851 JSReceiver::DeleteProperty(object, name)); | 851 JSReceiver::DeleteProperty(object, name)); |
852 return *result; | 852 return *result; |
853 } | 853 } |
854 | 854 |
855 | 855 |
856 static Object* ComputeReceiverForNonGlobal(Isolate* isolate, JSObject* holder) { | 856 static Object* ComputeReceiverForNonGlobal(Isolate* isolate, JSObject* holder) { |
857 DCHECK(!holder->IsGlobalObject()); | 857 DCHECK(!holder->IsGlobalObject()); |
858 Context* top = isolate->context(); | 858 |
859 // Get the context extension function. | |
860 JSFunction* context_extension_function = | |
861 top->native_context()->context_extension_function(); | |
862 // If the holder isn't a context extension object, we just return it | 859 // If the holder isn't a context extension object, we just return it |
863 // as the receiver. This allows arguments objects to be used as | 860 // as the receiver. This allows arguments objects to be used as |
864 // receivers, but only if they are put in the context scope chain | 861 // receivers, but only if they are put in the context scope chain |
865 // explicitly via a with-statement. | 862 // explicitly via a with-statement. |
866 Object* constructor = holder->map()->GetConstructor(); | 863 if (holder->map()->instance_type() != JS_CONTEXT_EXTENSION_OBJECT_TYPE) { |
867 if (constructor != context_extension_function) return holder; | 864 return holder; |
| 865 } |
868 // Fall back to using the global object as the implicit receiver if | 866 // Fall back to using the global object as the implicit receiver if |
869 // the property turns out to be a local variable allocated in a | 867 // the property turns out to be a local variable allocated in a |
870 // context extension object - introduced via eval. | 868 // context extension object - introduced via eval. |
871 return isolate->heap()->undefined_value(); | 869 return isolate->heap()->undefined_value(); |
872 } | 870 } |
873 | 871 |
874 | 872 |
875 static ObjectPair LoadLookupSlotHelper(Arguments args, Isolate* isolate, | 873 static ObjectPair LoadLookupSlotHelper(Arguments args, Isolate* isolate, |
876 bool throw_error) { | 874 bool throw_error) { |
877 HandleScope scope(isolate); | 875 HandleScope scope(isolate); |
(...skipping 244 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1122 return Smi::FromInt(frame->GetArgumentsLength()); | 1120 return Smi::FromInt(frame->GetArgumentsLength()); |
1123 } | 1121 } |
1124 | 1122 |
1125 | 1123 |
1126 RUNTIME_FUNCTION(RuntimeReference_Arguments) { | 1124 RUNTIME_FUNCTION(RuntimeReference_Arguments) { |
1127 SealHandleScope shs(isolate); | 1125 SealHandleScope shs(isolate); |
1128 return __RT_impl_Runtime_GetArgumentsProperty(args, isolate); | 1126 return __RT_impl_Runtime_GetArgumentsProperty(args, isolate); |
1129 } | 1127 } |
1130 } | 1128 } |
1131 } // namespace v8::internal | 1129 } // namespace v8::internal |
OLD | NEW |