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 995 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1006 __ bind(&next_test); | 1006 __ bind(&next_test); |
1007 __ Drop(1); // Switch value is no longer needed. | 1007 __ Drop(1); // Switch value is no longer needed. |
1008 if (default_clause == NULL) { | 1008 if (default_clause == NULL) { |
1009 __ jmp(nested_statement.break_label()); | 1009 __ jmp(nested_statement.break_label()); |
1010 } else { | 1010 } else { |
1011 __ jmp(default_clause->body_target()); | 1011 __ jmp(default_clause->body_target()); |
1012 } | 1012 } |
1013 | 1013 |
1014 // Compile all the case bodies. | 1014 // Compile all the case bodies. |
1015 for (int i = 0; i < clauses->length(); i++) { | 1015 for (int i = 0; i < clauses->length(); i++) { |
1016 Comment cmnt(masm_, "[ Case body"); | |
1017 CaseClause* clause = clauses->at(i); | 1016 CaseClause* clause = clauses->at(i); |
1018 __ bind(clause->body_target()); | 1017 __ bind(clause->body_target()); |
1019 PrepareForBailoutForId(clause->EntryId(), NO_REGISTERS); | 1018 PrepareForBailoutForId(clause->EntryId(), NO_REGISTERS); |
| 1019 |
| 1020 // Initialize counter |
| 1021 { Comment cmnt(masm_, "[ Case hit counter"); |
| 1022 Handle<JSGlobalPropertyCell> cell = |
| 1023 isolate()->factory()->NewJSGlobalPropertyCell( |
| 1024 Handle<Object>(Smi::FromInt(0), isolate())); |
| 1025 RecordTypeFeedbackCell(clause->CounterId(), cell); |
| 1026 |
| 1027 // Increment counter |
| 1028 Label ok; |
| 1029 Operand counter = FieldOperand(ebx, JSGlobalPropertyCell::kValueOffset); |
| 1030 |
| 1031 __ LoadHeapObject(ebx, cell); |
| 1032 __ mov(ecx, counter); |
| 1033 __ AssertSmi(ecx); |
| 1034 __ add(ecx, Immediate(Smi::FromInt(1))); |
| 1035 __ j(no_overflow, &ok, Label::kNear); |
| 1036 |
| 1037 // Decrement on overflow |
| 1038 __ sub(ecx, Immediate(Smi::FromInt(1))); |
| 1039 __ bind(&ok); |
| 1040 __ mov(counter, ecx); |
| 1041 } |
| 1042 |
| 1043 Comment cmnt(masm_, "[ Case body"); |
1020 VisitStatements(clause->statements()); | 1044 VisitStatements(clause->statements()); |
1021 } | 1045 } |
1022 | 1046 |
1023 __ bind(nested_statement.break_label()); | 1047 __ bind(nested_statement.break_label()); |
1024 PrepareForBailoutForId(stmt->ExitId(), NO_REGISTERS); | 1048 PrepareForBailoutForId(stmt->ExitId(), NO_REGISTERS); |
1025 } | 1049 } |
1026 | 1050 |
1027 | 1051 |
1028 void FullCodeGenerator::VisitForInStatement(ForInStatement* stmt) { | 1052 void FullCodeGenerator::VisitForInStatement(ForInStatement* stmt) { |
1029 Comment cmnt(masm_, "[ ForInStatement"); | 1053 Comment cmnt(masm_, "[ ForInStatement"); |
(...skipping 3839 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4869 *stack_depth = 0; | 4893 *stack_depth = 0; |
4870 *context_length = 0; | 4894 *context_length = 0; |
4871 return previous_; | 4895 return previous_; |
4872 } | 4896 } |
4873 | 4897 |
4874 #undef __ | 4898 #undef __ |
4875 | 4899 |
4876 } } // namespace v8::internal | 4900 } } // namespace v8::internal |
4877 | 4901 |
4878 #endif // V8_TARGET_ARCH_IA32 | 4902 #endif // V8_TARGET_ARCH_IA32 |
OLD | NEW |