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 209 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
220 return code; | 220 return code; |
221 } | 221 } |
222 | 222 |
223 | 223 |
224 bool IC::AddressIsOptimizedCode() const { | 224 bool IC::AddressIsOptimizedCode() const { |
225 Code* host = | 225 Code* host = |
226 isolate()->inner_pointer_to_code_cache()->GetCacheEntry(address())->code; | 226 isolate()->inner_pointer_to_code_cache()->GetCacheEntry(address())->code; |
227 return host->kind() == Code::OPTIMIZED_FUNCTION; | 227 return host->kind() == Code::OPTIMIZED_FUNCTION; |
228 } | 228 } |
229 | 229 |
230 | |
231 static void LookupForRead(LookupIterator* it) { | 230 static void LookupForRead(LookupIterator* it) { |
232 for (; it->IsFound(); it->Next()) { | 231 for (; it->IsFound(); it->Next()) { |
233 switch (it->state()) { | 232 switch (it->state()) { |
234 case LookupIterator::NOT_FOUND: | 233 case LookupIterator::NOT_FOUND: |
235 case LookupIterator::TRANSITION: | 234 case LookupIterator::TRANSITION: |
236 UNREACHABLE(); | 235 UNREACHABLE(); |
237 case LookupIterator::JSPROXY: | 236 case LookupIterator::JSPROXY: |
238 return; | 237 return; |
239 case LookupIterator::INTERCEPTOR: { | 238 case LookupIterator::INTERCEPTOR: { |
240 // If there is a getter, return; otherwise loop to perform the lookup. | 239 // If there is a getter, return; otherwise loop to perform the lookup. |
(...skipping 393 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
634 | 633 |
635 if (use_ic && LoadScriptContextFieldStub::Accepted(&lookup_result)) { | 634 if (use_ic && LoadScriptContextFieldStub::Accepted(&lookup_result)) { |
636 TRACE_HANDLER_STATS(isolate(), LoadIC_LoadScriptContextFieldStub); | 635 TRACE_HANDLER_STATS(isolate(), LoadIC_LoadScriptContextFieldStub); |
637 LoadScriptContextFieldStub stub(isolate(), &lookup_result); | 636 LoadScriptContextFieldStub stub(isolate(), &lookup_result); |
638 PatchCache(name, stub.GetCode()); | 637 PatchCache(name, stub.GetCode()); |
639 } | 638 } |
640 return result; | 639 return result; |
641 } | 640 } |
642 } | 641 } |
643 | 642 |
| 643 if (state() != UNINITIALIZED) { |
| 644 JSObject::MakePrototypesFast(object, kStartAtReceiver, isolate()); |
| 645 } |
644 // Named lookup in the object. | 646 // Named lookup in the object. |
645 LookupIterator it(object, name); | 647 LookupIterator it(object, name); |
646 LookupForRead(&it); | 648 LookupForRead(&it); |
647 | 649 |
648 if (it.IsFound() || !ShouldThrowReferenceError(object)) { | 650 if (it.IsFound() || !ShouldThrowReferenceError(object)) { |
649 // Update inline cache and stub cache. | 651 // Update inline cache and stub cache. |
650 if (use_ic) UpdateCaches(&it); | 652 if (use_ic) UpdateCaches(&it); |
651 | 653 |
652 // Get the property. | 654 // Get the property. |
653 Handle<Object> result; | 655 Handle<Object> result; |
(...skipping 869 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1523 Object::SetProperty(object, name, value, language_mode()), Object); | 1525 Object::SetProperty(object, name, value, language_mode()), Object); |
1524 return result; | 1526 return result; |
1525 } | 1527 } |
1526 | 1528 |
1527 // If the object is undefined or null it's illegal to try to set any | 1529 // If the object is undefined or null it's illegal to try to set any |
1528 // properties on it; throw a TypeError in that case. | 1530 // properties on it; throw a TypeError in that case. |
1529 if (object->IsUndefined(isolate()) || object->IsNull()) { | 1531 if (object->IsUndefined(isolate()) || object->IsNull()) { |
1530 return TypeError(MessageTemplate::kNonObjectPropertyStore, object, name); | 1532 return TypeError(MessageTemplate::kNonObjectPropertyStore, object, name); |
1531 } | 1533 } |
1532 | 1534 |
| 1535 if (state() != UNINITIALIZED) { |
| 1536 JSObject::MakePrototypesFast(object, kStartAtPrototype, isolate()); |
| 1537 } |
1533 LookupIterator it(object, name); | 1538 LookupIterator it(object, name); |
1534 if (FLAG_use_ic) UpdateCaches(&it, value, store_mode); | 1539 if (FLAG_use_ic) UpdateCaches(&it, value, store_mode); |
1535 | 1540 |
1536 MAYBE_RETURN_NULL( | 1541 MAYBE_RETURN_NULL( |
1537 Object::SetProperty(&it, value, language_mode(), store_mode)); | 1542 Object::SetProperty(&it, value, language_mode(), store_mode)); |
1538 return value; | 1543 return value; |
1539 } | 1544 } |
1540 | 1545 |
1541 Handle<Code> CallIC::initialize_stub_in_optimized_code( | 1546 Handle<Code> CallIC::initialize_stub_in_optimized_code( |
1542 Isolate* isolate, int argc, ConvertReceiverMode mode, | 1547 Isolate* isolate, int argc, ConvertReceiverMode mode, |
(...skipping 1395 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2938 DCHECK_EQ(FeedbackVectorSlotKind::KEYED_LOAD_IC, | 2943 DCHECK_EQ(FeedbackVectorSlotKind::KEYED_LOAD_IC, |
2939 vector->GetKind(vector_slot)); | 2944 vector->GetKind(vector_slot)); |
2940 KeyedLoadICNexus nexus(vector, vector_slot); | 2945 KeyedLoadICNexus nexus(vector, vector_slot); |
2941 KeyedLoadIC ic(IC::EXTRA_CALL_FRAME, isolate, &nexus); | 2946 KeyedLoadIC ic(IC::EXTRA_CALL_FRAME, isolate, &nexus); |
2942 ic.UpdateState(receiver, key); | 2947 ic.UpdateState(receiver, key); |
2943 RETURN_RESULT_OR_FAILURE(isolate, ic.Load(receiver, key)); | 2948 RETURN_RESULT_OR_FAILURE(isolate, ic.Load(receiver, key)); |
2944 } | 2949 } |
2945 } | 2950 } |
2946 } // namespace internal | 2951 } // namespace internal |
2947 } // namespace v8 | 2952 } // namespace v8 |
OLD | NEW |