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

Side by Side Diff: src/runtime.cc

Issue 525087: Forgot patch to make it compiler on Linux. (Closed)
Patch Set: Created 10 years, 11 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 | « no previous file | 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-2009 the V8 project authors. All rights reserved. 1 // Copyright 2006-2009 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 5365 matching lines...) Expand 10 before | Expand all | Expand 10 after
5376 * 5376 *
5377 * An index limit is used to deal with the situation that a result array 5377 * An index limit is used to deal with the situation that a result array
5378 * length overflows 32-bit non-negative integer. 5378 * length overflows 32-bit non-negative integer.
5379 */ 5379 */
5380 class ArrayConcatVisitor { 5380 class ArrayConcatVisitor {
5381 public: 5381 public:
5382 ArrayConcatVisitor(Handle<FixedArray> storage, 5382 ArrayConcatVisitor(Handle<FixedArray> storage,
5383 uint32_t index_limit, 5383 uint32_t index_limit,
5384 bool fast_elements) : 5384 bool fast_elements) :
5385 storage_(storage), index_limit_(index_limit), 5385 storage_(storage), index_limit_(index_limit),
5386 fast_elements_(fast_elements), index_offset_(0) { } 5386 index_offset_(0), fast_elements_(fast_elements) { }
5387 5387
5388 void visit(uint32_t i, Handle<Object> elm) { 5388 void visit(uint32_t i, Handle<Object> elm) {
5389 if (i >= index_limit_ - index_offset_) return; 5389 if (i >= index_limit_ - index_offset_) return;
5390 uint32_t index = index_offset_ + i; 5390 uint32_t index = index_offset_ + i;
5391 5391
5392 if (fast_elements_) { 5392 if (fast_elements_) {
5393 ASSERT(index < static_cast<uint32_t>(storage_->length())); 5393 ASSERT(index < static_cast<uint32_t>(storage_->length()));
5394 storage_->set(index, *elm); 5394 storage_->set(index, *elm);
5395 5395
5396 } else { 5396 } else {
(...skipping 247 matching lines...) Expand 10 before | Expand all | Expand 10 after
5644 * 5644 *
5645 * If the result array index overflows 32-bit unsigned integer, the rounded 5645 * If the result array index overflows 32-bit unsigned integer, the rounded
5646 * non-negative number is used as new length. For example, if one 5646 * non-negative number is used as new length. For example, if one
5647 * array length is 2^32 - 1, second array length is 1, the 5647 * array length is 2^32 - 1, second array length is 1, the
5648 * concatenated array length is 0. 5648 * concatenated array length is 0.
5649 * TODO(lrn) Change length behavior to ECMAScript 5 specification (length 5649 * TODO(lrn) Change length behavior to ECMAScript 5 specification (length
5650 * is one more than the last array index to get a value assigned). 5650 * is one more than the last array index to get a value assigned).
5651 */ 5651 */
5652 static uint32_t IterateArguments(Handle<JSArray> arguments, 5652 static uint32_t IterateArguments(Handle<JSArray> arguments,
5653 ArrayConcatVisitor* visitor) { 5653 ArrayConcatVisitor* visitor) {
5654 const uint32_t max_length = JSObject::kMaxElementCount;
5655 uint32_t visited_elements = 0; 5654 uint32_t visited_elements = 0;
5656 uint32_t num_of_args = static_cast<uint32_t>(arguments->length()->Number()); 5655 uint32_t num_of_args = static_cast<uint32_t>(arguments->length()->Number());
5657 5656
5658 for (uint32_t i = 0; i < num_of_args; i++) { 5657 for (uint32_t i = 0; i < num_of_args; i++) {
5659 Handle<Object> obj(arguments->GetElement(i)); 5658 Handle<Object> obj(arguments->GetElement(i));
5660 if (obj->IsJSArray()) { 5659 if (obj->IsJSArray()) {
5661 Handle<JSArray> array = Handle<JSArray>::cast(obj); 5660 Handle<JSArray> array = Handle<JSArray>::cast(obj);
5662 uint32_t len = static_cast<uint32_t>(array->length()->Number()); 5661 uint32_t len = static_cast<uint32_t>(array->length()->Number());
5663 uint32_t nof_elements = 5662 uint32_t nof_elements =
5664 IterateArrayAndPrototypeElements(array, visitor); 5663 IterateArrayAndPrototypeElements(array, visitor);
(...skipping 2413 matching lines...) Expand 10 before | Expand all | Expand 10 after
8078 } else { 8077 } else {
8079 // Handle last resort GC and make sure to allow future allocations 8078 // Handle last resort GC and make sure to allow future allocations
8080 // to grow the heap without causing GCs (if possible). 8079 // to grow the heap without causing GCs (if possible).
8081 Counters::gc_last_resort_from_js.Increment(); 8080 Counters::gc_last_resort_from_js.Increment();
8082 Heap::CollectAllGarbage(false); 8081 Heap::CollectAllGarbage(false);
8083 } 8082 }
8084 } 8083 }
8085 8084
8086 8085
8087 } } // namespace v8::internal 8086 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698