OLD | NEW |
1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 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 12 matching lines...) Expand all Loading... |
23 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | 23 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
24 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 24 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
25 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 25 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
26 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 26 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
27 | 27 |
28 #include "v8.h" | 28 #include "v8.h" |
29 | 29 |
30 #if defined(V8_TARGET_ARCH_ARM) | 30 #if defined(V8_TARGET_ARCH_ARM) |
31 | 31 |
32 #include "code-stubs.h" | 32 #include "code-stubs.h" |
33 #include "codegen-inl.h" | 33 #include "codegen.h" |
34 #include "compiler.h" | 34 #include "compiler.h" |
35 #include "debug.h" | 35 #include "debug.h" |
36 #include "full-codegen.h" | 36 #include "full-codegen.h" |
37 #include "parser.h" | 37 #include "parser.h" |
38 #include "scopes.h" | 38 #include "scopes.h" |
39 #include "stub-cache.h" | 39 #include "stub-cache.h" |
40 | 40 |
41 #include "arm/code-stubs-arm.h" | 41 #include "arm/code-stubs-arm.h" |
42 | 42 |
43 namespace v8 { | 43 namespace v8 { |
(...skipping 773 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
817 VisitForStackValue(stmt->tag()); | 817 VisitForStackValue(stmt->tag()); |
818 PrepareForBailoutForId(stmt->EntryId(), NO_REGISTERS); | 818 PrepareForBailoutForId(stmt->EntryId(), NO_REGISTERS); |
819 | 819 |
820 ZoneList<CaseClause*>* clauses = stmt->cases(); | 820 ZoneList<CaseClause*>* clauses = stmt->cases(); |
821 CaseClause* default_clause = NULL; // Can occur anywhere in the list. | 821 CaseClause* default_clause = NULL; // Can occur anywhere in the list. |
822 | 822 |
823 Label next_test; // Recycled for each test. | 823 Label next_test; // Recycled for each test. |
824 // Compile all the tests with branches to their bodies. | 824 // Compile all the tests with branches to their bodies. |
825 for (int i = 0; i < clauses->length(); i++) { | 825 for (int i = 0; i < clauses->length(); i++) { |
826 CaseClause* clause = clauses->at(i); | 826 CaseClause* clause = clauses->at(i); |
827 clause->body_target()->entry_label()->Unuse(); | 827 clause->body_target()->Unuse(); |
828 | 828 |
829 // The default is not a test, but remember it as final fall through. | 829 // The default is not a test, but remember it as final fall through. |
830 if (clause->is_default()) { | 830 if (clause->is_default()) { |
831 default_clause = clause; | 831 default_clause = clause; |
832 continue; | 832 continue; |
833 } | 833 } |
834 | 834 |
835 Comment cmnt(masm_, "[ Case comparison"); | 835 Comment cmnt(masm_, "[ Case comparison"); |
836 __ bind(&next_test); | 836 __ bind(&next_test); |
837 next_test.Unuse(); | 837 next_test.Unuse(); |
838 | 838 |
839 // Compile the label expression. | 839 // Compile the label expression. |
840 VisitForAccumulatorValue(clause->label()); | 840 VisitForAccumulatorValue(clause->label()); |
841 | 841 |
842 // Perform the comparison as if via '==='. | 842 // Perform the comparison as if via '==='. |
843 __ ldr(r1, MemOperand(sp, 0)); // Switch value. | 843 __ ldr(r1, MemOperand(sp, 0)); // Switch value. |
844 bool inline_smi_code = ShouldInlineSmiCase(Token::EQ_STRICT); | 844 bool inline_smi_code = ShouldInlineSmiCase(Token::EQ_STRICT); |
845 JumpPatchSite patch_site(masm_); | 845 JumpPatchSite patch_site(masm_); |
846 if (inline_smi_code) { | 846 if (inline_smi_code) { |
847 Label slow_case; | 847 Label slow_case; |
848 __ orr(r2, r1, r0); | 848 __ orr(r2, r1, r0); |
849 patch_site.EmitJumpIfNotSmi(r2, &slow_case); | 849 patch_site.EmitJumpIfNotSmi(r2, &slow_case); |
850 | 850 |
851 __ cmp(r1, r0); | 851 __ cmp(r1, r0); |
852 __ b(ne, &next_test); | 852 __ b(ne, &next_test); |
853 __ Drop(1); // Switch value is no longer needed. | 853 __ Drop(1); // Switch value is no longer needed. |
854 __ b(clause->body_target()->entry_label()); | 854 __ b(clause->body_target()); |
855 __ bind(&slow_case); | 855 __ bind(&slow_case); |
856 } | 856 } |
857 | 857 |
858 // Record position before stub call for type feedback. | 858 // Record position before stub call for type feedback. |
859 SetSourcePosition(clause->position()); | 859 SetSourcePosition(clause->position()); |
860 Handle<Code> ic = CompareIC::GetUninitialized(Token::EQ_STRICT); | 860 Handle<Code> ic = CompareIC::GetUninitialized(Token::EQ_STRICT); |
861 EmitCallIC(ic, &patch_site); | 861 EmitCallIC(ic, &patch_site); |
862 __ cmp(r0, Operand(0)); | 862 __ cmp(r0, Operand(0)); |
863 __ b(ne, &next_test); | 863 __ b(ne, &next_test); |
864 __ Drop(1); // Switch value is no longer needed. | 864 __ Drop(1); // Switch value is no longer needed. |
865 __ b(clause->body_target()->entry_label()); | 865 __ b(clause->body_target()); |
866 } | 866 } |
867 | 867 |
868 // Discard the test value and jump to the default if present, otherwise to | 868 // Discard the test value and jump to the default if present, otherwise to |
869 // the end of the statement. | 869 // the end of the statement. |
870 __ bind(&next_test); | 870 __ bind(&next_test); |
871 __ Drop(1); // Switch value is no longer needed. | 871 __ Drop(1); // Switch value is no longer needed. |
872 if (default_clause == NULL) { | 872 if (default_clause == NULL) { |
873 __ b(nested_statement.break_target()); | 873 __ b(nested_statement.break_target()); |
874 } else { | 874 } else { |
875 __ b(default_clause->body_target()->entry_label()); | 875 __ b(default_clause->body_target()); |
876 } | 876 } |
877 | 877 |
878 // Compile all the case bodies. | 878 // Compile all the case bodies. |
879 for (int i = 0; i < clauses->length(); i++) { | 879 for (int i = 0; i < clauses->length(); i++) { |
880 Comment cmnt(masm_, "[ Case body"); | 880 Comment cmnt(masm_, "[ Case body"); |
881 CaseClause* clause = clauses->at(i); | 881 CaseClause* clause = clauses->at(i); |
882 __ bind(clause->body_target()->entry_label()); | 882 __ bind(clause->body_target()); |
883 PrepareForBailoutForId(clause->EntryId(), NO_REGISTERS); | 883 PrepareForBailoutForId(clause->EntryId(), NO_REGISTERS); |
884 VisitStatements(clause->statements()); | 884 VisitStatements(clause->statements()); |
885 } | 885 } |
886 | 886 |
887 __ bind(nested_statement.break_target()); | 887 __ bind(nested_statement.break_target()); |
888 PrepareForBailoutForId(stmt->ExitId(), NO_REGISTERS); | 888 PrepareForBailoutForId(stmt->ExitId(), NO_REGISTERS); |
889 } | 889 } |
890 | 890 |
891 | 891 |
892 void FullCodeGenerator::VisitForInStatement(ForInStatement* stmt) { | 892 void FullCodeGenerator::VisitForInStatement(ForInStatement* stmt) { |
(...skipping 3472 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4365 __ mov(r1, Operand(r1, ASR, 1)); // Un-smi-tag value. | 4365 __ mov(r1, Operand(r1, ASR, 1)); // Un-smi-tag value. |
4366 __ add(pc, r1, Operand(masm_->CodeObject())); | 4366 __ add(pc, r1, Operand(masm_->CodeObject())); |
4367 } | 4367 } |
4368 | 4368 |
4369 | 4369 |
4370 #undef __ | 4370 #undef __ |
4371 | 4371 |
4372 } } // namespace v8::internal | 4372 } } // namespace v8::internal |
4373 | 4373 |
4374 #endif // V8_TARGET_ARCH_ARM | 4374 #endif // V8_TARGET_ARCH_ARM |
OLD | NEW |