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 2403 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2414 | 2414 |
2415 | 2415 |
2416 void CodeGenerator::VisitConditional(Conditional* node) { | 2416 void CodeGenerator::VisitConditional(Conditional* node) { |
2417 #ifdef DEBUG | 2417 #ifdef DEBUG |
2418 int original_height = frame_->height(); | 2418 int original_height = frame_->height(); |
2419 #endif | 2419 #endif |
2420 VirtualFrame::SpilledScope spilled_scope; | 2420 VirtualFrame::SpilledScope spilled_scope; |
2421 Comment cmnt(masm_, "[ Conditional"); | 2421 Comment cmnt(masm_, "[ Conditional"); |
2422 JumpTarget then; | 2422 JumpTarget then; |
2423 JumpTarget else_; | 2423 JumpTarget else_; |
2424 JumpTarget exit; | |
2425 LoadConditionAndSpill(node->condition(), NOT_INSIDE_TYPEOF, | 2424 LoadConditionAndSpill(node->condition(), NOT_INSIDE_TYPEOF, |
2426 &then, &else_, true); | 2425 &then, &else_, true); |
2427 if (frame_ != NULL) { | 2426 if (has_valid_frame()) { |
2428 Branch(false, &else_); | 2427 Branch(false, &else_); |
2429 } | 2428 } |
2430 if (frame_ != NULL || then.is_linked()) { | 2429 if (has_valid_frame() || then.is_linked()) { |
2431 then.Bind(); | 2430 then.Bind(); |
2432 LoadAndSpill(node->then_expression(), typeof_state()); | 2431 LoadAndSpill(node->then_expression(), typeof_state()); |
2433 } | 2432 } |
2434 if (frame_ != NULL) { | |
2435 exit.Jump(); | |
2436 } | |
2437 if (else_.is_linked()) { | 2433 if (else_.is_linked()) { |
| 2434 JumpTarget exit; |
| 2435 if (has_valid_frame()) exit.Jump(); |
2438 else_.Bind(); | 2436 else_.Bind(); |
2439 LoadAndSpill(node->else_expression(), typeof_state()); | 2437 LoadAndSpill(node->else_expression(), typeof_state()); |
2440 } | 2438 if (exit.is_linked()) exit.Bind(); |
2441 if (exit.is_linked()) { | |
2442 exit.Bind(); | |
2443 } | 2439 } |
2444 ASSERT(frame_->height() == original_height + 1); | 2440 ASSERT(frame_->height() == original_height + 1); |
2445 } | 2441 } |
2446 | 2442 |
2447 | 2443 |
2448 void CodeGenerator::LoadFromSlot(Slot* slot, TypeofState typeof_state) { | 2444 void CodeGenerator::LoadFromSlot(Slot* slot, TypeofState typeof_state) { |
2449 VirtualFrame::SpilledScope spilled_scope; | 2445 VirtualFrame::SpilledScope spilled_scope; |
2450 if (slot->type() == Slot::LOOKUP) { | 2446 if (slot->type() == Slot::LOOKUP) { |
2451 ASSERT(slot->var()->is_dynamic()); | 2447 ASSERT(slot->var()->is_dynamic()); |
2452 | 2448 |
(...skipping 1155 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3608 Comment cmnt(masm_, "[ UnaryOperation"); | 3604 Comment cmnt(masm_, "[ UnaryOperation"); |
3609 | 3605 |
3610 Token::Value op = node->op(); | 3606 Token::Value op = node->op(); |
3611 | 3607 |
3612 if (op == Token::NOT) { | 3608 if (op == Token::NOT) { |
3613 LoadConditionAndSpill(node->expression(), | 3609 LoadConditionAndSpill(node->expression(), |
3614 NOT_INSIDE_TYPEOF, | 3610 NOT_INSIDE_TYPEOF, |
3615 false_target(), | 3611 false_target(), |
3616 true_target(), | 3612 true_target(), |
3617 true); | 3613 true); |
3618 // LoadConditionAndSpill might emit only unconditional jumps to | 3614 // LoadCondition may (and usually does) leave a test and branch to |
3619 // the targets in which case cc_reg_ is not set. When that | 3615 // be emitted by the caller. In that case, negate the condition. |
3620 // happens, don't attempt to negate the condition. | |
3621 if (has_cc()) cc_reg_ = NegateCondition(cc_reg_); | 3616 if (has_cc()) cc_reg_ = NegateCondition(cc_reg_); |
3622 | 3617 |
3623 } else if (op == Token::DELETE) { | 3618 } else if (op == Token::DELETE) { |
3624 Property* property = node->expression()->AsProperty(); | 3619 Property* property = node->expression()->AsProperty(); |
3625 Variable* variable = node->expression()->AsVariableProxy()->AsVariable(); | 3620 Variable* variable = node->expression()->AsVariableProxy()->AsVariable(); |
3626 if (property != NULL) { | 3621 if (property != NULL) { |
3627 LoadAndSpill(property->obj()); | 3622 LoadAndSpill(property->obj()); |
3628 LoadAndSpill(property->key()); | 3623 LoadAndSpill(property->key()); |
3629 Result arg_count = allocator_->Allocate(r0); | 3624 Result arg_count = allocator_->Allocate(r0); |
3630 ASSERT(arg_count.is_valid()); | 3625 ASSERT(arg_count.is_valid()); |
(...skipping 2776 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6407 int CompareStub::MinorKey() { | 6402 int CompareStub::MinorKey() { |
6408 // Encode the two parameters in a unique 16 bit value. | 6403 // Encode the two parameters in a unique 16 bit value. |
6409 ASSERT(static_cast<unsigned>(cc_) >> 28 < (1 << 15)); | 6404 ASSERT(static_cast<unsigned>(cc_) >> 28 < (1 << 15)); |
6410 return (static_cast<unsigned>(cc_) >> 27) | (strict_ ? 1 : 0); | 6405 return (static_cast<unsigned>(cc_) >> 27) | (strict_ ? 1 : 0); |
6411 } | 6406 } |
6412 | 6407 |
6413 | 6408 |
6414 #undef __ | 6409 #undef __ |
6415 | 6410 |
6416 } } // namespace v8::internal | 6411 } } // namespace v8::internal |
OLD | NEW |