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

Side by Side Diff: src/compiler.cc

Issue 12049012: Avoid handle dereference during graph optimization. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: addressed comments Created 7 years, 11 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/compiler.h ('k') | src/handles.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 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 83 matching lines...) Expand 10 before | Expand all | Expand 10 after
94 isolate_ = isolate; 94 isolate_ = isolate;
95 function_ = NULL; 95 function_ = NULL;
96 scope_ = NULL; 96 scope_ = NULL;
97 global_scope_ = NULL; 97 global_scope_ = NULL;
98 extension_ = NULL; 98 extension_ = NULL;
99 pre_parse_data_ = NULL; 99 pre_parse_data_ = NULL;
100 zone_ = zone; 100 zone_ = zone;
101 deferred_handles_ = NULL; 101 deferred_handles_ = NULL;
102 code_stub_ = NULL; 102 code_stub_ = NULL;
103 prologue_offset_ = kPrologueOffsetNotSet; 103 prologue_offset_ = kPrologueOffsetNotSet;
104 opt_count_ = shared_info().is_null() ? 0 : shared_info()->opt_count();
104 if (mode == STUB) { 105 if (mode == STUB) {
105 mode_ = STUB; 106 mode_ = STUB;
106 return; 107 return;
107 } 108 }
108 mode_ = V8::UseCrankshaft() ? mode : NONOPT; 109 mode_ = V8::UseCrankshaft() ? mode : NONOPT;
109 if (script_->type()->value() == Script::TYPE_NATIVE) { 110 if (script_->type()->value() == Script::TYPE_NATIVE) {
110 MarkAsNative(); 111 MarkAsNative();
111 } 112 }
112 if (!shared_info_.is_null()) { 113 if (!shared_info_.is_null()) {
113 ASSERT(language_mode() == CLASSIC_MODE); 114 ASSERT(language_mode() == CLASSIC_MODE);
(...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after
278 // generated code for this from the shared function object. 279 // generated code for this from the shared function object.
279 if (AlwaysFullCompiler(info()->isolate())) { 280 if (AlwaysFullCompiler(info()->isolate())) {
280 info()->SetCode(code); 281 info()->SetCode(code);
281 return SetLastStatus(BAILED_OUT); 282 return SetLastStatus(BAILED_OUT);
282 } 283 }
283 284
284 // Limit the number of times we re-compile a functions with 285 // Limit the number of times we re-compile a functions with
285 // the optimizing compiler. 286 // the optimizing compiler.
286 const int kMaxOptCount = 287 const int kMaxOptCount =
287 FLAG_deopt_every_n_times == 0 ? FLAG_max_opt_count : 1000; 288 FLAG_deopt_every_n_times == 0 ? FLAG_max_opt_count : 1000;
288 if (info()->shared_info()->opt_count() > kMaxOptCount) { 289 if (info()->opt_count() > kMaxOptCount) {
289 info()->set_bailout_reason("optimized too many times"); 290 info()->set_bailout_reason("optimized too many times");
290 return AbortOptimization(); 291 return AbortOptimization();
291 } 292 }
292 293
293 // Due to an encoding limit on LUnallocated operands in the Lithium 294 // Due to an encoding limit on LUnallocated operands in the Lithium
294 // language, we cannot optimize functions with too many formal parameters 295 // language, we cannot optimize functions with too many formal parameters
295 // or perform on-stack replacement for function with too many 296 // or perform on-stack replacement for function with too many
296 // stack-allocated local variables. 297 // stack-allocated local variables.
297 // 298 //
298 // The encoding is as a signed value, with parameters and receiver using 299 // The encoding is as a signed value, with parameters and receiver using
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after
387 return AbortOptimization(); 388 return AbortOptimization();
388 } 389 }
389 } 390 }
390 391
391 return SetLastStatus(SUCCEEDED); 392 return SetLastStatus(SUCCEEDED);
392 } 393 }
393 394
394 OptimizingCompiler::Status OptimizingCompiler::OptimizeGraph() { 395 OptimizingCompiler::Status OptimizingCompiler::OptimizeGraph() {
395 AssertNoAllocation no_gc; 396 AssertNoAllocation no_gc;
396 NoHandleAllocation no_handles; 397 NoHandleAllocation no_handles;
398 NoHandleDereference no_deref;
397 399
398 ASSERT(last_status() == SUCCEEDED); 400 ASSERT(last_status() == SUCCEEDED);
399 Timer t(this, &time_taken_to_optimize_); 401 Timer t(this, &time_taken_to_optimize_);
400 ASSERT(graph_ != NULL); 402 ASSERT(graph_ != NULL);
401 SmartArrayPointer<char> bailout_reason; 403 SmartArrayPointer<char> bailout_reason;
402 if (!graph_->Optimize(&bailout_reason)) { 404 if (!graph_->Optimize(&bailout_reason)) {
403 if (!bailout_reason.is_empty()) graph_builder_->Bailout(*bailout_reason); 405 if (!bailout_reason.is_empty()) graph_builder_->Bailout(*bailout_reason);
404 return SetLastStatus(BAILED_OUT); 406 return SetLastStatus(BAILED_OUT);
405 } else { 407 } else {
406 chunk_ = LChunk::NewChunk(graph_); 408 chunk_ = LChunk::NewChunk(graph_);
(...skipping 710 matching lines...) Expand 10 before | Expand all | Expand 10 after
1117 } 1119 }
1118 } 1120 }
1119 1121
1120 GDBJIT(AddCode(Handle<String>(shared->DebugName()), 1122 GDBJIT(AddCode(Handle<String>(shared->DebugName()),
1121 Handle<Script>(info->script()), 1123 Handle<Script>(info->script()),
1122 Handle<Code>(info->code()), 1124 Handle<Code>(info->code()),
1123 info)); 1125 info));
1124 } 1126 }
1125 1127
1126 } } // namespace v8::internal 1128 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/compiler.h ('k') | src/handles.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698