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 osr_pc_offset_(0), | 62 osr_pc_offset_(0) { |
63 parameter_count_(0) { | |
64 Initialize(script->GetIsolate(), BASE, zone); | 63 Initialize(script->GetIsolate(), BASE, zone); |
65 } | 64 } |
66 | 65 |
67 | 66 |
68 CompilationInfo::CompilationInfo(Handle<SharedFunctionInfo> shared_info, | 67 CompilationInfo::CompilationInfo(Handle<SharedFunctionInfo> shared_info, |
69 Zone* zone) | 68 Zone* zone) |
70 : flags_(LanguageModeField::encode(CLASSIC_MODE) | IsLazy::encode(true)), | 69 : flags_(LanguageModeField::encode(CLASSIC_MODE) | IsLazy::encode(true)), |
71 shared_info_(shared_info), | 70 shared_info_(shared_info), |
72 script_(Handle<Script>(Script::cast(shared_info->script()))), | 71 script_(Handle<Script>(Script::cast(shared_info->script()))), |
73 osr_ast_id_(BailoutId::None()), | 72 osr_ast_id_(BailoutId::None()), |
74 osr_pc_offset_(0), | 73 osr_pc_offset_(0) { |
75 parameter_count_(0) { | |
76 Initialize(script_->GetIsolate(), BASE, zone); | 74 Initialize(script_->GetIsolate(), BASE, zone); |
77 } | 75 } |
78 | 76 |
79 | 77 |
80 CompilationInfo::CompilationInfo(Handle<JSFunction> closure, | 78 CompilationInfo::CompilationInfo(Handle<JSFunction> closure, |
81 Zone* zone) | 79 Zone* zone) |
82 : flags_(LanguageModeField::encode(CLASSIC_MODE) | IsLazy::encode(true)), | 80 : flags_(LanguageModeField::encode(CLASSIC_MODE) | IsLazy::encode(true)), |
83 closure_(closure), | 81 closure_(closure), |
84 shared_info_(Handle<SharedFunctionInfo>(closure->shared())), | 82 shared_info_(Handle<SharedFunctionInfo>(closure->shared())), |
85 script_(Handle<Script>(Script::cast(shared_info_->script()))), | 83 script_(Handle<Script>(Script::cast(shared_info_->script()))), |
86 context_(closure->context()), | 84 context_(closure->context()), |
87 osr_ast_id_(BailoutId::None()), | 85 osr_ast_id_(BailoutId::None()), |
88 osr_pc_offset_(0), | 86 osr_pc_offset_(0) { |
89 parameter_count_(0) { | |
90 Initialize(script_->GetIsolate(), BASE, zone); | 87 Initialize(script_->GetIsolate(), BASE, zone); |
91 } | 88 } |
92 | 89 |
93 | 90 |
94 CompilationInfo::CompilationInfo(HydrogenCodeStub* stub, | 91 CompilationInfo::CompilationInfo(HydrogenCodeStub* stub, |
95 Isolate* isolate, | 92 Isolate* isolate, |
96 Zone* zone) | 93 Zone* zone) |
97 : flags_(LanguageModeField::encode(CLASSIC_MODE) | | 94 : flags_(LanguageModeField::encode(CLASSIC_MODE) | |
98 IsLazy::encode(true)), | 95 IsLazy::encode(true)), |
99 osr_ast_id_(BailoutId::None()), | 96 osr_ast_id_(BailoutId::None()), |
100 osr_pc_offset_(0), | 97 osr_pc_offset_(0) { |
101 parameter_count_(0) { | |
102 Initialize(isolate, STUB, zone); | 98 Initialize(isolate, STUB, zone); |
103 code_stub_ = stub; | 99 code_stub_ = stub; |
104 } | 100 } |
105 | 101 |
106 | 102 |
107 void CompilationInfo::Initialize(Isolate* isolate, | 103 void CompilationInfo::Initialize(Isolate* isolate, |
108 Mode mode, | 104 Mode mode, |
109 Zone* zone) { | 105 Zone* zone) { |
110 isolate_ = isolate; | 106 isolate_ = isolate; |
111 function_ = NULL; | 107 function_ = NULL; |
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
181 DependentCode* dependent_code = | 177 DependentCode* dependent_code = |
182 DependentCode::ForObject(group_objects->at(j), group); | 178 DependentCode::ForObject(group_objects->at(j), group); |
183 dependent_code->RemoveCompilationInfo(group, this); | 179 dependent_code->RemoveCompilationInfo(group, this); |
184 } | 180 } |
185 dependencies_[i] = NULL; // Zone-allocated, no need to delete. | 181 dependencies_[i] = NULL; // Zone-allocated, no need to delete. |
186 } | 182 } |
187 } | 183 } |
188 | 184 |
189 | 185 |
190 int CompilationInfo::num_parameters() const { | 186 int CompilationInfo::num_parameters() const { |
191 if (IsStub()) { | 187 ASSERT(!IsStub()); |
192 ASSERT(parameter_count_ > 0); | 188 return scope()->num_parameters(); |
193 return parameter_count_; | |
194 } else { | |
195 return scope()->num_parameters(); | |
196 } | |
197 } | 189 } |
198 | 190 |
199 | 191 |
200 int CompilationInfo::num_heap_slots() const { | 192 int CompilationInfo::num_heap_slots() const { |
201 if (IsStub()) { | 193 if (IsStub()) { |
202 return 0; | 194 return 0; |
203 } else { | 195 } else { |
204 return scope()->num_heap_slots(); | 196 return scope()->num_heap_slots(); |
205 } | 197 } |
206 } | 198 } |
(...skipping 1154 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1361 AllowHandleDereference allow_deref; | 1353 AllowHandleDereference allow_deref; |
1362 bool tracing_on = info()->IsStub() | 1354 bool tracing_on = info()->IsStub() |
1363 ? FLAG_trace_hydrogen_stubs | 1355 ? FLAG_trace_hydrogen_stubs |
1364 : (FLAG_trace_hydrogen && | 1356 : (FLAG_trace_hydrogen && |
1365 info()->closure()->PassesFilter(FLAG_trace_hydrogen_filter)); | 1357 info()->closure()->PassesFilter(FLAG_trace_hydrogen_filter)); |
1366 return (tracing_on && | 1358 return (tracing_on && |
1367 OS::StrChr(const_cast<char*>(FLAG_trace_phase), name_[0]) != NULL); | 1359 OS::StrChr(const_cast<char*>(FLAG_trace_phase), name_[0]) != NULL); |
1368 } | 1360 } |
1369 | 1361 |
1370 } } // namespace v8::internal | 1362 } } // namespace v8::internal |
OLD | NEW |