| OLD | NEW |
| 1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
| 2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
| 3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
| 4 // met: | 4 // met: |
| 5 // | 5 // |
| 6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
| 7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
| 8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
| 9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
| 10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
| (...skipping 427 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 438 if (!lookup->IsInterceptor() || !lookup->IsCacheable()) { | 438 if (!lookup->IsInterceptor() || !lookup->IsCacheable()) { |
| 439 return; | 439 return; |
| 440 } | 440 } |
| 441 | 441 |
| 442 Handle<JSObject> holder(lookup->holder()); | 442 Handle<JSObject> holder(lookup->holder()); |
| 443 if (HasInterceptorGetter(*holder)) { | 443 if (HasInterceptorGetter(*holder)) { |
| 444 return; | 444 return; |
| 445 } | 445 } |
| 446 | 446 |
| 447 holder->LocalLookupRealNamedProperty(*name, lookup); | 447 holder->LocalLookupRealNamedProperty(*name, lookup); |
| 448 if (lookup->IsProperty()) { | 448 if (lookup->IsFound()) { |
| 449 ASSERT(!lookup->IsInterceptor()); | 449 ASSERT(!lookup->IsInterceptor()); |
| 450 return; | 450 return; |
| 451 } | 451 } |
| 452 | 452 |
| 453 Handle<Object> proto(holder->GetPrototype()); | 453 Handle<Object> proto(holder->GetPrototype()); |
| 454 if (proto->IsNull()) { | 454 if (proto->IsNull()) { |
| 455 lookup->NotFound(); | 455 ASSERT(!lookup->IsFound()); |
| 456 return; | 456 return; |
| 457 } | 457 } |
| 458 | 458 |
| 459 object = proto; | 459 object = proto; |
| 460 } | 460 } |
| 461 } | 461 } |
| 462 | 462 |
| 463 | 463 |
| 464 Handle<Object> CallICBase::TryCallAsFunction(Handle<Object> object) { | 464 Handle<Object> CallICBase::TryCallAsFunction(Handle<Object> object) { |
| 465 Handle<Object> delegate = Execution::GetFunctionDelegate(object); | 465 Handle<Object> delegate = Execution::GetFunctionDelegate(object); |
| (...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 526 result = TryCallAsFunction(result); | 526 result = TryCallAsFunction(result); |
| 527 if (result->IsJSFunction()) return *result; | 527 if (result->IsJSFunction()) return *result; |
| 528 | 528 |
| 529 // Otherwise, it will fail in the lookup step. | 529 // Otherwise, it will fail in the lookup step. |
| 530 } | 530 } |
| 531 | 531 |
| 532 // Lookup the property in the object. | 532 // Lookup the property in the object. |
| 533 LookupResult lookup(isolate()); | 533 LookupResult lookup(isolate()); |
| 534 LookupForRead(object, name, &lookup); | 534 LookupForRead(object, name, &lookup); |
| 535 | 535 |
| 536 if (!lookup.IsProperty()) { | 536 if (!lookup.IsFound()) { |
| 537 // If the object does not have the requested property, check which | 537 // If the object does not have the requested property, check which |
| 538 // exception we need to throw. | 538 // exception we need to throw. |
| 539 return IsContextual(object) | 539 return IsContextual(object) |
| 540 ? ReferenceError("not_defined", name) | 540 ? ReferenceError("not_defined", name) |
| 541 : TypeError("undefined_method", object, name); | 541 : TypeError("undefined_method", object, name); |
| 542 } | 542 } |
| 543 | 543 |
| 544 // Lookup is valid: Update inline cache and stub cache. | 544 // Lookup is valid: Update inline cache and stub cache. |
| 545 if (FLAG_use_ic) { | 545 if (FLAG_use_ic) { |
| 546 UpdateCaches(&lookup, state, extra_ic_state, object, name); | 546 UpdateCaches(&lookup, state, extra_ic_state, object, name); |
| (...skipping 346 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 893 // Check if the name is trivially convertible to an index and get | 893 // Check if the name is trivially convertible to an index and get |
| 894 // the element if so. | 894 // the element if so. |
| 895 uint32_t index; | 895 uint32_t index; |
| 896 if (name->AsArrayIndex(&index)) return object->GetElement(index); | 896 if (name->AsArrayIndex(&index)) return object->GetElement(index); |
| 897 | 897 |
| 898 // Named lookup in the object. | 898 // Named lookup in the object. |
| 899 LookupResult lookup(isolate()); | 899 LookupResult lookup(isolate()); |
| 900 LookupForRead(object, name, &lookup); | 900 LookupForRead(object, name, &lookup); |
| 901 | 901 |
| 902 // If we did not find a property, check if we need to throw an exception. | 902 // If we did not find a property, check if we need to throw an exception. |
| 903 if (!lookup.IsProperty()) { | 903 if (!lookup.IsFound()) { |
| 904 if (IsContextual(object)) { | 904 if (IsContextual(object)) { |
| 905 return ReferenceError("not_defined", name); | 905 return ReferenceError("not_defined", name); |
| 906 } | 906 } |
| 907 LOG(isolate(), SuspectReadEvent(*name, *object)); | 907 LOG(isolate(), SuspectReadEvent(*name, *object)); |
| 908 } | 908 } |
| 909 | 909 |
| 910 // Update inline cache and stub cache. | 910 // Update inline cache and stub cache. |
| 911 if (FLAG_use_ic) { | 911 if (FLAG_use_ic) { |
| 912 UpdateCaches(&lookup, state, object, name); | 912 UpdateCaches(&lookup, state, object, name); |
| 913 } | 913 } |
| (...skipping 245 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1159 // Rewrite to the generic keyed load stub. | 1159 // Rewrite to the generic keyed load stub. |
| 1160 if (FLAG_use_ic) set_target(*generic_stub()); | 1160 if (FLAG_use_ic) set_target(*generic_stub()); |
| 1161 return Runtime::GetElementOrCharAt(isolate(), object, index); | 1161 return Runtime::GetElementOrCharAt(isolate(), object, index); |
| 1162 } | 1162 } |
| 1163 | 1163 |
| 1164 // Named lookup. | 1164 // Named lookup. |
| 1165 LookupResult lookup(isolate()); | 1165 LookupResult lookup(isolate()); |
| 1166 LookupForRead(object, name, &lookup); | 1166 LookupForRead(object, name, &lookup); |
| 1167 | 1167 |
| 1168 // If we did not find a property, check if we need to throw an exception. | 1168 // If we did not find a property, check if we need to throw an exception. |
| 1169 if (!lookup.IsProperty() && IsContextual(object)) { | 1169 if (!lookup.IsFound() && IsContextual(object)) { |
| 1170 return ReferenceError("not_defined", name); | 1170 return ReferenceError("not_defined", name); |
| 1171 } | 1171 } |
| 1172 | 1172 |
| 1173 if (FLAG_use_ic) { | 1173 if (FLAG_use_ic) { |
| 1174 UpdateCaches(&lookup, state, object, name); | 1174 UpdateCaches(&lookup, state, object, name); |
| 1175 } | 1175 } |
| 1176 | 1176 |
| 1177 PropertyAttributes attr; | 1177 PropertyAttributes attr; |
| 1178 if (lookup.IsInterceptor()) { | 1178 if (lookup.IsInterceptor()) { |
| 1179 // Get the property. | 1179 // Get the property. |
| (...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1310 return !lookup->GetTransitionDetails().IsReadOnly(); | 1310 return !lookup->GetTransitionDetails().IsReadOnly(); |
| 1311 } | 1311 } |
| 1312 return !lookup->IsReadOnly(); | 1312 return !lookup->IsReadOnly(); |
| 1313 } | 1313 } |
| 1314 | 1314 |
| 1315 | 1315 |
| 1316 static bool LookupForWrite(Handle<JSObject> receiver, | 1316 static bool LookupForWrite(Handle<JSObject> receiver, |
| 1317 Handle<String> name, | 1317 Handle<String> name, |
| 1318 LookupResult* lookup) { | 1318 LookupResult* lookup) { |
| 1319 receiver->LocalLookup(*name, lookup); | 1319 receiver->LocalLookup(*name, lookup); |
| 1320 if (!lookup->IsFound()) { |
| 1321 receiver->map()->LookupTransition(*receiver, *name, lookup); |
| 1322 } |
| 1320 if (!StoreICableLookup(lookup)) { | 1323 if (!StoreICableLookup(lookup)) { |
| 1321 // 2nd chance: There can be accessors somewhere in the prototype chain. Note | 1324 // 2nd chance: There can be accessors somewhere in the prototype chain. Note |
| 1322 // that we explicitly exclude native accessors for now, because the stubs | 1325 // that we explicitly exclude native accessors for now, because the stubs |
| 1323 // are not yet prepared for this scenario. | 1326 // are not yet prepared for this scenario. |
| 1324 receiver->Lookup(*name, lookup); | 1327 receiver->Lookup(*name, lookup); |
| 1325 if (!lookup->IsPropertyCallbacks()) return false; | 1328 if (!lookup->IsPropertyCallbacks()) return false; |
| 1326 Handle<Object> callback(lookup->GetCallbackObject()); | 1329 Handle<Object> callback(lookup->GetCallbackObject()); |
| 1327 return callback->IsAccessorPair() && StoreICableLookup(lookup); | 1330 return callback->IsAccessorPair() && StoreICableLookup(lookup); |
| 1328 } | 1331 } |
| 1329 | 1332 |
| (...skipping 1363 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2693 #undef ADDR | 2696 #undef ADDR |
| 2694 }; | 2697 }; |
| 2695 | 2698 |
| 2696 | 2699 |
| 2697 Address IC::AddressFromUtilityId(IC::UtilityId id) { | 2700 Address IC::AddressFromUtilityId(IC::UtilityId id) { |
| 2698 return IC_utilities[id]; | 2701 return IC_utilities[id]; |
| 2699 } | 2702 } |
| 2700 | 2703 |
| 2701 | 2704 |
| 2702 } } // namespace v8::internal | 2705 } } // namespace v8::internal |
| OLD | NEW |