Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(34)

Side by Side Diff: src/ic/ic.cc

Issue 2036493006: Keep prototype maps in dictionary mode until ICs see them (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: fix tests & rebase Created 4 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/factory.cc ('k') | src/objects.h » ('j') | src/objects.h » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 205 matching lines...) Expand 10 before | Expand all | Expand 10 after
216 return code; 216 return code;
217 } 217 }
218 218
219 219
220 bool IC::AddressIsOptimizedCode() const { 220 bool IC::AddressIsOptimizedCode() const {
221 Code* host = 221 Code* host =
222 isolate()->inner_pointer_to_code_cache()->GetCacheEntry(address())->code; 222 isolate()->inner_pointer_to_code_cache()->GetCacheEntry(address())->code;
223 return host->kind() == Code::OPTIMIZED_FUNCTION; 223 return host->kind() == Code::OPTIMIZED_FUNCTION;
224 } 224 }
225 225
226
227 static void LookupForRead(LookupIterator* it) { 226 static void LookupForRead(LookupIterator* it) {
228 for (; it->IsFound(); it->Next()) { 227 for (; it->IsFound(); it->Next()) {
229 switch (it->state()) { 228 switch (it->state()) {
230 case LookupIterator::NOT_FOUND: 229 case LookupIterator::NOT_FOUND:
231 case LookupIterator::TRANSITION: 230 case LookupIterator::TRANSITION:
232 UNREACHABLE(); 231 UNREACHABLE();
233 case LookupIterator::JSPROXY: 232 case LookupIterator::JSPROXY:
234 return; 233 return;
235 case LookupIterator::INTERCEPTOR: { 234 case LookupIterator::INTERCEPTOR: {
236 // If there is a getter, return; otherwise loop to perform the lookup. 235 // If there is a getter, return; otherwise loop to perform the lookup.
(...skipping 397 matching lines...) Expand 10 before | Expand all | Expand 10 after
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, true /* include_receiver */,
645 isolate());
646 }
644 // Named lookup in the object. 647 // Named lookup in the object.
645 LookupIterator it(object, name); 648 LookupIterator it(object, name);
646 LookupForRead(&it); 649 LookupForRead(&it);
647 650
648 if (it.IsFound() || !ShouldThrowReferenceError(object)) { 651 if (it.IsFound() || !ShouldThrowReferenceError(object)) {
649 // Update inline cache and stub cache. 652 // Update inline cache and stub cache.
650 if (use_ic) UpdateCaches(&it); 653 if (use_ic) UpdateCaches(&it);
651 654
652 // Get the property. 655 // Get the property.
653 Handle<Object> result; 656 Handle<Object> result;
(...skipping 869 matching lines...) Expand 10 before | Expand all | Expand 10 after
1523 Object::SetProperty(object, name, value, language_mode()), Object); 1526 Object::SetProperty(object, name, value, language_mode()), Object);
1524 return result; 1527 return result;
1525 } 1528 }
1526 1529
1527 // If the object is undefined or null it's illegal to try to set any 1530 // 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. 1531 // properties on it; throw a TypeError in that case.
1529 if (object->IsUndefined(isolate()) || object->IsNull()) { 1532 if (object->IsUndefined(isolate()) || object->IsNull()) {
1530 return TypeError(MessageTemplate::kNonObjectPropertyStore, object, name); 1533 return TypeError(MessageTemplate::kNonObjectPropertyStore, object, name);
1531 } 1534 }
1532 1535
1536 if (state() != UNINITIALIZED) {
1537 JSObject::MakePrototypesFast(object, false /* include_receiver */,
1538 isolate());
1539 }
1533 LookupIterator it(object, name); 1540 LookupIterator it(object, name);
1534 if (FLAG_use_ic) UpdateCaches(&it, value, store_mode); 1541 if (FLAG_use_ic) UpdateCaches(&it, value, store_mode);
1535 1542
1536 MAYBE_RETURN_NULL( 1543 MAYBE_RETURN_NULL(
1537 Object::SetProperty(&it, value, language_mode(), store_mode)); 1544 Object::SetProperty(&it, value, language_mode(), store_mode));
1538 return value; 1545 return value;
1539 } 1546 }
1540 1547
1541 Handle<Code> CallIC::initialize_stub_in_optimized_code( 1548 Handle<Code> CallIC::initialize_stub_in_optimized_code(
1542 Isolate* isolate, int argc, ConvertReceiverMode mode, 1549 Isolate* isolate, int argc, ConvertReceiverMode mode,
(...skipping 1395 matching lines...) Expand 10 before | Expand all | Expand 10 after
2938 DCHECK_EQ(FeedbackVectorSlotKind::KEYED_LOAD_IC, 2945 DCHECK_EQ(FeedbackVectorSlotKind::KEYED_LOAD_IC,
2939 vector->GetKind(vector_slot)); 2946 vector->GetKind(vector_slot));
2940 KeyedLoadICNexus nexus(vector, vector_slot); 2947 KeyedLoadICNexus nexus(vector, vector_slot);
2941 KeyedLoadIC ic(IC::EXTRA_CALL_FRAME, isolate, &nexus); 2948 KeyedLoadIC ic(IC::EXTRA_CALL_FRAME, isolate, &nexus);
2942 ic.UpdateState(receiver, key); 2949 ic.UpdateState(receiver, key);
2943 RETURN_RESULT_OR_FAILURE(isolate, ic.Load(receiver, key)); 2950 RETURN_RESULT_OR_FAILURE(isolate, ic.Load(receiver, key));
2944 } 2951 }
2945 } 2952 }
2946 } // namespace internal 2953 } // namespace internal
2947 } // namespace v8 2954 } // namespace v8
OLDNEW
« no previous file with comments | « src/factory.cc ('k') | src/objects.h » ('j') | src/objects.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698