| 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 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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 this_has_uses_(true), |
| 64 optimization_id_(-1) { |
| 64 Initialize(script->GetIsolate(), BASE, zone); | 65 Initialize(script->GetIsolate(), BASE, zone); |
| 65 } | 66 } |
| 66 | 67 |
| 67 | 68 |
| 68 CompilationInfo::CompilationInfo(Handle<SharedFunctionInfo> shared_info, | 69 CompilationInfo::CompilationInfo(Handle<SharedFunctionInfo> shared_info, |
| 69 Zone* zone) | 70 Zone* zone) |
| 70 : flags_(LanguageModeField::encode(CLASSIC_MODE) | IsLazy::encode(true)), | 71 : flags_(LanguageModeField::encode(CLASSIC_MODE) | IsLazy::encode(true)), |
| 71 shared_info_(shared_info), | 72 shared_info_(shared_info), |
| 72 script_(Handle<Script>(Script::cast(shared_info->script()))), | 73 script_(Handle<Script>(Script::cast(shared_info->script()))), |
| 73 osr_ast_id_(BailoutId::None()), | 74 osr_ast_id_(BailoutId::None()), |
| 74 parameter_count_(0), | 75 parameter_count_(0), |
| 75 this_has_uses_(true) { | 76 this_has_uses_(true), |
| 77 optimization_id_(-1) { |
| 76 Initialize(script_->GetIsolate(), BASE, zone); | 78 Initialize(script_->GetIsolate(), BASE, zone); |
| 77 } | 79 } |
| 78 | 80 |
| 79 | 81 |
| 80 CompilationInfo::CompilationInfo(Handle<JSFunction> closure, | 82 CompilationInfo::CompilationInfo(Handle<JSFunction> closure, |
| 81 Zone* zone) | 83 Zone* zone) |
| 82 : flags_(LanguageModeField::encode(CLASSIC_MODE) | IsLazy::encode(true)), | 84 : flags_(LanguageModeField::encode(CLASSIC_MODE) | IsLazy::encode(true)), |
| 83 closure_(closure), | 85 closure_(closure), |
| 84 shared_info_(Handle<SharedFunctionInfo>(closure->shared())), | 86 shared_info_(Handle<SharedFunctionInfo>(closure->shared())), |
| 85 script_(Handle<Script>(Script::cast(shared_info_->script()))), | 87 script_(Handle<Script>(Script::cast(shared_info_->script()))), |
| 86 context_(closure->context()), | 88 context_(closure->context()), |
| 87 osr_ast_id_(BailoutId::None()), | 89 osr_ast_id_(BailoutId::None()), |
| 88 parameter_count_(0), | 90 parameter_count_(0), |
| 89 this_has_uses_(true) { | 91 this_has_uses_(true), |
| 92 optimization_id_(-1) { |
| 90 Initialize(script_->GetIsolate(), BASE, zone); | 93 Initialize(script_->GetIsolate(), BASE, zone); |
| 91 } | 94 } |
| 92 | 95 |
| 93 | 96 |
| 94 CompilationInfo::CompilationInfo(HydrogenCodeStub* stub, | 97 CompilationInfo::CompilationInfo(HydrogenCodeStub* stub, |
| 95 Isolate* isolate, | 98 Isolate* isolate, |
| 96 Zone* zone) | 99 Zone* zone) |
| 97 : flags_(LanguageModeField::encode(CLASSIC_MODE) | | 100 : flags_(LanguageModeField::encode(CLASSIC_MODE) | |
| 98 IsLazy::encode(true)), | 101 IsLazy::encode(true)), |
| 99 osr_ast_id_(BailoutId::None()), | 102 osr_ast_id_(BailoutId::None()), |
| 100 parameter_count_(0), | 103 parameter_count_(0), |
| 101 this_has_uses_(true) { | 104 this_has_uses_(true), |
| 105 optimization_id_(-1) { |
| 102 Initialize(isolate, STUB, zone); | 106 Initialize(isolate, STUB, zone); |
| 103 code_stub_ = stub; | 107 code_stub_ = stub; |
| 104 } | 108 } |
| 105 | 109 |
| 106 | 110 |
| 107 void CompilationInfo::Initialize(Isolate* isolate, | 111 void CompilationInfo::Initialize(Isolate* isolate, |
| 108 Mode mode, | 112 Mode mode, |
| 109 Zone* zone) { | 113 Zone* zone) { |
| 110 isolate_ = isolate; | 114 isolate_ = isolate; |
| 111 function_ = NULL; | 115 function_ = NULL; |
| (...skipping 286 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 398 if (FLAG_trace_hydrogen) { | 402 if (FLAG_trace_hydrogen) { |
| 399 Handle<String> name = info()->function()->debug_name(); | 403 Handle<String> name = info()->function()->debug_name(); |
| 400 PrintF("-----------------------------------------------------------\n"); | 404 PrintF("-----------------------------------------------------------\n"); |
| 401 PrintF("Compiling method %s using hydrogen\n", name->ToCString().get()); | 405 PrintF("Compiling method %s using hydrogen\n", name->ToCString().get()); |
| 402 isolate()->GetHTracer()->TraceCompilation(info()); | 406 isolate()->GetHTracer()->TraceCompilation(info()); |
| 403 } | 407 } |
| 404 | 408 |
| 405 // Type-check the function. | 409 // Type-check the function. |
| 406 AstTyper::Run(info()); | 410 AstTyper::Run(info()); |
| 407 | 411 |
| 408 graph_builder_ = FLAG_emit_opt_code_positions | 412 graph_builder_ = FLAG_hydrogen_track_positions |
| 409 ? new(info()->zone()) HOptimizedGraphBuilderWithPositions(info()) | 413 ? new(info()->zone()) HOptimizedGraphBuilderWithPositions(info()) |
| 410 : new(info()->zone()) HOptimizedGraphBuilder(info()); | 414 : new(info()->zone()) HOptimizedGraphBuilder(info()); |
| 411 | 415 |
| 412 Timer t(this, &time_taken_to_create_graph_); | 416 Timer t(this, &time_taken_to_create_graph_); |
| 413 info()->set_this_has_uses(false); | 417 info()->set_this_has_uses(false); |
| 414 graph_ = graph_builder_->CreateGraph(); | 418 graph_ = graph_builder_->CreateGraph(); |
| 415 | 419 |
| 416 if (isolate()->has_pending_exception()) { | 420 if (isolate()->has_pending_exception()) { |
| 417 return SetLastStatus(FAILED); | 421 return SetLastStatus(FAILED); |
| 418 } | 422 } |
| (...skipping 879 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1298 AllowHandleDereference allow_deref; | 1302 AllowHandleDereference allow_deref; |
| 1299 bool tracing_on = info()->IsStub() | 1303 bool tracing_on = info()->IsStub() |
| 1300 ? FLAG_trace_hydrogen_stubs | 1304 ? FLAG_trace_hydrogen_stubs |
| 1301 : (FLAG_trace_hydrogen && | 1305 : (FLAG_trace_hydrogen && |
| 1302 info()->closure()->PassesFilter(FLAG_trace_hydrogen_filter)); | 1306 info()->closure()->PassesFilter(FLAG_trace_hydrogen_filter)); |
| 1303 return (tracing_on && | 1307 return (tracing_on && |
| 1304 OS::StrChr(const_cast<char*>(FLAG_trace_phase), name_[0]) != NULL); | 1308 OS::StrChr(const_cast<char*>(FLAG_trace_phase), name_[0]) != NULL); |
| 1305 } | 1309 } |
| 1306 | 1310 |
| 1307 } } // namespace v8::internal | 1311 } } // namespace v8::internal |
| OLD | NEW |