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/ast/prettyprinter.h" | 5 #include "src/ast/prettyprinter.h" |
6 | 6 |
7 #include <stdarg.h> | 7 #include <stdarg.h> |
8 | 8 |
9 #include "src/ast/ast-value-factory.h" | 9 #include "src/ast/ast-value-factory.h" |
10 #include "src/ast/scopes.h" | 10 #include "src/ast/scopes.h" |
11 #include "src/base/platform/platform.h" | 11 #include "src/base/platform/platform.h" |
| 12 #include "src/execution.h" |
| 13 #include "src/isolate.h" |
12 | 14 |
13 namespace v8 { | 15 namespace v8 { |
14 namespace internal { | 16 namespace internal { |
15 | 17 |
16 CallPrinter::CallPrinter(Isolate* isolate, bool is_builtin) | 18 CallPrinter::CallPrinter(Isolate* isolate, bool is_builtin) |
17 : builder_(isolate) { | 19 : builder_(isolate) { |
18 isolate_ = isolate; | 20 isolate_ = isolate; |
19 position_ = 0; | 21 position_ = 0; |
20 num_prints_ = 0; | 22 num_prints_ = 0; |
21 found_ = false; | 23 found_ = false; |
22 done_ = false; | 24 done_ = false; |
23 is_builtin_ = is_builtin; | 25 is_builtin_ = is_builtin; |
24 InitializeAstVisitor(isolate); | 26 InitializeAstVisitor(isolate->stack_guard()->real_climit()); |
25 } | 27 } |
26 | 28 |
27 Handle<String> CallPrinter::Print(FunctionLiteral* program, int position) { | 29 Handle<String> CallPrinter::Print(FunctionLiteral* program, int position) { |
28 num_prints_ = 0; | 30 num_prints_ = 0; |
29 position_ = position; | 31 position_ = position; |
30 Find(program); | 32 Find(program); |
31 return builder_.Finish().ToHandleChecked(); | 33 return builder_.Finish().ToHandleChecked(); |
32 } | 34 } |
33 | 35 |
34 | 36 |
(...skipping 527 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
562 | 564 |
563 private: | 565 private: |
564 AstPrinter* ast_printer_; | 566 AstPrinter* ast_printer_; |
565 }; | 567 }; |
566 | 568 |
567 | 569 |
568 //----------------------------------------------------------------------------- | 570 //----------------------------------------------------------------------------- |
569 | 571 |
570 AstPrinter::AstPrinter(Isolate* isolate) | 572 AstPrinter::AstPrinter(Isolate* isolate) |
571 : isolate_(isolate), output_(nullptr), size_(0), pos_(0), indent_(0) { | 573 : isolate_(isolate), output_(nullptr), size_(0), pos_(0), indent_(0) { |
572 InitializeAstVisitor(isolate); | 574 InitializeAstVisitor(isolate->stack_guard()->real_climit()); |
573 } | 575 } |
574 | 576 |
575 AstPrinter::~AstPrinter() { | 577 AstPrinter::~AstPrinter() { |
576 DCHECK(indent_ == 0); | 578 DCHECK(indent_ == 0); |
577 DeleteArray(output_); | 579 DeleteArray(output_); |
578 } | 580 } |
579 | 581 |
580 | 582 |
581 void AstPrinter::PrintIndented(const char* txt) { | 583 void AstPrinter::PrintIndented(const char* txt) { |
582 for (int i = 0; i < indent_; i++) { | 584 for (int i = 0; i < indent_; i++) { |
(...skipping 577 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1160 | 1162 |
1161 void AstPrinter::VisitRewritableExpression(RewritableExpression* node) { | 1163 void AstPrinter::VisitRewritableExpression(RewritableExpression* node) { |
1162 Visit(node->expression()); | 1164 Visit(node->expression()); |
1163 } | 1165 } |
1164 | 1166 |
1165 | 1167 |
1166 #endif // DEBUG | 1168 #endif // DEBUG |
1167 | 1169 |
1168 } // namespace internal | 1170 } // namespace internal |
1169 } // namespace v8 | 1171 } // namespace v8 |
OLD | NEW |