| OLD | NEW |
| 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 375 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 386 return SetLastStatus(BAILED_OUT); | 386 return SetLastStatus(BAILED_OUT); |
| 387 } else { | 387 } else { |
| 388 return AbortOptimization(); | 388 return AbortOptimization(); |
| 389 } | 389 } |
| 390 } | 390 } |
| 391 | 391 |
| 392 return SetLastStatus(SUCCEEDED); | 392 return SetLastStatus(SUCCEEDED); |
| 393 } | 393 } |
| 394 | 394 |
| 395 OptimizingCompiler::Status OptimizingCompiler::OptimizeGraph() { | 395 OptimizingCompiler::Status OptimizingCompiler::OptimizeGraph() { |
| 396 AssertNoAllocation no_gc; | 396 DisallowHeapAllocation no_allocation; |
| 397 NoHandleAllocation no_handles(isolate()); | 397 DisallowHandleAllocation no_handles; |
| 398 HandleDereferenceGuard no_deref(isolate(), HandleDereferenceGuard::DISALLOW); | 398 DisallowHandleDereference no_deref; |
| 399 | 399 |
| 400 ASSERT(last_status() == SUCCEEDED); | 400 ASSERT(last_status() == SUCCEEDED); |
| 401 Timer t(this, &time_taken_to_optimize_); | 401 Timer t(this, &time_taken_to_optimize_); |
| 402 ASSERT(graph_ != NULL); | 402 ASSERT(graph_ != NULL); |
| 403 SmartArrayPointer<char> bailout_reason; | 403 SmartArrayPointer<char> bailout_reason; |
| 404 if (!graph_->Optimize(&bailout_reason)) { | 404 if (!graph_->Optimize(&bailout_reason)) { |
| 405 if (!bailout_reason.is_empty()) graph_builder_->Bailout(*bailout_reason); | 405 if (!bailout_reason.is_empty()) graph_builder_->Bailout(*bailout_reason); |
| 406 return SetLastStatus(BAILED_OUT); | 406 return SetLastStatus(BAILED_OUT); |
| 407 } else { | 407 } else { |
| 408 chunk_ = LChunk::NewChunk(graph_); | 408 chunk_ = LChunk::NewChunk(graph_); |
| 409 if (chunk_ == NULL) { | 409 if (chunk_ == NULL) { |
| 410 return SetLastStatus(BAILED_OUT); | 410 return SetLastStatus(BAILED_OUT); |
| 411 } | 411 } |
| 412 } | 412 } |
| 413 return SetLastStatus(SUCCEEDED); | 413 return SetLastStatus(SUCCEEDED); |
| 414 } | 414 } |
| 415 | 415 |
| 416 | 416 |
| 417 OptimizingCompiler::Status OptimizingCompiler::GenerateAndInstallCode() { | 417 OptimizingCompiler::Status OptimizingCompiler::GenerateAndInstallCode() { |
| 418 ASSERT(last_status() == SUCCEEDED); | 418 ASSERT(last_status() == SUCCEEDED); |
| 419 { // Scope for timer. | 419 { // Scope for timer. |
| 420 Timer timer(this, &time_taken_to_codegen_); | 420 Timer timer(this, &time_taken_to_codegen_); |
| 421 ASSERT(chunk_ != NULL); | 421 ASSERT(chunk_ != NULL); |
| 422 ASSERT(graph_ != NULL); | 422 ASSERT(graph_ != NULL); |
| 423 // Deferred handles reference objects that were accessible during | 423 // Deferred handles reference objects that were accessible during |
| 424 // graph creation. To make sure that we don't encounter inconsistencies | 424 // graph creation. To make sure that we don't encounter inconsistencies |
| 425 // between graph creation and code generation, we disallow accessing | 425 // between graph creation and code generation, we disallow accessing |
| 426 // objects through deferred handles during the latter, with exceptions. | 426 // objects through deferred handles during the latter, with exceptions. |
| 427 HandleDereferenceGuard no_deref_deferred( | 427 DisallowDeferredHandleDereference no_deferred_handle_deref(); |
| 428 isolate(), HandleDereferenceGuard::DISALLOW_DEFERRED); | |
| 429 Handle<Code> optimized_code = chunk_->Codegen(); | 428 Handle<Code> optimized_code = chunk_->Codegen(); |
| 430 if (optimized_code.is_null()) { | 429 if (optimized_code.is_null()) { |
| 431 info()->set_bailout_reason("code generation failed"); | 430 info()->set_bailout_reason("code generation failed"); |
| 432 return AbortOptimization(); | 431 return AbortOptimization(); |
| 433 } | 432 } |
| 434 info()->SetCode(optimized_code); | 433 info()->SetCode(optimized_code); |
| 435 } | 434 } |
| 436 RecordOptimizationStats(); | 435 RecordOptimizationStats(); |
| 437 return SetLastStatus(SUCCEEDED); | 436 return SetLastStatus(SUCCEEDED); |
| 438 } | 437 } |
| (...skipping 735 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1174 } | 1173 } |
| 1175 } | 1174 } |
| 1176 | 1175 |
| 1177 GDBJIT(AddCode(Handle<String>(shared->DebugName()), | 1176 GDBJIT(AddCode(Handle<String>(shared->DebugName()), |
| 1178 Handle<Script>(info->script()), | 1177 Handle<Script>(info->script()), |
| 1179 Handle<Code>(info->code()), | 1178 Handle<Code>(info->code()), |
| 1180 info)); | 1179 info)); |
| 1181 } | 1180 } |
| 1182 | 1181 |
| 1183 } } // namespace v8::internal | 1182 } } // namespace v8::internal |
| OLD | NEW |