| OLD | NEW |
| 1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 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 18 matching lines...) Expand all Loading... |
| 29 | 29 |
| 30 #include "arm/lithium-codegen-arm.h" | 30 #include "arm/lithium-codegen-arm.h" |
| 31 #include "arm/lithium-gap-resolver-arm.h" | 31 #include "arm/lithium-gap-resolver-arm.h" |
| 32 #include "code-stubs.h" | 32 #include "code-stubs.h" |
| 33 #include "stub-cache.h" | 33 #include "stub-cache.h" |
| 34 | 34 |
| 35 namespace v8 { | 35 namespace v8 { |
| 36 namespace internal { | 36 namespace internal { |
| 37 | 37 |
| 38 | 38 |
| 39 class SafepointGenerator : public PostCallGenerator { | 39 class SafepointGenerator : public CallWrapper { |
| 40 public: | 40 public: |
| 41 SafepointGenerator(LCodeGen* codegen, | 41 SafepointGenerator(LCodeGen* codegen, |
| 42 LPointerMap* pointers, | 42 LPointerMap* pointers, |
| 43 int deoptimization_index) | 43 int deoptimization_index) |
| 44 : codegen_(codegen), | 44 : codegen_(codegen), |
| 45 pointers_(pointers), | 45 pointers_(pointers), |
| 46 deoptimization_index_(deoptimization_index) { } | 46 deoptimization_index_(deoptimization_index) { } |
| 47 virtual ~SafepointGenerator() { } | 47 virtual ~SafepointGenerator() { } |
| 48 | 48 |
| 49 virtual void Generate() { | 49 virtual void BeforeCall(int call_size) { |
| 50 ASSERT(call_size >= 0); |
| 51 // Ensure that we have enough space after the previous safepoint position |
| 52 // for the generated code there. |
| 53 int call_end = codegen_->masm()->pc_offset() + call_size; |
| 54 int prev_jump_end = |
| 55 codegen_->LastSafepointEnd() + Deoptimizer::patch_size(); |
| 56 if (call_end < prev_jump_end) { |
| 57 int padding_size = prev_jump_end - call_end; |
| 58 ASSERT_EQ(0, padding_size % Assembler::kInstrSize); |
| 59 while (padding_size > 0) { |
| 60 codegen_->masm()->nop(); |
| 61 padding_size -= Assembler::kInstrSize; |
| 62 } |
| 63 } |
| 64 } |
| 65 |
| 66 virtual void AfterCall() { |
| 50 codegen_->RecordSafepoint(pointers_, deoptimization_index_); | 67 codegen_->RecordSafepoint(pointers_, deoptimization_index_); |
| 51 } | 68 } |
| 52 | 69 |
| 53 private: | 70 private: |
| 54 LCodeGen* codegen_; | 71 LCodeGen* codegen_; |
| 55 LPointerMap* pointers_; | 72 LPointerMap* pointers_; |
| 56 int deoptimization_index_; | 73 int deoptimization_index_; |
| 57 }; | 74 }; |
| 58 | 75 |
| 59 | 76 |
| (...skipping 3810 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3870 ASSERT(!environment->HasBeenRegistered()); | 3887 ASSERT(!environment->HasBeenRegistered()); |
| 3871 RegisterEnvironmentForDeoptimization(environment); | 3888 RegisterEnvironmentForDeoptimization(environment); |
| 3872 ASSERT(osr_pc_offset_ == -1); | 3889 ASSERT(osr_pc_offset_ == -1); |
| 3873 osr_pc_offset_ = masm()->pc_offset(); | 3890 osr_pc_offset_ = masm()->pc_offset(); |
| 3874 } | 3891 } |
| 3875 | 3892 |
| 3876 | 3893 |
| 3877 #undef __ | 3894 #undef __ |
| 3878 | 3895 |
| 3879 } } // namespace v8::internal | 3896 } } // namespace v8::internal |
| OLD | NEW |