| 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/ast-numbering.h" | 9 #include "src/ast-numbering.h" |
| 10 #include "src/ast-this-access-visitor.h" | 10 #include "src/ast-this-access-visitor.h" |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 50 | 50 |
| 51 CompilationInfo::CompilationInfo(Handle<Script> script, Zone* zone) | 51 CompilationInfo::CompilationInfo(Handle<Script> script, Zone* zone) |
| 52 : flags_(kThisHasUses), | 52 : flags_(kThisHasUses), |
| 53 script_(script), | 53 script_(script), |
| 54 source_stream_(NULL), | 54 source_stream_(NULL), |
| 55 osr_ast_id_(BailoutId::None()), | 55 osr_ast_id_(BailoutId::None()), |
| 56 parameter_count_(0), | 56 parameter_count_(0), |
| 57 optimization_id_(-1), | 57 optimization_id_(-1), |
| 58 ast_value_factory_(NULL), | 58 ast_value_factory_(NULL), |
| 59 ast_value_factory_owned_(false), | 59 ast_value_factory_owned_(false), |
| 60 aborted_due_to_dependency_change_(false) { | 60 aborted_due_to_dependency_change_(false), |
| 61 osr_expr_stack_height_(0) { |
| 61 Initialize(script->GetIsolate(), BASE, zone); | 62 Initialize(script->GetIsolate(), BASE, zone); |
| 62 } | 63 } |
| 63 | 64 |
| 64 | 65 |
| 65 CompilationInfo::CompilationInfo(Isolate* isolate, Zone* zone) | 66 CompilationInfo::CompilationInfo(Isolate* isolate, Zone* zone) |
| 66 : flags_(kThisHasUses), | 67 : flags_(kThisHasUses), |
| 67 script_(Handle<Script>::null()), | 68 script_(Handle<Script>::null()), |
| 68 source_stream_(NULL), | 69 source_stream_(NULL), |
| 69 osr_ast_id_(BailoutId::None()), | 70 osr_ast_id_(BailoutId::None()), |
| 70 parameter_count_(0), | 71 parameter_count_(0), |
| 71 optimization_id_(-1), | 72 optimization_id_(-1), |
| 72 ast_value_factory_(NULL), | 73 ast_value_factory_(NULL), |
| 73 ast_value_factory_owned_(false), | 74 ast_value_factory_owned_(false), |
| 74 aborted_due_to_dependency_change_(false) { | 75 aborted_due_to_dependency_change_(false), |
| 76 osr_expr_stack_height_(0) { |
| 75 Initialize(isolate, STUB, zone); | 77 Initialize(isolate, STUB, zone); |
| 76 } | 78 } |
| 77 | 79 |
| 78 | 80 |
| 79 CompilationInfo::CompilationInfo(Handle<SharedFunctionInfo> shared_info, | 81 CompilationInfo::CompilationInfo(Handle<SharedFunctionInfo> shared_info, |
| 80 Zone* zone) | 82 Zone* zone) |
| 81 : flags_(kLazy | kThisHasUses), | 83 : flags_(kLazy | kThisHasUses), |
| 82 shared_info_(shared_info), | 84 shared_info_(shared_info), |
| 83 script_(Handle<Script>(Script::cast(shared_info->script()))), | 85 script_(Handle<Script>(Script::cast(shared_info->script()))), |
| 84 source_stream_(NULL), | 86 source_stream_(NULL), |
| 85 osr_ast_id_(BailoutId::None()), | 87 osr_ast_id_(BailoutId::None()), |
| 86 parameter_count_(0), | 88 parameter_count_(0), |
| 87 optimization_id_(-1), | 89 optimization_id_(-1), |
| 88 ast_value_factory_(NULL), | 90 ast_value_factory_(NULL), |
| 89 ast_value_factory_owned_(false), | 91 ast_value_factory_owned_(false), |
| 90 aborted_due_to_dependency_change_(false) { | 92 aborted_due_to_dependency_change_(false), |
| 93 osr_expr_stack_height_(0) { |
| 91 Initialize(script_->GetIsolate(), BASE, zone); | 94 Initialize(script_->GetIsolate(), BASE, zone); |
| 92 } | 95 } |
| 93 | 96 |
| 94 | 97 |
| 95 CompilationInfo::CompilationInfo(Handle<JSFunction> closure, Zone* zone) | 98 CompilationInfo::CompilationInfo(Handle<JSFunction> closure, Zone* zone) |
| 96 : flags_(kLazy | kThisHasUses), | 99 : flags_(kLazy | kThisHasUses), |
| 97 closure_(closure), | 100 closure_(closure), |
| 98 shared_info_(Handle<SharedFunctionInfo>(closure->shared())), | 101 shared_info_(Handle<SharedFunctionInfo>(closure->shared())), |
| 99 script_(Handle<Script>(Script::cast(shared_info_->script()))), | 102 script_(Handle<Script>(Script::cast(shared_info_->script()))), |
| 100 source_stream_(NULL), | 103 source_stream_(NULL), |
| 101 context_(closure->context()), | 104 context_(closure->context()), |
| 102 osr_ast_id_(BailoutId::None()), | 105 osr_ast_id_(BailoutId::None()), |
| 103 parameter_count_(0), | 106 parameter_count_(0), |
| 104 optimization_id_(-1), | 107 optimization_id_(-1), |
| 105 ast_value_factory_(NULL), | 108 ast_value_factory_(NULL), |
| 106 ast_value_factory_owned_(false), | 109 ast_value_factory_owned_(false), |
| 107 aborted_due_to_dependency_change_(false) { | 110 aborted_due_to_dependency_change_(false), |
| 111 osr_expr_stack_height_(0) { |
| 108 Initialize(script_->GetIsolate(), BASE, zone); | 112 Initialize(script_->GetIsolate(), BASE, zone); |
| 109 } | 113 } |
| 110 | 114 |
| 111 | 115 |
| 112 CompilationInfo::CompilationInfo(HydrogenCodeStub* stub, Isolate* isolate, | 116 CompilationInfo::CompilationInfo(HydrogenCodeStub* stub, Isolate* isolate, |
| 113 Zone* zone) | 117 Zone* zone) |
| 114 : flags_(kLazy | kThisHasUses), | 118 : flags_(kLazy | kThisHasUses), |
| 115 source_stream_(NULL), | 119 source_stream_(NULL), |
| 116 osr_ast_id_(BailoutId::None()), | 120 osr_ast_id_(BailoutId::None()), |
| 117 parameter_count_(0), | 121 parameter_count_(0), |
| 118 optimization_id_(-1), | 122 optimization_id_(-1), |
| 119 ast_value_factory_(NULL), | 123 ast_value_factory_(NULL), |
| 120 ast_value_factory_owned_(false), | 124 ast_value_factory_owned_(false), |
| 121 aborted_due_to_dependency_change_(false) { | 125 aborted_due_to_dependency_change_(false), |
| 126 osr_expr_stack_height_(0) { |
| 122 Initialize(isolate, STUB, zone); | 127 Initialize(isolate, STUB, zone); |
| 123 code_stub_ = stub; | 128 code_stub_ = stub; |
| 124 } | 129 } |
| 125 | 130 |
| 126 | 131 |
| 127 CompilationInfo::CompilationInfo( | 132 CompilationInfo::CompilationInfo( |
| 128 ScriptCompiler::ExternalSourceStream* stream, | 133 ScriptCompiler::ExternalSourceStream* stream, |
| 129 ScriptCompiler::StreamedSource::Encoding encoding, Isolate* isolate, | 134 ScriptCompiler::StreamedSource::Encoding encoding, Isolate* isolate, |
| 130 Zone* zone) | 135 Zone* zone) |
| 131 : flags_(kThisHasUses), | 136 : flags_(kThisHasUses), |
| 132 source_stream_(stream), | 137 source_stream_(stream), |
| 133 source_stream_encoding_(encoding), | 138 source_stream_encoding_(encoding), |
| 134 osr_ast_id_(BailoutId::None()), | 139 osr_ast_id_(BailoutId::None()), |
| 135 parameter_count_(0), | 140 parameter_count_(0), |
| 136 optimization_id_(-1), | 141 optimization_id_(-1), |
| 137 ast_value_factory_(NULL), | 142 ast_value_factory_(NULL), |
| 138 ast_value_factory_owned_(false), | 143 ast_value_factory_owned_(false), |
| 139 aborted_due_to_dependency_change_(false) { | 144 aborted_due_to_dependency_change_(false), |
| 145 osr_expr_stack_height_(0) { |
| 140 Initialize(isolate, BASE, zone); | 146 Initialize(isolate, BASE, zone); |
| 141 } | 147 } |
| 142 | 148 |
| 143 | 149 |
| 144 void CompilationInfo::Initialize(Isolate* isolate, | 150 void CompilationInfo::Initialize(Isolate* isolate, |
| 145 Mode mode, | 151 Mode mode, |
| 146 Zone* zone) { | 152 Zone* zone) { |
| 147 isolate_ = isolate; | 153 isolate_ = isolate; |
| 148 function_ = NULL; | 154 function_ = NULL; |
| 149 scope_ = NULL; | 155 scope_ = NULL; |
| (...skipping 1445 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1595 } | 1601 } |
| 1596 | 1602 |
| 1597 | 1603 |
| 1598 #if DEBUG | 1604 #if DEBUG |
| 1599 void CompilationInfo::PrintAstForTesting() { | 1605 void CompilationInfo::PrintAstForTesting() { |
| 1600 PrintF("--- Source from AST ---\n%s\n", | 1606 PrintF("--- Source from AST ---\n%s\n", |
| 1601 PrettyPrinter(isolate(), zone()).PrintProgram(function())); | 1607 PrettyPrinter(isolate(), zone()).PrintProgram(function())); |
| 1602 } | 1608 } |
| 1603 #endif | 1609 #endif |
| 1604 } } // namespace v8::internal | 1610 } } // namespace v8::internal |
| OLD | NEW |