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/runtime.cc

Issue 7565005: Version 3.5.3 (Closed) Base URL: https://v8.googlecode.com/svn/trunk
Patch Set: Created 9 years, 4 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/platform-win32.cc ('k') | src/version.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 2011 the V8 project authors. All rights reserved. 1 // Copyright 2011 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 9572 matching lines...) Expand 10 before | Expand all | Expand 10 after
9583 // Move contents of argument 0 (an array) to argument 1 (an array) 9583 // Move contents of argument 0 (an array) to argument 1 (an array)
9584 RUNTIME_FUNCTION(MaybeObject*, Runtime_MoveArrayContents) { 9584 RUNTIME_FUNCTION(MaybeObject*, Runtime_MoveArrayContents) {
9585 ASSERT(args.length() == 2); 9585 ASSERT(args.length() == 2);
9586 CONVERT_CHECKED(JSArray, from, args[0]); 9586 CONVERT_CHECKED(JSArray, from, args[0]);
9587 CONVERT_CHECKED(JSArray, to, args[1]); 9587 CONVERT_CHECKED(JSArray, to, args[1]);
9588 HeapObject* new_elements = from->elements(); 9588 HeapObject* new_elements = from->elements();
9589 MaybeObject* maybe_new_map; 9589 MaybeObject* maybe_new_map;
9590 if (new_elements->map() == isolate->heap()->fixed_array_map() || 9590 if (new_elements->map() == isolate->heap()->fixed_array_map() ||
9591 new_elements->map() == isolate->heap()->fixed_cow_array_map()) { 9591 new_elements->map() == isolate->heap()->fixed_cow_array_map()) {
9592 maybe_new_map = to->map()->GetFastElementsMap(); 9592 maybe_new_map = to->map()->GetFastElementsMap();
9593 } else if (new_elements->map() ==
9594 isolate->heap()->fixed_double_array_map()) {
9595 maybe_new_map = to->map()->GetFastDoubleElementsMap();
9593 } else { 9596 } else {
9594 maybe_new_map = to->map()->GetSlowElementsMap(); 9597 maybe_new_map = to->map()->GetSlowElementsMap();
9595 } 9598 }
9596 Object* new_map; 9599 Object* new_map;
9597 if (!maybe_new_map->ToObject(&new_map)) return maybe_new_map; 9600 if (!maybe_new_map->ToObject(&new_map)) return maybe_new_map;
9598 to->set_map(Map::cast(new_map)); 9601 to->set_map(Map::cast(new_map));
9599 to->set_elements(new_elements); 9602 to->set_elements(new_elements);
9600 to->set_length(from->length()); 9603 to->set_length(from->length());
9601 Object* obj; 9604 Object* obj;
9602 { MaybeObject* maybe_obj = from->ResetElements(); 9605 { MaybeObject* maybe_obj = from->ResetElements();
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
9670 for (int i = 0; i < keys_length; i++) { 9673 for (int i = 0; i < keys_length; i++) {
9671 Object* key = keys->get(i); 9674 Object* key = keys->get(i);
9672 uint32_t index = 0; 9675 uint32_t index = 0;
9673 if (!key->ToArrayIndex(&index) || index >= length) { 9676 if (!key->ToArrayIndex(&index) || index >= length) {
9674 // Zap invalid keys. 9677 // Zap invalid keys.
9675 keys->set_undefined(i); 9678 keys->set_undefined(i);
9676 } 9679 }
9677 } 9680 }
9678 return *isolate->factory()->NewJSArrayWithElements(keys); 9681 return *isolate->factory()->NewJSArrayWithElements(keys);
9679 } else { 9682 } else {
9680 ASSERT(array->HasFastElements()); 9683 ASSERT(array->HasFastElements() || array->HasFastDoubleElements());
9681 Handle<FixedArray> single_interval = isolate->factory()->NewFixedArray(2); 9684 Handle<FixedArray> single_interval = isolate->factory()->NewFixedArray(2);
9682 // -1 means start of array. 9685 // -1 means start of array.
9683 single_interval->set(0, Smi::FromInt(-1)); 9686 single_interval->set(0, Smi::FromInt(-1));
9687 FixedArrayBase* elements = FixedArrayBase::cast(array->elements());
9684 uint32_t actual_length = 9688 uint32_t actual_length =
9685 static_cast<uint32_t>(FixedArray::cast(array->elements())->length()); 9689 static_cast<uint32_t>(elements->length());
9686 uint32_t min_length = actual_length < length ? actual_length : length; 9690 uint32_t min_length = actual_length < length ? actual_length : length;
9687 Handle<Object> length_object = 9691 Handle<Object> length_object =
9688 isolate->factory()->NewNumber(static_cast<double>(min_length)); 9692 isolate->factory()->NewNumber(static_cast<double>(min_length));
9689 single_interval->set(1, *length_object); 9693 single_interval->set(1, *length_object);
9690 return *isolate->factory()->NewJSArrayWithElements(single_interval); 9694 return *isolate->factory()->NewJSArrayWithElements(single_interval);
9691 } 9695 }
9692 } 9696 }
9693 9697
9694 9698
9695 // DefineAccessor takes an optional final argument which is the 9699 // DefineAccessor takes an optional final argument which is the
(...skipping 3067 matching lines...) Expand 10 before | Expand all | Expand 10 after
12763 } else { 12767 } else {
12764 // Handle last resort GC and make sure to allow future allocations 12768 // Handle last resort GC and make sure to allow future allocations
12765 // to grow the heap without causing GCs (if possible). 12769 // to grow the heap without causing GCs (if possible).
12766 isolate->counters()->gc_last_resort_from_js()->Increment(); 12770 isolate->counters()->gc_last_resort_from_js()->Increment();
12767 isolate->heap()->CollectAllGarbage(false); 12771 isolate->heap()->CollectAllGarbage(false);
12768 } 12772 }
12769 } 12773 }
12770 12774
12771 12775
12772 } } // namespace v8::internal 12776 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/platform-win32.cc ('k') | src/version.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698