| 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 279 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 391 if (FLAG_trace_hydrogen) { | 395 if (FLAG_trace_hydrogen) { |
| 392 Handle<String> name = info()->function()->debug_name(); | 396 Handle<String> name = info()->function()->debug_name(); |
| 393 PrintF("-----------------------------------------------------------\n"); | 397 PrintF("-----------------------------------------------------------\n"); |
| 394 PrintF("Compiling method %s using hydrogen\n", name->ToCString().get()); | 398 PrintF("Compiling method %s using hydrogen\n", name->ToCString().get()); |
| 395 isolate()->GetHTracer()->TraceCompilation(info()); | 399 isolate()->GetHTracer()->TraceCompilation(info()); |
| 396 } | 400 } |
| 397 | 401 |
| 398 // Type-check the function. | 402 // Type-check the function. |
| 399 AstTyper::Run(info()); | 403 AstTyper::Run(info()); |
| 400 | 404 |
| 401 graph_builder_ = FLAG_emit_opt_code_positions | 405 graph_builder_ = FLAG_hydrogen_track_positions |
| 402 ? new(info()->zone()) HOptimizedGraphBuilderWithPositions(info()) | 406 ? new(info()->zone()) HOptimizedGraphBuilderWithPositions(info()) |
| 403 : new(info()->zone()) HOptimizedGraphBuilder(info()); | 407 : new(info()->zone()) HOptimizedGraphBuilder(info()); |
| 404 | 408 |
| 405 Timer t(this, &time_taken_to_create_graph_); | 409 Timer t(this, &time_taken_to_create_graph_); |
| 406 info()->set_this_has_uses(false); | 410 info()->set_this_has_uses(false); |
| 407 graph_ = graph_builder_->CreateGraph(); | 411 graph_ = graph_builder_->CreateGraph(); |
| 408 | 412 |
| 409 if (isolate()->has_pending_exception()) { | 413 if (isolate()->has_pending_exception()) { |
| 410 return SetLastStatus(FAILED); | 414 return SetLastStatus(FAILED); |
| 411 } | 415 } |
| (...skipping 879 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1291 AllowHandleDereference allow_deref; | 1295 AllowHandleDereference allow_deref; |
| 1292 bool tracing_on = info()->IsStub() | 1296 bool tracing_on = info()->IsStub() |
| 1293 ? FLAG_trace_hydrogen_stubs | 1297 ? FLAG_trace_hydrogen_stubs |
| 1294 : (FLAG_trace_hydrogen && | 1298 : (FLAG_trace_hydrogen && |
| 1295 info()->closure()->PassesFilter(FLAG_trace_hydrogen_filter)); | 1299 info()->closure()->PassesFilter(FLAG_trace_hydrogen_filter)); |
| 1296 return (tracing_on && | 1300 return (tracing_on && |
| 1297 OS::StrChr(const_cast<char*>(FLAG_trace_phase), name_[0]) != NULL); | 1301 OS::StrChr(const_cast<char*>(FLAG_trace_phase), name_[0]) != NULL); |
| 1298 } | 1302 } |
| 1299 | 1303 |
| 1300 } } // namespace v8::internal | 1304 } } // namespace v8::internal |
| OLD | NEW |