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 17 matching lines...) Expand all Loading... |
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 #include "register-allocator-inl.h" | 32 #include "register-allocator-inl.h" |
33 | 33 |
34 namespace v8 { | 34 namespace v8 { |
35 namespace internal { | 35 namespace internal { |
36 | 36 |
37 | 37 |
38 bool JumpTarget::compiling_deferred_code_ = false; | |
39 | |
40 | |
41 void JumpTarget::Jump(Result* arg) { | 38 void JumpTarget::Jump(Result* arg) { |
42 ASSERT(cgen()->has_valid_frame()); | 39 ASSERT(cgen()->has_valid_frame()); |
43 | 40 |
44 cgen()->frame()->Push(arg); | 41 cgen()->frame()->Push(arg); |
45 DoJump(); | 42 DoJump(); |
46 } | 43 } |
47 | 44 |
48 | 45 |
49 void JumpTarget::Branch(Condition cc, Result* arg, Hint hint) { | 46 void JumpTarget::Branch(Condition cc, Result* arg, Hint hint) { |
50 ASSERT(cgen()->has_valid_frame()); | 47 ASSERT(cgen()->has_valid_frame()); |
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
136 *arg1 = cgen()->frame()->Pop(); | 133 *arg1 = cgen()->frame()->Pop(); |
137 *arg0 = cgen()->frame()->Pop(); | 134 *arg0 = cgen()->frame()->Pop(); |
138 } | 135 } |
139 | 136 |
140 | 137 |
141 void JumpTarget::ComputeEntryFrame() { | 138 void JumpTarget::ComputeEntryFrame() { |
142 // Given: a collection of frames reaching by forward CFG edges and | 139 // Given: a collection of frames reaching by forward CFG edges and |
143 // the directionality of the block. Compute: an entry frame for the | 140 // the directionality of the block. Compute: an entry frame for the |
144 // block. | 141 // block. |
145 | 142 |
146 Counters::compute_entry_frame.Increment(); | 143 COUNTERS->compute_entry_frame()->Increment(); |
147 #ifdef DEBUG | 144 #ifdef DEBUG |
148 if (compiling_deferred_code_) { | 145 if (Isolate::Current()->jump_target_compiling_deferred_code()) { |
149 ASSERT(reaching_frames_.length() > 1); | 146 ASSERT(reaching_frames_.length() > 1); |
150 VirtualFrame* frame = reaching_frames_[0]; | 147 VirtualFrame* frame = reaching_frames_[0]; |
151 bool all_identical = true; | 148 bool all_identical = true; |
152 for (int i = 1; i < reaching_frames_.length(); i++) { | 149 for (int i = 1; i < reaching_frames_.length(); i++) { |
153 if (!frame->Equals(reaching_frames_[i])) { | 150 if (!frame->Equals(reaching_frames_[i])) { |
154 all_identical = false; | 151 all_identical = false; |
155 break; | 152 break; |
156 } | 153 } |
157 } | 154 } |
158 ASSERT(!all_identical || all_identical); | 155 ASSERT(!all_identical || all_identical); |
(...skipping 247 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
406 fall_through.Branch(NegateCondition(cc), NegateHint(hint)); | 403 fall_through.Branch(NegateCondition(cc), NegateHint(hint)); |
407 Jump(); // May emit merge code here. | 404 Jump(); // May emit merge code here. |
408 fall_through.Bind(); | 405 fall_through.Bind(); |
409 } else { | 406 } else { |
410 DoBranch(cc, hint); | 407 DoBranch(cc, hint); |
411 } | 408 } |
412 } | 409 } |
413 | 410 |
414 | 411 |
415 DeferredCode::DeferredCode() | 412 DeferredCode::DeferredCode() |
416 : masm_(CodeGeneratorScope::Current()->masm()), | 413 : masm_(CodeGeneratorScope::Current(Isolate::Current())->masm()), |
417 statement_position_(masm_->positions_recorder()-> | 414 statement_position_(masm_->positions_recorder()-> |
418 current_statement_position()), | 415 current_statement_position()), |
419 position_(masm_->positions_recorder()->current_position()), | 416 position_(masm_->positions_recorder()->current_position()), |
420 frame_state_(CodeGeneratorScope::Current()->frame()) { | 417 frame_state_(CodeGeneratorScope::Current(Isolate::Current())->frame()) { |
421 ASSERT(statement_position_ != RelocInfo::kNoPosition); | 418 ASSERT(statement_position_ != RelocInfo::kNoPosition); |
422 ASSERT(position_ != RelocInfo::kNoPosition); | 419 ASSERT(position_ != RelocInfo::kNoPosition); |
423 | 420 |
424 CodeGeneratorScope::Current()->AddDeferred(this); | 421 CodeGeneratorScope::Current(Isolate::Current())->AddDeferred(this); |
425 #ifdef DEBUG | 422 #ifdef DEBUG |
426 comment_ = ""; | 423 comment_ = ""; |
427 #endif | 424 #endif |
428 } | 425 } |
429 | 426 |
430 } } // namespace v8::internal | 427 } } // namespace v8::internal |
OLD | NEW |