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

Side by Side Diff: src/objects.cc

Issue 3836001: Get rid of requested size in RetryAfterGC. (Closed)
Patch Set: Created 10 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/objects.h ('k') | src/objects-inl.h » ('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 2010 the V8 project authors. All rights reserved. 1 // Copyright 2010 the V8 project authors. All rights reserved.
2 // Redistribution and use in source and binary forms, with or without 2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are 3 // modification, are permitted provided that the following conditions are
4 // met: 4 // met:
5 // 5 //
6 // * Redistributions of source code must retain the above copyright 6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer. 7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above 8 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following 9 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided 10 // disclaimer in the documentation and/or other materials provided
(...skipping 556 matching lines...) Expand 10 before | Expand all | Expand 10 after
567 void Failure::FailurePrint(StringStream* accumulator) { 567 void Failure::FailurePrint(StringStream* accumulator) {
568 accumulator->Add("Failure(%p)", reinterpret_cast<void*>(value())); 568 accumulator->Add("Failure(%p)", reinterpret_cast<void*>(value()));
569 } 569 }
570 570
571 571
572 void Failure::FailurePrint() { 572 void Failure::FailurePrint() {
573 PrintF("Failure(%p)", reinterpret_cast<void*>(value())); 573 PrintF("Failure(%p)", reinterpret_cast<void*>(value()));
574 } 574 }
575 575
576 576
577 Failure* Failure::RetryAfterGC(int requested_bytes, AllocationSpace space) {
578 ASSERT((space & ~kSpaceTagMask) == 0);
579 // TODO(X64): Stop using Smi validation for non-smi checks, even if they
580 // happen to be identical at the moment.
581
582 int requested = requested_bytes >> kObjectAlignmentBits;
583 int value = (requested << kSpaceTagSize) | space;
584 // We can't very well allocate a heap number in this situation, and if the
585 // requested memory is so large it seems reasonable to say that this is an
586 // out of memory situation. This fixes a crash in
587 // js1_5/Regress/regress-303213.js.
588 if (value >> kSpaceTagSize != requested ||
589 !Smi::IsValid(value) ||
590 value != ((value << kFailureTypeTagSize) >> kFailureTypeTagSize) ||
591 !Smi::IsValid(value << kFailureTypeTagSize)) {
592 Top::context()->mark_out_of_memory();
593 return Failure::OutOfMemoryException();
594 }
595 return Construct(RETRY_AFTER_GC, value);
596 }
597
598
599 // Should a word be prefixed by 'a' or 'an' in order to read naturally in 577 // Should a word be prefixed by 'a' or 'an' in order to read naturally in
600 // English? Returns false for non-ASCII or words that don't start with 578 // English? Returns false for non-ASCII or words that don't start with
601 // a capital letter. The a/an rule follows pronunciation in English. 579 // a capital letter. The a/an rule follows pronunciation in English.
602 // We don't use the BBC's overcorrect "an historic occasion" though if 580 // We don't use the BBC's overcorrect "an historic occasion" though if
603 // you speak a dialect you may well say "an 'istoric occasion". 581 // you speak a dialect you may well say "an 'istoric occasion".
604 static bool AnWord(String* str) { 582 static bool AnWord(String* str) {
605 if (str->length() == 0) return false; // A nothing. 583 if (str->length() == 0) return false; // A nothing.
606 int c0 = str->Get(0); 584 int c0 = str->Get(0);
607 int c1 = str->length() > 1 ? str->Get(1) : 0; 585 int c1 = str->length() > 1 ? str->Get(1) : 0;
608 if (c0 == 'U') { 586 if (c0 == 'U') {
(...skipping 8451 matching lines...) Expand 10 before | Expand all | Expand 10 after
9060 if (break_point_objects()->IsUndefined()) return 0; 9038 if (break_point_objects()->IsUndefined()) return 0;
9061 // Single beak point. 9039 // Single beak point.
9062 if (!break_point_objects()->IsFixedArray()) return 1; 9040 if (!break_point_objects()->IsFixedArray()) return 1;
9063 // Multiple break points. 9041 // Multiple break points.
9064 return FixedArray::cast(break_point_objects())->length(); 9042 return FixedArray::cast(break_point_objects())->length();
9065 } 9043 }
9066 #endif 9044 #endif
9067 9045
9068 9046
9069 } } // namespace v8::internal 9047 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/objects.h ('k') | src/objects-inl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698