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

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

Issue 42008: Introduce a BreakTarget subclass of JumpTarget used to represent the... (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: '' Created 11 years, 9 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 | « src/codegen-ia32.h ('k') | src/jump-target.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 2006-2008 the V8 project authors. All rights reserved. 1 // Copyright 2006-2008 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 2217 matching lines...) Expand 10 before | Expand all | Expand 10 after
2228 } 2228 }
2229 break; 2229 break;
2230 } 2230 }
2231 2231
2232 case LoopStatement::WHILE_LOOP: { 2232 case LoopStatement::WHILE_LOOP: {
2233 // TODO(260): This flag controls whether to duplicate the test 2233 // TODO(260): This flag controls whether to duplicate the test
2234 // at the bottom of the loop. Replace it with a better 2234 // at the bottom of the loop. Replace it with a better
2235 // indication of when it is safe to do so. 2235 // indication of when it is safe to do so.
2236 static const bool test_at_bottom = false; 2236 static const bool test_at_bottom = false;
2237 2237
2238 JumpTarget body; // Uninitialized. 2238 JumpTarget body(this); // Initialized as forward-only.
2239 IncrementLoopNesting(); 2239 IncrementLoopNesting();
2240 2240
2241 // If the condition is always false and has no side effects, we 2241 // If the condition is always false and has no side effects, we
2242 // do not need to compile anything. 2242 // do not need to compile anything.
2243 if (info == ALWAYS_FALSE) break; 2243 if (info == ALWAYS_FALSE) break;
2244 2244
2245 // Based on the condition analysis, compile the test as necessary. 2245 // Based on the condition analysis, compile the test as necessary.
2246 if (info == ALWAYS_TRUE) { 2246 if (info == ALWAYS_TRUE) {
2247 // We will not compile the test expression. Label the top of 2247 // We will not compile the test expression. Label the top of
2248 // the loop with the continue target. 2248 // the loop with the continue target.
2249 node->continue_target()->Initialize(this, JumpTarget::BIDIRECTIONAL); 2249 node->continue_target()->Initialize(this, JumpTarget::BIDIRECTIONAL);
2250 node->continue_target()->Bind(); 2250 node->continue_target()->Bind();
2251 } else { 2251 } else {
2252 ASSERT(info == DONT_KNOW); // ALWAYS_FALSE cannot reach here. 2252 ASSERT(info == DONT_KNOW); // ALWAYS_FALSE cannot reach here.
2253 if (test_at_bottom) { 2253 if (test_at_bottom) {
2254 // Continue is the test at the bottom, no need to label the 2254 // Continue is the test at the bottom, no need to label the
2255 // test at the top. The body is a backward target. 2255 // test at the top. The body is a backward target.
2256 node->continue_target()->Initialize(this); 2256 node->continue_target()->Initialize(this);
2257 body.Initialize(this, JumpTarget::BIDIRECTIONAL); 2257 body.make_bidirectional();
2258 } else { 2258 } else {
2259 // Label the test at the top as the continue target. The 2259 // Label the test at the top as the continue target. The
2260 // body is a forward-only target. 2260 // body is a forward-only target.
2261 node->continue_target()->Initialize(this, JumpTarget::BIDIRECTIONAL); 2261 node->continue_target()->Initialize(this, JumpTarget::BIDIRECTIONAL);
2262 node->continue_target()->Bind(); 2262 node->continue_target()->Bind();
2263 body.Initialize(this);
2264 } 2263 }
2265 // Compile the test with the body as the true target and 2264 // Compile the test with the body as the true target and
2266 // preferred fall-through and with the break target as the 2265 // preferred fall-through and with the break target as the
2267 // false target. 2266 // false target.
2268 ControlDestination dest(&body, node->break_target(), true); 2267 ControlDestination dest(&body, node->break_target(), true);
2269 LoadCondition(node->cond(), NOT_INSIDE_TYPEOF, &dest, true); 2268 LoadCondition(node->cond(), NOT_INSIDE_TYPEOF, &dest, true);
2270 2269
2271 if (dest.false_was_fall_through()) { 2270 if (dest.false_was_fall_through()) {
2272 // If we got the break target as fall-through, the test may 2271 // If we got the break target as fall-through, the test may
2273 // have been unconditionally false (if there are no jumps to 2272 // have been unconditionally false (if there are no jumps to
(...skipping 4662 matching lines...) Expand 10 before | Expand all | Expand 10 after
6936 6935
6937 // Slow-case: Go through the JavaScript implementation. 6936 // Slow-case: Go through the JavaScript implementation.
6938 __ bind(&slow); 6937 __ bind(&slow);
6939 __ InvokeBuiltin(Builtins::INSTANCE_OF, JUMP_FUNCTION); 6938 __ InvokeBuiltin(Builtins::INSTANCE_OF, JUMP_FUNCTION);
6940 } 6939 }
6941 6940
6942 6941
6943 #undef __ 6942 #undef __
6944 6943
6945 } } // namespace v8::internal 6944 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/codegen-ia32.h ('k') | src/jump-target.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698