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 1043 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1054 __ bind(&next_test); | 1054 __ bind(&next_test); |
1055 __ Drop(1); // Switch value is no longer needed. | 1055 __ Drop(1); // Switch value is no longer needed. |
1056 if (default_clause == NULL) { | 1056 if (default_clause == NULL) { |
1057 __ b(nested_statement.break_label()); | 1057 __ b(nested_statement.break_label()); |
1058 } else { | 1058 } else { |
1059 __ b(default_clause->body_target()); | 1059 __ b(default_clause->body_target()); |
1060 } | 1060 } |
1061 | 1061 |
1062 // Compile all the case bodies. | 1062 // Compile all the case bodies. |
1063 for (int i = 0; i < clauses->length(); i++) { | 1063 for (int i = 0; i < clauses->length(); i++) { |
1064 Comment cmnt(masm_, "[ Case body"); | |
1065 CaseClause* clause = clauses->at(i); | 1064 CaseClause* clause = clauses->at(i); |
1066 __ bind(clause->body_target()); | 1065 __ bind(clause->body_target()); |
1067 PrepareForBailoutForId(clause->EntryId(), NO_REGISTERS); | 1066 PrepareForBailoutForId(clause->EntryId(), NO_REGISTERS); |
| 1067 |
| 1068 // Initialize counter |
| 1069 { Comment cmnt(masm_, "[ Case hit counter"); |
| 1070 Handle<JSGlobalPropertyCell> cell = |
| 1071 isolate()->factory()->NewJSGlobalPropertyCell( |
| 1072 Handle<Object>(Smi::FromInt(0), isolate())); |
| 1073 RecordTypeFeedbackCell(clause->CounterId(), cell); |
| 1074 |
| 1075 // Increment counter |
| 1076 Label ok; |
| 1077 MemOperand counter = |
| 1078 FieldMemOperand(r1, JSGlobalPropertyCell::kValueOffset); |
| 1079 |
| 1080 __ LoadHeapObject(r1, cell); |
| 1081 __ AssertSmi(counter); |
| 1082 __ ldr(r2, counter); |
| 1083 __ add(r2, r2, Operand(Smi::FromInt(1)), SetCC); |
| 1084 __ b(vc, &ok); |
| 1085 __ sub(r2, r2, Operand(Smi::FromInt(1)), SetCC); |
| 1086 __ bind(&ok); |
| 1087 __ str(r2, counter); |
| 1088 } |
| 1089 |
| 1090 Comment cmnt(masm_, "[ Case body"); |
1068 VisitStatements(clause->statements()); | 1091 VisitStatements(clause->statements()); |
1069 } | 1092 } |
1070 | 1093 |
1071 __ bind(nested_statement.break_label()); | 1094 __ bind(nested_statement.break_label()); |
1072 PrepareForBailoutForId(stmt->ExitId(), NO_REGISTERS); | 1095 PrepareForBailoutForId(stmt->ExitId(), NO_REGISTERS); |
1073 } | 1096 } |
1074 | 1097 |
1075 | 1098 |
1076 void FullCodeGenerator::VisitForInStatement(ForInStatement* stmt) { | 1099 void FullCodeGenerator::VisitForInStatement(ForInStatement* stmt) { |
1077 Comment cmnt(masm_, "[ ForInStatement"); | 1100 Comment cmnt(masm_, "[ ForInStatement"); |
(...skipping 3799 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4877 *context_length = 0; | 4900 *context_length = 0; |
4878 return previous_; | 4901 return previous_; |
4879 } | 4902 } |
4880 | 4903 |
4881 | 4904 |
4882 #undef __ | 4905 #undef __ |
4883 | 4906 |
4884 } } // namespace v8::internal | 4907 } } // namespace v8::internal |
4885 | 4908 |
4886 #endif // V8_TARGET_ARCH_ARM | 4909 #endif // V8_TARGET_ARCH_ARM |
OLD | NEW |