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

Side by Side Diff: src/ast/prettyprinter.cc

Issue 2060213002: Revert of Replace all remaining Oddball checks with new function (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 4 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
« no previous file with comments | « src/ast/ast.cc ('k') | src/builtins.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/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"
(...skipping 423 matching lines...) Expand 10 before | Expand all | Expand 10 after
434 } 434 }
435 } 435 }
436 436
437 437
438 void CallPrinter::PrintLiteral(Object* value, bool quote) { 438 void CallPrinter::PrintLiteral(Object* value, bool quote) {
439 Object* object = value; 439 Object* object = value;
440 if (object->IsString()) { 440 if (object->IsString()) {
441 if (quote) Print("\""); 441 if (quote) Print("\"");
442 Print("%s", String::cast(object)->ToCString().get()); 442 Print("%s", String::cast(object)->ToCString().get());
443 if (quote) Print("\""); 443 if (quote) Print("\"");
444 } else if (object->IsNull(isolate_)) { 444 } else if (object->IsNull()) {
445 Print("null"); 445 Print("null");
446 } else if (object->IsTrue(isolate_)) { 446 } else if (object->IsTrue()) {
447 Print("true"); 447 Print("true");
448 } else if (object->IsFalse(isolate_)) { 448 } else if (object->IsFalse()) {
449 Print("false"); 449 Print("false");
450 } else if (object->IsUndefined(isolate_)) { 450 } else if (object->IsUndefined(isolate_)) {
451 Print("undefined"); 451 Print("undefined");
452 } else if (object->IsNumber()) { 452 } else if (object->IsNumber()) {
453 Print("%g", object->Number()); 453 Print("%g", object->Number());
454 } else if (object->IsSymbol()) { 454 } else if (object->IsSymbol()) {
455 // Symbols can only occur as literals if they were inserted by the parser. 455 // Symbols can only occur as literals if they were inserted by the parser.
456 PrintLiteral(Symbol::cast(object)->name(), false); 456 PrintLiteral(Symbol::cast(object)->name(), false);
457 } 457 }
458 } 458 }
(...skipping 603 matching lines...) Expand 10 before | Expand all | Expand 10 after
1062 1062
1063 void PrettyPrinter::PrintLiteral(Handle<Object> value, bool quote) { 1063 void PrettyPrinter::PrintLiteral(Handle<Object> value, bool quote) {
1064 Object* object = *value; 1064 Object* object = *value;
1065 if (object->IsString()) { 1065 if (object->IsString()) {
1066 String* string = String::cast(object); 1066 String* string = String::cast(object);
1067 if (quote) Print("\""); 1067 if (quote) Print("\"");
1068 for (int i = 0; i < string->length(); i++) { 1068 for (int i = 0; i < string->length(); i++) {
1069 Print("%c", string->Get(i)); 1069 Print("%c", string->Get(i));
1070 } 1070 }
1071 if (quote) Print("\""); 1071 if (quote) Print("\"");
1072 } else if (object->IsNull(isolate_)) { 1072 } else if (object->IsNull()) {
1073 Print("null"); 1073 Print("null");
1074 } else if (object->IsTrue(isolate_)) { 1074 } else if (object->IsTrue()) {
1075 Print("true"); 1075 Print("true");
1076 } else if (object->IsFalse(isolate_)) { 1076 } else if (object->IsFalse()) {
1077 Print("false"); 1077 Print("false");
1078 } else if (object->IsUndefined(isolate_)) { 1078 } else if (object->IsUndefined(isolate_)) {
1079 Print("undefined"); 1079 Print("undefined");
1080 } else if (object->IsNumber()) { 1080 } else if (object->IsNumber()) {
1081 Print("%g", object->Number()); 1081 Print("%g", object->Number());
1082 } else if (object->IsJSObject()) { 1082 } else if (object->IsJSObject()) {
1083 // regular expression 1083 // regular expression
1084 if (object->IsJSFunction()) { 1084 if (object->IsJSFunction()) {
1085 Print("JS-Function"); 1085 Print("JS-Function");
1086 } else if (object->IsJSArray()) { 1086 } else if (object->IsJSArray()) {
(...skipping 661 matching lines...) Expand 10 before | Expand all | Expand 10 after
1748 1748
1749 void AstPrinter::VisitRewritableExpression(RewritableExpression* node) { 1749 void AstPrinter::VisitRewritableExpression(RewritableExpression* node) {
1750 Visit(node->expression()); 1750 Visit(node->expression());
1751 } 1751 }
1752 1752
1753 1753
1754 #endif // DEBUG 1754 #endif // DEBUG
1755 1755
1756 } // namespace internal 1756 } // namespace internal
1757 } // namespace v8 1757 } // namespace v8
OLDNEW
« no previous file with comments | « src/ast/ast.cc ('k') | src/builtins.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698