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 12 matching lines...) Expand all Loading... |
23 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | 23 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
24 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 24 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
25 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 25 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
26 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 26 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
27 | 27 |
28 #include "v8.h" | 28 #include "v8.h" |
29 | 29 |
30 #include "bootstrapper.h" | 30 #include "bootstrapper.h" |
31 #include "codegen-inl.h" | 31 #include "codegen-inl.h" |
32 #include "debug.h" | 32 #include "debug.h" |
| 33 #include "runtime.h" |
33 #include "scopes.h" | 34 #include "scopes.h" |
34 #include "runtime.h" | 35 #include "virtual-frame.h" |
35 | 36 |
36 namespace v8 { namespace internal { | 37 namespace v8 { namespace internal { |
37 | 38 |
38 #define __ masm_-> | 39 #define __ masm_-> |
39 | 40 |
40 // ------------------------------------------------------------------------- | 41 // ------------------------------------------------------------------------- |
41 // CodeGenState implementation. | 42 // CodeGenState implementation. |
42 | 43 |
43 CodeGenState::CodeGenState(CodeGenerator* owner) | 44 CodeGenState::CodeGenState(CodeGenerator* owner) |
44 : owner_(owner), | 45 : owner_(owner), |
(...skipping 387 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
432 if (force_control && !dest->is_used()) { | 433 if (force_control && !dest->is_used()) { |
433 // Convert the TOS value into flow to the control destination. | 434 // Convert the TOS value into flow to the control destination. |
434 ToBoolean(dest); | 435 ToBoolean(dest); |
435 } | 436 } |
436 | 437 |
437 ASSERT(!(force_control && !dest->is_used())); | 438 ASSERT(!(force_control && !dest->is_used())); |
438 ASSERT(dest->is_used() || frame_->height() == original_height + 1); | 439 ASSERT(dest->is_used() || frame_->height() == original_height + 1); |
439 } | 440 } |
440 | 441 |
441 | 442 |
| 443 void CodeGenerator::LoadAndSpill(Expression* expression, |
| 444 TypeofState typeof_state) { |
| 445 ASSERT(in_spilled_code()); |
| 446 set_in_spilled_code(false); |
| 447 Load(expression, typeof_state); |
| 448 frame_->SpillAll(); |
| 449 set_in_spilled_code(true); |
| 450 } |
| 451 |
| 452 |
442 void CodeGenerator::Load(Expression* x, TypeofState typeof_state) { | 453 void CodeGenerator::Load(Expression* x, TypeofState typeof_state) { |
443 #ifdef DEBUG | 454 #ifdef DEBUG |
444 int original_height = frame_->height(); | 455 int original_height = frame_->height(); |
445 #endif | 456 #endif |
446 ASSERT(!in_spilled_code()); | 457 ASSERT(!in_spilled_code()); |
447 JumpTarget true_target(this); | 458 JumpTarget true_target(this); |
448 JumpTarget false_target(this); | 459 JumpTarget false_target(this); |
449 ControlDestination dest(&true_target, &false_target, true); | 460 ControlDestination dest(&true_target, &false_target, true); |
450 LoadCondition(x, typeof_state, &dest, false); | 461 LoadCondition(x, typeof_state, &dest, false); |
451 | 462 |
(...skipping 1094 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1546 DeferredStackCheck* deferred = new DeferredStackCheck(this); | 1557 DeferredStackCheck* deferred = new DeferredStackCheck(this); |
1547 ExternalReference stack_guard_limit = | 1558 ExternalReference stack_guard_limit = |
1548 ExternalReference::address_of_stack_guard_limit(); | 1559 ExternalReference::address_of_stack_guard_limit(); |
1549 __ cmp(esp, Operand::StaticVariable(stack_guard_limit)); | 1560 __ cmp(esp, Operand::StaticVariable(stack_guard_limit)); |
1550 deferred->enter()->Branch(below, not_taken); | 1561 deferred->enter()->Branch(below, not_taken); |
1551 deferred->BindExit(); | 1562 deferred->BindExit(); |
1552 } | 1563 } |
1553 } | 1564 } |
1554 | 1565 |
1555 | 1566 |
| 1567 void CodeGenerator::VisitAndSpill(Statement* statement) { |
| 1568 ASSERT(in_spilled_code()); |
| 1569 set_in_spilled_code(false); |
| 1570 Visit(statement); |
| 1571 if (frame_ != NULL) { |
| 1572 frame_->SpillAll(); |
| 1573 } |
| 1574 set_in_spilled_code(true); |
| 1575 } |
| 1576 |
| 1577 |
| 1578 void CodeGenerator::VisitStatementsAndSpill(ZoneList<Statement*>* statements) { |
| 1579 ASSERT(in_spilled_code()); |
| 1580 set_in_spilled_code(false); |
| 1581 VisitStatements(statements); |
| 1582 if (frame_ != NULL) { |
| 1583 frame_->SpillAll(); |
| 1584 } |
| 1585 set_in_spilled_code(true); |
| 1586 } |
| 1587 |
| 1588 |
1556 void CodeGenerator::VisitStatements(ZoneList<Statement*>* statements) { | 1589 void CodeGenerator::VisitStatements(ZoneList<Statement*>* statements) { |
1557 ASSERT(!in_spilled_code()); | 1590 ASSERT(!in_spilled_code()); |
1558 for (int i = 0; has_valid_frame() && i < statements->length(); i++) { | 1591 for (int i = 0; has_valid_frame() && i < statements->length(); i++) { |
1559 Visit(statements->at(i)); | 1592 Visit(statements->at(i)); |
1560 } | 1593 } |
1561 } | 1594 } |
1562 | 1595 |
1563 | 1596 |
1564 void CodeGenerator::VisitBlock(Block* node) { | 1597 void CodeGenerator::VisitBlock(Block* node) { |
1565 ASSERT(!in_spilled_code()); | 1598 ASSERT(!in_spilled_code()); |
(...skipping 5317 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6883 | 6916 |
6884 // Slow-case: Go through the JavaScript implementation. | 6917 // Slow-case: Go through the JavaScript implementation. |
6885 __ bind(&slow); | 6918 __ bind(&slow); |
6886 __ InvokeBuiltin(Builtins::INSTANCE_OF, JUMP_FUNCTION); | 6919 __ InvokeBuiltin(Builtins::INSTANCE_OF, JUMP_FUNCTION); |
6887 } | 6920 } |
6888 | 6921 |
6889 | 6922 |
6890 #undef __ | 6923 #undef __ |
6891 | 6924 |
6892 } } // namespace v8::internal | 6925 } } // namespace v8::internal |
OLD | NEW |