| 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 16 matching lines...) Expand all Loading... |
| 27 | 27 |
| 28 #include "arm/lithium-codegen-arm.h" | 28 #include "arm/lithium-codegen-arm.h" |
| 29 #include "arm/lithium-gap-resolver-arm.h" | 29 #include "arm/lithium-gap-resolver-arm.h" |
| 30 #include "code-stubs.h" | 30 #include "code-stubs.h" |
| 31 #include "stub-cache.h" | 31 #include "stub-cache.h" |
| 32 | 32 |
| 33 namespace v8 { | 33 namespace v8 { |
| 34 namespace internal { | 34 namespace internal { |
| 35 | 35 |
| 36 | 36 |
| 37 class SafepointGenerator : public PostCallGenerator { | 37 class SafepointGenerator : public CallWrapper { |
| 38 public: | 38 public: |
| 39 SafepointGenerator(LCodeGen* codegen, | 39 SafepointGenerator(LCodeGen* codegen, |
| 40 LPointerMap* pointers, | 40 LPointerMap* pointers, |
| 41 int deoptimization_index) | 41 int deoptimization_index) |
| 42 : codegen_(codegen), | 42 : codegen_(codegen), |
| 43 pointers_(pointers), | 43 pointers_(pointers), |
| 44 deoptimization_index_(deoptimization_index) { } | 44 deoptimization_index_(deoptimization_index) { } |
| 45 virtual ~SafepointGenerator() { } | 45 virtual ~SafepointGenerator() { } |
| 46 | 46 |
| 47 virtual void Generate() { | 47 virtual void BeforeCall(int call_size) { |
| 48 ASSERT(call_size >= 0); |
| 49 // Ensure that we have enough space after the previous safepoint position |
| 50 // for the generated code there. |
| 51 int call_end = codegen_->masm()->pc_offset() + call_size; |
| 52 int prev_jump_end = |
| 53 codegen_->LastSafepointEnd() + Deoptimizer::patch_size(); |
| 54 if (call_end < prev_jump_end) { |
| 55 int padding_size = prev_jump_end - call_end; |
| 56 ASSERT_EQ(0, padding_size % Assembler::kInstrSize); |
| 57 while (padding_size > 0) { |
| 58 codegen_->masm()->nop(); |
| 59 padding_size -= Assembler::kInstrSize; |
| 60 } |
| 61 } |
| 62 } |
| 63 |
| 64 virtual void AfterCall() { |
| 48 codegen_->RecordSafepoint(pointers_, deoptimization_index_); | 65 codegen_->RecordSafepoint(pointers_, deoptimization_index_); |
| 49 } | 66 } |
| 50 | 67 |
| 51 private: | 68 private: |
| 52 LCodeGen* codegen_; | 69 LCodeGen* codegen_; |
| 53 LPointerMap* pointers_; | 70 LPointerMap* pointers_; |
| 54 int deoptimization_index_; | 71 int deoptimization_index_; |
| 55 }; | 72 }; |
| 56 | 73 |
| 57 | 74 |
| (...skipping 3802 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3860 ASSERT(!environment->HasBeenRegistered()); | 3877 ASSERT(!environment->HasBeenRegistered()); |
| 3861 RegisterEnvironmentForDeoptimization(environment); | 3878 RegisterEnvironmentForDeoptimization(environment); |
| 3862 ASSERT(osr_pc_offset_ == -1); | 3879 ASSERT(osr_pc_offset_ == -1); |
| 3863 osr_pc_offset_ = masm()->pc_offset(); | 3880 osr_pc_offset_ = masm()->pc_offset(); |
| 3864 } | 3881 } |
| 3865 | 3882 |
| 3866 | 3883 |
| 3867 #undef __ | 3884 #undef __ |
| 3868 | 3885 |
| 3869 } } // namespace v8::internal | 3886 } } // namespace v8::internal |
| OLD | NEW |