| OLD | NEW |
| 1 // Copyright 2010 the V8 project authors. All rights reserved. | 1 // Copyright 2010 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 16 matching lines...) Expand all Loading... |
| 27 | 27 |
| 28 #include "v8.h" | 28 #include "v8.h" |
| 29 | 29 |
| 30 #include "codegen-inl.h" | 30 #include "codegen-inl.h" |
| 31 #include "jump-target-inl.h" | 31 #include "jump-target-inl.h" |
| 32 | 32 |
| 33 namespace v8 { | 33 namespace v8 { |
| 34 namespace internal { | 34 namespace internal { |
| 35 | 35 |
| 36 | 36 |
| 37 void JumpTarget::Jump(Result* arg) { | |
| 38 UNIMPLEMENTED(); | |
| 39 } | |
| 40 | |
| 41 | |
| 42 void JumpTarget::Branch(Condition cc, Result* arg, Hint hint) { | |
| 43 UNIMPLEMENTED(); | |
| 44 } | |
| 45 | |
| 46 | |
| 47 void JumpTarget::Branch(Condition cc, Result* arg0, Result* arg1, Hint hint) { | |
| 48 UNIMPLEMENTED(); | |
| 49 } | |
| 50 | |
| 51 | |
| 52 void BreakTarget::Branch(Condition cc, Result* arg, Hint hint) { | |
| 53 UNIMPLEMENTED(); | |
| 54 } | |
| 55 | |
| 56 | |
| 57 void JumpTarget::Bind(Result* arg) { | |
| 58 UNIMPLEMENTED(); | |
| 59 } | |
| 60 | |
| 61 | |
| 62 void JumpTarget::Bind(Result* arg0, Result* arg1) { | |
| 63 UNIMPLEMENTED(); | |
| 64 } | |
| 65 | |
| 66 | |
| 67 void JumpTarget::ComputeEntryFrame() { | |
| 68 UNIMPLEMENTED(); | |
| 69 } | |
| 70 | |
| 71 | |
| 72 DeferredCode::DeferredCode() | 37 DeferredCode::DeferredCode() |
| 73 : masm_(CodeGeneratorScope::Current()->masm()), | 38 : masm_(CodeGeneratorScope::Current()->masm()), |
| 74 statement_position_(masm_->current_statement_position()), | 39 statement_position_(masm_->current_statement_position()), |
| 75 position_(masm_->current_position()) { | 40 position_(masm_->current_position()) { |
| 76 ASSERT(statement_position_ != RelocInfo::kNoPosition); | 41 ASSERT(statement_position_ != RelocInfo::kNoPosition); |
| 77 ASSERT(position_ != RelocInfo::kNoPosition); | 42 ASSERT(position_ != RelocInfo::kNoPosition); |
| 78 | 43 |
| 79 CodeGeneratorScope::Current()->AddDeferred(this); | 44 CodeGeneratorScope::Current()->AddDeferred(this); |
| 80 | 45 |
| 81 #ifdef DEBUG | 46 #ifdef DEBUG |
| 82 CodeGeneratorScope::Current()->frame()->AssertIsSpilled(); | 47 CodeGeneratorScope::Current()->frame()->AssertIsSpilled(); |
| 83 #endif | 48 #endif |
| 84 } | 49 } |
| 85 | 50 |
| 51 |
| 52 // ------------------------------------------------------------------------- |
| 53 // BreakTarget implementation. |
| 54 |
| 55 |
| 56 void BreakTarget::SetExpectedHeight() { |
| 57 expected_height_ = cgen()->frame()->height(); |
| 58 } |
| 59 |
| 60 |
| 61 void BreakTarget::Jump() { |
| 62 ASSERT(cgen()->has_valid_frame()); |
| 63 |
| 64 int count = cgen()->frame()->height() - expected_height_; |
| 65 if (count > 0) { |
| 66 cgen()->frame()->Drop(count); |
| 67 } |
| 68 DoJump(); |
| 69 } |
| 70 |
| 71 |
| 72 void BreakTarget::Branch(Condition cc, Hint hint) { |
| 73 if (cc == al) { |
| 74 Jump(); |
| 75 return; |
| 76 } |
| 77 |
| 78 ASSERT(cgen()->has_valid_frame()); |
| 79 |
| 80 int count = cgen()->frame()->height() - expected_height_; |
| 81 if (count > 0) { |
| 82 // We negate and branch here rather than using DoBranch's negate |
| 83 // and branch. This gives us a hook to remove statement state |
| 84 // from the frame. |
| 85 JumpTarget fall_through; |
| 86 // Branch to fall through will not negate, because it is a |
| 87 // forward-only target. |
| 88 fall_through.Branch(NegateCondition(cc), NegateHint(hint)); |
| 89 // Emit merge code. |
| 90 cgen()->frame()->Drop(count); |
| 91 DoJump(); |
| 92 fall_through.Bind(); |
| 93 } else { |
| 94 DoBranch(cc, hint); |
| 95 } |
| 96 } |
| 97 |
| 98 |
| 99 void BreakTarget::Bind() { |
| 100 if (cgen()->has_valid_frame()) { |
| 101 int count = cgen()->frame()->height() - expected_height_; |
| 102 if (count > 0) { |
| 103 cgen()->frame()->Drop(count); |
| 104 } |
| 105 } |
| 106 DoBind(); |
| 107 } |
| 108 |
| 86 } } // namespace v8::internal | 109 } } // namespace v8::internal |
| OLD | NEW |