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 678 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
689 break; | 689 break; |
690 case BOOLEAN_CHECK: | 690 case BOOLEAN_CHECK: |
691 function = native_context->boolean_function(); | 691 function = native_context->boolean_function(); |
692 break; | 692 break; |
693 } | 693 } |
694 ASSERT(function != NULL); | 694 ASSERT(function != NULL); |
695 return Handle<JSObject>(JSObject::cast(function->instance_prototype())); | 695 return Handle<JSObject>(JSObject::cast(function->instance_prototype())); |
696 } | 696 } |
697 | 697 |
698 | 698 |
699 void Call::RecordTypeFeedback(TypeFeedbackOracle* oracle, | 699 void Call::RecordTypeFeedback(TypeFeedbackOracle* oracle) { |
700 ContextualMode contextual_mode) { | |
701 is_monomorphic_ = oracle->CallIsMonomorphic(CallFeedbackId()); | 700 is_monomorphic_ = oracle->CallIsMonomorphic(CallFeedbackId()); |
702 Property* property = expression()->AsProperty(); | 701 Property* property = expression()->AsProperty(); |
703 if (property == NULL) { | 702 if (property == NULL) { |
704 // Function call. Specialize for monomorphic calls. | 703 // Function call. Specialize for monomorphic calls. |
705 if (is_monomorphic_) target_ = oracle->GetCallTarget(CallFeedbackId()); | 704 if (is_monomorphic_) target_ = oracle->GetCallTarget(CallFeedbackId()); |
706 } else if (property->key()->IsPropertyName()) { | 705 } else if (property->key()->IsPropertyName()) { |
707 // Method call. Specialize for the receiver types seen at runtime. | 706 // Method call. Specialize for the receiver types seen at runtime. |
708 Literal* key = property->key()->AsLiteral(); | 707 Literal* key = property->key()->AsLiteral(); |
709 ASSERT(key != NULL && key->value()->IsString()); | 708 ASSERT(key != NULL && key->value()->IsString()); |
710 Handle<String> name = Handle<String>::cast(key->value()); | 709 Handle<String> name = Handle<String>::cast(key->value()); |
711 check_type_ = oracle->GetCallCheckType(CallFeedbackId()); | 710 check_type_ = oracle->GetCallCheckType(CallFeedbackId()); |
712 receiver_types_.Clear(); | 711 receiver_types_.Clear(); |
713 if (check_type_ == RECEIVER_MAP_CHECK) { | 712 if (check_type_ == RECEIVER_MAP_CHECK) { |
714 oracle->CallReceiverTypes(CallFeedbackId(), | 713 oracle->CallReceiverTypes(CallFeedbackId(), |
715 name, arguments()->length(), contextual_mode, &receiver_types_); | 714 name, arguments()->length(), &receiver_types_); |
716 is_monomorphic_ = is_monomorphic_ && receiver_types_.length() > 0; | 715 is_monomorphic_ = is_monomorphic_ && receiver_types_.length() > 0; |
717 } else { | 716 } else { |
718 holder_ = GetPrototypeForPrimitiveCheck(check_type_, oracle->isolate()); | 717 holder_ = GetPrototypeForPrimitiveCheck(check_type_, oracle->isolate()); |
719 receiver_types_.Add(handle(holder_->map()), oracle->zone()); | 718 receiver_types_.Add(handle(holder_->map()), oracle->zone()); |
720 } | 719 } |
721 #ifdef ENABLE_SLOW_ASSERTS | 720 #ifdef ENABLE_SLOW_ASSERTS |
722 if (FLAG_enable_slow_asserts) { | 721 if (FLAG_enable_slow_asserts) { |
723 int length = receiver_types_.length(); | 722 int length = receiver_types_.length(); |
724 for (int i = 0; i < length; i++) { | 723 for (int i = 0; i < length; i++) { |
725 Handle<Map> map = receiver_types_.at(i); | 724 Handle<Map> map = receiver_types_.at(i); |
(...skipping 536 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1262 OS::SNPrintF(buffer, "%d", Smi::cast(*value_)->value()); | 1261 OS::SNPrintF(buffer, "%d", Smi::cast(*value_)->value()); |
1263 str = arr; | 1262 str = arr; |
1264 } else { | 1263 } else { |
1265 str = DoubleToCString(value_->Number(), buffer); | 1264 str = DoubleToCString(value_->Number(), buffer); |
1266 } | 1265 } |
1267 return isolate_->factory()->NewStringFromAscii(CStrVector(str)); | 1266 return isolate_->factory()->NewStringFromAscii(CStrVector(str)); |
1268 } | 1267 } |
1269 | 1268 |
1270 | 1269 |
1271 } } // namespace v8::internal | 1270 } } // namespace v8::internal |
OLD | NEW |