Chromium Code Reviews| 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/type-info.h" | 5 #include "src/type-info.h" |
| 6 | 6 |
| 7 #include "src/ast/ast.h" | 7 #include "src/ast/ast.h" |
| 8 #include "src/code-stubs.h" | 8 #include "src/code-stubs.h" |
| 9 #include "src/ic/ic.h" | 9 #include "src/ic/ic.h" |
| 10 #include "src/ic/stub-cache.h" | 10 #include "src/ic/stub-cache.h" |
| (...skipping 202 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 213 AstType* BinaryOpFeedbackToType(int hint) { | 213 AstType* BinaryOpFeedbackToType(int hint) { |
| 214 switch (hint) { | 214 switch (hint) { |
| 215 case BinaryOperationFeedback::kNone: | 215 case BinaryOperationFeedback::kNone: |
| 216 return AstType::None(); | 216 return AstType::None(); |
| 217 case BinaryOperationFeedback::kSignedSmall: | 217 case BinaryOperationFeedback::kSignedSmall: |
| 218 return AstType::SignedSmall(); | 218 return AstType::SignedSmall(); |
| 219 case BinaryOperationFeedback::kNumber: | 219 case BinaryOperationFeedback::kNumber: |
| 220 return AstType::Number(); | 220 return AstType::Number(); |
| 221 case BinaryOperationFeedback::kString: | 221 case BinaryOperationFeedback::kString: |
| 222 return AstType::String(); | 222 return AstType::String(); |
| 223 // TODO(mythria): Merge Number and NumberOrOddball feedback, after | |
| 224 // fixing crankshaft to handle Oddballs along with Numbers. | |
| 225 case BinaryOperationFeedback::kNumberOrOddball: | 223 case BinaryOperationFeedback::kNumberOrOddball: |
| 224 return AstType::NumberOrOddball(); | |
| 226 case BinaryOperationFeedback::kAny: | 225 case BinaryOperationFeedback::kAny: |
| 227 default: | 226 default: |
| 228 return AstType::Any(); | 227 return AstType::Any(); |
| 229 } | 228 } |
| 230 UNREACHABLE(); | 229 UNREACHABLE(); |
| 231 return AstType::None(); | 230 return AstType::None(); |
| 232 } | 231 } |
| 233 | 232 |
| 234 } // end anonymous namespace | 233 } // end anonymous namespace |
| 235 | 234 |
| (...skipping 21 matching lines...) Expand all Loading... | |
| 257 // Merge the feedback from full-codegen if available. | 256 // Merge the feedback from full-codegen if available. |
| 258 Handle<Code> code = Handle<Code>::cast(info); | 257 Handle<Code> code = Handle<Code>::cast(info); |
| 259 Handle<Map> map; | 258 Handle<Map> map; |
| 260 Map* raw_map = code->FindFirstMap(); | 259 Map* raw_map = code->FindFirstMap(); |
| 261 if (raw_map != NULL) Map::TryUpdate(handle(raw_map)).ToHandle(&map); | 260 if (raw_map != NULL) Map::TryUpdate(handle(raw_map)).ToHandle(&map); |
| 262 | 261 |
| 263 if (code->is_compare_ic_stub()) { | 262 if (code->is_compare_ic_stub()) { |
| 264 CompareICStub stub(code->stub_key(), isolate()); | 263 CompareICStub stub(code->stub_key(), isolate()); |
| 265 AstType* left_type_from_ic = | 264 AstType* left_type_from_ic = |
| 266 CompareICState::StateToType(zone(), stub.left()); | 265 CompareICState::StateToType(zone(), stub.left()); |
| 267 *left_type = AstType::Union(*left_type, left_type_from_ic, zone()); | |
| 268 AstType* right_type_from_ic = | 266 AstType* right_type_from_ic = |
| 269 CompareICState::StateToType(zone(), stub.right()); | 267 CompareICState::StateToType(zone(), stub.right()); |
| 270 *right_type = AstType::Union(*right_type, right_type_from_ic, zone()); | |
| 271 AstType* combined_type_from_ic = | 268 AstType* combined_type_from_ic = |
| 272 CompareICState::StateToType(zone(), stub.state(), map); | 269 CompareICState::StateToType(zone(), stub.state(), map); |
| 273 *combined_type = | 270 // Full-codegen collects lhs and rhs feedback seperately and crankshaft |
|
rmcilroy
2016/11/10 08:45:27
Capitalise Crankshaft, Full-codegen and Ignition (
mythria
2016/11/10 11:43:01
Done.
| |
| 274 AstType::Union(*combined_type, combined_type_from_ic, zone()); | 271 // could use this information to optimize better. So if combining the |
| 272 // feedback has made the feedback less precise, we can use the feedback | |
|
rmcilroy
2016/11/10 08:45:27
Can use -> should use
mythria
2016/11/10 11:43:01
Done.
| |
| 273 // only from full-codegen. If the union of feedback from full-codegen and | |
|
rmcilroy
2016/11/10 08:45:27
Of feedback -> of the feedback
mythria
2016/11/10 11:43:01
Done.
| |
| 274 // if it is same as that of ignition, there is no need of combining | |
|
rmcilroy
2016/11/10 08:45:27
Of combining -> to combine
rmcilroy
2016/11/10 08:45:28
and if it is same as -> is the same as
mythria
2016/11/10 11:43:01
Done.
mythria
2016/11/10 11:43:01
Done.
| |
| 275 // feedback from ignition. | |
| 276 AstType* combined_type_from_fcg = AstType::Union( | |
| 277 left_type_from_ic, | |
| 278 AstType::Union(right_type_from_ic, combined_type_from_ic, zone()), | |
| 279 zone()); | |
| 280 if (combined_type_from_fcg == *left_type) { | |
|
mythria
2016/11/09 16:18:49
I am not sure if == is the right way to check equa
| |
| 281 // Just pass FCG feedback. FCG collects information about lhs, rhs and | |
| 282 // result types seperately. So just retain that FCG information. | |
| 283 *left_type = left_type_from_ic; | |
| 284 *right_type = right_type_from_ic; | |
| 285 *combined_type = combined_type_from_ic; | |
| 286 } else { | |
| 287 // Combine ignition and FCG feedbacks. | |
| 288 *left_type = AstType::Union(*left_type, left_type_from_ic, zone()); | |
| 289 *right_type = AstType::Union(*right_type, right_type_from_ic, zone()); | |
| 290 *combined_type = | |
| 291 AstType::Union(*combined_type, combined_type_from_ic, zone()); | |
| 292 } | |
| 275 } | 293 } |
| 276 } | 294 } |
| 277 | 295 |
| 278 void TypeFeedbackOracle::BinaryType(TypeFeedbackId id, FeedbackVectorSlot slot, | 296 void TypeFeedbackOracle::BinaryType(TypeFeedbackId id, FeedbackVectorSlot slot, |
| 279 AstType** left, AstType** right, | 297 AstType** left, AstType** right, |
| 280 AstType** result, | 298 AstType** result, |
| 281 Maybe<int>* fixed_right_arg, | 299 Maybe<int>* fixed_right_arg, |
| 282 Handle<AllocationSite>* allocation_site, | 300 Handle<AllocationSite>* allocation_site, |
| 283 Token::Value op) { | 301 Token::Value op) { |
| 284 Handle<Object> object = GetInfo(id); | 302 Handle<Object> object = GetInfo(id); |
| (...skipping 21 matching lines...) Expand all Loading... | |
| 306 *allocation_site = Handle<AllocationSite>::null(); | 324 *allocation_site = Handle<AllocationSite>::null(); |
| 307 | 325 |
| 308 if (!object->IsCode()) return; | 326 if (!object->IsCode()) return; |
| 309 | 327 |
| 310 // Merge the feedback from full-codegen if available. | 328 // Merge the feedback from full-codegen if available. |
| 311 Handle<Code> code = Handle<Code>::cast(object); | 329 Handle<Code> code = Handle<Code>::cast(object); |
| 312 DCHECK_EQ(Code::BINARY_OP_IC, code->kind()); | 330 DCHECK_EQ(Code::BINARY_OP_IC, code->kind()); |
| 313 BinaryOpICState state(isolate(), code->extra_ic_state()); | 331 BinaryOpICState state(isolate(), code->extra_ic_state()); |
| 314 DCHECK_EQ(op, state.op()); | 332 DCHECK_EQ(op, state.op()); |
| 315 | 333 |
| 316 *left = AstType::Union(*left, state.GetLeftType(), zone()); | 334 // Full-codegen collects lhs and rhs feedback seperately and crankshaft |
| 317 *right = AstType::Union(*right, state.GetRightType(), zone()); | 335 // could use this information to optimize better. So if combining the |
| 318 *result = AstType::Union(*result, state.GetResultType(), zone()); | 336 // feedback has made the feedback less precise, we can use the feedback |
| 337 // only from full-codegen. If the union of feedback from full-codegen and | |
| 338 // if it is same as that of ignition, there is no need of combining | |
| 339 // feedback from ignition. | |
|
rmcilroy
2016/11/10 08:45:28
Same comments as above.
| |
| 340 AstType* combined_type_from_fcg = AstType::Union( | |
| 341 state.GetLeftType(), | |
| 342 AstType::Union(state.GetRightType(), state.GetResultType(), zone()), | |
| 343 zone()); | |
| 344 if (combined_type_from_fcg == *left) { | |
| 345 // Just pass FCG feedback. FCG collects information about lhs, rhs and | |
| 346 // result types seperately. So just retain that FCG information. | |
| 347 *left = state.GetLeftType(); | |
| 348 *right = state.GetRightType(); | |
| 349 *result = state.GetResultType(); | |
| 350 } else { | |
| 351 // Combine ignition and FCG feedback. | |
| 352 *left = AstType::Union(*left, state.GetLeftType(), zone()); | |
| 353 *right = AstType::Union(*right, state.GetRightType(), zone()); | |
| 354 *result = AstType::Union(*result, state.GetResultType(), zone()); | |
| 355 } | |
| 356 // Ignition does not collect this feedback. | |
| 319 *fixed_right_arg = state.fixed_right_arg(); | 357 *fixed_right_arg = state.fixed_right_arg(); |
| 320 | 358 |
| 321 AllocationSite* first_allocation_site = code->FindFirstAllocationSite(); | 359 AllocationSite* first_allocation_site = code->FindFirstAllocationSite(); |
| 322 if (first_allocation_site != NULL) { | 360 if (first_allocation_site != NULL) { |
| 323 *allocation_site = handle(first_allocation_site); | 361 *allocation_site = handle(first_allocation_site); |
| 324 } else { | 362 } else { |
| 325 *allocation_site = Handle<AllocationSite>::null(); | 363 *allocation_site = Handle<AllocationSite>::null(); |
| 326 } | 364 } |
| 327 } | 365 } |
| 328 | 366 |
| (...skipping 219 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 548 // Dictionary has been allocated with sufficient size for all elements. | 586 // Dictionary has been allocated with sufficient size for all elements. |
| 549 DisallowHeapAllocation no_need_to_resize_dictionary; | 587 DisallowHeapAllocation no_need_to_resize_dictionary; |
| 550 HandleScope scope(isolate()); | 588 HandleScope scope(isolate()); |
| 551 USE(UnseededNumberDictionary::AtNumberPut( | 589 USE(UnseededNumberDictionary::AtNumberPut( |
| 552 dictionary_, IdToKey(ast_id), handle(target, isolate()))); | 590 dictionary_, IdToKey(ast_id), handle(target, isolate()))); |
| 553 } | 591 } |
| 554 | 592 |
| 555 | 593 |
| 556 } // namespace internal | 594 } // namespace internal |
| 557 } // namespace v8 | 595 } // namespace v8 |
| OLD | NEW |