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

Side by Side Diff: src/objects.cc

Issue 259173003: Kiss goodbye to MaybeObject. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: rebase + addressed comments Created 6 years, 7 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/objects.h ('k') | src/objects-debug.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 2013 the V8 project authors. All rights reserved. 1 // Copyright 2013 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 "v8.h" 5 #include "v8.h"
6 6
7 #include "accessors.h" 7 #include "accessors.h"
8 #include "allocation-site-scopes.h" 8 #include "allocation-site-scopes.h"
9 #include "api.h" 9 #include "api.h"
10 #include "arguments.h" 10 #include "arguments.h"
(...skipping 970 matching lines...) Expand 10 before | Expand all | Expand 10 after
981 HeapStringAllocator allocator; 981 HeapStringAllocator allocator;
982 StringStream accumulator(&allocator); 982 StringStream accumulator(&allocator);
983 ShortPrint(&accumulator); 983 ShortPrint(&accumulator);
984 accumulator.OutputToFile(out); 984 accumulator.OutputToFile(out);
985 } 985 }
986 986
987 987
988 void Object::ShortPrint(StringStream* accumulator) { 988 void Object::ShortPrint(StringStream* accumulator) {
989 if (IsSmi()) { 989 if (IsSmi()) {
990 Smi::cast(this)->SmiPrint(accumulator); 990 Smi::cast(this)->SmiPrint(accumulator);
991 } else if (IsFailure()) {
992 Failure::cast(this)->FailurePrint(accumulator);
993 } else { 991 } else {
994 HeapObject::cast(this)->HeapObjectShortPrint(accumulator); 992 HeapObject::cast(this)->HeapObjectShortPrint(accumulator);
995 } 993 }
996 } 994 }
997 995
998 996
999 void Smi::SmiPrint(FILE* out) { 997 void Smi::SmiPrint(FILE* out) {
1000 PrintF(out, "%d", value()); 998 PrintF(out, "%d", value());
1001 } 999 }
1002 1000
1003 1001
1004 void Smi::SmiPrint(StringStream* accumulator) { 1002 void Smi::SmiPrint(StringStream* accumulator) {
1005 accumulator->Add("%d", value()); 1003 accumulator->Add("%d", value());
1006 } 1004 }
1007 1005
1008 1006
1009 void Failure::FailurePrint(StringStream* accumulator) {
1010 accumulator->Add("Failure(%p)", reinterpret_cast<void*>(value()));
1011 }
1012
1013
1014 void Failure::FailurePrint(FILE* out) {
1015 PrintF(out, "Failure(%p)", reinterpret_cast<void*>(value()));
1016 }
1017
1018
1019 // Should a word be prefixed by 'a' or 'an' in order to read naturally in 1007 // Should a word be prefixed by 'a' or 'an' in order to read naturally in
1020 // English? Returns false for non-ASCII or words that don't start with 1008 // English? Returns false for non-ASCII or words that don't start with
1021 // a capital letter. The a/an rule follows pronunciation in English. 1009 // a capital letter. The a/an rule follows pronunciation in English.
1022 // We don't use the BBC's overcorrect "an historic occasion" though if 1010 // We don't use the BBC's overcorrect "an historic occasion" though if
1023 // you speak a dialect you may well say "an 'istoric occasion". 1011 // you speak a dialect you may well say "an 'istoric occasion".
1024 static bool AnWord(String* str) { 1012 static bool AnWord(String* str) {
1025 if (str->length() == 0) return false; // A nothing. 1013 if (str->length() == 0) return false; // A nothing.
1026 int c0 = str->Get(0); 1014 int c0 = str->Get(0);
1027 int c1 = str->length() > 1 ? str->Get(1) : 0; 1015 int c1 = str->length() > 1 ? str->Get(1) : 0;
1028 if (c0 == 'U') { 1016 if (c0 == 'U') {
(...skipping 16188 matching lines...) Expand 10 before | Expand all | Expand 10 after
17217 #define ERROR_MESSAGES_TEXTS(C, T) T, 17205 #define ERROR_MESSAGES_TEXTS(C, T) T,
17218 static const char* error_messages_[] = { 17206 static const char* error_messages_[] = {
17219 ERROR_MESSAGES_LIST(ERROR_MESSAGES_TEXTS) 17207 ERROR_MESSAGES_LIST(ERROR_MESSAGES_TEXTS)
17220 }; 17208 };
17221 #undef ERROR_MESSAGES_TEXTS 17209 #undef ERROR_MESSAGES_TEXTS
17222 return error_messages_[reason]; 17210 return error_messages_[reason];
17223 } 17211 }
17224 17212
17225 17213
17226 } } // namespace v8::internal 17214 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/objects.h ('k') | src/objects-debug.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698