| 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 192 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 203 return AstType::Number(); | 203 return AstType::Number(); |
| 204 case CompareOperationHint::kNumberOrOddball: | 204 case CompareOperationHint::kNumberOrOddball: |
| 205 return AstType::NumberOrOddball(); | 205 return AstType::NumberOrOddball(); |
| 206 case CompareOperationHint::kAny: | 206 case CompareOperationHint::kAny: |
| 207 return AstType::Any(); | 207 return AstType::Any(); |
| 208 } | 208 } |
| 209 UNREACHABLE(); | 209 UNREACHABLE(); |
| 210 return AstType::None(); | 210 return AstType::None(); |
| 211 } | 211 } |
| 212 | 212 |
| 213 AstType* BinaryOpFeedbackToType(int hint) { | 213 AstType* BinaryOpHintToType(BinaryOperationHint hint) { |
| 214 switch (hint) { | 214 switch (hint) { |
| 215 case BinaryOperationFeedback::kNone: | 215 case BinaryOperationHint::kNone: |
| 216 return AstType::None(); | 216 return AstType::None(); |
| 217 case BinaryOperationFeedback::kSignedSmall: | 217 case BinaryOperationHint::kSignedSmall: |
| 218 return AstType::SignedSmall(); | 218 return AstType::SignedSmall(); |
| 219 case BinaryOperationFeedback::kNumber: | 219 case BinaryOperationHint::kSigned32: |
| 220 return AstType::Signed32(); |
| 221 case BinaryOperationHint::kNumberOrOddball: |
| 220 return AstType::Number(); | 222 return AstType::Number(); |
| 221 case BinaryOperationFeedback::kString: | 223 case BinaryOperationHint::kString: |
| 222 return AstType::String(); | 224 return AstType::String(); |
| 223 // TODO(mythria): Merge Number and NumberOrOddball feedback, after | 225 case BinaryOperationHint::kAny: |
| 224 // fixing crankshaft to handle Oddballs along with Numbers. | |
| 225 case BinaryOperationFeedback::kNumberOrOddball: | |
| 226 case BinaryOperationFeedback::kAny: | |
| 227 default: | |
| 228 return AstType::Any(); | 226 return AstType::Any(); |
| 229 } | 227 } |
| 230 UNREACHABLE(); | 228 UNREACHABLE(); |
| 231 return AstType::None(); | 229 return AstType::None(); |
| 232 } | 230 } |
| 233 | 231 |
| 234 } // end anonymous namespace | 232 } // end anonymous namespace |
| 235 | 233 |
| 236 void TypeFeedbackOracle::CompareType(TypeFeedbackId id, FeedbackVectorSlot slot, | 234 void TypeFeedbackOracle::CompareType(TypeFeedbackId id, FeedbackVectorSlot slot, |
| 237 AstType** left_type, AstType** right_type, | 235 AstType** left_type, AstType** right_type, |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 294 *allocation_site = Handle<AllocationSite>::null(); | 292 *allocation_site = Handle<AllocationSite>::null(); |
| 295 return; | 293 return; |
| 296 } | 294 } |
| 297 | 295 |
| 298 // Feedback from Ignition. The feedback slot will be allocated and initialized | 296 // Feedback from Ignition. The feedback slot will be allocated and initialized |
| 299 // to AstType::None() even when ignition is not enabled. So it is safe to get | 297 // to AstType::None() even when ignition is not enabled. So it is safe to get |
| 300 // feedback from the type feedback vector. | 298 // feedback from the type feedback vector. |
| 301 DCHECK(!slot.IsInvalid()); | 299 DCHECK(!slot.IsInvalid()); |
| 302 BinaryOpICNexus nexus(feedback_vector_, slot); | 300 BinaryOpICNexus nexus(feedback_vector_, slot); |
| 303 *left = *right = *result = | 301 *left = *right = *result = |
| 304 BinaryOpFeedbackToType(Smi::cast(nexus.GetFeedback())->value()); | 302 BinaryOpHintToType(nexus.GetBinaryOperationFeedback()); |
| 305 *fixed_right_arg = Nothing<int>(); | 303 *fixed_right_arg = Nothing<int>(); |
| 306 *allocation_site = Handle<AllocationSite>::null(); | 304 *allocation_site = Handle<AllocationSite>::null(); |
| 307 | 305 |
| 308 if (!object->IsCode()) return; | 306 if (!object->IsCode()) return; |
| 309 | 307 |
| 310 // Merge the feedback from full-codegen if available. | 308 // Merge the feedback from full-codegen if available. |
| 311 Handle<Code> code = Handle<Code>::cast(object); | 309 Handle<Code> code = Handle<Code>::cast(object); |
| 312 DCHECK_EQ(Code::BINARY_OP_IC, code->kind()); | 310 DCHECK_EQ(Code::BINARY_OP_IC, code->kind()); |
| 313 BinaryOpICState state(isolate(), code->extra_ic_state()); | 311 BinaryOpICState state(isolate(), code->extra_ic_state()); |
| 314 DCHECK_EQ(op, state.op()); | 312 DCHECK_EQ(op, state.op()); |
| (...skipping 14 matching lines...) Expand all Loading... |
| 329 AstType* TypeFeedbackOracle::CountType(TypeFeedbackId id, | 327 AstType* TypeFeedbackOracle::CountType(TypeFeedbackId id, |
| 330 FeedbackVectorSlot slot) { | 328 FeedbackVectorSlot slot) { |
| 331 Handle<Object> object = GetInfo(id); | 329 Handle<Object> object = GetInfo(id); |
| 332 if (slot.IsInvalid()) { | 330 if (slot.IsInvalid()) { |
| 333 DCHECK(!object->IsCode()); | 331 DCHECK(!object->IsCode()); |
| 334 return AstType::None(); | 332 return AstType::None(); |
| 335 } | 333 } |
| 336 | 334 |
| 337 DCHECK(!slot.IsInvalid()); | 335 DCHECK(!slot.IsInvalid()); |
| 338 BinaryOpICNexus nexus(feedback_vector_, slot); | 336 BinaryOpICNexus nexus(feedback_vector_, slot); |
| 339 AstType* type = | 337 AstType* type = BinaryOpHintToType(nexus.GetBinaryOperationFeedback()); |
| 340 BinaryOpFeedbackToType(Smi::cast(nexus.GetFeedback())->value()); | |
| 341 | 338 |
| 342 if (!object->IsCode()) return type; | 339 if (!object->IsCode()) return type; |
| 343 | 340 |
| 344 Handle<Code> code = Handle<Code>::cast(object); | 341 Handle<Code> code = Handle<Code>::cast(object); |
| 345 DCHECK_EQ(Code::BINARY_OP_IC, code->kind()); | 342 DCHECK_EQ(Code::BINARY_OP_IC, code->kind()); |
| 346 BinaryOpICState state(isolate(), code->extra_ic_state()); | 343 BinaryOpICState state(isolate(), code->extra_ic_state()); |
| 347 return AstType::Union(type, state.GetLeftType(), zone()); | 344 return AstType::Union(type, state.GetLeftType(), zone()); |
| 348 } | 345 } |
| 349 | 346 |
| 350 | 347 |
| (...skipping 197 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 548 // Dictionary has been allocated with sufficient size for all elements. | 545 // Dictionary has been allocated with sufficient size for all elements. |
| 549 DisallowHeapAllocation no_need_to_resize_dictionary; | 546 DisallowHeapAllocation no_need_to_resize_dictionary; |
| 550 HandleScope scope(isolate()); | 547 HandleScope scope(isolate()); |
| 551 USE(UnseededNumberDictionary::AtNumberPut( | 548 USE(UnseededNumberDictionary::AtNumberPut( |
| 552 dictionary_, IdToKey(ast_id), handle(target, isolate()))); | 549 dictionary_, IdToKey(ast_id), handle(target, isolate()))); |
| 553 } | 550 } |
| 554 | 551 |
| 555 | 552 |
| 556 } // namespace internal | 553 } // namespace internal |
| 557 } // namespace v8 | 554 } // namespace v8 |
| OLD | NEW |