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...) 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 284 matching lines...) Loading... |
392 } | 396 } |
393 | 397 |
394 // Type-check the function. | 398 // Type-check the function. |
395 AstTyper::Run(info()); | 399 AstTyper::Run(info()); |
396 | 400 |
397 graph_builder_ = FLAG_emit_opt_code_positions | 401 graph_builder_ = FLAG_emit_opt_code_positions |
398 ? new(info()->zone()) HOptimizedGraphBuilderWithPositions(info()) | 402 ? new(info()->zone()) HOptimizedGraphBuilderWithPositions(info()) |
399 : new(info()->zone()) HOptimizedGraphBuilder(info()); | 403 : new(info()->zone()) HOptimizedGraphBuilder(info()); |
400 | 404 |
401 Timer t(this, &time_taken_to_create_graph_); | 405 Timer t(this, &time_taken_to_create_graph_); |
| 406 info()->set_this_has_uses(false); |
402 graph_ = graph_builder_->CreateGraph(); | 407 graph_ = graph_builder_->CreateGraph(); |
403 | 408 |
404 if (isolate()->has_pending_exception()) { | 409 if (isolate()->has_pending_exception()) { |
405 return SetLastStatus(FAILED); | 410 return SetLastStatus(FAILED); |
406 } | 411 } |
407 | 412 |
408 // The function being compiled may have bailed out due to an inline | 413 // The function being compiled may have bailed out due to an inline |
409 // candidate bailing out. In such a case, we don't disable | 414 // candidate bailing out. In such a case, we don't disable |
410 // optimization on the shared_info. | 415 // optimization on the shared_info. |
411 ASSERT(!graph_builder_->inline_bailout() || graph_ == NULL); | 416 ASSERT(!graph_builder_->inline_bailout() || graph_ == NULL); |
(...skipping 874 matching lines...) Loading... |
1286 AllowHandleDereference allow_deref; | 1291 AllowHandleDereference allow_deref; |
1287 bool tracing_on = info()->IsStub() | 1292 bool tracing_on = info()->IsStub() |
1288 ? FLAG_trace_hydrogen_stubs | 1293 ? FLAG_trace_hydrogen_stubs |
1289 : (FLAG_trace_hydrogen && | 1294 : (FLAG_trace_hydrogen && |
1290 info()->closure()->PassesFilter(FLAG_trace_hydrogen_filter)); | 1295 info()->closure()->PassesFilter(FLAG_trace_hydrogen_filter)); |
1291 return (tracing_on && | 1296 return (tracing_on && |
1292 OS::StrChr(const_cast<char*>(FLAG_trace_phase), name_[0]) != NULL); | 1297 OS::StrChr(const_cast<char*>(FLAG_trace_phase), name_[0]) != NULL); |
1293 } | 1298 } |
1294 | 1299 |
1295 } } // namespace v8::internal | 1300 } } // namespace v8::internal |
OLD | NEW |