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

Side by Side Diff: src/runtime.cc

Issue 1659: Use RUNTIME_ASSERT instead of CHECK in runtime.cc. ... (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: Created 12 years, 3 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/array.js ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2006-2008 Google Inc. All Rights Reserved. 1 // Copyright 2006-2008 Google Inc. 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 3432 matching lines...) Expand 10 before | Expand all | Expand 10 after
3443 } 3443 }
3444 3444
3445 3445
3446 // Push an array unto an array of arrays if it is not already in the 3446 // Push an array unto an array of arrays if it is not already in the
3447 // array. Returns true if the element was pushed on the stack and 3447 // array. Returns true if the element was pushed on the stack and
3448 // false otherwise. 3448 // false otherwise.
3449 static Object* Runtime_PushIfAbsent(Arguments args) { 3449 static Object* Runtime_PushIfAbsent(Arguments args) {
3450 ASSERT(args.length() == 2); 3450 ASSERT(args.length() == 2);
3451 CONVERT_CHECKED(JSArray, array, args[0]); 3451 CONVERT_CHECKED(JSArray, array, args[0]);
3452 CONVERT_CHECKED(JSArray, element, args[1]); 3452 CONVERT_CHECKED(JSArray, element, args[1]);
3453 CHECK(array->HasFastElements()); 3453 RUNTIME_ASSERT(array->HasFastElements());
3454 int length = Smi::cast(array->length())->value(); 3454 int length = Smi::cast(array->length())->value();
3455 FixedArray* elements = FixedArray::cast(array->elements()); 3455 FixedArray* elements = FixedArray::cast(array->elements());
3456 for (int i = 0; i < length; i++) { 3456 for (int i = 0; i < length; i++) {
3457 if (elements->get(i) == element) return Heap::false_value(); 3457 if (elements->get(i) == element) return Heap::false_value();
3458 } 3458 }
3459 Object* obj = array->SetFastElement(length, element); 3459 Object* obj = array->SetFastElement(length, element);
3460 if (obj->IsFailure()) return obj; 3460 if (obj->IsFailure()) return obj;
3461 return Heap::true_value(); 3461 return Heap::true_value();
3462 } 3462 }
3463 3463
(...skipping 1527 matching lines...) Expand 10 before | Expand all | Expand 10 after
4991 4991
4992 void Runtime::PerformGC(Object* result) { 4992 void Runtime::PerformGC(Object* result) {
4993 Failure* failure = Failure::cast(result); 4993 Failure* failure = Failure::cast(result);
4994 // Try to do a garbage collection; ignore it if it fails. The C 4994 // Try to do a garbage collection; ignore it if it fails. The C
4995 // entry stub will throw an out-of-memory exception in that case. 4995 // entry stub will throw an out-of-memory exception in that case.
4996 Heap::CollectGarbage(failure->requested(), failure->allocation_space()); 4996 Heap::CollectGarbage(failure->requested(), failure->allocation_space());
4997 } 4997 }
4998 4998
4999 4999
5000 } } // namespace v8::internal 5000 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/array.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698