| 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 868 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 879 __ Branch(&next_test, ne, v0, Operand(zero_reg)); | 879 __ Branch(&next_test, ne, v0, Operand(zero_reg)); |
| 880 __ Drop(1); // Switch value is no longer needed. | 880 __ Drop(1); // Switch value is no longer needed. |
| 881 __ Branch(clause->body_target()); | 881 __ Branch(clause->body_target()); |
| 882 } | 882 } |
| 883 | 883 |
| 884 // Discard the test value and jump to the default if present, otherwise to | 884 // Discard the test value and jump to the default if present, otherwise to |
| 885 // the end of the statement. | 885 // the end of the statement. |
| 886 __ bind(&next_test); | 886 __ bind(&next_test); |
| 887 __ Drop(1); // Switch value is no longer needed. | 887 __ Drop(1); // Switch value is no longer needed. |
| 888 if (default_clause == NULL) { | 888 if (default_clause == NULL) { |
| 889 __ Branch(nested_statement.break_target()); | 889 __ Branch(nested_statement.break_label()); |
| 890 } else { | 890 } else { |
| 891 __ Branch(default_clause->body_target()); | 891 __ Branch(default_clause->body_target()); |
| 892 } | 892 } |
| 893 | 893 |
| 894 // Compile all the case bodies. | 894 // Compile all the case bodies. |
| 895 for (int i = 0; i < clauses->length(); i++) { | 895 for (int i = 0; i < clauses->length(); i++) { |
| 896 Comment cmnt(masm_, "[ Case body"); | 896 Comment cmnt(masm_, "[ Case body"); |
| 897 CaseClause* clause = clauses->at(i); | 897 CaseClause* clause = clauses->at(i); |
| 898 __ bind(clause->body_target()); | 898 __ bind(clause->body_target()); |
| 899 PrepareForBailoutForId(clause->EntryId(), NO_REGISTERS); | 899 PrepareForBailoutForId(clause->EntryId(), NO_REGISTERS); |
| 900 VisitStatements(clause->statements()); | 900 VisitStatements(clause->statements()); |
| 901 } | 901 } |
| 902 | 902 |
| 903 __ bind(nested_statement.break_target()); | 903 __ bind(nested_statement.break_label()); |
| 904 PrepareForBailoutForId(stmt->ExitId(), NO_REGISTERS); | 904 PrepareForBailoutForId(stmt->ExitId(), NO_REGISTERS); |
| 905 } | 905 } |
| 906 | 906 |
| 907 | 907 |
| 908 void FullCodeGenerator::VisitForInStatement(ForInStatement* stmt) { | 908 void FullCodeGenerator::VisitForInStatement(ForInStatement* stmt) { |
| 909 Comment cmnt(masm_, "[ ForInStatement"); | 909 Comment cmnt(masm_, "[ ForInStatement"); |
| 910 SetStatementPosition(stmt); | 910 SetStatementPosition(stmt); |
| 911 | 911 |
| 912 Label loop, exit; | 912 Label loop, exit; |
| 913 ForIn loop_statement(this, stmt); | 913 ForIn loop_statement(this, stmt); |
| (...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1019 __ Push(a1, v0); | 1019 __ Push(a1, v0); |
| 1020 __ lw(a1, FieldMemOperand(v0, FixedArray::kLengthOffset)); | 1020 __ lw(a1, FieldMemOperand(v0, FixedArray::kLengthOffset)); |
| 1021 __ li(a0, Operand(Smi::FromInt(0))); | 1021 __ li(a0, Operand(Smi::FromInt(0))); |
| 1022 __ Push(a1, a0); // Fixed array length (as smi) and initial index. | 1022 __ Push(a1, a0); // Fixed array length (as smi) and initial index. |
| 1023 | 1023 |
| 1024 // Generate code for doing the condition check. | 1024 // Generate code for doing the condition check. |
| 1025 __ bind(&loop); | 1025 __ bind(&loop); |
| 1026 // Load the current count to a0, load the length to a1. | 1026 // Load the current count to a0, load the length to a1. |
| 1027 __ lw(a0, MemOperand(sp, 0 * kPointerSize)); | 1027 __ lw(a0, MemOperand(sp, 0 * kPointerSize)); |
| 1028 __ lw(a1, MemOperand(sp, 1 * kPointerSize)); | 1028 __ lw(a1, MemOperand(sp, 1 * kPointerSize)); |
| 1029 __ Branch(loop_statement.break_target(), hs, a0, Operand(a1)); | 1029 __ Branch(loop_statement.break_label(), hs, a0, Operand(a1)); |
| 1030 | 1030 |
| 1031 // Get the current entry of the array into register a3. | 1031 // Get the current entry of the array into register a3. |
| 1032 __ lw(a2, MemOperand(sp, 2 * kPointerSize)); | 1032 __ lw(a2, MemOperand(sp, 2 * kPointerSize)); |
| 1033 __ Addu(a2, a2, Operand(FixedArray::kHeaderSize - kHeapObjectTag)); | 1033 __ Addu(a2, a2, Operand(FixedArray::kHeaderSize - kHeapObjectTag)); |
| 1034 __ sll(t0, a0, kPointerSizeLog2 - kSmiTagSize); | 1034 __ sll(t0, a0, kPointerSizeLog2 - kSmiTagSize); |
| 1035 __ addu(t0, a2, t0); // Array base + scaled (smi) index. | 1035 __ addu(t0, a2, t0); // Array base + scaled (smi) index. |
| 1036 __ lw(a3, MemOperand(t0)); // Current entry. | 1036 __ lw(a3, MemOperand(t0)); // Current entry. |
| 1037 | 1037 |
| 1038 // Get the expected map from the stack or a zero map in the | 1038 // Get the expected map from the stack or a zero map in the |
| 1039 // permanent slow case into register a2. | 1039 // permanent slow case into register a2. |
| 1040 __ lw(a2, MemOperand(sp, 3 * kPointerSize)); | 1040 __ lw(a2, MemOperand(sp, 3 * kPointerSize)); |
| 1041 | 1041 |
| 1042 // Check if the expected map still matches that of the enumerable. | 1042 // Check if the expected map still matches that of the enumerable. |
| 1043 // If not, we have to filter the key. | 1043 // If not, we have to filter the key. |
| 1044 Label update_each; | 1044 Label update_each; |
| 1045 __ lw(a1, MemOperand(sp, 4 * kPointerSize)); | 1045 __ lw(a1, MemOperand(sp, 4 * kPointerSize)); |
| 1046 __ lw(t0, FieldMemOperand(a1, HeapObject::kMapOffset)); | 1046 __ lw(t0, FieldMemOperand(a1, HeapObject::kMapOffset)); |
| 1047 __ Branch(&update_each, eq, t0, Operand(a2)); | 1047 __ Branch(&update_each, eq, t0, Operand(a2)); |
| 1048 | 1048 |
| 1049 // Convert the entry to a string or (smi) 0 if it isn't a property | 1049 // Convert the entry to a string or (smi) 0 if it isn't a property |
| 1050 // any more. If the property has been removed while iterating, we | 1050 // any more. If the property has been removed while iterating, we |
| 1051 // just skip it. | 1051 // just skip it. |
| 1052 __ push(a1); // Enumerable. | 1052 __ push(a1); // Enumerable. |
| 1053 __ push(a3); // Current entry. | 1053 __ push(a3); // Current entry. |
| 1054 __ InvokeBuiltin(Builtins::FILTER_KEY, CALL_FUNCTION); | 1054 __ InvokeBuiltin(Builtins::FILTER_KEY, CALL_FUNCTION); |
| 1055 __ mov(a3, result_register()); | 1055 __ mov(a3, result_register()); |
| 1056 __ Branch(loop_statement.continue_target(), eq, a3, Operand(zero_reg)); | 1056 __ Branch(loop_statement.continue_label(), eq, a3, Operand(zero_reg)); |
| 1057 | 1057 |
| 1058 // Update the 'each' property or variable from the possibly filtered | 1058 // Update the 'each' property or variable from the possibly filtered |
| 1059 // entry in register a3. | 1059 // entry in register a3. |
| 1060 __ bind(&update_each); | 1060 __ bind(&update_each); |
| 1061 __ mov(result_register(), a3); | 1061 __ mov(result_register(), a3); |
| 1062 // Perform the assignment as if via '='. | 1062 // Perform the assignment as if via '='. |
| 1063 { EffectContext context(this); | 1063 { EffectContext context(this); |
| 1064 EmitAssignment(stmt->each(), stmt->AssignmentId()); | 1064 EmitAssignment(stmt->each(), stmt->AssignmentId()); |
| 1065 } | 1065 } |
| 1066 | 1066 |
| 1067 // Generate code for the body of the loop. | 1067 // Generate code for the body of the loop. |
| 1068 Visit(stmt->body()); | 1068 Visit(stmt->body()); |
| 1069 | 1069 |
| 1070 // Generate code for the going to the next element by incrementing | 1070 // Generate code for the going to the next element by incrementing |
| 1071 // the index (smi) stored on top of the stack. | 1071 // the index (smi) stored on top of the stack. |
| 1072 __ bind(loop_statement.continue_target()); | 1072 __ bind(loop_statement.continue_label()); |
| 1073 __ pop(a0); | 1073 __ pop(a0); |
| 1074 __ Addu(a0, a0, Operand(Smi::FromInt(1))); | 1074 __ Addu(a0, a0, Operand(Smi::FromInt(1))); |
| 1075 __ push(a0); | 1075 __ push(a0); |
| 1076 | 1076 |
| 1077 EmitStackCheck(stmt); | 1077 EmitStackCheck(stmt); |
| 1078 __ Branch(&loop); | 1078 __ Branch(&loop); |
| 1079 | 1079 |
| 1080 // Remove the pointers stored on the stack. | 1080 // Remove the pointers stored on the stack. |
| 1081 __ bind(loop_statement.break_target()); | 1081 __ bind(loop_statement.break_label()); |
| 1082 __ Drop(5); | 1082 __ Drop(5); |
| 1083 | 1083 |
| 1084 // Exit and decrement the loop depth. | 1084 // Exit and decrement the loop depth. |
| 1085 __ bind(&exit); | 1085 __ bind(&exit); |
| 1086 decrement_loop_depth(); | 1086 decrement_loop_depth(); |
| 1087 } | 1087 } |
| 1088 | 1088 |
| 1089 | 1089 |
| 1090 void FullCodeGenerator::EmitNewClosure(Handle<SharedFunctionInfo> info, | 1090 void FullCodeGenerator::EmitNewClosure(Handle<SharedFunctionInfo> info, |
| 1091 bool pretenure) { | 1091 bool pretenure) { |
| (...skipping 3226 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4318 __ Addu(at, a1, Operand(masm_->CodeObject())); | 4318 __ Addu(at, a1, Operand(masm_->CodeObject())); |
| 4319 __ Jump(at); | 4319 __ Jump(at); |
| 4320 } | 4320 } |
| 4321 | 4321 |
| 4322 | 4322 |
| 4323 #undef __ | 4323 #undef __ |
| 4324 | 4324 |
| 4325 } } // namespace v8::internal | 4325 } } // namespace v8::internal |
| 4326 | 4326 |
| 4327 #endif // V8_TARGET_ARCH_MIPS | 4327 #endif // V8_TARGET_ARCH_MIPS |
| OLD | NEW |