OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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/ic/ic.h" | 5 #include "src/ic/ic.h" |
6 | 6 |
7 #include "src/accessors.h" | 7 #include "src/accessors.h" |
8 #include "src/api.h" | 8 #include "src/api.h" |
9 #include "src/arguments.h" | 9 #include "src/arguments.h" |
10 #include "src/base/bits.h" | 10 #include "src/base/bits.h" |
(...skipping 1033 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1044 TRACE_GENERIC_IC(isolate(), "LoadIC", "incompatible receiver type"); | 1044 TRACE_GENERIC_IC(isolate(), "LoadIC", "incompatible receiver type"); |
1045 code = slow_stub(); | 1045 code = slow_stub(); |
1046 } | 1046 } |
1047 } else if (accessors->IsAccessorPair()) { | 1047 } else if (accessors->IsAccessorPair()) { |
1048 Handle<Object> getter(Handle<AccessorPair>::cast(accessors)->getter(), | 1048 Handle<Object> getter(Handle<AccessorPair>::cast(accessors)->getter(), |
1049 isolate()); | 1049 isolate()); |
1050 Handle<JSObject> holder = lookup->GetHolder<JSObject>(); | 1050 Handle<JSObject> holder = lookup->GetHolder<JSObject>(); |
1051 Handle<Object> receiver = lookup->GetReceiver(); | 1051 Handle<Object> receiver = lookup->GetReceiver(); |
1052 if (getter->IsJSFunction() && holder->HasFastProperties()) { | 1052 if (getter->IsJSFunction() && holder->HasFastProperties()) { |
1053 Handle<JSFunction> function = Handle<JSFunction>::cast(getter); | 1053 Handle<JSFunction> function = Handle<JSFunction>::cast(getter); |
1054 if (receiver->IsJSObject() || function->IsBuiltin() || | 1054 if (receiver->IsJSObject() || function->shared()->IsBuiltin() || |
1055 !is_sloppy(function->shared()->language_mode())) { | 1055 !is_sloppy(function->shared()->language_mode())) { |
1056 CallOptimization call_optimization(function); | 1056 CallOptimization call_optimization(function); |
1057 if (call_optimization.is_simple_api_call() && | 1057 if (call_optimization.is_simple_api_call() && |
1058 !call_optimization.IsCompatibleReceiver(receiver, holder)) { | 1058 !call_optimization.IsCompatibleReceiver(receiver, holder)) { |
1059 TRACE_GENERIC_IC(isolate(), "LoadIC", | 1059 TRACE_GENERIC_IC(isolate(), "LoadIC", |
1060 "incompatible receiver type"); | 1060 "incompatible receiver type"); |
1061 code = slow_stub(); | 1061 code = slow_stub(); |
1062 } | 1062 } |
1063 } | 1063 } |
1064 } | 1064 } |
(...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1203 return compiler.CompileLoadCallback(lookup->name(), info); | 1203 return compiler.CompileLoadCallback(lookup->name(), info); |
1204 } | 1204 } |
1205 if (accessors->IsAccessorPair()) { | 1205 if (accessors->IsAccessorPair()) { |
1206 Handle<Object> getter(Handle<AccessorPair>::cast(accessors)->getter(), | 1206 Handle<Object> getter(Handle<AccessorPair>::cast(accessors)->getter(), |
1207 isolate()); | 1207 isolate()); |
1208 if (!getter->IsJSFunction()) break; | 1208 if (!getter->IsJSFunction()) break; |
1209 if (!holder->HasFastProperties()) break; | 1209 if (!holder->HasFastProperties()) break; |
1210 // When debugging we need to go the slow path to flood the accessor. | 1210 // When debugging we need to go the slow path to flood the accessor. |
1211 if (GetSharedFunctionInfo()->HasDebugInfo()) break; | 1211 if (GetSharedFunctionInfo()->HasDebugInfo()) break; |
1212 Handle<JSFunction> function = Handle<JSFunction>::cast(getter); | 1212 Handle<JSFunction> function = Handle<JSFunction>::cast(getter); |
1213 if (!receiver->IsJSObject() && !function->IsBuiltin() && | 1213 if (!receiver->IsJSObject() && !function->shared()->IsBuiltin() && |
1214 is_sloppy(function->shared()->language_mode())) { | 1214 is_sloppy(function->shared()->language_mode())) { |
1215 // Calling sloppy non-builtins with a value as the receiver | 1215 // Calling sloppy non-builtins with a value as the receiver |
1216 // requires boxing. | 1216 // requires boxing. |
1217 break; | 1217 break; |
1218 } | 1218 } |
1219 CallOptimization call_optimization(function); | 1219 CallOptimization call_optimization(function); |
1220 NamedLoadHandlerCompiler compiler(isolate(), map, holder, cache_holder); | 1220 NamedLoadHandlerCompiler compiler(isolate(), map, holder, cache_holder); |
1221 if (call_optimization.is_simple_api_call()) { | 1221 if (call_optimization.is_simple_api_call()) { |
1222 if (call_optimization.IsCompatibleReceiver(receiver, holder)) { | 1222 if (call_optimization.IsCompatibleReceiver(receiver, holder)) { |
1223 return compiler.CompileLoadCallback( | 1223 return compiler.CompileLoadCallback( |
(...skipping 1910 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3134 KeyedLoadICNexus nexus(vector, vector_slot); | 3134 KeyedLoadICNexus nexus(vector, vector_slot); |
3135 KeyedLoadIC ic(IC::EXTRA_CALL_FRAME, isolate, &nexus); | 3135 KeyedLoadIC ic(IC::EXTRA_CALL_FRAME, isolate, &nexus); |
3136 ic.UpdateState(receiver, key); | 3136 ic.UpdateState(receiver, key); |
3137 ASSIGN_RETURN_FAILURE_ON_EXCEPTION(isolate, result, ic.Load(receiver, key)); | 3137 ASSIGN_RETURN_FAILURE_ON_EXCEPTION(isolate, result, ic.Load(receiver, key)); |
3138 } | 3138 } |
3139 | 3139 |
3140 return *result; | 3140 return *result; |
3141 } | 3141 } |
3142 } // namespace internal | 3142 } // namespace internal |
3143 } // namespace v8 | 3143 } // namespace v8 |
OLD | NEW |