| OLD | NEW |
| 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 392 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 403 | 403 |
| 404 // Emit code to load the value of an expression to the top of the | 404 // Emit code to load the value of an expression to the top of the |
| 405 // frame. If the expression is boolean-valued it may be compiled (or | 405 // frame. If the expression is boolean-valued it may be compiled (or |
| 406 // partially compiled) into control flow to the control destination. | 406 // partially compiled) into control flow to the control destination. |
| 407 // If force_control is true, control flow is forced. | 407 // If force_control is true, control flow is forced. |
| 408 void CodeGenerator::LoadCondition(Expression* x, | 408 void CodeGenerator::LoadCondition(Expression* x, |
| 409 TypeofState typeof_state, | 409 TypeofState typeof_state, |
| 410 ControlDestination* dest, | 410 ControlDestination* dest, |
| 411 bool force_control) { | 411 bool force_control) { |
| 412 ASSERT(!in_spilled_code()); | 412 ASSERT(!in_spilled_code()); |
| 413 #ifdef DEBUG | |
| 414 int original_height = frame_->height(); | 413 int original_height = frame_->height(); |
| 415 #endif | 414 |
| 416 { CodeGenState new_state(this, typeof_state, dest); | 415 { CodeGenState new_state(this, typeof_state, dest); |
| 417 Visit(x); | 416 Visit(x); |
| 417 |
| 418 // If we hit a stack overflow, we may not have actually visited |
| 419 // the expression. In that case, we ensure that we have a |
| 420 // valid-looking frame state because we will continue to generate |
| 421 // code as we unwind the C++ stack. |
| 422 // |
| 423 // It's possible to have both a stack overflow and a valid frame |
| 424 // state (eg, a subexpression overflowed, visiting it returned |
| 425 // with a dummied frame state, and visiting this expression |
| 426 // returned with a normal-looking state). |
| 427 if (HasStackOverflow() && |
| 428 !dest->is_used() && |
| 429 frame_->height() == original_height) { |
| 430 dest->Goto(true); |
| 431 } |
| 418 } | 432 } |
| 419 | 433 |
| 420 if (force_control && !dest->is_used()) { | 434 if (force_control && !dest->is_used()) { |
| 421 // Convert the TOS value into flow to the control destination. | 435 // Convert the TOS value into flow to the control destination. |
| 422 ToBoolean(dest); | 436 ToBoolean(dest); |
| 423 } | 437 } |
| 424 | 438 |
| 425 ASSERT(!(force_control && !dest->is_used())); | 439 ASSERT(!(force_control && !dest->is_used())); |
| 426 ASSERT(dest->is_used() || frame_->height() == original_height + 1); | 440 ASSERT(dest->is_used() || frame_->height() == original_height + 1); |
| 427 } | 441 } |
| (...skipping 6227 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6655 | 6669 |
| 6656 // Slow-case: Go through the JavaScript implementation. | 6670 // Slow-case: Go through the JavaScript implementation. |
| 6657 __ bind(&slow); | 6671 __ bind(&slow); |
| 6658 __ InvokeBuiltin(Builtins::INSTANCE_OF, JUMP_FUNCTION); | 6672 __ InvokeBuiltin(Builtins::INSTANCE_OF, JUMP_FUNCTION); |
| 6659 } | 6673 } |
| 6660 | 6674 |
| 6661 | 6675 |
| 6662 #undef __ | 6676 #undef __ |
| 6663 | 6677 |
| 6664 } } // namespace v8::internal | 6678 } } // namespace v8::internal |
| OLD | NEW |