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 369 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
380 } | 380 } |
381 | 381 |
382 return true; | 382 return true; |
383 } | 383 } |
384 | 384 |
385 | 385 |
386 void IC::UpdateState(Handle<Object> receiver, Handle<Object> name) { | 386 void IC::UpdateState(Handle<Object> receiver, Handle<Object> name) { |
387 update_receiver_map(receiver); | 387 update_receiver_map(receiver); |
388 if (!name->IsString()) return; | 388 if (!name->IsString()) return; |
389 if (state() != MONOMORPHIC && state() != POLYMORPHIC) return; | 389 if (state() != MONOMORPHIC && state() != POLYMORPHIC) return; |
390 if (receiver->IsUndefined(isolate()) || receiver->IsNull(isolate())) return; | 390 if (receiver->IsNullOrUndefined(isolate())) return; |
391 | 391 |
392 // Remove the target from the code cache if it became invalid | 392 // Remove the target from the code cache if it became invalid |
393 // because of changes in the prototype chain to avoid hitting it | 393 // because of changes in the prototype chain to avoid hitting it |
394 // again. | 394 // again. |
395 if (ShouldRecomputeHandler(Handle<String>::cast(name))) { | 395 if (ShouldRecomputeHandler(Handle<String>::cast(name))) { |
396 MarkRecomputeHandler(name); | 396 MarkRecomputeHandler(name); |
397 } | 397 } |
398 } | 398 } |
399 | 399 |
400 | 400 |
(...skipping 256 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
657 nexus->ConfigurePolymorphic(maps, transitioned_maps, handlers); | 657 nexus->ConfigurePolymorphic(maps, transitioned_maps, handlers); |
658 | 658 |
659 vector_set_ = true; | 659 vector_set_ = true; |
660 OnTypeFeedbackChanged(isolate(), get_host()); | 660 OnTypeFeedbackChanged(isolate(), get_host()); |
661 } | 661 } |
662 | 662 |
663 | 663 |
664 MaybeHandle<Object> LoadIC::Load(Handle<Object> object, Handle<Name> name) { | 664 MaybeHandle<Object> LoadIC::Load(Handle<Object> object, Handle<Name> name) { |
665 // If the object is undefined or null it's illegal to try to get any | 665 // If the object is undefined or null it's illegal to try to get any |
666 // of its properties; throw a TypeError in that case. | 666 // of its properties; throw a TypeError in that case. |
667 if (object->IsUndefined(isolate()) || object->IsNull(isolate())) { | 667 if (object->IsNullOrUndefined(isolate())) { |
668 if (FLAG_use_ic && state() != UNINITIALIZED && state() != PREMONOMORPHIC) { | 668 if (FLAG_use_ic && state() != UNINITIALIZED && state() != PREMONOMORPHIC) { |
669 // Ensure the IC state progresses. | 669 // Ensure the IC state progresses. |
670 TRACE_HANDLER_STATS(isolate(), LoadIC_NonReceiver); | 670 TRACE_HANDLER_STATS(isolate(), LoadIC_NonReceiver); |
671 update_receiver_map(object); | 671 update_receiver_map(object); |
672 PatchCache(name, slow_stub()); | 672 PatchCache(name, slow_stub()); |
673 TRACE_IC("LoadIC", name); | 673 TRACE_IC("LoadIC", name); |
674 } | 674 } |
675 return TypeError(MessageTemplate::kNonObjectPropertyLoad, object, name); | 675 return TypeError(MessageTemplate::kNonObjectPropertyLoad, object, name); |
676 } | 676 } |
677 | 677 |
(...skipping 1133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1811 if (MigrateDeprecated(object) || object->IsJSProxy()) { | 1811 if (MigrateDeprecated(object) || object->IsJSProxy()) { |
1812 Handle<Object> result; | 1812 Handle<Object> result; |
1813 ASSIGN_RETURN_ON_EXCEPTION( | 1813 ASSIGN_RETURN_ON_EXCEPTION( |
1814 isolate(), result, | 1814 isolate(), result, |
1815 Object::SetProperty(object, name, value, language_mode()), Object); | 1815 Object::SetProperty(object, name, value, language_mode()), Object); |
1816 return result; | 1816 return result; |
1817 } | 1817 } |
1818 | 1818 |
1819 // If the object is undefined or null it's illegal to try to set any | 1819 // If the object is undefined or null it's illegal to try to set any |
1820 // properties on it; throw a TypeError in that case. | 1820 // properties on it; throw a TypeError in that case. |
1821 if (object->IsUndefined(isolate()) || object->IsNull(isolate())) { | 1821 if (object->IsNullOrUndefined(isolate())) { |
1822 if (FLAG_use_ic && state() != UNINITIALIZED && state() != PREMONOMORPHIC) { | 1822 if (FLAG_use_ic && state() != UNINITIALIZED && state() != PREMONOMORPHIC) { |
1823 // Ensure the IC state progresses. | 1823 // Ensure the IC state progresses. |
1824 TRACE_HANDLER_STATS(isolate(), StoreIC_NonReceiver); | 1824 TRACE_HANDLER_STATS(isolate(), StoreIC_NonReceiver); |
1825 update_receiver_map(object); | 1825 update_receiver_map(object); |
1826 PatchCache(name, slow_stub()); | 1826 PatchCache(name, slow_stub()); |
1827 TRACE_IC("StoreIC", name); | 1827 TRACE_IC("StoreIC", name); |
1828 } | 1828 } |
1829 return TypeError(MessageTemplate::kNonObjectPropertyStore, object, name); | 1829 return TypeError(MessageTemplate::kNonObjectPropertyStore, object, name); |
1830 } | 1830 } |
1831 | 1831 |
(...skipping 1380 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 |