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 27 matching lines...) Expand all Loading... |
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, Zone* zone) | 47 CompilationInfo::CompilationInfo(Handle<Script> script, Zone* zone) |
48 : flags_(StrictModeField::encode(SLOPPY)), | 48 : flags_(kThisHasUses), |
49 script_(script), | 49 script_(script), |
50 osr_ast_id_(BailoutId::None()), | 50 osr_ast_id_(BailoutId::None()), |
51 parameter_count_(0), | 51 parameter_count_(0), |
52 this_has_uses_(true), | |
53 optimization_id_(-1), | 52 optimization_id_(-1), |
54 ast_value_factory_(NULL), | 53 ast_value_factory_(NULL), |
55 ast_value_factory_owned_(false) { | 54 ast_value_factory_owned_(false) { |
56 Initialize(script->GetIsolate(), BASE, zone); | 55 Initialize(script->GetIsolate(), BASE, zone); |
57 } | 56 } |
58 | 57 |
59 | 58 |
60 CompilationInfo::CompilationInfo(Isolate* isolate, Zone* zone) | 59 CompilationInfo::CompilationInfo(Isolate* isolate, Zone* zone) |
61 : flags_(StrictModeField::encode(SLOPPY)), | 60 : flags_(kThisHasUses), |
62 script_(Handle<Script>::null()), | 61 script_(Handle<Script>::null()), |
63 osr_ast_id_(BailoutId::None()), | 62 osr_ast_id_(BailoutId::None()), |
64 parameter_count_(0), | 63 parameter_count_(0), |
65 this_has_uses_(true), | |
66 optimization_id_(-1), | 64 optimization_id_(-1), |
67 ast_value_factory_(NULL), | 65 ast_value_factory_(NULL), |
68 ast_value_factory_owned_(false) { | 66 ast_value_factory_owned_(false) { |
69 Initialize(isolate, STUB, zone); | 67 Initialize(isolate, STUB, zone); |
70 } | 68 } |
71 | 69 |
72 | 70 |
73 CompilationInfo::CompilationInfo(Handle<SharedFunctionInfo> shared_info, | 71 CompilationInfo::CompilationInfo(Handle<SharedFunctionInfo> shared_info, |
74 Zone* zone) | 72 Zone* zone) |
75 : flags_(StrictModeField::encode(SLOPPY) | IsLazy::encode(true)), | 73 : flags_(kLazy | kThisHasUses), |
76 shared_info_(shared_info), | 74 shared_info_(shared_info), |
77 script_(Handle<Script>(Script::cast(shared_info->script()))), | 75 script_(Handle<Script>(Script::cast(shared_info->script()))), |
78 osr_ast_id_(BailoutId::None()), | 76 osr_ast_id_(BailoutId::None()), |
79 parameter_count_(0), | 77 parameter_count_(0), |
80 this_has_uses_(true), | |
81 optimization_id_(-1), | 78 optimization_id_(-1), |
82 ast_value_factory_(NULL), | 79 ast_value_factory_(NULL), |
83 ast_value_factory_owned_(false) { | 80 ast_value_factory_owned_(false) { |
84 Initialize(script_->GetIsolate(), BASE, zone); | 81 Initialize(script_->GetIsolate(), BASE, zone); |
85 } | 82 } |
86 | 83 |
87 | 84 |
88 CompilationInfo::CompilationInfo(Handle<JSFunction> closure, Zone* zone) | 85 CompilationInfo::CompilationInfo(Handle<JSFunction> closure, Zone* zone) |
89 : flags_(StrictModeField::encode(SLOPPY) | IsLazy::encode(true)), | 86 : flags_(kLazy | kThisHasUses), |
90 closure_(closure), | 87 closure_(closure), |
91 shared_info_(Handle<SharedFunctionInfo>(closure->shared())), | 88 shared_info_(Handle<SharedFunctionInfo>(closure->shared())), |
92 script_(Handle<Script>(Script::cast(shared_info_->script()))), | 89 script_(Handle<Script>(Script::cast(shared_info_->script()))), |
93 context_(closure->context()), | 90 context_(closure->context()), |
94 osr_ast_id_(BailoutId::None()), | 91 osr_ast_id_(BailoutId::None()), |
95 parameter_count_(0), | 92 parameter_count_(0), |
96 this_has_uses_(true), | |
97 optimization_id_(-1), | 93 optimization_id_(-1), |
98 ast_value_factory_(NULL), | 94 ast_value_factory_(NULL), |
99 ast_value_factory_owned_(false) { | 95 ast_value_factory_owned_(false) { |
100 Initialize(script_->GetIsolate(), BASE, zone); | 96 Initialize(script_->GetIsolate(), BASE, zone); |
101 } | 97 } |
102 | 98 |
103 | 99 |
104 CompilationInfo::CompilationInfo(HydrogenCodeStub* stub, Isolate* isolate, | 100 CompilationInfo::CompilationInfo(HydrogenCodeStub* stub, Isolate* isolate, |
105 Zone* zone) | 101 Zone* zone) |
106 : flags_(StrictModeField::encode(SLOPPY) | IsLazy::encode(true)), | 102 : flags_(kLazy | kThisHasUses), |
107 osr_ast_id_(BailoutId::None()), | 103 osr_ast_id_(BailoutId::None()), |
108 parameter_count_(0), | 104 parameter_count_(0), |
109 this_has_uses_(true), | |
110 optimization_id_(-1), | 105 optimization_id_(-1), |
111 ast_value_factory_(NULL), | 106 ast_value_factory_(NULL), |
112 ast_value_factory_owned_(false) { | 107 ast_value_factory_owned_(false) { |
113 Initialize(isolate, STUB, zone); | 108 Initialize(isolate, STUB, zone); |
114 code_stub_ = stub; | 109 code_stub_ = stub; |
115 } | 110 } |
116 | 111 |
117 | 112 |
118 void CompilationInfo::Initialize(Isolate* isolate, | 113 void CompilationInfo::Initialize(Isolate* isolate, |
119 Mode mode, | 114 Mode mode, |
(...skipping 1262 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1382 AllowHandleDereference allow_deref; | 1377 AllowHandleDereference allow_deref; |
1383 bool tracing_on = info()->IsStub() | 1378 bool tracing_on = info()->IsStub() |
1384 ? FLAG_trace_hydrogen_stubs | 1379 ? FLAG_trace_hydrogen_stubs |
1385 : (FLAG_trace_hydrogen && | 1380 : (FLAG_trace_hydrogen && |
1386 info()->closure()->PassesFilter(FLAG_trace_hydrogen_filter)); | 1381 info()->closure()->PassesFilter(FLAG_trace_hydrogen_filter)); |
1387 return (tracing_on && | 1382 return (tracing_on && |
1388 base::OS::StrChr(const_cast<char*>(FLAG_trace_phase), name_[0]) != NULL); | 1383 base::OS::StrChr(const_cast<char*>(FLAG_trace_phase), name_[0]) != NULL); |
1389 } | 1384 } |
1390 | 1385 |
1391 } } // namespace v8::internal | 1386 } } // namespace v8::internal |
OLD | NEW |