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 <stdarg.h> | 5 #include <stdarg.h> |
6 | 6 |
7 #include "v8.h" | 7 #include "v8.h" |
8 | 8 |
9 #include "prettyprinter.h" | 9 #include "prettyprinter.h" |
10 #include "scopes.h" | 10 #include "scopes.h" |
(...skipping 488 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
499 | 499 |
500 if (n >= 0) { | 500 if (n >= 0) { |
501 // there was enough space - we are done | 501 // there was enough space - we are done |
502 pos_ += n; | 502 pos_ += n; |
503 return; | 503 return; |
504 } else { | 504 } else { |
505 // there was not enough space - allocate more and try again | 505 // there was not enough space - allocate more and try again |
506 const int slack = 32; | 506 const int slack = 32; |
507 int new_size = size_ + (size_ >> 1) + slack; | 507 int new_size = size_ + (size_ >> 1) + slack; |
508 char* new_output = NewArray<char>(new_size); | 508 char* new_output = NewArray<char>(new_size); |
509 OS::MemCopy(new_output, output_, pos_); | 509 MemCopy(new_output, output_, pos_); |
510 DeleteArray(output_); | 510 DeleteArray(output_); |
511 output_ = new_output; | 511 output_ = new_output; |
512 size_ = new_size; | 512 size_ = new_size; |
513 } | 513 } |
514 } | 514 } |
515 } | 515 } |
516 | 516 |
517 | 517 |
518 void PrettyPrinter::PrintStatements(ZoneList<Statement*>* statements) { | 518 void PrettyPrinter::PrintStatements(ZoneList<Statement*>* statements) { |
519 if (statements == NULL) return; | 519 if (statements == NULL) return; |
(...skipping 615 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1135 } | 1135 } |
1136 | 1136 |
1137 | 1137 |
1138 void AstPrinter::VisitThisFunction(ThisFunction* node) { | 1138 void AstPrinter::VisitThisFunction(ThisFunction* node) { |
1139 IndentedScope indent(this, "THIS-FUNCTION"); | 1139 IndentedScope indent(this, "THIS-FUNCTION"); |
1140 } | 1140 } |
1141 | 1141 |
1142 #endif // DEBUG | 1142 #endif // DEBUG |
1143 | 1143 |
1144 } } // namespace v8::internal | 1144 } } // namespace v8::internal |
OLD | NEW |