| 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 628 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 639 is_monomorphic_ = oracle->CallIsMonomorphic(this); | 639 is_monomorphic_ = oracle->CallIsMonomorphic(this); |
| 640 Property* property = expression()->AsProperty(); | 640 Property* property = expression()->AsProperty(); |
| 641 if (property == NULL) { | 641 if (property == NULL) { |
| 642 // Function call. Specialize for monomorphic calls. | 642 // Function call. Specialize for monomorphic calls. |
| 643 if (is_monomorphic_) target_ = oracle->GetCallTarget(this); | 643 if (is_monomorphic_) target_ = oracle->GetCallTarget(this); |
| 644 } else { | 644 } else { |
| 645 // Method call. Specialize for the receiver types seen at runtime. | 645 // Method call. Specialize for the receiver types seen at runtime. |
| 646 Literal* key = property->key()->AsLiteral(); | 646 Literal* key = property->key()->AsLiteral(); |
| 647 ASSERT(key != NULL && key->value()->IsString()); | 647 ASSERT(key != NULL && key->value()->IsString()); |
| 648 Handle<String> name = Handle<String>::cast(key->value()); | 648 Handle<String> name = Handle<String>::cast(key->value()); |
| 649 check_type_ = oracle->GetCallCheckType(this); |
| 649 receiver_types_.Clear(); | 650 receiver_types_.Clear(); |
| 650 oracle->CallReceiverTypes(this, name, call_kind, &receiver_types_); | 651 if (check_type_ == RECEIVER_MAP_CHECK) { |
| 652 oracle->CallReceiverTypes(this, name, call_kind, &receiver_types_); |
| 653 is_monomorphic_ = is_monomorphic_ && receiver_types_.length() > 0; |
| 654 } else { |
| 655 holder_ = GetPrototypeForPrimitiveCheck(check_type_, oracle->isolate()); |
| 656 receiver_types_.Add(handle(holder_->map()), oracle->zone()); |
| 657 } |
| 651 #ifdef DEBUG | 658 #ifdef DEBUG |
| 652 if (FLAG_enable_slow_asserts) { | 659 if (FLAG_enable_slow_asserts) { |
| 653 int length = receiver_types_.length(); | 660 int length = receiver_types_.length(); |
| 654 for (int i = 0; i < length; i++) { | 661 for (int i = 0; i < length; i++) { |
| 655 Handle<Map> map = receiver_types_.at(i); | 662 Handle<Map> map = receiver_types_.at(i); |
| 656 ASSERT(!map.is_null() && *map != NULL); | 663 ASSERT(!map.is_null() && *map != NULL); |
| 657 } | 664 } |
| 658 } | 665 } |
| 659 #endif | 666 #endif |
| 660 check_type_ = oracle->GetCallCheckType(this); | |
| 661 if (is_monomorphic_) { | 667 if (is_monomorphic_) { |
| 662 Handle<Map> map; | 668 Handle<Map> map = receiver_types_.first(); |
| 663 if (receiver_types_.length() > 0) { | |
| 664 ASSERT(check_type_ == RECEIVER_MAP_CHECK); | |
| 665 map = receiver_types_.at(0); | |
| 666 } else { | |
| 667 ASSERT(check_type_ != RECEIVER_MAP_CHECK); | |
| 668 holder_ = GetPrototypeForPrimitiveCheck(check_type_, oracle->isolate()); | |
| 669 map = Handle<Map>(holder_->map()); | |
| 670 } | |
| 671 is_monomorphic_ = ComputeTarget(map, name); | 669 is_monomorphic_ = ComputeTarget(map, name); |
| 672 } | 670 } |
| 673 } | 671 } |
| 674 } | 672 } |
| 675 | 673 |
| 676 | 674 |
| 677 void CallNew::RecordTypeFeedback(TypeFeedbackOracle* oracle) { | 675 void CallNew::RecordTypeFeedback(TypeFeedbackOracle* oracle) { |
| 678 allocation_info_cell_ = oracle->GetCallNewAllocationInfoCell(this); | 676 allocation_info_cell_ = oracle->GetCallNewAllocationInfoCell(this); |
| 679 is_monomorphic_ = oracle->CallNewIsMonomorphic(this); | 677 is_monomorphic_ = oracle->CallNewIsMonomorphic(this); |
| 680 if (is_monomorphic_) { | 678 if (is_monomorphic_) { |
| (...skipping 397 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1078 } | 1076 } |
| 1079 | 1077 |
| 1080 | 1078 |
| 1081 #define REGULAR_NODE(NodeType) \ | 1079 #define REGULAR_NODE(NodeType) \ |
| 1082 void AstConstructionVisitor::Visit##NodeType(NodeType* node) { \ | 1080 void AstConstructionVisitor::Visit##NodeType(NodeType* node) { \ |
| 1083 increase_node_count(); \ | 1081 increase_node_count(); \ |
| 1084 } | 1082 } |
| 1085 #define DONT_OPTIMIZE_NODE(NodeType) \ | 1083 #define DONT_OPTIMIZE_NODE(NodeType) \ |
| 1086 void AstConstructionVisitor::Visit##NodeType(NodeType* node) { \ | 1084 void AstConstructionVisitor::Visit##NodeType(NodeType* node) { \ |
| 1087 increase_node_count(); \ | 1085 increase_node_count(); \ |
| 1088 add_flag(kDontOptimize); \ | 1086 set_dont_optimize_reason(k##NodeType); \ |
| 1089 add_flag(kDontInline); \ | 1087 add_flag(kDontInline); \ |
| 1090 add_flag(kDontSelfOptimize); \ | 1088 add_flag(kDontSelfOptimize); \ |
| 1091 } | 1089 } |
| 1092 #define DONT_SELFOPTIMIZE_NODE(NodeType) \ | 1090 #define DONT_SELFOPTIMIZE_NODE(NodeType) \ |
| 1093 void AstConstructionVisitor::Visit##NodeType(NodeType* node) { \ | 1091 void AstConstructionVisitor::Visit##NodeType(NodeType* node) { \ |
| 1094 increase_node_count(); \ | 1092 increase_node_count(); \ |
| 1095 add_flag(kDontSelfOptimize); \ | 1093 add_flag(kDontSelfOptimize); \ |
| 1096 } | 1094 } |
| 1097 #define DONT_CACHE_NODE(NodeType) \ | 1095 #define DONT_CACHE_NODE(NodeType) \ |
| 1098 void AstConstructionVisitor::Visit##NodeType(NodeType* node) { \ | 1096 void AstConstructionVisitor::Visit##NodeType(NodeType* node) { \ |
| 1099 increase_node_count(); \ | 1097 increase_node_count(); \ |
| 1100 add_flag(kDontOptimize); \ | 1098 set_dont_optimize_reason(k##NodeType); \ |
| 1101 add_flag(kDontInline); \ | 1099 add_flag(kDontInline); \ |
| 1102 add_flag(kDontSelfOptimize); \ | 1100 add_flag(kDontSelfOptimize); \ |
| 1103 add_flag(kDontCache); \ | 1101 add_flag(kDontCache); \ |
| 1104 } | 1102 } |
| 1105 | 1103 |
| 1106 REGULAR_NODE(VariableDeclaration) | 1104 REGULAR_NODE(VariableDeclaration) |
| 1107 REGULAR_NODE(FunctionDeclaration) | 1105 REGULAR_NODE(FunctionDeclaration) |
| 1108 REGULAR_NODE(Block) | 1106 REGULAR_NODE(Block) |
| 1109 REGULAR_NODE(ExpressionStatement) | 1107 REGULAR_NODE(ExpressionStatement) |
| 1110 REGULAR_NODE(EmptyStatement) | 1108 REGULAR_NODE(EmptyStatement) |
| (...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1192 OS::SNPrintF(buffer, "%d", Smi::cast(*value_)->value()); | 1190 OS::SNPrintF(buffer, "%d", Smi::cast(*value_)->value()); |
| 1193 str = arr; | 1191 str = arr; |
| 1194 } else { | 1192 } else { |
| 1195 str = DoubleToCString(value_->Number(), buffer); | 1193 str = DoubleToCString(value_->Number(), buffer); |
| 1196 } | 1194 } |
| 1197 return isolate_->factory()->NewStringFromAscii(CStrVector(str)); | 1195 return isolate_->factory()->NewStringFromAscii(CStrVector(str)); |
| 1198 } | 1196 } |
| 1199 | 1197 |
| 1200 | 1198 |
| 1201 } } // namespace v8::internal | 1199 } } // namespace v8::internal |
| OLD | NEW |