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

Side by Side Diff: src/ic/handler-compiler.cc

Issue 1675223002: Mark maps having a hidden prototype rather than maps of hidden prototypes. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Addressed comment Created 4 years, 10 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/ic/call-optimization.cc ('k') | src/ic/ic.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 the V8 project authors. All rights reserved. 1 // Copyright 2014 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/handler-compiler.h" 5 #include "src/ic/handler-compiler.h"
6 6
7 #include "src/ic/call-optimization.h" 7 #include "src/ic/call-optimization.h"
8 #include "src/ic/ic.h" 8 #include "src/ic/ic.h"
9 #include "src/ic/ic-inl.h" 9 #include "src/ic/ic-inl.h"
10 #include "src/isolate-inl.h" 10 #include "src/isolate-inl.h"
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
49 ? name 49 ? name
50 : Handle<Name>::cast(isolate->factory()->nonexistent_symbol()); 50 : Handle<Name>::cast(isolate->factory()->nonexistent_symbol());
51 Handle<Map> current_map = stub_holder_map; 51 Handle<Map> current_map = stub_holder_map;
52 Handle<JSObject> last(JSObject::cast(receiver_map->prototype())); 52 Handle<JSObject> last(JSObject::cast(receiver_map->prototype()));
53 while (true) { 53 while (true) {
54 if (current_map->is_dictionary_map()) cache_name = name; 54 if (current_map->is_dictionary_map()) cache_name = name;
55 if (current_map->prototype()->IsNull()) break; 55 if (current_map->prototype()->IsNull()) break;
56 if (name->IsPrivate()) { 56 if (name->IsPrivate()) {
57 // TODO(verwaest): Use nonexistent_private_symbol. 57 // TODO(verwaest): Use nonexistent_private_symbol.
58 cache_name = name; 58 cache_name = name;
59 JSReceiver* prototype = JSReceiver::cast(current_map->prototype()); 59 if (!current_map->has_hidden_prototype()) break;
60 if (!prototype->map()->is_hidden_prototype() &&
61 !prototype->map()->IsJSGlobalObjectMap()) {
62 break;
63 }
64 } 60 }
65 61
66 last = handle(JSObject::cast(current_map->prototype())); 62 last = handle(JSObject::cast(current_map->prototype()));
67 current_map = handle(last->map()); 63 current_map = handle(last->map());
68 } 64 }
69 // Compile the stub that is either shared for all names or 65 // Compile the stub that is either shared for all names or
70 // name specific if there are global objects involved. 66 // name specific if there are global objects involved.
71 Handle<Code> handler = PropertyHandlerCompiler::Find( 67 Handle<Code> handler = PropertyHandlerCompiler::Find(
72 cache_name, stub_holder_map, Code::LOAD_IC, flag, Code::FAST); 68 cache_name, stub_holder_map, Code::LOAD_IC, flag, Code::FAST);
73 if (!handler.is_null()) return handler; 69 if (!handler.is_null()) return handler;
(...skipping 355 matching lines...) Expand 10 before | Expand all | Expand 10 after
429 PushVectorAndSlot(); 425 PushVectorAndSlot();
430 426
431 // Check that we are allowed to write this. 427 // Check that we are allowed to write this.
432 bool is_nonexistent = holder()->map() == transition->GetBackPointer(); 428 bool is_nonexistent = holder()->map() == transition->GetBackPointer();
433 if (is_nonexistent) { 429 if (is_nonexistent) {
434 // Find the top object. 430 // Find the top object.
435 Handle<JSObject> last; 431 Handle<JSObject> last;
436 PrototypeIterator::WhereToEnd end = 432 PrototypeIterator::WhereToEnd end =
437 name->IsPrivate() ? PrototypeIterator::END_AT_NON_HIDDEN 433 name->IsPrivate() ? PrototypeIterator::END_AT_NON_HIDDEN
438 : PrototypeIterator::END_AT_NULL; 434 : PrototypeIterator::END_AT_NULL;
439 PrototypeIterator iter(isolate(), holder()); 435 PrototypeIterator iter(isolate(), holder(),
440 while (!iter.IsAtEnd(end)) { 436 PrototypeIterator::START_AT_PROTOTYPE, end);
437 while (!iter.IsAtEnd()) {
441 last = PrototypeIterator::GetCurrent<JSObject>(iter); 438 last = PrototypeIterator::GetCurrent<JSObject>(iter);
442 iter.Advance(); 439 iter.Advance();
443 } 440 }
444 if (!last.is_null()) set_holder(last); 441 if (!last.is_null()) set_holder(last);
445 NonexistentFrontendHeader(name, &miss, scratch1(), scratch2()); 442 NonexistentFrontendHeader(name, &miss, scratch1(), scratch2());
446 } else { 443 } else {
447 FrontendHeader(receiver(), name, &miss, DONT_RETURN_ANYTHING); 444 FrontendHeader(receiver(), name, &miss, DONT_RETURN_ANYTHING);
448 DCHECK(holder()->HasFastProperties()); 445 DCHECK(holder()->HasFastProperties());
449 } 446 }
450 447
(...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after
603 : kNoExtraICState); 600 : kNoExtraICState);
604 cached_stub = LoadDictionaryElementStub(isolate(), state).GetCode(); 601 cached_stub = LoadDictionaryElementStub(isolate(), state).GetCode();
605 } 602 }
606 } 603 }
607 604
608 handlers->Add(cached_stub); 605 handlers->Add(cached_stub);
609 } 606 }
610 } 607 }
611 } // namespace internal 608 } // namespace internal
612 } // namespace v8 609 } // namespace v8
OLDNEW
« no previous file with comments | « src/ic/call-optimization.cc ('k') | src/ic/ic.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698