| 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 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 52 | 52 |
| 53 namespace v8 { | 53 namespace v8 { |
| 54 namespace internal { | 54 namespace internal { |
| 55 | 55 |
| 56 | 56 |
| 57 CompilationInfo::CompilationInfo(Handle<Script> script, | 57 CompilationInfo::CompilationInfo(Handle<Script> script, |
| 58 Zone* zone) | 58 Zone* zone) |
| 59 : flags_(LanguageModeField::encode(CLASSIC_MODE)), | 59 : flags_(LanguageModeField::encode(CLASSIC_MODE)), |
| 60 script_(script), | 60 script_(script), |
| 61 osr_ast_id_(BailoutId::None()), | 61 osr_ast_id_(BailoutId::None()), |
| 62 parameter_count_(0) { | 62 parameter_count_(0), |
| 63 this_has_uses_(true) { |
| 63 Initialize(script->GetIsolate(), BASE, zone); | 64 Initialize(script->GetIsolate(), BASE, zone); |
| 64 } | 65 } |
| 65 | 66 |
| 66 | 67 |
| 67 CompilationInfo::CompilationInfo(Handle<SharedFunctionInfo> shared_info, | 68 CompilationInfo::CompilationInfo(Handle<SharedFunctionInfo> shared_info, |
| 68 Zone* zone) | 69 Zone* zone) |
| 69 : flags_(LanguageModeField::encode(CLASSIC_MODE) | IsLazy::encode(true)), | 70 : flags_(LanguageModeField::encode(CLASSIC_MODE) | IsLazy::encode(true)), |
| 70 shared_info_(shared_info), | 71 shared_info_(shared_info), |
| 71 script_(Handle<Script>(Script::cast(shared_info->script()))), | 72 script_(Handle<Script>(Script::cast(shared_info->script()))), |
| 72 osr_ast_id_(BailoutId::None()), | 73 osr_ast_id_(BailoutId::None()), |
| 73 parameter_count_(0) { | 74 parameter_count_(0), |
| 75 this_has_uses_(true) { |
| 74 Initialize(script_->GetIsolate(), BASE, zone); | 76 Initialize(script_->GetIsolate(), BASE, zone); |
| 75 } | 77 } |
| 76 | 78 |
| 77 | 79 |
| 78 CompilationInfo::CompilationInfo(Handle<JSFunction> closure, | 80 CompilationInfo::CompilationInfo(Handle<JSFunction> closure, |
| 79 Zone* zone) | 81 Zone* zone) |
| 80 : flags_(LanguageModeField::encode(CLASSIC_MODE) | IsLazy::encode(true)), | 82 : flags_(LanguageModeField::encode(CLASSIC_MODE) | IsLazy::encode(true)), |
| 81 closure_(closure), | 83 closure_(closure), |
| 82 shared_info_(Handle<SharedFunctionInfo>(closure->shared())), | 84 shared_info_(Handle<SharedFunctionInfo>(closure->shared())), |
| 83 script_(Handle<Script>(Script::cast(shared_info_->script()))), | 85 script_(Handle<Script>(Script::cast(shared_info_->script()))), |
| 84 context_(closure->context()), | 86 context_(closure->context()), |
| 85 osr_ast_id_(BailoutId::None()), | 87 osr_ast_id_(BailoutId::None()), |
| 86 parameter_count_(0) { | 88 parameter_count_(0), |
| 89 this_has_uses_(true) { |
| 87 Initialize(script_->GetIsolate(), BASE, zone); | 90 Initialize(script_->GetIsolate(), BASE, zone); |
| 88 } | 91 } |
| 89 | 92 |
| 90 | 93 |
| 91 CompilationInfo::CompilationInfo(HydrogenCodeStub* stub, | 94 CompilationInfo::CompilationInfo(HydrogenCodeStub* stub, |
| 92 Isolate* isolate, | 95 Isolate* isolate, |
| 93 Zone* zone) | 96 Zone* zone) |
| 94 : flags_(LanguageModeField::encode(CLASSIC_MODE) | | 97 : flags_(LanguageModeField::encode(CLASSIC_MODE) | |
| 95 IsLazy::encode(true)), | 98 IsLazy::encode(true)), |
| 96 osr_ast_id_(BailoutId::None()), | 99 osr_ast_id_(BailoutId::None()), |
| 97 parameter_count_(0) { | 100 parameter_count_(0), |
| 101 this_has_uses_(true) { |
| 98 Initialize(isolate, STUB, zone); | 102 Initialize(isolate, STUB, zone); |
| 99 code_stub_ = stub; | 103 code_stub_ = stub; |
| 100 } | 104 } |
| 101 | 105 |
| 102 | 106 |
| 103 void CompilationInfo::Initialize(Isolate* isolate, | 107 void CompilationInfo::Initialize(Isolate* isolate, |
| 104 Mode mode, | 108 Mode mode, |
| 105 Zone* zone) { | 109 Zone* zone) { |
| 106 isolate_ = isolate; | 110 isolate_ = isolate; |
| 107 function_ = NULL; | 111 function_ = NULL; |
| (...skipping 293 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 401 } | 405 } |
| 402 | 406 |
| 403 // Type-check the function. | 407 // Type-check the function. |
| 404 AstTyper::Run(info()); | 408 AstTyper::Run(info()); |
| 405 | 409 |
| 406 graph_builder_ = FLAG_emit_opt_code_positions | 410 graph_builder_ = FLAG_emit_opt_code_positions |
| 407 ? new(info()->zone()) HOptimizedGraphBuilderWithPositions(info()) | 411 ? new(info()->zone()) HOptimizedGraphBuilderWithPositions(info()) |
| 408 : new(info()->zone()) HOptimizedGraphBuilder(info()); | 412 : new(info()->zone()) HOptimizedGraphBuilder(info()); |
| 409 | 413 |
| 410 Timer t(this, &time_taken_to_create_graph_); | 414 Timer t(this, &time_taken_to_create_graph_); |
| 415 info()->set_this_has_uses(false); |
| 411 graph_ = graph_builder_->CreateGraph(); | 416 graph_ = graph_builder_->CreateGraph(); |
| 412 | 417 |
| 413 if (isolate()->has_pending_exception()) { | 418 if (isolate()->has_pending_exception()) { |
| 414 return SetLastStatus(FAILED); | 419 return SetLastStatus(FAILED); |
| 415 } | 420 } |
| 416 | 421 |
| 417 // The function being compiled may have bailed out due to an inline | 422 // The function being compiled may have bailed out due to an inline |
| 418 // candidate bailing out. In such a case, we don't disable | 423 // candidate bailing out. In such a case, we don't disable |
| 419 // optimization on the shared_info. | 424 // optimization on the shared_info. |
| 420 ASSERT(!graph_builder_->inline_bailout() || graph_ == NULL); | 425 ASSERT(!graph_builder_->inline_bailout() || graph_ == NULL); |
| (...skipping 874 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1295 AllowHandleDereference allow_deref; | 1300 AllowHandleDereference allow_deref; |
| 1296 bool tracing_on = info()->IsStub() | 1301 bool tracing_on = info()->IsStub() |
| 1297 ? FLAG_trace_hydrogen_stubs | 1302 ? FLAG_trace_hydrogen_stubs |
| 1298 : (FLAG_trace_hydrogen && | 1303 : (FLAG_trace_hydrogen && |
| 1299 info()->closure()->PassesFilter(FLAG_trace_hydrogen_filter)); | 1304 info()->closure()->PassesFilter(FLAG_trace_hydrogen_filter)); |
| 1300 return (tracing_on && | 1305 return (tracing_on && |
| 1301 OS::StrChr(const_cast<char*>(FLAG_trace_phase), name_[0]) != NULL); | 1306 OS::StrChr(const_cast<char*>(FLAG_trace_phase), name_[0]) != NULL); |
| 1302 } | 1307 } |
| 1303 | 1308 |
| 1304 } } // namespace v8::internal | 1309 } } // namespace v8::internal |
| OLD | NEW |