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 1388 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1399 isolate(), result, | 1399 isolate(), result, |
1400 Runtime::GetObjectProperty(isolate(), object, key, language_mode()), | 1400 Runtime::GetObjectProperty(isolate(), object, key, language_mode()), |
1401 Object); | 1401 Object); |
1402 return result; | 1402 return result; |
1403 } | 1403 } |
1404 | 1404 |
1405 | 1405 |
1406 bool StoreIC::LookupForWrite(LookupIterator* it, Handle<Object> value, | 1406 bool StoreIC::LookupForWrite(LookupIterator* it, Handle<Object> value, |
1407 JSReceiver::StoreFromKeyed store_mode) { | 1407 JSReceiver::StoreFromKeyed store_mode) { |
1408 // Disable ICs for non-JSObjects for now. | 1408 // Disable ICs for non-JSObjects for now. |
1409 Handle<Object> receiver = it->GetReceiver(); | 1409 Handle<Object> object = it->GetReceiver(); |
1410 if (!receiver->IsJSObject()) return false; | 1410 if (!object->IsJSObject()) return false; |
1411 DCHECK(!Handle<JSObject>::cast(receiver)->map()->is_deprecated()); | 1411 Handle<JSObject> receiver = Handle<JSObject>::cast(object); |
| 1412 DCHECK(!receiver->map()->is_deprecated()); |
1412 | 1413 |
1413 for (; it->IsFound(); it->Next()) { | 1414 for (; it->IsFound(); it->Next()) { |
1414 switch (it->state()) { | 1415 switch (it->state()) { |
1415 case LookupIterator::NOT_FOUND: | 1416 case LookupIterator::NOT_FOUND: |
1416 case LookupIterator::TRANSITION: | 1417 case LookupIterator::TRANSITION: |
1417 UNREACHABLE(); | 1418 UNREACHABLE(); |
1418 case LookupIterator::JSPROXY: | 1419 case LookupIterator::JSPROXY: |
1419 return false; | 1420 return false; |
1420 case LookupIterator::INTERCEPTOR: { | 1421 case LookupIterator::INTERCEPTOR: { |
1421 Handle<JSObject> holder = it->GetHolder<JSObject>(); | 1422 Handle<JSObject> holder = it->GetHolder<JSObject>(); |
(...skipping 19 matching lines...) Expand all Loading... |
1441 if (receiver.is_identical_to(holder)) { | 1442 if (receiver.is_identical_to(holder)) { |
1442 it->PrepareForDataProperty(value); | 1443 it->PrepareForDataProperty(value); |
1443 // The previous receiver map might just have been deprecated, | 1444 // The previous receiver map might just have been deprecated, |
1444 // so reload it. | 1445 // so reload it. |
1445 update_receiver_map(receiver); | 1446 update_receiver_map(receiver); |
1446 return true; | 1447 return true; |
1447 } | 1448 } |
1448 | 1449 |
1449 // Receiver != holder. | 1450 // Receiver != holder. |
1450 if (receiver->IsJSGlobalProxy()) { | 1451 if (receiver->IsJSGlobalProxy()) { |
1451 PrototypeIterator iter(it->isolate(), | 1452 PrototypeIterator iter(it->isolate(), receiver); |
1452 Handle<JSGlobalProxy>::cast(receiver)); | |
1453 return it->GetHolder<Object>().is_identical_to( | 1453 return it->GetHolder<Object>().is_identical_to( |
1454 PrototypeIterator::GetCurrent(iter)); | 1454 PrototypeIterator::GetCurrent(iter)); |
1455 } | 1455 } |
1456 | 1456 |
1457 if (it->HolderIsReceiverOrHiddenPrototype()) return false; | 1457 if (it->HolderIsReceiverOrHiddenPrototype()) return false; |
1458 | 1458 |
1459 it->PrepareTransitionToDataProperty(value, NONE, store_mode); | 1459 if (it->ExtendingNonExtensible(receiver)) return false; |
| 1460 it->PrepareTransitionToDataProperty(receiver, value, NONE, store_mode); |
1460 return it->IsCacheableTransition(); | 1461 return it->IsCacheableTransition(); |
1461 } | 1462 } |
1462 } | 1463 } |
1463 } | 1464 } |
1464 | 1465 |
1465 it->PrepareTransitionToDataProperty(value, NONE, store_mode); | 1466 receiver = it->GetStoreTarget(); |
| 1467 if (it->ExtendingNonExtensible(receiver)) return false; |
| 1468 it->PrepareTransitionToDataProperty(receiver, value, NONE, store_mode); |
1466 return it->IsCacheableTransition(); | 1469 return it->IsCacheableTransition(); |
1467 } | 1470 } |
1468 | 1471 |
1469 | 1472 |
1470 MaybeHandle<Object> StoreIC::Store(Handle<Object> object, Handle<Name> name, | 1473 MaybeHandle<Object> StoreIC::Store(Handle<Object> object, Handle<Name> name, |
1471 Handle<Object> value, | 1474 Handle<Object> value, |
1472 JSReceiver::StoreFromKeyed store_mode) { | 1475 JSReceiver::StoreFromKeyed store_mode) { |
1473 // Check if the name is trivially convertible to an index and set the element. | 1476 // Check if the name is trivially convertible to an index and set the element. |
1474 uint32_t index; | 1477 uint32_t index; |
1475 if (kind() == Code::KEYED_STORE_IC && name->AsArrayIndex(&index)) { | 1478 if (kind() == Code::KEYED_STORE_IC && name->AsArrayIndex(&index)) { |
(...skipping 1487 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2963 KeyedLoadICNexus nexus(vector, vector_slot); | 2966 KeyedLoadICNexus nexus(vector, vector_slot); |
2964 KeyedLoadIC ic(IC::EXTRA_CALL_FRAME, isolate, &nexus); | 2967 KeyedLoadIC ic(IC::EXTRA_CALL_FRAME, isolate, &nexus); |
2965 ic.UpdateState(receiver, key); | 2968 ic.UpdateState(receiver, key); |
2966 ASSIGN_RETURN_FAILURE_ON_EXCEPTION(isolate, result, ic.Load(receiver, key)); | 2969 ASSIGN_RETURN_FAILURE_ON_EXCEPTION(isolate, result, ic.Load(receiver, key)); |
2967 } | 2970 } |
2968 | 2971 |
2969 return *result; | 2972 return *result; |
2970 } | 2973 } |
2971 } // namespace internal | 2974 } // namespace internal |
2972 } // namespace v8 | 2975 } // namespace v8 |
OLD | NEW |