OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
4 // met: | 4 // met: |
5 // | 5 // |
6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
(...skipping 412 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
423 Literal* lit_key = key()->AsLiteral(); | 423 Literal* lit_key = key()->AsLiteral(); |
424 ASSERT(lit_key != NULL && lit_key->handle()->IsString()); | 424 ASSERT(lit_key != NULL && lit_key->handle()->IsString()); |
425 Handle<String> name = Handle<String>::cast(lit_key->handle()); | 425 Handle<String> name = Handle<String>::cast(lit_key->handle()); |
426 oracle->LoadReceiverTypes(this, name, &receiver_types_); | 426 oracle->LoadReceiverTypes(this, name, &receiver_types_); |
427 } | 427 } |
428 } else if (oracle->LoadIsBuiltin(this, Builtins::kKeyedLoadIC_String)) { | 428 } else if (oracle->LoadIsBuiltin(this, Builtins::kKeyedLoadIC_String)) { |
429 is_string_access_ = true; | 429 is_string_access_ = true; |
430 } else if (is_monomorphic_) { | 430 } else if (is_monomorphic_) { |
431 receiver_types_.Add(oracle->LoadMonomorphicReceiverType(this), | 431 receiver_types_.Add(oracle->LoadMonomorphicReceiverType(this), |
432 zone); | 432 zone); |
433 } else if (oracle->LoadIsMegamorphicWithTypeInfo(this)) { | 433 } else if (oracle->LoadIsPolymorphic(this)) { |
434 receiver_types_.Reserve(kMaxKeyedPolymorphism, zone); | 434 receiver_types_.Reserve(kMaxKeyedPolymorphism, zone); |
435 oracle->CollectKeyedReceiverTypes(PropertyFeedbackId(), &receiver_types_); | 435 oracle->CollectKeyedReceiverTypes(PropertyFeedbackId(), &receiver_types_); |
436 } | 436 } |
437 } | 437 } |
438 | 438 |
439 | 439 |
440 void Assignment::RecordTypeFeedback(TypeFeedbackOracle* oracle, | 440 void Assignment::RecordTypeFeedback(TypeFeedbackOracle* oracle, |
441 Zone* zone) { | 441 Zone* zone) { |
442 Property* prop = target()->AsProperty(); | 442 Property* prop = target()->AsProperty(); |
443 ASSERT(prop != NULL); | 443 ASSERT(prop != NULL); |
444 TypeFeedbackId id = AssignmentFeedbackId(); | 444 TypeFeedbackId id = AssignmentFeedbackId(); |
445 is_monomorphic_ = oracle->StoreIsMonomorphicNormal(id); | 445 is_monomorphic_ = oracle->StoreIsMonomorphicNormal(id); |
446 receiver_types_.Clear(); | 446 receiver_types_.Clear(); |
447 if (prop->key()->IsPropertyName()) { | 447 if (prop->key()->IsPropertyName()) { |
448 Literal* lit_key = prop->key()->AsLiteral(); | 448 Literal* lit_key = prop->key()->AsLiteral(); |
449 ASSERT(lit_key != NULL && lit_key->handle()->IsString()); | 449 ASSERT(lit_key != NULL && lit_key->handle()->IsString()); |
450 Handle<String> name = Handle<String>::cast(lit_key->handle()); | 450 Handle<String> name = Handle<String>::cast(lit_key->handle()); |
451 oracle->StoreReceiverTypes(this, name, &receiver_types_); | 451 oracle->StoreReceiverTypes(this, name, &receiver_types_); |
452 } else if (is_monomorphic_) { | 452 } else if (is_monomorphic_) { |
453 // Record receiver type for monomorphic keyed stores. | 453 // Record receiver type for monomorphic keyed stores. |
454 receiver_types_.Add(oracle->StoreMonomorphicReceiverType(id), zone); | 454 receiver_types_.Add(oracle->StoreMonomorphicReceiverType(id), zone); |
455 } else if (oracle->StoreIsMegamorphicWithTypeInfo(id)) { | 455 } else if (oracle->StoreIsPolymorphic(id)) { |
456 receiver_types_.Reserve(kMaxKeyedPolymorphism, zone); | 456 receiver_types_.Reserve(kMaxKeyedPolymorphism, zone); |
457 oracle->CollectKeyedReceiverTypes(id, &receiver_types_); | 457 oracle->CollectKeyedReceiverTypes(id, &receiver_types_); |
458 } | 458 } |
459 } | 459 } |
460 | 460 |
461 | 461 |
462 void CountOperation::RecordTypeFeedback(TypeFeedbackOracle* oracle, | 462 void CountOperation::RecordTypeFeedback(TypeFeedbackOracle* oracle, |
463 Zone* zone) { | 463 Zone* zone) { |
464 TypeFeedbackId id = CountStoreFeedbackId(); | 464 TypeFeedbackId id = CountStoreFeedbackId(); |
465 is_monomorphic_ = oracle->StoreIsMonomorphicNormal(id); | 465 is_monomorphic_ = oracle->StoreIsMonomorphicNormal(id); |
466 receiver_types_.Clear(); | 466 receiver_types_.Clear(); |
467 if (is_monomorphic_) { | 467 if (is_monomorphic_) { |
468 // Record receiver type for monomorphic keyed stores. | 468 // Record receiver type for monomorphic keyed stores. |
469 receiver_types_.Add( | 469 receiver_types_.Add( |
470 oracle->StoreMonomorphicReceiverType(id), zone); | 470 oracle->StoreMonomorphicReceiverType(id), zone); |
471 } else if (oracle->StoreIsMegamorphicWithTypeInfo(id)) { | 471 } else if (oracle->StoreIsPolymorphic(id)) { |
472 receiver_types_.Reserve(kMaxKeyedPolymorphism, zone); | 472 receiver_types_.Reserve(kMaxKeyedPolymorphism, zone); |
473 oracle->CollectKeyedReceiverTypes(id, &receiver_types_); | 473 oracle->CollectKeyedReceiverTypes(id, &receiver_types_); |
474 } | 474 } |
475 } | 475 } |
476 | 476 |
477 | 477 |
478 void CaseClause::RecordTypeFeedback(TypeFeedbackOracle* oracle) { | 478 void CaseClause::RecordTypeFeedback(TypeFeedbackOracle* oracle) { |
479 TypeInfo info = oracle->SwitchType(this); | 479 TypeInfo info = oracle->SwitchType(this); |
480 if (info.IsUninitialized()) info = TypeInfo::Unknown(); | 480 if (info.IsUninitialized()) info = TypeInfo::Unknown(); |
481 if (info.IsSmi()) { | 481 if (info.IsSmi()) { |
(...skipping 628 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1110 OS::SNPrintF(buffer, "%d", Smi::cast(*handle_)->value()); | 1110 OS::SNPrintF(buffer, "%d", Smi::cast(*handle_)->value()); |
1111 str = arr; | 1111 str = arr; |
1112 } else { | 1112 } else { |
1113 str = DoubleToCString(handle_->Number(), buffer); | 1113 str = DoubleToCString(handle_->Number(), buffer); |
1114 } | 1114 } |
1115 return FACTORY->NewStringFromAscii(CStrVector(str)); | 1115 return FACTORY->NewStringFromAscii(CStrVector(str)); |
1116 } | 1116 } |
1117 | 1117 |
1118 | 1118 |
1119 } } // namespace v8::internal | 1119 } } // namespace v8::internal |
OLD | NEW |