OLD | NEW |
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/v8.h" | 5 #include "src/v8.h" |
6 | 6 |
7 #include "src/ic/call-optimization.h" | 7 #include "src/ic/call-optimization.h" |
8 | 8 |
9 | 9 |
10 namespace v8 { | 10 namespace v8 { |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
44 *holder_lookup = kHolderNotFound; | 44 *holder_lookup = kHolderNotFound; |
45 return Handle<JSObject>::null(); | 45 return Handle<JSObject>::null(); |
46 } | 46 } |
47 | 47 |
48 | 48 |
49 bool CallOptimization::IsCompatibleReceiver(Handle<Object> receiver, | 49 bool CallOptimization::IsCompatibleReceiver(Handle<Object> receiver, |
50 Handle<JSObject> holder) const { | 50 Handle<JSObject> holder) const { |
51 DCHECK(is_simple_api_call()); | 51 DCHECK(is_simple_api_call()); |
52 if (!receiver->IsHeapObject()) return false; | 52 if (!receiver->IsHeapObject()) return false; |
53 Handle<Map> map(HeapObject::cast(*receiver)->map()); | 53 Handle<Map> map(HeapObject::cast(*receiver)->map()); |
54 return IsCompatibleReceiverType(map, holder); | 54 return IsCompatibleReceiverMap(map, holder); |
55 } | 55 } |
56 | 56 |
57 | 57 |
58 bool CallOptimization::IsCompatibleReceiverType(Handle<Map> map, | 58 bool CallOptimization::IsCompatibleReceiverMap(Handle<Map> map, |
59 Handle<JSObject> holder) const { | 59 Handle<JSObject> holder) const { |
60 HolderLookup holder_lookup; | 60 HolderLookup holder_lookup; |
61 Handle<JSObject> api_holder = LookupHolderOfExpectedType(map, &holder_lookup); | 61 Handle<JSObject> api_holder = LookupHolderOfExpectedType(map, &holder_lookup); |
62 switch (holder_lookup) { | 62 switch (holder_lookup) { |
63 case kHolderNotFound: | 63 case kHolderNotFound: |
64 return false; | 64 return false; |
65 case kHolderIsReceiver: | 65 case kHolderIsReceiver: |
66 return true; | 66 return true; |
67 case kHolderFound: | 67 case kHolderFound: |
68 if (api_holder.is_identical_to(holder)) return true; | 68 if (api_holder.is_identical_to(holder)) return true; |
69 // Check if holder is in prototype chain of api_holder. | 69 // Check if holder is in prototype chain of api_holder. |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
106 | 106 |
107 if (!info->signature()->IsUndefined()) { | 107 if (!info->signature()->IsUndefined()) { |
108 expected_receiver_type_ = | 108 expected_receiver_type_ = |
109 handle(FunctionTemplateInfo::cast(info->signature())); | 109 handle(FunctionTemplateInfo::cast(info->signature())); |
110 } | 110 } |
111 | 111 |
112 is_simple_api_call_ = true; | 112 is_simple_api_call_ = true; |
113 } | 113 } |
114 } | 114 } |
115 } // namespace v8::internal | 115 } // namespace v8::internal |
OLD | NEW |