| OLD | NEW |
| 1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "src/v8.h" | 5 #include "src/v8.h" |
| 6 | 6 |
| 7 #include "src/compiler.h" | 7 #include "src/compiler.h" |
| 8 | 8 |
| 9 #include "src/bootstrapper.h" | 9 #include "src/bootstrapper.h" |
| 10 #include "src/codegen.h" | 10 #include "src/codegen.h" |
| (...skipping 20 matching lines...) Expand all Loading... |
| 31 namespace internal { | 31 namespace internal { |
| 32 | 32 |
| 33 | 33 |
| 34 CompilationInfo::CompilationInfo(Handle<Script> script, | 34 CompilationInfo::CompilationInfo(Handle<Script> script, |
| 35 Zone* zone) | 35 Zone* zone) |
| 36 : flags_(StrictModeField::encode(SLOPPY)), | 36 : flags_(StrictModeField::encode(SLOPPY)), |
| 37 script_(script), | 37 script_(script), |
| 38 osr_ast_id_(BailoutId::None()), | 38 osr_ast_id_(BailoutId::None()), |
| 39 parameter_count_(0), | 39 parameter_count_(0), |
| 40 this_has_uses_(true), | 40 this_has_uses_(true), |
| 41 optimization_id_(-1) { | 41 optimization_id_(-1), |
| 42 ast_value_factory_(NULL), |
| 43 ast_value_factory_owned_(false) { |
| 42 Initialize(script->GetIsolate(), BASE, zone); | 44 Initialize(script->GetIsolate(), BASE, zone); |
| 43 } | 45 } |
| 44 | 46 |
| 45 | 47 |
| 46 CompilationInfo::CompilationInfo(Handle<SharedFunctionInfo> shared_info, | 48 CompilationInfo::CompilationInfo(Handle<SharedFunctionInfo> shared_info, |
| 47 Zone* zone) | 49 Zone* zone) |
| 48 : flags_(StrictModeField::encode(SLOPPY) | IsLazy::encode(true)), | 50 : flags_(StrictModeField::encode(SLOPPY) | IsLazy::encode(true)), |
| 49 shared_info_(shared_info), | 51 shared_info_(shared_info), |
| 50 script_(Handle<Script>(Script::cast(shared_info->script()))), | 52 script_(Handle<Script>(Script::cast(shared_info->script()))), |
| 51 osr_ast_id_(BailoutId::None()), | 53 osr_ast_id_(BailoutId::None()), |
| 52 parameter_count_(0), | 54 parameter_count_(0), |
| 53 this_has_uses_(true), | 55 this_has_uses_(true), |
| 54 optimization_id_(-1) { | 56 optimization_id_(-1), |
| 57 ast_value_factory_(NULL), |
| 58 ast_value_factory_owned_(false) { |
| 55 Initialize(script_->GetIsolate(), BASE, zone); | 59 Initialize(script_->GetIsolate(), BASE, zone); |
| 56 } | 60 } |
| 57 | 61 |
| 58 | 62 |
| 59 CompilationInfo::CompilationInfo(Handle<JSFunction> closure, | 63 CompilationInfo::CompilationInfo(Handle<JSFunction> closure, |
| 60 Zone* zone) | 64 Zone* zone) |
| 61 : flags_(StrictModeField::encode(SLOPPY) | IsLazy::encode(true)), | 65 : flags_(StrictModeField::encode(SLOPPY) | IsLazy::encode(true)), |
| 62 closure_(closure), | 66 closure_(closure), |
| 63 shared_info_(Handle<SharedFunctionInfo>(closure->shared())), | 67 shared_info_(Handle<SharedFunctionInfo>(closure->shared())), |
| 64 script_(Handle<Script>(Script::cast(shared_info_->script()))), | 68 script_(Handle<Script>(Script::cast(shared_info_->script()))), |
| 65 context_(closure->context()), | 69 context_(closure->context()), |
| 66 osr_ast_id_(BailoutId::None()), | 70 osr_ast_id_(BailoutId::None()), |
| 67 parameter_count_(0), | 71 parameter_count_(0), |
| 68 this_has_uses_(true), | 72 this_has_uses_(true), |
| 69 optimization_id_(-1) { | 73 optimization_id_(-1), |
| 74 ast_value_factory_(NULL), |
| 75 ast_value_factory_owned_(false) { |
| 70 Initialize(script_->GetIsolate(), BASE, zone); | 76 Initialize(script_->GetIsolate(), BASE, zone); |
| 71 } | 77 } |
| 72 | 78 |
| 73 | 79 |
| 74 CompilationInfo::CompilationInfo(HydrogenCodeStub* stub, | 80 CompilationInfo::CompilationInfo(HydrogenCodeStub* stub, |
| 75 Isolate* isolate, | 81 Isolate* isolate, |
| 76 Zone* zone) | 82 Zone* zone) |
| 77 : flags_(StrictModeField::encode(SLOPPY) | IsLazy::encode(true)), | 83 : flags_(StrictModeField::encode(SLOPPY) | IsLazy::encode(true)), |
| 78 osr_ast_id_(BailoutId::None()), | 84 osr_ast_id_(BailoutId::None()), |
| 79 parameter_count_(0), | 85 parameter_count_(0), |
| 80 this_has_uses_(true), | 86 this_has_uses_(true), |
| 81 optimization_id_(-1) { | 87 optimization_id_(-1), |
| 88 ast_value_factory_(NULL), |
| 89 ast_value_factory_owned_(false) { |
| 82 Initialize(isolate, STUB, zone); | 90 Initialize(isolate, STUB, zone); |
| 83 code_stub_ = stub; | 91 code_stub_ = stub; |
| 84 } | 92 } |
| 85 | 93 |
| 86 | 94 |
| 87 void CompilationInfo::Initialize(Isolate* isolate, | 95 void CompilationInfo::Initialize(Isolate* isolate, |
| 88 Mode mode, | 96 Mode mode, |
| 89 Zone* zone) { | 97 Zone* zone) { |
| 90 isolate_ = isolate; | 98 isolate_ = isolate; |
| 91 function_ = NULL; | 99 function_ = NULL; |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 124 // passed in shared info, rather than creating a new one. | 132 // passed in shared info, rather than creating a new one. |
| 125 feedback_vector_ = Handle<FixedArray>(shared_info()->feedback_vector(), | 133 feedback_vector_ = Handle<FixedArray>(shared_info()->feedback_vector(), |
| 126 isolate); | 134 isolate); |
| 127 } | 135 } |
| 128 } | 136 } |
| 129 | 137 |
| 130 | 138 |
| 131 CompilationInfo::~CompilationInfo() { | 139 CompilationInfo::~CompilationInfo() { |
| 132 delete deferred_handles_; | 140 delete deferred_handles_; |
| 133 delete no_frame_ranges_; | 141 delete no_frame_ranges_; |
| 142 if (ast_value_factory_owned_) delete ast_value_factory_; |
| 134 #ifdef DEBUG | 143 #ifdef DEBUG |
| 135 // Check that no dependent maps have been added or added dependent maps have | 144 // Check that no dependent maps have been added or added dependent maps have |
| 136 // been rolled back or committed. | 145 // been rolled back or committed. |
| 137 for (int i = 0; i < DependentCode::kGroupCount; i++) { | 146 for (int i = 0; i < DependentCode::kGroupCount; i++) { |
| 138 ASSERT_EQ(NULL, dependencies_[i]); | 147 ASSERT_EQ(NULL, dependencies_[i]); |
| 139 } | 148 } |
| 140 #endif // DEBUG | 149 #endif // DEBUG |
| 141 } | 150 } |
| 142 | 151 |
| 143 | 152 |
| (...skipping 1156 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1300 AllowHandleDereference allow_deref; | 1309 AllowHandleDereference allow_deref; |
| 1301 bool tracing_on = info()->IsStub() | 1310 bool tracing_on = info()->IsStub() |
| 1302 ? FLAG_trace_hydrogen_stubs | 1311 ? FLAG_trace_hydrogen_stubs |
| 1303 : (FLAG_trace_hydrogen && | 1312 : (FLAG_trace_hydrogen && |
| 1304 info()->closure()->PassesFilter(FLAG_trace_hydrogen_filter)); | 1313 info()->closure()->PassesFilter(FLAG_trace_hydrogen_filter)); |
| 1305 return (tracing_on && | 1314 return (tracing_on && |
| 1306 OS::StrChr(const_cast<char*>(FLAG_trace_phase), name_[0]) != NULL); | 1315 OS::StrChr(const_cast<char*>(FLAG_trace_phase), name_[0]) != NULL); |
| 1307 } | 1316 } |
| 1308 | 1317 |
| 1309 } } // namespace v8::internal | 1318 } } // namespace v8::internal |
| OLD | NEW |