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 1046 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1057 __ bind(&next_test); | 1057 __ bind(&next_test); |
1058 __ Drop(1); // Switch value is no longer needed. | 1058 __ Drop(1); // Switch value is no longer needed. |
1059 if (default_clause == NULL) { | 1059 if (default_clause == NULL) { |
1060 __ Branch(nested_statement.break_label()); | 1060 __ Branch(nested_statement.break_label()); |
1061 } else { | 1061 } else { |
1062 __ Branch(default_clause->body_target()); | 1062 __ Branch(default_clause->body_target()); |
1063 } | 1063 } |
1064 | 1064 |
1065 // Compile all the case bodies. | 1065 // Compile all the case bodies. |
1066 for (int i = 0; i < clauses->length(); i++) { | 1066 for (int i = 0; i < clauses->length(); i++) { |
1067 Comment cmnt(masm_, "[ Case body"); | |
1068 CaseClause* clause = clauses->at(i); | 1067 CaseClause* clause = clauses->at(i); |
1069 __ bind(clause->body_target()); | 1068 __ bind(clause->body_target()); |
1070 PrepareForBailoutForId(clause->EntryId(), NO_REGISTERS); | 1069 PrepareForBailoutForId(clause->EntryId(), NO_REGISTERS); |
| 1070 |
| 1071 // Initialize counter |
| 1072 { Comment cmnt(masm_, "[ Case hit counter"); |
| 1073 Handle<JSGlobalPropertyCell> cell = |
| 1074 isolate()->factory()->NewJSGlobalPropertyCell( |
| 1075 Handle<Object>(Smi::FromInt(0), isolate())); |
| 1076 RecordTypeFeedbackCell(clause->CounterId(), cell); |
| 1077 |
| 1078 // Increment counter |
| 1079 Label ok; |
| 1080 MemOperand counter = |
| 1081 FieldMemOperand(a1, JSGlobalPropertyCell::kValueOffset); |
| 1082 |
| 1083 __ LoadHeapObject(a1, cell); |
| 1084 __ lw(a2, counter); |
| 1085 __ Addu(a2, a2, Operand(Smi::FromInt(1))); |
| 1086 __ SmiTagCheckOverflow(a2, a3); |
| 1087 __ BranchOnNoOverflow(&ok, a3); |
| 1088 |
| 1089 // Decrement on overflow |
| 1090 __ Subu(a2, a2, Operand(Smi::FromInt(1))); |
| 1091 __ bind(&ok); |
| 1092 __ sw(a2, counter); |
| 1093 } |
| 1094 |
| 1095 Comment cmnt(masm_, "[ Case body"); |
1071 VisitStatements(clause->statements()); | 1096 VisitStatements(clause->statements()); |
1072 } | 1097 } |
1073 | 1098 |
1074 __ bind(nested_statement.break_label()); | 1099 __ bind(nested_statement.break_label()); |
1075 PrepareForBailoutForId(stmt->ExitId(), NO_REGISTERS); | 1100 PrepareForBailoutForId(stmt->ExitId(), NO_REGISTERS); |
1076 } | 1101 } |
1077 | 1102 |
1078 | 1103 |
1079 void FullCodeGenerator::VisitForInStatement(ForInStatement* stmt) { | 1104 void FullCodeGenerator::VisitForInStatement(ForInStatement* stmt) { |
1080 Comment cmnt(masm_, "[ ForInStatement"); | 1105 Comment cmnt(masm_, "[ ForInStatement"); |
(...skipping 3831 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4912 *context_length = 0; | 4937 *context_length = 0; |
4913 return previous_; | 4938 return previous_; |
4914 } | 4939 } |
4915 | 4940 |
4916 | 4941 |
4917 #undef __ | 4942 #undef __ |
4918 | 4943 |
4919 } } // namespace v8::internal | 4944 } } // namespace v8::internal |
4920 | 4945 |
4921 #endif // V8_TARGET_ARCH_MIPS | 4946 #endif // V8_TARGET_ARCH_MIPS |
OLD | NEW |