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-arguments-inl.h" | 8 #include "src/api-arguments-inl.h" |
9 #include "src/api.h" | 9 #include "src/api.h" |
10 #include "src/arguments.h" | 10 #include "src/arguments.h" |
(...skipping 1223 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1234 &object_offset)); | 1234 &object_offset)); |
1235 #endif | 1235 #endif |
1236 | 1236 |
1237 DCHECK(IsCompatibleReceiver(lookup, map)); | 1237 DCHECK(IsCompatibleReceiver(lookup, map)); |
1238 Handle<Object> accessors = lookup->GetAccessors(); | 1238 Handle<Object> accessors = lookup->GetAccessors(); |
1239 if (accessors->IsAccessorPair()) { | 1239 if (accessors->IsAccessorPair()) { |
1240 DCHECK(holder->HasFastProperties()); | 1240 DCHECK(holder->HasFastProperties()); |
1241 DCHECK(!GetSharedFunctionInfo()->HasDebugInfo()); | 1241 DCHECK(!GetSharedFunctionInfo()->HasDebugInfo()); |
1242 Handle<Object> getter(Handle<AccessorPair>::cast(accessors)->getter(), | 1242 Handle<Object> getter(Handle<AccessorPair>::cast(accessors)->getter(), |
1243 isolate()); | 1243 isolate()); |
| 1244 |
| 1245 MaybeHandle<Name> maybe_name = |
| 1246 FunctionTemplateInfo::TryGetCachePropertyName(isolate(), getter); |
| 1247 if (!maybe_name.is_null()) { |
| 1248 Handle<Name> name = maybe_name.ToHandleChecked(); |
| 1249 LookupIterator cache_it(lookup->GetReceiver(), name, holder); |
| 1250 CHECK_EQ(LookupIterator::DATA, cache_it.state()); |
| 1251 return CompileHandler(&cache_it, unused, cache_holder); |
| 1252 } |
| 1253 |
1244 CallOptimization call_optimization(getter); | 1254 CallOptimization call_optimization(getter); |
1245 NamedLoadHandlerCompiler compiler(isolate(), map, holder, cache_holder); | 1255 NamedLoadHandlerCompiler compiler(isolate(), map, holder, cache_holder); |
1246 if (call_optimization.is_simple_api_call()) { | 1256 if (call_optimization.is_simple_api_call()) { |
1247 TRACE_HANDLER_STATS(isolate(), LoadIC_LoadCallback); | 1257 TRACE_HANDLER_STATS(isolate(), LoadIC_LoadCallback); |
1248 int index = lookup->GetAccessorIndex(); | 1258 int index = lookup->GetAccessorIndex(); |
1249 Handle<Code> code = compiler.CompileLoadCallback( | 1259 Handle<Code> code = compiler.CompileLoadCallback( |
1250 lookup->name(), call_optimization, index, slow_stub()); | 1260 lookup->name(), call_optimization, index, slow_stub()); |
1251 return code; | 1261 return code; |
1252 } | 1262 } |
1253 TRACE_HANDLER_STATS(isolate(), LoadIC_LoadViaGetter); | 1263 TRACE_HANDLER_STATS(isolate(), LoadIC_LoadViaGetter); |
(...skipping 27 matching lines...) Expand all Loading... |
1281 NamedLoadHandlerCompiler compiler(isolate(), map, holder, cache_holder); | 1291 NamedLoadHandlerCompiler compiler(isolate(), map, holder, cache_holder); |
1282 Handle<PropertyCell> cell = lookup->GetPropertyCell(); | 1292 Handle<PropertyCell> cell = lookup->GetPropertyCell(); |
1283 Handle<Code> code = compiler.CompileLoadGlobal( | 1293 Handle<Code> code = compiler.CompileLoadGlobal( |
1284 cell, lookup->name(), lookup->IsConfigurable()); | 1294 cell, lookup->name(), lookup->IsConfigurable()); |
1285 return code; | 1295 return code; |
1286 } | 1296 } |
1287 | 1297 |
1288 // -------------- Fields -------------- | 1298 // -------------- Fields -------------- |
1289 if (lookup->property_details().type() == DATA) { | 1299 if (lookup->property_details().type() == DATA) { |
1290 FieldIndex field = lookup->GetFieldIndex(); | 1300 FieldIndex field = lookup->GetFieldIndex(); |
1291 DCHECK(!receiver_is_holder); | |
1292 TRACE_HANDLER_STATS(isolate(), LoadIC_LoadField); | 1301 TRACE_HANDLER_STATS(isolate(), LoadIC_LoadField); |
1293 NamedLoadHandlerCompiler compiler(isolate(), map, holder, cache_holder); | 1302 NamedLoadHandlerCompiler compiler(isolate(), map, holder, cache_holder); |
1294 return compiler.CompileLoadField(lookup->name(), field); | 1303 return compiler.CompileLoadField(lookup->name(), field); |
1295 } | 1304 } |
1296 | 1305 |
1297 // -------------- Constant properties -------------- | 1306 // -------------- Constant properties -------------- |
1298 DCHECK(lookup->property_details().type() == DATA_CONSTANT); | 1307 DCHECK(lookup->property_details().type() == DATA_CONSTANT); |
1299 DCHECK(!receiver_is_holder); | 1308 DCHECK(!receiver_is_holder); |
1300 TRACE_HANDLER_STATS(isolate(), LoadIC_LoadConstant); | 1309 TRACE_HANDLER_STATS(isolate(), LoadIC_LoadConstant); |
1301 NamedLoadHandlerCompiler compiler(isolate(), map, holder, cache_holder); | 1310 NamedLoadHandlerCompiler compiler(isolate(), map, holder, cache_holder); |
(...skipping 1618 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2920 DCHECK_EQ(LookupIterator::INTERCEPTOR, it.state()); | 2929 DCHECK_EQ(LookupIterator::INTERCEPTOR, it.state()); |
2921 it.Next(); | 2930 it.Next(); |
2922 ASSIGN_RETURN_FAILURE_ON_EXCEPTION(isolate, result, | 2931 ASSIGN_RETURN_FAILURE_ON_EXCEPTION(isolate, result, |
2923 Object::GetProperty(&it)); | 2932 Object::GetProperty(&it)); |
2924 } | 2933 } |
2925 | 2934 |
2926 return *result; | 2935 return *result; |
2927 } | 2936 } |
2928 } // namespace internal | 2937 } // namespace internal |
2929 } // namespace v8 | 2938 } // namespace v8 |
OLD | NEW |