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