Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(553)

Side by Side Diff: src/x64/lithium-codegen-x64.cc

Issue 6624053: X64: Ensure that there is always room for a call between recoreded safepoints. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 9 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 30 matching lines...) Expand all
41 // the invoke instruction sequence generated by the macro assembler. 41 // the invoke instruction sequence generated by the macro assembler.
42 class SafepointGenerator : public PostCallGenerator { 42 class SafepointGenerator : public PostCallGenerator {
43 public: 43 public:
44 SafepointGenerator(LCodeGen* codegen, 44 SafepointGenerator(LCodeGen* codegen,
45 LPointerMap* pointers, 45 LPointerMap* pointers,
46 int deoptimization_index, 46 int deoptimization_index,
47 bool ensure_reloc_space = false) 47 bool ensure_reloc_space = false)
48 : codegen_(codegen), 48 : codegen_(codegen),
49 pointers_(pointers), 49 pointers_(pointers),
50 deoptimization_index_(deoptimization_index), 50 deoptimization_index_(deoptimization_index),
51 ensure_reloc_space_(ensure_reloc_space) { } 51 ensure_reloc_space_(ensure_reloc_space),
52 previous_safepoint_position_(-kMinSafepointSize) { }
52 virtual ~SafepointGenerator() { } 53 virtual ~SafepointGenerator() { }
53 54
54 virtual void Generate() { 55 virtual void Generate() {
56 // Ensure that we have enough space after the previous safepoint position
57 // for the generated code there.
58 int position = codegen_->masm()->pc_offset();
59 ASSERT(position > previous_safepoint_position_);
60 if (position < previous_safepoint_position_ + kMinSafepointSize) {
61 int padding_size =
62 previous_safepoint_position_ + kMinSafepointSize - position;
63 STATIC_ASSERT(kMinSafepointSize <= 9); // One multibyte nop is enough.
64 codegen_->masm()->nop(padding_size);
65 position += padding_size;
66 }
55 // Ensure that we have enough space in the reloc info to patch 67 // Ensure that we have enough space in the reloc info to patch
56 // this with calls when doing deoptimization. 68 // this with calls when doing deoptimization.
57 if (ensure_reloc_space_) { 69 if (ensure_reloc_space_) {
58 codegen_->masm()->RecordComment(RelocInfo::kFillerCommentString, true); 70 codegen_->masm()->RecordComment(RelocInfo::kFillerCommentString, true);
59 } 71 }
60 codegen_->RecordSafepoint(pointers_, deoptimization_index_); 72 codegen_->RecordSafepoint(pointers_, deoptimization_index_);
73 previous_safepoint_position_ = position;
61 } 74 }
62 75
63 private: 76 private:
77 static const int kMinSafepointSize =
78 MacroAssembler::kShortCallInstructionLength;
64 LCodeGen* codegen_; 79 LCodeGen* codegen_;
65 LPointerMap* pointers_; 80 LPointerMap* pointers_;
66 int deoptimization_index_; 81 int deoptimization_index_;
67 bool ensure_reloc_space_; 82 bool ensure_reloc_space_;
83 int previous_safepoint_position_;
68 }; 84 };
69 85
70 86
71 #define __ masm()-> 87 #define __ masm()->
72 88
73 bool LCodeGen::GenerateCode() { 89 bool LCodeGen::GenerateCode() {
74 HPhase phase("Code generation", chunk()); 90 HPhase phase("Code generation", chunk());
75 ASSERT(is_unused()); 91 ASSERT(is_unused());
76 status_ = GENERATING; 92 status_ = GENERATING;
77 return GeneratePrologue() && 93 return GeneratePrologue() &&
(...skipping 3569 matching lines...) Expand 10 before | Expand all | Expand 10 after
3647 RegisterEnvironmentForDeoptimization(environment); 3663 RegisterEnvironmentForDeoptimization(environment);
3648 ASSERT(osr_pc_offset_ == -1); 3664 ASSERT(osr_pc_offset_ == -1);
3649 osr_pc_offset_ = masm()->pc_offset(); 3665 osr_pc_offset_ = masm()->pc_offset();
3650 } 3666 }
3651 3667
3652 #undef __ 3668 #undef __
3653 3669
3654 } } // namespace v8::internal 3670 } } // namespace v8::internal
3655 3671
3656 #endif // V8_TARGET_ARCH_X64 3672 #endif // V8_TARGET_ARCH_X64
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698