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

Side by Side Diff: src/ic/call-optimization.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/ia32/builtins-ia32.cc ('k') | src/ic/handler-compiler.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/call-optimization.h" 5 #include "src/ic/call-optimization.h"
6 6
7 7
8 namespace v8 { 8 namespace v8 {
9 namespace internal { 9 namespace internal {
10 10
11 CallOptimization::CallOptimization(Handle<JSFunction> function) { 11 CallOptimization::CallOptimization(Handle<JSFunction> function) {
12 Initialize(function); 12 Initialize(function);
13 } 13 }
14 14
15 15
16 Handle<JSObject> CallOptimization::LookupHolderOfExpectedType( 16 Handle<JSObject> CallOptimization::LookupHolderOfExpectedType(
17 Handle<Map> object_map, HolderLookup* holder_lookup, 17 Handle<Map> object_map, HolderLookup* holder_lookup,
18 int* holder_depth_in_prototype_chain) const { 18 int* holder_depth_in_prototype_chain) const {
19 DCHECK(is_simple_api_call()); 19 DCHECK(is_simple_api_call());
20 if (!object_map->IsJSObjectMap()) { 20 if (!object_map->IsJSObjectMap()) {
21 *holder_lookup = kHolderNotFound; 21 *holder_lookup = kHolderNotFound;
22 return Handle<JSObject>::null(); 22 return Handle<JSObject>::null();
23 } 23 }
24 if (expected_receiver_type_.is_null() || 24 if (expected_receiver_type_.is_null() ||
25 expected_receiver_type_->IsTemplateFor(*object_map)) { 25 expected_receiver_type_->IsTemplateFor(*object_map)) {
26 *holder_lookup = kHolderIsReceiver; 26 *holder_lookup = kHolderIsReceiver;
27 return Handle<JSObject>::null(); 27 return Handle<JSObject>::null();
28 } 28 }
29 for (int depth = 1; true; depth++) { 29 for (int depth = 1; true; depth++) {
30 if (!object_map->prototype()->IsJSObject()) break; 30 if (!object_map->has_hidden_prototype()) break;
31 Handle<JSObject> prototype(JSObject::cast(object_map->prototype())); 31 Handle<JSObject> prototype(JSObject::cast(object_map->prototype()));
32 if (!prototype->map()->is_hidden_prototype()) break;
33 object_map = handle(prototype->map()); 32 object_map = handle(prototype->map());
34 if (expected_receiver_type_->IsTemplateFor(*object_map)) { 33 if (expected_receiver_type_->IsTemplateFor(*object_map)) {
35 *holder_lookup = kHolderFound; 34 *holder_lookup = kHolderFound;
36 if (holder_depth_in_prototype_chain != NULL) { 35 if (holder_depth_in_prototype_chain != NULL) {
37 *holder_depth_in_prototype_chain = depth; 36 *holder_depth_in_prototype_chain = depth;
38 } 37 }
39 return prototype; 38 return prototype;
40 } 39 }
41 } 40 }
42 *holder_lookup = kHolderNotFound; 41 *holder_lookup = kHolderNotFound;
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
104 103
105 if (!info->signature()->IsUndefined()) { 104 if (!info->signature()->IsUndefined()) {
106 expected_receiver_type_ = 105 expected_receiver_type_ =
107 handle(FunctionTemplateInfo::cast(info->signature())); 106 handle(FunctionTemplateInfo::cast(info->signature()));
108 } 107 }
109 108
110 is_simple_api_call_ = true; 109 is_simple_api_call_ = true;
111 } 110 }
112 } // namespace internal 111 } // namespace internal
113 } // namespace v8 112 } // namespace v8
OLDNEW
« no previous file with comments | « src/ia32/builtins-ia32.cc ('k') | src/ic/handler-compiler.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698