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

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

Issue 5883003: Fix issue 974. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge/build/ia32
Patch Set: Better instruction sequence for x64. Created 10 years 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 | « src/full-codegen.h ('k') | src/ia32/full-codegen-ia32.cc » ('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 2010 the V8 project authors. All rights reserved. 1 // Copyright 2010 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 928 matching lines...) Expand 10 before | Expand all | Expand 10 after
939 __ bind(&done); 939 __ bind(&done);
940 PrepareForBailoutForId(stmt->id(), NO_REGISTERS); 940 PrepareForBailoutForId(stmt->id(), NO_REGISTERS);
941 } 941 }
942 942
943 943
944 void FullCodeGenerator::VisitContinueStatement(ContinueStatement* stmt) { 944 void FullCodeGenerator::VisitContinueStatement(ContinueStatement* stmt) {
945 Comment cmnt(masm_, "[ ContinueStatement"); 945 Comment cmnt(masm_, "[ ContinueStatement");
946 SetStatementPosition(stmt); 946 SetStatementPosition(stmt);
947 NestedStatement* current = nesting_stack_; 947 NestedStatement* current = nesting_stack_;
948 int stack_depth = 0; 948 int stack_depth = 0;
949 // When continuing, we clobber the unpredictable value in the accumulator
950 // with one that's safe for GC. If we hit an exit from the try block of
951 // try...finally on our way out, we will unconditionally preserve the
952 // accumulator on the stack.
953 ClearAccumulator();
949 while (!current->IsContinueTarget(stmt->target())) { 954 while (!current->IsContinueTarget(stmt->target())) {
950 stack_depth = current->Exit(stack_depth); 955 stack_depth = current->Exit(stack_depth);
951 current = current->outer(); 956 current = current->outer();
952 } 957 }
953 __ Drop(stack_depth); 958 __ Drop(stack_depth);
954 959
955 Iteration* loop = current->AsIteration(); 960 Iteration* loop = current->AsIteration();
956 __ jmp(loop->continue_target()); 961 __ jmp(loop->continue_target());
957 } 962 }
958 963
959 964
960 void FullCodeGenerator::VisitBreakStatement(BreakStatement* stmt) { 965 void FullCodeGenerator::VisitBreakStatement(BreakStatement* stmt) {
961 Comment cmnt(masm_, "[ BreakStatement"); 966 Comment cmnt(masm_, "[ BreakStatement");
962 SetStatementPosition(stmt); 967 SetStatementPosition(stmt);
963 NestedStatement* current = nesting_stack_; 968 NestedStatement* current = nesting_stack_;
964 int stack_depth = 0; 969 int stack_depth = 0;
970 // When breaking, we clobber the unpredictable value in the accumulator
971 // with one that's safe for GC. If we hit an exit from the try block of
972 // try...finally on our way out, we will unconditionally preserve the
973 // accumulator on the stack.
974 ClearAccumulator();
965 while (!current->IsBreakTarget(stmt->target())) { 975 while (!current->IsBreakTarget(stmt->target())) {
966 stack_depth = current->Exit(stack_depth); 976 stack_depth = current->Exit(stack_depth);
967 current = current->outer(); 977 current = current->outer();
968 } 978 }
969 __ Drop(stack_depth); 979 __ Drop(stack_depth);
970 980
971 Breakable* target = current->AsBreakable(); 981 Breakable* target = current->AsBreakable();
972 __ jmp(target->break_target()); 982 __ jmp(target->break_target());
973 } 983 }
974 984
(...skipping 253 matching lines...) Expand 10 before | Expand all | Expand 10 after
1228 } 1238 }
1229 1239
1230 __ bind(&try_handler_setup); 1240 __ bind(&try_handler_setup);
1231 { 1241 {
1232 // Setup try handler (stack pointer registers). 1242 // Setup try handler (stack pointer registers).
1233 TryFinally try_block(this, &finally_entry); 1243 TryFinally try_block(this, &finally_entry);
1234 __ PushTryHandler(IN_JAVASCRIPT, TRY_FINALLY_HANDLER); 1244 __ PushTryHandler(IN_JAVASCRIPT, TRY_FINALLY_HANDLER);
1235 Visit(stmt->try_block()); 1245 Visit(stmt->try_block());
1236 __ PopTryHandler(); 1246 __ PopTryHandler();
1237 } 1247 }
1238 // Execute the finally block on the way out. 1248 // Execute the finally block on the way out. Clobber the unpredictable
1249 // value in the accumulator with one that's safe for GC. The finally
1250 // block will unconditionally preserve the accumulator on the stack.
1251 ClearAccumulator();
1239 __ Call(&finally_entry); 1252 __ Call(&finally_entry);
1240 } 1253 }
1241 1254
1242 1255
1243 void FullCodeGenerator::VisitDebuggerStatement(DebuggerStatement* stmt) { 1256 void FullCodeGenerator::VisitDebuggerStatement(DebuggerStatement* stmt) {
1244 #ifdef ENABLE_DEBUGGER_SUPPORT 1257 #ifdef ENABLE_DEBUGGER_SUPPORT
1245 Comment cmnt(masm_, "[ DebuggerStatement"); 1258 Comment cmnt(masm_, "[ DebuggerStatement");
1246 SetStatementPosition(stmt); 1259 SetStatementPosition(stmt);
1247 1260
1248 __ DebugBreak(); 1261 __ DebugBreak();
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after
1348 __ Drop(stack_depth); 1361 __ Drop(stack_depth);
1349 __ PopTryHandler(); 1362 __ PopTryHandler();
1350 return 0; 1363 return 0;
1351 } 1364 }
1352 1365
1353 1366
1354 #undef __ 1367 #undef __
1355 1368
1356 1369
1357 } } // namespace v8::internal 1370 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/full-codegen.h ('k') | src/ia32/full-codegen-ia32.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698