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

Side by Side Diff: src/rewriter.cc

Issue 1394303008: Remove unused Zone argument from InitializeAstVisitor (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Fix cctests Created 5 years, 2 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
« no previous file with comments | « src/prettyprinter.cc ('k') | src/runtime/runtime-internal.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/rewriter.h" 5 #include "src/rewriter.h"
6 6
7 #include "src/ast.h" 7 #include "src/ast.h"
8 #include "src/parser.h" 8 #include "src/parser.h"
9 #include "src/scopes.h" 9 #include "src/scopes.h"
10 10
11 namespace v8 { 11 namespace v8 {
12 namespace internal { 12 namespace internal {
13 13
14 class Processor: public AstVisitor { 14 class Processor: public AstVisitor {
15 public: 15 public:
16 Processor(Isolate* isolate, Scope* scope, Variable* result, 16 Processor(Isolate* isolate, Scope* scope, Variable* result,
17 AstValueFactory* ast_value_factory) 17 AstValueFactory* ast_value_factory)
18 : result_(result), 18 : result_(result),
19 result_assigned_(false), 19 result_assigned_(false),
20 replacement_(nullptr), 20 replacement_(nullptr),
21 is_set_(false), 21 is_set_(false),
22 zone_(ast_value_factory->zone()),
22 scope_(scope), 23 scope_(scope),
23 factory_(ast_value_factory) { 24 factory_(ast_value_factory) {
24 InitializeAstVisitor(isolate, ast_value_factory->zone()); 25 InitializeAstVisitor(isolate);
25 } 26 }
26 27
27 virtual ~Processor() { } 28 virtual ~Processor() { }
28 29
29 void Process(ZoneList<Statement*>* statements); 30 void Process(ZoneList<Statement*>* statements);
30 bool result_assigned() const { return result_assigned_; } 31 bool result_assigned() const { return result_assigned_; }
31 32
33 Zone* zone() { return zone_; }
32 Scope* scope() { return scope_; } 34 Scope* scope() { return scope_; }
33 AstNodeFactory* factory() { return &factory_; } 35 AstNodeFactory* factory() { return &factory_; }
34 36
35 private: 37 private:
36 Variable* result_; 38 Variable* result_;
37 39
38 // We are not tracking result usage via the result_'s use 40 // We are not tracking result usage via the result_'s use
39 // counts (we leave the accurate computation to the 41 // counts (we leave the accurate computation to the
40 // usage analyzer). Instead we simple remember if 42 // usage analyzer). Instead we simple remember if
41 // there was ever an assignment to result_. 43 // there was ever an assignment to result_.
42 bool result_assigned_; 44 bool result_assigned_;
43 45
44 // When visiting a node, we "return" a replacement for that node in 46 // When visiting a node, we "return" a replacement for that node in
45 // [replacement_]. In many cases this will just be the original node. 47 // [replacement_]. In many cases this will just be the original node.
46 Statement* replacement_; 48 Statement* replacement_;
47 49
48 // To avoid storing to .result all the time, we eliminate some of 50 // To avoid storing to .result all the time, we eliminate some of
49 // the stores by keeping track of whether or not we're sure .result 51 // the stores by keeping track of whether or not we're sure .result
50 // will be overwritten anyway. This is a bit more tricky than what I 52 // will be overwritten anyway. This is a bit more tricky than what I
51 // was hoping for. 53 // was hoping for.
52 bool is_set_; 54 bool is_set_;
53 55
56 Zone* zone_;
54 Scope* scope_; 57 Scope* scope_;
55 AstNodeFactory factory_; 58 AstNodeFactory factory_;
56 59
57 // Returns ".result = value" 60 // Returns ".result = value"
58 Expression* SetResult(Expression* value) { 61 Expression* SetResult(Expression* value) {
59 result_assigned_ = true; 62 result_assigned_ = true;
60 VariableProxy* result_proxy = factory()->NewVariableProxy(result_); 63 VariableProxy* result_proxy = factory()->NewVariableProxy(result_);
61 return factory()->NewAssignment( 64 return factory()->NewAssignment(
62 Token::ASSIGN, result_proxy, value, RelocInfo::kNoPosition); 65 Token::ASSIGN, result_proxy, value, RelocInfo::kNoPosition);
63 } 66 }
(...skipping 290 matching lines...) Expand 10 before | Expand all | Expand 10 after
354 body->Add(result_statement, info->zone()); 357 body->Add(result_statement, info->zone());
355 } 358 }
356 } 359 }
357 360
358 return true; 361 return true;
359 } 362 }
360 363
361 364
362 } // namespace internal 365 } // namespace internal
363 } // namespace v8 366 } // namespace v8
OLDNEW
« no previous file with comments | « src/prettyprinter.cc ('k') | src/runtime/runtime-internal.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698