Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(307)

Side by Side Diff: src/arm/full-codegen-arm.cc

Issue 7669018: Clean up the nesting stack in the full code generator. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 9 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | src/full-codegen.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 860 matching lines...) Expand 10 before | Expand all | Expand 10 after
871 __ b(ne, &next_test); 871 __ b(ne, &next_test);
872 __ Drop(1); // Switch value is no longer needed. 872 __ Drop(1); // Switch value is no longer needed.
873 __ b(clause->body_target()); 873 __ b(clause->body_target());
874 } 874 }
875 875
876 // Discard the test value and jump to the default if present, otherwise to 876 // Discard the test value and jump to the default if present, otherwise to
877 // the end of the statement. 877 // the end of the statement.
878 __ bind(&next_test); 878 __ bind(&next_test);
879 __ Drop(1); // Switch value is no longer needed. 879 __ Drop(1); // Switch value is no longer needed.
880 if (default_clause == NULL) { 880 if (default_clause == NULL) {
881 __ b(nested_statement.break_target()); 881 __ b(nested_statement.break_label());
882 } else { 882 } else {
883 __ b(default_clause->body_target()); 883 __ b(default_clause->body_target());
884 } 884 }
885 885
886 // Compile all the case bodies. 886 // Compile all the case bodies.
887 for (int i = 0; i < clauses->length(); i++) { 887 for (int i = 0; i < clauses->length(); i++) {
888 Comment cmnt(masm_, "[ Case body"); 888 Comment cmnt(masm_, "[ Case body");
889 CaseClause* clause = clauses->at(i); 889 CaseClause* clause = clauses->at(i);
890 __ bind(clause->body_target()); 890 __ bind(clause->body_target());
891 PrepareForBailoutForId(clause->EntryId(), NO_REGISTERS); 891 PrepareForBailoutForId(clause->EntryId(), NO_REGISTERS);
892 VisitStatements(clause->statements()); 892 VisitStatements(clause->statements());
893 } 893 }
894 894
895 __ bind(nested_statement.break_target()); 895 __ bind(nested_statement.break_label());
896 PrepareForBailoutForId(stmt->ExitId(), NO_REGISTERS); 896 PrepareForBailoutForId(stmt->ExitId(), NO_REGISTERS);
897 } 897 }
898 898
899 899
900 void FullCodeGenerator::VisitForInStatement(ForInStatement* stmt) { 900 void FullCodeGenerator::VisitForInStatement(ForInStatement* stmt) {
901 Comment cmnt(masm_, "[ ForInStatement"); 901 Comment cmnt(masm_, "[ ForInStatement");
902 SetStatementPosition(stmt); 902 SetStatementPosition(stmt);
903 903
904 Label loop, exit; 904 Label loop, exit;
905 ForIn loop_statement(this, stmt); 905 ForIn loop_statement(this, stmt);
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after
1016 __ Push(r1, r0); 1016 __ Push(r1, r0);
1017 __ ldr(r1, FieldMemOperand(r0, FixedArray::kLengthOffset)); 1017 __ ldr(r1, FieldMemOperand(r0, FixedArray::kLengthOffset));
1018 __ mov(r0, Operand(Smi::FromInt(0))); 1018 __ mov(r0, Operand(Smi::FromInt(0)));
1019 __ Push(r1, r0); // Fixed array length (as smi) and initial index. 1019 __ Push(r1, r0); // Fixed array length (as smi) and initial index.
1020 1020
1021 // Generate code for doing the condition check. 1021 // Generate code for doing the condition check.
1022 __ bind(&loop); 1022 __ bind(&loop);
1023 // Load the current count to r0, load the length to r1. 1023 // Load the current count to r0, load the length to r1.
1024 __ Ldrd(r0, r1, MemOperand(sp, 0 * kPointerSize)); 1024 __ Ldrd(r0, r1, MemOperand(sp, 0 * kPointerSize));
1025 __ cmp(r0, r1); // Compare to the array length. 1025 __ cmp(r0, r1); // Compare to the array length.
1026 __ b(hs, loop_statement.break_target()); 1026 __ b(hs, loop_statement.break_label());
1027 1027
1028 // Get the current entry of the array into register r3. 1028 // Get the current entry of the array into register r3.
1029 __ ldr(r2, MemOperand(sp, 2 * kPointerSize)); 1029 __ ldr(r2, MemOperand(sp, 2 * kPointerSize));
1030 __ add(r2, r2, Operand(FixedArray::kHeaderSize - kHeapObjectTag)); 1030 __ add(r2, r2, Operand(FixedArray::kHeaderSize - kHeapObjectTag));
1031 __ ldr(r3, MemOperand(r2, r0, LSL, kPointerSizeLog2 - kSmiTagSize)); 1031 __ ldr(r3, MemOperand(r2, r0, LSL, kPointerSizeLog2 - kSmiTagSize));
1032 1032
1033 // Get the expected map from the stack or a zero map in the 1033 // Get the expected map from the stack or a zero map in the
1034 // permanent slow case into register r2. 1034 // permanent slow case into register r2.
1035 __ ldr(r2, MemOperand(sp, 3 * kPointerSize)); 1035 __ ldr(r2, MemOperand(sp, 3 * kPointerSize));
1036 1036
1037 // Check if the expected map still matches that of the enumerable. 1037 // Check if the expected map still matches that of the enumerable.
1038 // If not, we have to filter the key. 1038 // If not, we have to filter the key.
1039 Label update_each; 1039 Label update_each;
1040 __ ldr(r1, MemOperand(sp, 4 * kPointerSize)); 1040 __ ldr(r1, MemOperand(sp, 4 * kPointerSize));
1041 __ ldr(r4, FieldMemOperand(r1, HeapObject::kMapOffset)); 1041 __ ldr(r4, FieldMemOperand(r1, HeapObject::kMapOffset));
1042 __ cmp(r4, Operand(r2)); 1042 __ cmp(r4, Operand(r2));
1043 __ b(eq, &update_each); 1043 __ b(eq, &update_each);
1044 1044
1045 // Convert the entry to a string or (smi) 0 if it isn't a property 1045 // Convert the entry to a string or (smi) 0 if it isn't a property
1046 // any more. If the property has been removed while iterating, we 1046 // any more. If the property has been removed while iterating, we
1047 // just skip it. 1047 // just skip it.
1048 __ push(r1); // Enumerable. 1048 __ push(r1); // Enumerable.
1049 __ push(r3); // Current entry. 1049 __ push(r3); // Current entry.
1050 __ InvokeBuiltin(Builtins::FILTER_KEY, CALL_FUNCTION); 1050 __ InvokeBuiltin(Builtins::FILTER_KEY, CALL_FUNCTION);
1051 __ mov(r3, Operand(r0), SetCC); 1051 __ mov(r3, Operand(r0), SetCC);
1052 __ b(eq, loop_statement.continue_target()); 1052 __ b(eq, loop_statement.continue_label());
1053 1053
1054 // Update the 'each' property or variable from the possibly filtered 1054 // Update the 'each' property or variable from the possibly filtered
1055 // entry in register r3. 1055 // entry in register r3.
1056 __ bind(&update_each); 1056 __ bind(&update_each);
1057 __ mov(result_register(), r3); 1057 __ mov(result_register(), r3);
1058 // Perform the assignment as if via '='. 1058 // Perform the assignment as if via '='.
1059 { EffectContext context(this); 1059 { EffectContext context(this);
1060 EmitAssignment(stmt->each(), stmt->AssignmentId()); 1060 EmitAssignment(stmt->each(), stmt->AssignmentId());
1061 } 1061 }
1062 1062
1063 // Generate code for the body of the loop. 1063 // Generate code for the body of the loop.
1064 Visit(stmt->body()); 1064 Visit(stmt->body());
1065 1065
1066 // Generate code for the going to the next element by incrementing 1066 // Generate code for the going to the next element by incrementing
1067 // the index (smi) stored on top of the stack. 1067 // the index (smi) stored on top of the stack.
1068 __ bind(loop_statement.continue_target()); 1068 __ bind(loop_statement.continue_label());
1069 __ pop(r0); 1069 __ pop(r0);
1070 __ add(r0, r0, Operand(Smi::FromInt(1))); 1070 __ add(r0, r0, Operand(Smi::FromInt(1)));
1071 __ push(r0); 1071 __ push(r0);
1072 1072
1073 EmitStackCheck(stmt); 1073 EmitStackCheck(stmt);
1074 __ b(&loop); 1074 __ b(&loop);
1075 1075
1076 // Remove the pointers stored on the stack. 1076 // Remove the pointers stored on the stack.
1077 __ bind(loop_statement.break_target()); 1077 __ bind(loop_statement.break_label());
1078 __ Drop(5); 1078 __ Drop(5);
1079 1079
1080 // Exit and decrement the loop depth. 1080 // Exit and decrement the loop depth.
1081 __ bind(&exit); 1081 __ bind(&exit);
1082 decrement_loop_depth(); 1082 decrement_loop_depth();
1083 } 1083 }
1084 1084
1085 1085
1086 void FullCodeGenerator::EmitNewClosure(Handle<SharedFunctionInfo> info, 1086 void FullCodeGenerator::EmitNewClosure(Handle<SharedFunctionInfo> info,
1087 bool pretenure) { 1087 bool pretenure) {
(...skipping 3210 matching lines...) Expand 10 before | Expand all | Expand 10 after
4298 __ mov(r1, Operand(r1, ASR, 1)); // Un-smi-tag value. 4298 __ mov(r1, Operand(r1, ASR, 1)); // Un-smi-tag value.
4299 __ add(pc, r1, Operand(masm_->CodeObject())); 4299 __ add(pc, r1, Operand(masm_->CodeObject()));
4300 } 4300 }
4301 4301
4302 4302
4303 #undef __ 4303 #undef __
4304 4304
4305 } } // namespace v8::internal 4305 } } // namespace v8::internal
4306 4306
4307 #endif // V8_TARGET_ARCH_ARM 4307 #endif // V8_TARGET_ARCH_ARM
OLDNEW
« no previous file with comments | « no previous file | src/full-codegen.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698