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

Side by Side Diff: src/compiler-dispatcher/compiler-dispatcher-job.cc

Issue 2317253006: Use GetCurrentStackPosition() to calculate the stack limit. (Closed)
Patch Set: Also change background-parsing-task.cc Created 4 years, 3 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
« no previous file with comments | « src/background-parsing-task.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 2016 the V8 project authors. All rights reserved. 1 // Copyright 2016 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "src/compiler-dispatcher/compiler-dispatcher-job.h" 5 #include "src/compiler-dispatcher/compiler-dispatcher-job.h"
6 6
7 #include "src/assert-scope.h" 7 #include "src/assert-scope.h"
8 #include "src/compilation-info.h" 8 #include "src/compilation-info.h"
9 #include "src/compiler.h" 9 #include "src/compiler.h"
10 #include "src/global-handles.h" 10 #include "src/global-handles.h"
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after
104 // If we can't parse on a background thread, we need to be able to deref the 104 // If we can't parse on a background thread, we need to be able to deref the
105 // source string. 105 // source string.
106 if (can_parse_on_background_thread_) { 106 if (can_parse_on_background_thread_) {
107 no_deref.reset(new DisallowHandleDereference()); 107 no_deref.reset(new DisallowHandleDereference());
108 } 108 }
109 109
110 // Nullify the Isolate temporarily so that the parser doesn't accidentally 110 // Nullify the Isolate temporarily so that the parser doesn't accidentally
111 // use it. 111 // use it.
112 parse_info_->set_isolate(nullptr); 112 parse_info_->set_isolate(nullptr);
113 113
114 uintptr_t stack_limit = 114 uintptr_t stack_limit = GetCurrentStackPosition() - max_stack_size_ * KB;
115 reinterpret_cast<uintptr_t>(&stack_limit) - max_stack_size_ * KB;
116 115
117 parser_->set_stack_limit(stack_limit); 116 parser_->set_stack_limit(stack_limit);
118 parser_->ParseOnBackground(parse_info_.get()); 117 parser_->ParseOnBackground(parse_info_.get());
119 118
120 parse_info_->set_isolate(isolate_); 119 parse_info_->set_isolate(isolate_);
121 120
122 status_ = CompileJobStatus::kParsed; 121 status_ = CompileJobStatus::kParsed;
123 } 122 }
124 123
125 bool CompilerDispatcherJob::FinalizeParsingOnMainThread() { 124 bool CompilerDispatcherJob::FinalizeParsingOnMainThread() {
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
200 } 199 }
201 200
202 void CompilerDispatcherJob::Compile() { 201 void CompilerDispatcherJob::Compile() {
203 DCHECK(status() == CompileJobStatus::kReadyToCompile); 202 DCHECK(status() == CompileJobStatus::kReadyToCompile);
204 DCHECK(can_compile_on_background_thread_ || 203 DCHECK(can_compile_on_background_thread_ ||
205 ThreadId::Current().Equals(isolate_->thread_id())); 204 ThreadId::Current().Equals(isolate_->thread_id()));
206 205
207 // Disallowing of handle dereference and heap access dealt with in 206 // Disallowing of handle dereference and heap access dealt with in
208 // CompilationJob::ExecuteJob. 207 // CompilationJob::ExecuteJob.
209 208
210 uintptr_t stack_limit = 209 uintptr_t stack_limit = GetCurrentStackPosition() - max_stack_size_ * KB;
211 reinterpret_cast<uintptr_t>(&stack_limit) - max_stack_size_ * KB;
212 compile_job_->set_stack_limit(stack_limit); 210 compile_job_->set_stack_limit(stack_limit);
213 211
214 CompilationJob::Status status = compile_job_->ExecuteJob(); 212 CompilationJob::Status status = compile_job_->ExecuteJob();
215 USE(status); 213 USE(status);
216 214
217 // Always transition to kCompiled - errors will be reported by 215 // Always transition to kCompiled - errors will be reported by
218 // FinalizeCompilingOnMainThread. 216 // FinalizeCompilingOnMainThread.
219 status_ = CompileJobStatus::kCompiled; 217 status_ = CompileJobStatus::kCompiled;
220 } 218 }
221 219
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
255 if (!source_.is_null()) { 253 if (!source_.is_null()) {
256 i::GlobalHandles::Destroy(Handle<Object>::cast(source_).location()); 254 i::GlobalHandles::Destroy(Handle<Object>::cast(source_).location());
257 source_ = Handle<String>::null(); 255 source_ = Handle<String>::null();
258 } 256 }
259 257
260 status_ = CompileJobStatus::kInitial; 258 status_ = CompileJobStatus::kInitial;
261 } 259 }
262 260
263 } // namespace internal 261 } // namespace internal
264 } // namespace v8 262 } // namespace v8
OLDNEW
« no previous file with comments | « src/background-parsing-task.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698