Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1)

Side by Side Diff: src/runtime/runtime-scopes.cc

Issue 953283004: Make ComputeReceiverForNonGlobal faster (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
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
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698