Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1746)

Side by Side Diff: src/compiler.cc

Issue 334173003: Reuse AstValueFactory when optimizing. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 6 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « src/compiler.h ('k') | src/hydrogen.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 21 matching lines...) Expand all
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) { 42 ast_value_factory_(NULL),
43 ast_value_factory_owned_(false) {
43 Initialize(script->GetIsolate(), BASE, zone); 44 Initialize(script->GetIsolate(), BASE, zone);
44 } 45 }
45 46
46 47
47 CompilationInfo::CompilationInfo(Handle<SharedFunctionInfo> shared_info, 48 CompilationInfo::CompilationInfo(Handle<SharedFunctionInfo> shared_info,
48 Zone* zone) 49 Zone* zone)
49 : flags_(StrictModeField::encode(SLOPPY) | IsLazy::encode(true)), 50 : flags_(StrictModeField::encode(SLOPPY) | IsLazy::encode(true)),
50 shared_info_(shared_info), 51 shared_info_(shared_info),
51 script_(Handle<Script>(Script::cast(shared_info->script()))), 52 script_(Handle<Script>(Script::cast(shared_info->script()))),
52 osr_ast_id_(BailoutId::None()), 53 osr_ast_id_(BailoutId::None()),
53 parameter_count_(0), 54 parameter_count_(0),
54 this_has_uses_(true), 55 this_has_uses_(true),
55 optimization_id_(-1), 56 optimization_id_(-1),
56 ast_value_factory_(NULL) { 57 ast_value_factory_(NULL),
58 ast_value_factory_owned_(false) {
57 Initialize(script_->GetIsolate(), BASE, zone); 59 Initialize(script_->GetIsolate(), BASE, zone);
58 } 60 }
59 61
60 62
61 CompilationInfo::CompilationInfo(Handle<JSFunction> closure, 63 CompilationInfo::CompilationInfo(Handle<JSFunction> closure,
62 Zone* zone) 64 Zone* zone)
63 : flags_(StrictModeField::encode(SLOPPY) | IsLazy::encode(true)), 65 : flags_(StrictModeField::encode(SLOPPY) | IsLazy::encode(true)),
64 closure_(closure), 66 closure_(closure),
65 shared_info_(Handle<SharedFunctionInfo>(closure->shared())), 67 shared_info_(Handle<SharedFunctionInfo>(closure->shared())),
66 script_(Handle<Script>(Script::cast(shared_info_->script()))), 68 script_(Handle<Script>(Script::cast(shared_info_->script()))),
67 context_(closure->context()), 69 context_(closure->context()),
68 osr_ast_id_(BailoutId::None()), 70 osr_ast_id_(BailoutId::None()),
69 parameter_count_(0), 71 parameter_count_(0),
70 this_has_uses_(true), 72 this_has_uses_(true),
71 optimization_id_(-1), 73 optimization_id_(-1),
72 ast_value_factory_(NULL) { 74 ast_value_factory_(NULL),
75 ast_value_factory_owned_(false) {
73 Initialize(script_->GetIsolate(), BASE, zone); 76 Initialize(script_->GetIsolate(), BASE, zone);
74 } 77 }
75 78
76 79
77 CompilationInfo::CompilationInfo(HydrogenCodeStub* stub, 80 CompilationInfo::CompilationInfo(HydrogenCodeStub* stub,
78 Isolate* isolate, 81 Isolate* isolate,
79 Zone* zone) 82 Zone* zone)
80 : flags_(StrictModeField::encode(SLOPPY) | IsLazy::encode(true)), 83 : flags_(StrictModeField::encode(SLOPPY) | IsLazy::encode(true)),
81 osr_ast_id_(BailoutId::None()), 84 osr_ast_id_(BailoutId::None()),
82 parameter_count_(0), 85 parameter_count_(0),
83 this_has_uses_(true), 86 this_has_uses_(true),
84 optimization_id_(-1), 87 optimization_id_(-1),
85 ast_value_factory_(NULL) { 88 ast_value_factory_(NULL),
89 ast_value_factory_owned_(false) {
86 Initialize(isolate, STUB, zone); 90 Initialize(isolate, STUB, zone);
87 code_stub_ = stub; 91 code_stub_ = stub;
88 } 92 }
89 93
90 94
91 void CompilationInfo::Initialize(Isolate* isolate, 95 void CompilationInfo::Initialize(Isolate* isolate,
92 Mode mode, 96 Mode mode,
93 Zone* zone) { 97 Zone* zone) {
94 isolate_ = isolate; 98 isolate_ = isolate;
95 function_ = NULL; 99 function_ = NULL;
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
128 // passed in shared info, rather than creating a new one. 132 // passed in shared info, rather than creating a new one.
129 feedback_vector_ = Handle<FixedArray>(shared_info()->feedback_vector(), 133 feedback_vector_ = Handle<FixedArray>(shared_info()->feedback_vector(),
130 isolate); 134 isolate);
131 } 135 }
132 } 136 }
133 137
134 138
135 CompilationInfo::~CompilationInfo() { 139 CompilationInfo::~CompilationInfo() {
136 delete deferred_handles_; 140 delete deferred_handles_;
137 delete no_frame_ranges_; 141 delete no_frame_ranges_;
138 delete ast_value_factory_; 142 if (ast_value_factory_owned_) delete ast_value_factory_;
139 #ifdef DEBUG 143 #ifdef DEBUG
140 // 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
141 // been rolled back or committed. 145 // been rolled back or committed.
142 for (int i = 0; i < DependentCode::kGroupCount; i++) { 146 for (int i = 0; i < DependentCode::kGroupCount; i++) {
143 ASSERT_EQ(NULL, dependencies_[i]); 147 ASSERT_EQ(NULL, dependencies_[i]);
144 } 148 }
145 #endif // DEBUG 149 #endif // DEBUG
146 } 150 }
147 151
148 152
(...skipping 1152 matching lines...) Expand 10 before | Expand all | Expand 10 after
1301 AllowHandleDereference allow_deref; 1305 AllowHandleDereference allow_deref;
1302 bool tracing_on = info()->IsStub() 1306 bool tracing_on = info()->IsStub()
1303 ? FLAG_trace_hydrogen_stubs 1307 ? FLAG_trace_hydrogen_stubs
1304 : (FLAG_trace_hydrogen && 1308 : (FLAG_trace_hydrogen &&
1305 info()->closure()->PassesFilter(FLAG_trace_hydrogen_filter)); 1309 info()->closure()->PassesFilter(FLAG_trace_hydrogen_filter));
1306 return (tracing_on && 1310 return (tracing_on &&
1307 OS::StrChr(const_cast<char*>(FLAG_trace_phase), name_[0]) != NULL); 1311 OS::StrChr(const_cast<char*>(FLAG_trace_phase), name_[0]) != NULL);
1308 } 1312 }
1309 1313
1310 } } // namespace v8::internal 1314 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/compiler.h ('k') | src/hydrogen.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698