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

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

Issue 6728001: Ensure enough space for lazy deoptimization relocation information. (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 | « src/ia32/lithium-codegen-ia32.cc ('k') | 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 25 matching lines...) Expand all
36 namespace v8 { 36 namespace v8 {
37 namespace internal { 37 namespace internal {
38 38
39 39
40 // When invoking builtins, we need to record the safepoint in the middle of 40 // When invoking builtins, we need to record the safepoint in the middle of
41 // the invoke instruction sequence generated by the macro assembler. 41 // the invoke instruction sequence generated by the macro assembler.
42 class SafepointGenerator : public CallWrapper { 42 class SafepointGenerator : public CallWrapper {
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)
48 : codegen_(codegen), 47 : codegen_(codegen),
49 pointers_(pointers), 48 pointers_(pointers),
50 deoptimization_index_(deoptimization_index), 49 deoptimization_index_(deoptimization_index) { }
51 ensure_reloc_space_(ensure_reloc_space) { }
52 virtual ~SafepointGenerator() { } 50 virtual ~SafepointGenerator() { }
53 51
54 virtual void BeforeCall(int call_size) { 52 virtual void BeforeCall(int call_size) {
55 ASSERT(call_size >= 0); 53 ASSERT(call_size >= 0);
56 // Ensure that we have enough space after the previous safepoint position 54 // Ensure that we have enough space after the previous safepoint position
57 // for the jump generated there. 55 // for the jump generated there.
58 int call_end = codegen_->masm()->pc_offset() + call_size; 56 int call_end = codegen_->masm()->pc_offset() + call_size;
59 int prev_jump_end = codegen_->LastSafepointEnd() + kMinSafepointSize; 57 int prev_jump_end = codegen_->LastSafepointEnd() + kMinSafepointSize;
60 if (call_end < prev_jump_end) { 58 if (call_end < prev_jump_end) {
61 int padding_size = prev_jump_end - call_end; 59 int padding_size = prev_jump_end - call_end;
62 STATIC_ASSERT(kMinSafepointSize <= 9); // One multibyte nop is enough. 60 STATIC_ASSERT(kMinSafepointSize <= 9); // One multibyte nop is enough.
63 codegen_->masm()->nop(padding_size); 61 codegen_->masm()->nop(padding_size);
64 } 62 }
65 } 63 }
66 64
67 virtual void AfterCall() { 65 virtual void AfterCall() {
68 // Ensure that we have enough space in the reloc info to patch 66 // Ensure that we have enough space in the reloc info to patch
69 // this with calls when doing deoptimization. 67 // this with calls when doing deoptimization.
70 if (ensure_reloc_space_) { 68 codegen_->masm()->RecordComment(RelocInfo::kFillerCommentString, true);
71 codegen_->masm()->RecordComment(RelocInfo::kFillerCommentString, true);
72 }
73 codegen_->RecordSafepoint(pointers_, deoptimization_index_); 69 codegen_->RecordSafepoint(pointers_, deoptimization_index_);
74 } 70 }
75 71
76 private: 72 private:
77 static const int kMinSafepointSize = 73 static const int kMinSafepointSize =
78 MacroAssembler::kShortCallInstructionLength; 74 MacroAssembler::kShortCallInstructionLength;
79 LCodeGen* codegen_; 75 LCodeGen* codegen_;
80 LPointerMap* pointers_; 76 LPointerMap* pointers_;
81 int deoptimization_index_; 77 int deoptimization_index_;
82 bool ensure_reloc_space_;
83 }; 78 };
84 79
85 80
86 #define __ masm()-> 81 #define __ masm()->
87 82
88 bool LCodeGen::GenerateCode() { 83 bool LCodeGen::GenerateCode() {
89 HPhase phase("Code generation", chunk()); 84 HPhase phase("Code generation", chunk());
90 ASSERT(is_unused()); 85 ASSERT(is_unused());
91 status_ = GENERATING; 86 status_ = GENERATING;
92 return GeneratePrologue() && 87 return GeneratePrologue() &&
(...skipping 2243 matching lines...) Expand 10 before | Expand all | Expand 10 after
2336 2331
2337 // Invoke the function. 2332 // Invoke the function.
2338 __ bind(&invoke); 2333 __ bind(&invoke);
2339 ASSERT(instr->HasPointerMap() && instr->HasDeoptimizationEnvironment()); 2334 ASSERT(instr->HasPointerMap() && instr->HasDeoptimizationEnvironment());
2340 LPointerMap* pointers = instr->pointer_map(); 2335 LPointerMap* pointers = instr->pointer_map();
2341 LEnvironment* env = instr->deoptimization_environment(); 2336 LEnvironment* env = instr->deoptimization_environment();
2342 RecordPosition(pointers->position()); 2337 RecordPosition(pointers->position());
2343 RegisterEnvironmentForDeoptimization(env); 2338 RegisterEnvironmentForDeoptimization(env);
2344 SafepointGenerator safepoint_generator(this, 2339 SafepointGenerator safepoint_generator(this,
2345 pointers, 2340 pointers,
2346 env->deoptimization_index(), 2341 env->deoptimization_index());
2347 true);
2348 v8::internal::ParameterCount actual(rax); 2342 v8::internal::ParameterCount actual(rax);
2349 __ InvokeFunction(function, actual, CALL_FUNCTION, &safepoint_generator); 2343 __ InvokeFunction(function, actual, CALL_FUNCTION, &safepoint_generator);
2350 } 2344 }
2351 2345
2352 2346
2353 void LCodeGen::DoPushArgument(LPushArgument* instr) { 2347 void LCodeGen::DoPushArgument(LPushArgument* instr) {
2354 LOperand* argument = instr->InputAt(0); 2348 LOperand* argument = instr->InputAt(0);
2355 if (argument->IsConstantOperand()) { 2349 if (argument->IsConstantOperand()) {
2356 EmitPushConstantOperand(argument); 2350 EmitPushConstantOperand(argument);
2357 } else if (argument->IsRegister()) { 2351 } else if (argument->IsRegister()) {
(...skipping 1426 matching lines...) Expand 10 before | Expand all | Expand 10 after
3784 ASSERT(instr->HasPointerMap() && instr->HasDeoptimizationEnvironment()); 3778 ASSERT(instr->HasPointerMap() && instr->HasDeoptimizationEnvironment());
3785 LPointerMap* pointers = instr->pointer_map(); 3779 LPointerMap* pointers = instr->pointer_map();
3786 LEnvironment* env = instr->deoptimization_environment(); 3780 LEnvironment* env = instr->deoptimization_environment();
3787 RecordPosition(pointers->position()); 3781 RecordPosition(pointers->position());
3788 RegisterEnvironmentForDeoptimization(env); 3782 RegisterEnvironmentForDeoptimization(env);
3789 // Create safepoint generator that will also ensure enough space in the 3783 // Create safepoint generator that will also ensure enough space in the
3790 // reloc info for patching in deoptimization (since this is invoking a 3784 // reloc info for patching in deoptimization (since this is invoking a
3791 // builtin) 3785 // builtin)
3792 SafepointGenerator safepoint_generator(this, 3786 SafepointGenerator safepoint_generator(this,
3793 pointers, 3787 pointers,
3794 env->deoptimization_index(), 3788 env->deoptimization_index());
3795 true);
3796 __ Push(Smi::FromInt(strict_mode_flag())); 3789 __ Push(Smi::FromInt(strict_mode_flag()));
3797 __ InvokeBuiltin(Builtins::DELETE, CALL_FUNCTION, &safepoint_generator); 3790 __ InvokeBuiltin(Builtins::DELETE, CALL_FUNCTION, &safepoint_generator);
3798 } 3791 }
3799 3792
3800 3793
3801 void LCodeGen::DoStackCheck(LStackCheck* instr) { 3794 void LCodeGen::DoStackCheck(LStackCheck* instr) {
3802 // Perform stack overflow check. 3795 // Perform stack overflow check.
3803 NearLabel done; 3796 NearLabel done;
3804 __ CompareRoot(rsp, Heap::kStackLimitRootIndex); 3797 __ CompareRoot(rsp, Heap::kStackLimitRootIndex);
3805 __ j(above_equal, &done); 3798 __ j(above_equal, &done);
(...skipping 18 matching lines...) Expand all
3824 RegisterEnvironmentForDeoptimization(environment); 3817 RegisterEnvironmentForDeoptimization(environment);
3825 ASSERT(osr_pc_offset_ == -1); 3818 ASSERT(osr_pc_offset_ == -1);
3826 osr_pc_offset_ = masm()->pc_offset(); 3819 osr_pc_offset_ = masm()->pc_offset();
3827 } 3820 }
3828 3821
3829 #undef __ 3822 #undef __
3830 3823
3831 } } // namespace v8::internal 3824 } } // namespace v8::internal
3832 3825
3833 #endif // V8_TARGET_ARCH_X64 3826 #endif // V8_TARGET_ARCH_X64
OLDNEW
« no previous file with comments | « src/ia32/lithium-codegen-ia32.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698