| 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 <iostream> | 7 #include <iostream> |
| 8 | 8 |
| 9 #include "src/accessors.h" | 9 #include "src/accessors.h" |
| 10 #include "src/api-arguments-inl.h" | 10 #include "src/api-arguments-inl.h" |
| (...skipping 865 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 876 // Indicate that we've handled this case. | 876 // Indicate that we've handled this case. |
| 877 DCHECK(UseVector()); | 877 DCHECK(UseVector()); |
| 878 vector_set_ = true; | 878 vector_set_ = true; |
| 879 break; | 879 break; |
| 880 case GENERIC: | 880 case GENERIC: |
| 881 UNREACHABLE(); | 881 UNREACHABLE(); |
| 882 break; | 882 break; |
| 883 } | 883 } |
| 884 } | 884 } |
| 885 | 885 |
| 886 Handle<Object> LoadIC::SimpleFieldLoad(FieldIndex index) { | 886 Handle<Object> LoadIC::SimpleFieldLoad(Isolate* isolate, FieldIndex index) { |
| 887 TRACE_HANDLER_STATS(isolate(), LoadIC_LoadFieldDH); | 887 TRACE_HANDLER_STATS(isolate, LoadIC_LoadFieldDH); |
| 888 return LoadHandler::LoadField(isolate(), index); | 888 return LoadHandler::LoadField(isolate, index); |
| 889 } | 889 } |
| 890 | 890 |
| 891 namespace { | 891 namespace { |
| 892 | 892 |
| 893 template <bool fill_array = true> | 893 template <bool fill_array = true> |
| 894 int InitPrototypeChecks(Isolate* isolate, Handle<Map> receiver_map, | 894 int InitPrototypeChecks(Isolate* isolate, Handle<Map> receiver_map, |
| 895 Handle<JSObject> holder, Handle<Name> name, | 895 Handle<JSObject> holder, Handle<Name> name, |
| 896 Handle<FixedArray> array, int first_index) { | 896 Handle<FixedArray> array, int first_index) { |
| 897 DCHECK(holder.is_null() || holder->HasFastProperties()); | 897 DCHECK(holder.is_null() || holder->HasFastProperties()); |
| 898 | 898 |
| (...skipping 404 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1303 Map::UpdateCodeCache(stub_holder_map, lookup->name(), code); | 1303 Map::UpdateCodeCache(stub_holder_map, lookup->name(), code); |
| 1304 } | 1304 } |
| 1305 return handler; | 1305 return handler; |
| 1306 } | 1306 } |
| 1307 | 1307 |
| 1308 Handle<Object> LoadIC::GetMapIndependentHandler(LookupIterator* lookup) { | 1308 Handle<Object> LoadIC::GetMapIndependentHandler(LookupIterator* lookup) { |
| 1309 Handle<Object> receiver = lookup->GetReceiver(); | 1309 Handle<Object> receiver = lookup->GetReceiver(); |
| 1310 if (receiver->IsString() && | 1310 if (receiver->IsString() && |
| 1311 Name::Equals(isolate()->factory()->length_string(), lookup->name())) { | 1311 Name::Equals(isolate()->factory()->length_string(), lookup->name())) { |
| 1312 FieldIndex index = FieldIndex::ForInObjectOffset(String::kLengthOffset); | 1312 FieldIndex index = FieldIndex::ForInObjectOffset(String::kLengthOffset); |
| 1313 return SimpleFieldLoad(index); | 1313 return SimpleFieldLoad(isolate(), index); |
| 1314 } | 1314 } |
| 1315 | 1315 |
| 1316 if (receiver->IsStringWrapper() && | 1316 if (receiver->IsStringWrapper() && |
| 1317 Name::Equals(isolate()->factory()->length_string(), lookup->name())) { | 1317 Name::Equals(isolate()->factory()->length_string(), lookup->name())) { |
| 1318 TRACE_HANDLER_STATS(isolate(), LoadIC_StringLengthStub); | 1318 TRACE_HANDLER_STATS(isolate(), LoadIC_StringLengthStub); |
| 1319 StringLengthStub string_length_stub(isolate()); | 1319 StringLengthStub string_length_stub(isolate()); |
| 1320 return string_length_stub.GetCode(); | 1320 return string_length_stub.GetCode(); |
| 1321 } | 1321 } |
| 1322 | 1322 |
| 1323 // Use specialized code for getting prototype of functions. | 1323 // Use specialized code for getting prototype of functions. |
| (...skipping 17 matching lines...) Expand all Loading... |
| 1341 break; // Custom-compiled handler. | 1341 break; // Custom-compiled handler. |
| 1342 | 1342 |
| 1343 case LookupIterator::ACCESSOR: { | 1343 case LookupIterator::ACCESSOR: { |
| 1344 // Use simple field loads for some well-known callback properties. | 1344 // Use simple field loads for some well-known callback properties. |
| 1345 // The method will only return true for absolute truths based on the | 1345 // The method will only return true for absolute truths based on the |
| 1346 // receiver maps. | 1346 // receiver maps. |
| 1347 int object_offset; | 1347 int object_offset; |
| 1348 if (Accessors::IsJSObjectFieldAccessor(map, lookup->name(), | 1348 if (Accessors::IsJSObjectFieldAccessor(map, lookup->name(), |
| 1349 &object_offset)) { | 1349 &object_offset)) { |
| 1350 FieldIndex index = FieldIndex::ForInObjectOffset(object_offset, *map); | 1350 FieldIndex index = FieldIndex::ForInObjectOffset(object_offset, *map); |
| 1351 return SimpleFieldLoad(index); | 1351 return SimpleFieldLoad(isolate(), index); |
| 1352 } | 1352 } |
| 1353 | 1353 |
| 1354 if (IsCompatibleReceiver(lookup, map)) { | 1354 if (IsCompatibleReceiver(lookup, map)) { |
| 1355 Handle<Object> accessors = lookup->GetAccessors(); | 1355 Handle<Object> accessors = lookup->GetAccessors(); |
| 1356 if (accessors->IsAccessorPair()) { | 1356 if (accessors->IsAccessorPair()) { |
| 1357 if (!holder->HasFastProperties()) { | 1357 if (!holder->HasFastProperties()) { |
| 1358 TRACE_HANDLER_STATS(isolate(), LoadIC_SlowStub); | 1358 TRACE_HANDLER_STATS(isolate(), LoadIC_SlowStub); |
| 1359 return slow_stub(); | 1359 return slow_stub(); |
| 1360 } | 1360 } |
| 1361 // When debugging we need to go the slow path to flood the accessor. | 1361 // When debugging we need to go the slow path to flood the accessor. |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1412 TRACE_HANDLER_STATS(isolate(), LoadIC_SlowStub); | 1412 TRACE_HANDLER_STATS(isolate(), LoadIC_SlowStub); |
| 1413 return slow_stub(); | 1413 return slow_stub(); |
| 1414 } | 1414 } |
| 1415 TRACE_HANDLER_STATS(isolate(), LoadIC_LoadNormal); | 1415 TRACE_HANDLER_STATS(isolate(), LoadIC_LoadNormal); |
| 1416 return isolate()->builtins()->LoadIC_Normal(); | 1416 return isolate()->builtins()->LoadIC_Normal(); |
| 1417 } | 1417 } |
| 1418 | 1418 |
| 1419 // -------------- Fields -------------- | 1419 // -------------- Fields -------------- |
| 1420 if (lookup->property_details().type() == DATA) { | 1420 if (lookup->property_details().type() == DATA) { |
| 1421 FieldIndex field = lookup->GetFieldIndex(); | 1421 FieldIndex field = lookup->GetFieldIndex(); |
| 1422 Handle<Object> smi_handler = SimpleFieldLoad(field); | 1422 Handle<Object> smi_handler = SimpleFieldLoad(isolate(), field); |
| 1423 if (receiver_is_holder) { | 1423 if (receiver_is_holder) { |
| 1424 return smi_handler; | 1424 return smi_handler; |
| 1425 } | 1425 } |
| 1426 TRACE_HANDLER_STATS(isolate(), LoadIC_LoadFieldFromPrototypeDH); | 1426 TRACE_HANDLER_STATS(isolate(), LoadIC_LoadFieldFromPrototypeDH); |
| 1427 return LoadFromPrototype(map, holder, lookup->name(), smi_handler); | 1427 return LoadFromPrototype(map, holder, lookup->name(), smi_handler); |
| 1428 } | 1428 } |
| 1429 | 1429 |
| 1430 // -------------- Constant properties -------------- | 1430 // -------------- Constant properties -------------- |
| 1431 DCHECK(lookup->property_details().type() == DATA_CONSTANT); | 1431 DCHECK(lookup->property_details().type() == DATA_CONSTANT); |
| 1432 Handle<Object> smi_handler = | 1432 Handle<Object> smi_handler = |
| (...skipping 1779 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3212 DCHECK_EQ(LookupIterator::INTERCEPTOR, it.state()); | 3212 DCHECK_EQ(LookupIterator::INTERCEPTOR, it.state()); |
| 3213 it.Next(); | 3213 it.Next(); |
| 3214 ASSIGN_RETURN_FAILURE_ON_EXCEPTION(isolate, result, | 3214 ASSIGN_RETURN_FAILURE_ON_EXCEPTION(isolate, result, |
| 3215 Object::GetProperty(&it)); | 3215 Object::GetProperty(&it)); |
| 3216 } | 3216 } |
| 3217 | 3217 |
| 3218 return *result; | 3218 return *result; |
| 3219 } | 3219 } |
| 3220 } // namespace internal | 3220 } // namespace internal |
| 3221 } // namespace v8 | 3221 } // namespace v8 |
| OLD | NEW |