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/v8.h" | 5 #include "src/v8.h" |
6 | 6 |
7 #include "src/ast.h" | 7 #include "src/ast.h" |
8 #include "src/code-stubs.h" | 8 #include "src/code-stubs.h" |
9 #include "src/compiler.h" | 9 #include "src/compiler.h" |
10 #include "src/ic/ic.h" | 10 #include "src/ic/ic.h" |
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
94 | 94 |
95 byte TypeFeedbackOracle::ForInType(int feedback_vector_slot) { | 95 byte TypeFeedbackOracle::ForInType(int feedback_vector_slot) { |
96 Handle<Object> value = GetInfo(feedback_vector_slot); | 96 Handle<Object> value = GetInfo(feedback_vector_slot); |
97 return value.is_identical_to( | 97 return value.is_identical_to( |
98 TypeFeedbackVector::UninitializedSentinel(isolate())) | 98 TypeFeedbackVector::UninitializedSentinel(isolate())) |
99 ? ForInStatement::FAST_FOR_IN | 99 ? ForInStatement::FAST_FOR_IN |
100 : ForInStatement::SLOW_FOR_IN; | 100 : ForInStatement::SLOW_FOR_IN; |
101 } | 101 } |
102 | 102 |
103 | 103 |
104 KeyedAccessStoreMode TypeFeedbackOracle::GetStoreMode( | 104 void TypeFeedbackOracle::GetStoreModeAndKeyType( |
105 TypeFeedbackId ast_id) { | 105 TypeFeedbackId ast_id, KeyedAccessStoreMode* store_mode, |
| 106 IcCheckType* key_type) { |
106 Handle<Object> maybe_code = GetInfo(ast_id); | 107 Handle<Object> maybe_code = GetInfo(ast_id); |
107 if (maybe_code->IsCode()) { | 108 if (maybe_code->IsCode()) { |
108 Handle<Code> code = Handle<Code>::cast(maybe_code); | 109 Handle<Code> code = Handle<Code>::cast(maybe_code); |
109 if (code->kind() == Code::KEYED_STORE_IC) { | 110 if (code->kind() == Code::KEYED_STORE_IC) { |
110 return KeyedStoreIC::GetKeyedAccessStoreMode(code->extra_ic_state()); | 111 ExtraICState extra_ic_state = code->extra_ic_state(); |
| 112 *store_mode = KeyedStoreIC::GetKeyedAccessStoreMode(extra_ic_state); |
| 113 *key_type = KeyedStoreIC::GetKeyType(extra_ic_state); |
| 114 return; |
111 } | 115 } |
112 } | 116 } |
113 return STANDARD_STORE; | 117 *store_mode = STANDARD_STORE; |
| 118 *key_type = ELEMENT; |
114 } | 119 } |
115 | 120 |
116 | 121 |
117 Handle<JSFunction> TypeFeedbackOracle::GetCallTarget(int slot) { | 122 Handle<JSFunction> TypeFeedbackOracle::GetCallTarget(int slot) { |
118 Handle<Object> info = GetInfo(slot); | 123 Handle<Object> info = GetInfo(slot); |
119 if (info->IsAllocationSite()) { | 124 if (info->IsAllocationSite()) { |
120 return Handle<JSFunction>(isolate()->native_context()->array_function()); | 125 return Handle<JSFunction>(isolate()->native_context()->array_function()); |
121 } | 126 } |
122 | 127 |
123 return Handle<JSFunction>::cast(info); | 128 return Handle<JSFunction>::cast(info); |
(...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
264 void TypeFeedbackOracle::AssignmentReceiverTypes( | 269 void TypeFeedbackOracle::AssignmentReceiverTypes( |
265 TypeFeedbackId id, Handle<String> name, SmallMapList* receiver_types) { | 270 TypeFeedbackId id, Handle<String> name, SmallMapList* receiver_types) { |
266 receiver_types->Clear(); | 271 receiver_types->Clear(); |
267 Code::Flags flags = Code::ComputeHandlerFlags(Code::STORE_IC); | 272 Code::Flags flags = Code::ComputeHandlerFlags(Code::STORE_IC); |
268 CollectReceiverTypes(id, name, flags, receiver_types); | 273 CollectReceiverTypes(id, name, flags, receiver_types); |
269 } | 274 } |
270 | 275 |
271 | 276 |
272 void TypeFeedbackOracle::KeyedAssignmentReceiverTypes( | 277 void TypeFeedbackOracle::KeyedAssignmentReceiverTypes( |
273 TypeFeedbackId id, SmallMapList* receiver_types, | 278 TypeFeedbackId id, SmallMapList* receiver_types, |
274 KeyedAccessStoreMode* store_mode) { | 279 KeyedAccessStoreMode* store_mode, IcCheckType* key_type) { |
275 receiver_types->Clear(); | 280 receiver_types->Clear(); |
276 CollectReceiverTypes(id, receiver_types); | 281 CollectReceiverTypes(id, receiver_types); |
277 *store_mode = GetStoreMode(id); | 282 GetStoreModeAndKeyType(id, store_mode, key_type); |
278 } | 283 } |
279 | 284 |
280 | 285 |
281 void TypeFeedbackOracle::CountReceiverTypes(TypeFeedbackId id, | 286 void TypeFeedbackOracle::CountReceiverTypes(TypeFeedbackId id, |
282 SmallMapList* receiver_types) { | 287 SmallMapList* receiver_types) { |
283 receiver_types->Clear(); | 288 receiver_types->Clear(); |
284 CollectReceiverTypes(id, receiver_types); | 289 CollectReceiverTypes(id, receiver_types); |
285 } | 290 } |
286 | 291 |
287 | 292 |
(...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
447 UnseededNumberDictionary::kNotFound); | 452 UnseededNumberDictionary::kNotFound); |
448 // Dictionary has been allocated with sufficient size for all elements. | 453 // Dictionary has been allocated with sufficient size for all elements. |
449 DisallowHeapAllocation no_need_to_resize_dictionary; | 454 DisallowHeapAllocation no_need_to_resize_dictionary; |
450 HandleScope scope(isolate()); | 455 HandleScope scope(isolate()); |
451 USE(UnseededNumberDictionary::AtNumberPut( | 456 USE(UnseededNumberDictionary::AtNumberPut( |
452 dictionary_, IdToKey(ast_id), handle(target, isolate()))); | 457 dictionary_, IdToKey(ast_id), handle(target, isolate()))); |
453 } | 458 } |
454 | 459 |
455 | 460 |
456 } } // namespace v8::internal | 461 } } // namespace v8::internal |
OLD | NEW |