| 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 26 matching lines...) Expand all Loading... |
| 37 if (!IsAligned(reinterpret_cast<intptr_t>(data), kPointerAlignment)) { | 37 if (!IsAligned(reinterpret_cast<intptr_t>(data), kPointerAlignment)) { |
| 38 byte* copy = NewArray<byte>(length); | 38 byte* copy = NewArray<byte>(length); |
| 39 DCHECK(IsAligned(reinterpret_cast<intptr_t>(copy), kPointerAlignment)); | 39 DCHECK(IsAligned(reinterpret_cast<intptr_t>(copy), kPointerAlignment)); |
| 40 CopyBytes(copy, data, length); | 40 CopyBytes(copy, data, length); |
| 41 data_ = copy; | 41 data_ = copy; |
| 42 AcquireDataOwnership(); | 42 AcquireDataOwnership(); |
| 43 } | 43 } |
| 44 } | 44 } |
| 45 | 45 |
| 46 | 46 |
| 47 CompilationInfo::CompilationInfo(Handle<Script> script, | 47 CompilationInfo::CompilationInfo(Handle<Script> script, Zone* zone) |
| 48 Zone* zone) | |
| 49 : flags_(StrictModeField::encode(SLOPPY)), | 48 : flags_(StrictModeField::encode(SLOPPY)), |
| 50 script_(script), | 49 script_(script), |
| 51 osr_ast_id_(BailoutId::None()), | 50 osr_ast_id_(BailoutId::None()), |
| 52 parameter_count_(0), | 51 parameter_count_(0), |
| 53 this_has_uses_(true), | 52 this_has_uses_(true), |
| 54 optimization_id_(-1), | 53 optimization_id_(-1), |
| 55 ast_value_factory_(NULL), | 54 ast_value_factory_(NULL), |
| 56 ast_value_factory_owned_(false) { | 55 ast_value_factory_owned_(false), |
| 56 ast_node_id_counter_(0) { |
| 57 Initialize(script->GetIsolate(), BASE, zone); | 57 Initialize(script->GetIsolate(), BASE, zone); |
| 58 } | 58 } |
| 59 | 59 |
| 60 | 60 |
| 61 CompilationInfo::CompilationInfo(Isolate* isolate, Zone* zone) | 61 CompilationInfo::CompilationInfo(Isolate* isolate, Zone* zone) |
| 62 : flags_(StrictModeField::encode(SLOPPY)), | 62 : flags_(StrictModeField::encode(SLOPPY)), |
| 63 script_(Handle<Script>::null()), | 63 script_(Handle<Script>::null()), |
| 64 osr_ast_id_(BailoutId::None()), | 64 osr_ast_id_(BailoutId::None()), |
| 65 parameter_count_(0), | 65 parameter_count_(0), |
| 66 this_has_uses_(true), | 66 this_has_uses_(true), |
| 67 optimization_id_(-1), | 67 optimization_id_(-1), |
| 68 ast_value_factory_(NULL), | 68 ast_value_factory_(NULL), |
| 69 ast_value_factory_owned_(false) { | 69 ast_value_factory_owned_(false), |
| 70 ast_node_id_counter_(0) { |
| 70 Initialize(isolate, STUB, zone); | 71 Initialize(isolate, STUB, zone); |
| 71 } | 72 } |
| 72 | 73 |
| 73 | 74 |
| 74 CompilationInfo::CompilationInfo(Handle<SharedFunctionInfo> shared_info, | 75 CompilationInfo::CompilationInfo(Handle<SharedFunctionInfo> shared_info, |
| 75 Zone* zone) | 76 Zone* zone) |
| 76 : flags_(StrictModeField::encode(SLOPPY) | IsLazy::encode(true)), | 77 : flags_(StrictModeField::encode(SLOPPY) | IsLazy::encode(true)), |
| 77 shared_info_(shared_info), | 78 shared_info_(shared_info), |
| 78 script_(Handle<Script>(Script::cast(shared_info->script()))), | 79 script_(Handle<Script>(Script::cast(shared_info->script()))), |
| 79 osr_ast_id_(BailoutId::None()), | 80 osr_ast_id_(BailoutId::None()), |
| 80 parameter_count_(0), | 81 parameter_count_(0), |
| 81 this_has_uses_(true), | 82 this_has_uses_(true), |
| 82 optimization_id_(-1), | 83 optimization_id_(-1), |
| 83 ast_value_factory_(NULL), | 84 ast_value_factory_(NULL), |
| 84 ast_value_factory_owned_(false) { | 85 ast_value_factory_owned_(false), |
| 86 ast_node_id_counter_(0) { |
| 85 Initialize(script_->GetIsolate(), BASE, zone); | 87 Initialize(script_->GetIsolate(), BASE, zone); |
| 86 } | 88 } |
| 87 | 89 |
| 88 | 90 |
| 89 CompilationInfo::CompilationInfo(Handle<JSFunction> closure, | 91 CompilationInfo::CompilationInfo(Handle<JSFunction> closure, Zone* zone) |
| 90 Zone* zone) | |
| 91 : flags_(StrictModeField::encode(SLOPPY) | IsLazy::encode(true)), | 92 : flags_(StrictModeField::encode(SLOPPY) | IsLazy::encode(true)), |
| 92 closure_(closure), | 93 closure_(closure), |
| 93 shared_info_(Handle<SharedFunctionInfo>(closure->shared())), | 94 shared_info_(Handle<SharedFunctionInfo>(closure->shared())), |
| 94 script_(Handle<Script>(Script::cast(shared_info_->script()))), | 95 script_(Handle<Script>(Script::cast(shared_info_->script()))), |
| 95 context_(closure->context()), | 96 context_(closure->context()), |
| 96 osr_ast_id_(BailoutId::None()), | 97 osr_ast_id_(BailoutId::None()), |
| 97 parameter_count_(0), | 98 parameter_count_(0), |
| 98 this_has_uses_(true), | 99 this_has_uses_(true), |
| 99 optimization_id_(-1), | 100 optimization_id_(-1), |
| 100 ast_value_factory_(NULL), | 101 ast_value_factory_(NULL), |
| 101 ast_value_factory_owned_(false) { | 102 ast_value_factory_owned_(false), |
| 103 ast_node_id_counter_(0) { |
| 102 Initialize(script_->GetIsolate(), BASE, zone); | 104 Initialize(script_->GetIsolate(), BASE, zone); |
| 103 } | 105 } |
| 104 | 106 |
| 105 | 107 |
| 106 CompilationInfo::CompilationInfo(HydrogenCodeStub* stub, | 108 CompilationInfo::CompilationInfo(HydrogenCodeStub* stub, Isolate* isolate, |
| 107 Isolate* isolate, | |
| 108 Zone* zone) | 109 Zone* zone) |
| 109 : flags_(StrictModeField::encode(SLOPPY) | IsLazy::encode(true)), | 110 : flags_(StrictModeField::encode(SLOPPY) | IsLazy::encode(true)), |
| 110 osr_ast_id_(BailoutId::None()), | 111 osr_ast_id_(BailoutId::None()), |
| 111 parameter_count_(0), | 112 parameter_count_(0), |
| 112 this_has_uses_(true), | 113 this_has_uses_(true), |
| 113 optimization_id_(-1), | 114 optimization_id_(-1), |
| 114 ast_value_factory_(NULL), | 115 ast_value_factory_(NULL), |
| 115 ast_value_factory_owned_(false) { | 116 ast_value_factory_owned_(false), |
| 117 ast_node_id_counter_(0) { |
| 116 Initialize(isolate, STUB, zone); | 118 Initialize(isolate, STUB, zone); |
| 117 code_stub_ = stub; | 119 code_stub_ = stub; |
| 118 } | 120 } |
| 119 | 121 |
| 120 | 122 |
| 121 void CompilationInfo::Initialize(Isolate* isolate, | 123 void CompilationInfo::Initialize(Isolate* isolate, |
| 122 Mode mode, | 124 Mode mode, |
| 123 Zone* zone) { | 125 Zone* zone) { |
| 124 isolate_ = isolate; | 126 isolate_ = isolate; |
| 125 function_ = NULL; | 127 function_ = NULL; |
| (...skipping 1256 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1382 AllowHandleDereference allow_deref; | 1384 AllowHandleDereference allow_deref; |
| 1383 bool tracing_on = info()->IsStub() | 1385 bool tracing_on = info()->IsStub() |
| 1384 ? FLAG_trace_hydrogen_stubs | 1386 ? FLAG_trace_hydrogen_stubs |
| 1385 : (FLAG_trace_hydrogen && | 1387 : (FLAG_trace_hydrogen && |
| 1386 info()->closure()->PassesFilter(FLAG_trace_hydrogen_filter)); | 1388 info()->closure()->PassesFilter(FLAG_trace_hydrogen_filter)); |
| 1387 return (tracing_on && | 1389 return (tracing_on && |
| 1388 base::OS::StrChr(const_cast<char*>(FLAG_trace_phase), name_[0]) != NULL); | 1390 base::OS::StrChr(const_cast<char*>(FLAG_trace_phase), name_[0]) != NULL); |
| 1389 } | 1391 } |
| 1390 | 1392 |
| 1391 } } // namespace v8::internal | 1393 } } // namespace v8::internal |
| OLD | NEW |