OLD | NEW |
1 // Copyright 2006-2009 the V8 project authors. All rights reserved. | 1 // Copyright 2006-2009 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 2243 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2254 LoadCondition(node->cond(), NOT_INSIDE_TYPEOF, &dest, true); | 2254 LoadCondition(node->cond(), NOT_INSIDE_TYPEOF, &dest, true); |
2255 } | 2255 } |
2256 if (node->break_target()->is_linked()) { | 2256 if (node->break_target()->is_linked()) { |
2257 node->break_target()->Bind(); | 2257 node->break_target()->Bind(); |
2258 } | 2258 } |
2259 } | 2259 } |
2260 break; | 2260 break; |
2261 } | 2261 } |
2262 | 2262 |
2263 case LoopStatement::WHILE_LOOP: { | 2263 case LoopStatement::WHILE_LOOP: { |
2264 // Do not duplicate conditions with function literal | 2264 // Do not duplicate conditions that may have function literal |
2265 // subexpressions. This can cause us to compile the function | 2265 // subexpressions. This can cause us to compile the function |
2266 // literal twice. | 2266 // literal twice. |
2267 bool test_at_bottom = | 2267 bool test_at_bottom = !node->may_have_function_literal(); |
2268 !scope_->is_global_scope() && !node->has_function_literal(); | |
2269 | 2268 |
2270 IncrementLoopNesting(); | 2269 IncrementLoopNesting(); |
2271 | 2270 |
2272 // If the condition is always false and has no side effects, we | 2271 // If the condition is always false and has no side effects, we |
2273 // do not need to compile anything. | 2272 // do not need to compile anything. |
2274 if (info == ALWAYS_FALSE) break; | 2273 if (info == ALWAYS_FALSE) break; |
2275 | 2274 |
2276 JumpTarget body; | 2275 JumpTarget body; |
2277 if (test_at_bottom) { | 2276 if (test_at_bottom) { |
2278 body.Initialize(this, JumpTarget::BIDIRECTIONAL); | 2277 body.Initialize(this, JumpTarget::BIDIRECTIONAL); |
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2353 | 2352 |
2354 // The break target may be already bound (by the condition), or | 2353 // The break target may be already bound (by the condition), or |
2355 // there may not be a valid frame. Bind it only if needed. | 2354 // there may not be a valid frame. Bind it only if needed. |
2356 if (node->break_target()->is_linked()) { | 2355 if (node->break_target()->is_linked()) { |
2357 node->break_target()->Bind(); | 2356 node->break_target()->Bind(); |
2358 } | 2357 } |
2359 break; | 2358 break; |
2360 } | 2359 } |
2361 | 2360 |
2362 case LoopStatement::FOR_LOOP: { | 2361 case LoopStatement::FOR_LOOP: { |
2363 // Do not duplicate conditions with function literal | 2362 // Do not duplicate conditions that may have function literal |
2364 // subexpressions. This can cause us to compile the function | 2363 // subexpressions. This can cause us to compile the function |
2365 // literal twice. | 2364 // literal twice. |
2366 bool test_at_bottom = | 2365 bool test_at_bottom = !node->may_have_function_literal(); |
2367 !scope_->is_global_scope() && !node->has_function_literal(); | |
2368 | 2366 |
2369 // Compile the init expression if present. | 2367 // Compile the init expression if present. |
2370 if (node->init() != NULL) { | 2368 if (node->init() != NULL) { |
2371 Visit(node->init()); | 2369 Visit(node->init()); |
2372 } | 2370 } |
2373 | 2371 |
2374 IncrementLoopNesting(); | 2372 IncrementLoopNesting(); |
2375 | 2373 |
2376 // If the condition is always false and has no side effects, we | 2374 // If the condition is always false and has no side effects, we |
2377 // do not need to compile anything else. | 2375 // do not need to compile anything else. |
(...skipping 4616 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6994 | 6992 |
6995 // Slow-case: Go through the JavaScript implementation. | 6993 // Slow-case: Go through the JavaScript implementation. |
6996 __ bind(&slow); | 6994 __ bind(&slow); |
6997 __ InvokeBuiltin(Builtins::INSTANCE_OF, JUMP_FUNCTION); | 6995 __ InvokeBuiltin(Builtins::INSTANCE_OF, JUMP_FUNCTION); |
6998 } | 6996 } |
6999 | 6997 |
7000 | 6998 |
7001 #undef __ | 6999 #undef __ |
7002 | 7000 |
7003 } } // namespace v8::internal | 7001 } } // namespace v8::internal |
OLD | NEW |