| 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/compiler.h" | 9 #include "src/compiler.h" |
| 10 #include "src/ic/ic.h" | 10 #include "src/ic/ic.h" |
| (...skipping 196 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 207 | 207 |
| 208 Handle<Map> map; | 208 Handle<Map> map; |
| 209 Map* raw_map = code->FindFirstMap(); | 209 Map* raw_map = code->FindFirstMap(); |
| 210 if (raw_map != NULL) Map::TryUpdate(handle(raw_map)).ToHandle(&map); | 210 if (raw_map != NULL) Map::TryUpdate(handle(raw_map)).ToHandle(&map); |
| 211 | 211 |
| 212 if (code->is_compare_ic_stub()) { | 212 if (code->is_compare_ic_stub()) { |
| 213 CompareICStub stub(code->stub_key(), isolate()); | 213 CompareICStub stub(code->stub_key(), isolate()); |
| 214 *left_type = CompareICState::StateToType(zone(), stub.left()); | 214 *left_type = CompareICState::StateToType(zone(), stub.left()); |
| 215 *right_type = CompareICState::StateToType(zone(), stub.right()); | 215 *right_type = CompareICState::StateToType(zone(), stub.right()); |
| 216 *combined_type = CompareICState::StateToType(zone(), stub.state(), map); | 216 *combined_type = CompareICState::StateToType(zone(), stub.state(), map); |
| 217 } else if (code->is_compare_nil_ic_stub()) { | |
| 218 CompareNilICStub stub(isolate(), code->extra_ic_state()); | |
| 219 *combined_type = stub.GetType(zone(), map); | |
| 220 *left_type = *right_type = stub.GetInputType(zone(), map); | |
| 221 } | 217 } |
| 222 } | 218 } |
| 223 | 219 |
| 224 | 220 |
| 225 void TypeFeedbackOracle::BinaryType(TypeFeedbackId id, | 221 void TypeFeedbackOracle::BinaryType(TypeFeedbackId id, |
| 226 Type** left, | 222 Type** left, |
| 227 Type** right, | 223 Type** right, |
| 228 Type** result, | 224 Type** result, |
| 229 Maybe<int>* fixed_right_arg, | 225 Maybe<int>* fixed_right_arg, |
| 230 Handle<AllocationSite>* allocation_site, | 226 Handle<AllocationSite>* allocation_site, |
| (...skipping 219 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 450 TypeFeedbackId(static_cast<unsigned>((*infos)[i].data())); | 446 TypeFeedbackId(static_cast<unsigned>((*infos)[i].data())); |
| 451 Code* target = Code::GetCodeFromTargetAddress(target_address); | 447 Code* target = Code::GetCodeFromTargetAddress(target_address); |
| 452 switch (target->kind()) { | 448 switch (target->kind()) { |
| 453 case Code::LOAD_IC: | 449 case Code::LOAD_IC: |
| 454 case Code::STORE_IC: | 450 case Code::STORE_IC: |
| 455 case Code::KEYED_LOAD_IC: | 451 case Code::KEYED_LOAD_IC: |
| 456 case Code::KEYED_STORE_IC: | 452 case Code::KEYED_STORE_IC: |
| 457 case Code::BINARY_OP_IC: | 453 case Code::BINARY_OP_IC: |
| 458 case Code::COMPARE_IC: | 454 case Code::COMPARE_IC: |
| 459 case Code::TO_BOOLEAN_IC: | 455 case Code::TO_BOOLEAN_IC: |
| 460 case Code::COMPARE_NIL_IC: | |
| 461 SetInfo(ast_id, target); | 456 SetInfo(ast_id, target); |
| 462 break; | 457 break; |
| 463 | 458 |
| 464 default: | 459 default: |
| 465 break; | 460 break; |
| 466 } | 461 } |
| 467 } | 462 } |
| 468 } | 463 } |
| 469 | 464 |
| 470 | 465 |
| 471 void TypeFeedbackOracle::SetInfo(TypeFeedbackId ast_id, Object* target) { | 466 void TypeFeedbackOracle::SetInfo(TypeFeedbackId ast_id, Object* target) { |
| 472 DCHECK(dictionary_->FindEntry(IdToKey(ast_id)) == | 467 DCHECK(dictionary_->FindEntry(IdToKey(ast_id)) == |
| 473 UnseededNumberDictionary::kNotFound); | 468 UnseededNumberDictionary::kNotFound); |
| 474 // Dictionary has been allocated with sufficient size for all elements. | 469 // Dictionary has been allocated with sufficient size for all elements. |
| 475 DisallowHeapAllocation no_need_to_resize_dictionary; | 470 DisallowHeapAllocation no_need_to_resize_dictionary; |
| 476 HandleScope scope(isolate()); | 471 HandleScope scope(isolate()); |
| 477 USE(UnseededNumberDictionary::AtNumberPut( | 472 USE(UnseededNumberDictionary::AtNumberPut( |
| 478 dictionary_, IdToKey(ast_id), handle(target, isolate()))); | 473 dictionary_, IdToKey(ast_id), handle(target, isolate()))); |
| 479 } | 474 } |
| 480 | 475 |
| 481 | 476 |
| 482 } // namespace internal | 477 } // namespace internal |
| 483 } // namespace v8 | 478 } // namespace v8 |
| OLD | NEW |