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

Side by Side Diff: src/runtime.cc

Issue 13071006: Codify the assumption that %GetArrayKeys can return only a single interval starting at zero (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 7 years, 9 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
« src/array.js ('K') | « 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 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 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 9551 matching lines...) Expand 10 before | Expand all | Expand 10 after
9562 Handle<FixedArray> single_interval = isolate->factory()->NewFixedArray(2); 9562 Handle<FixedArray> single_interval = isolate->factory()->NewFixedArray(2);
9563 // -1 means start of array. 9563 // -1 means start of array.
9564 single_interval->set(0, Smi::FromInt(-1)); 9564 single_interval->set(0, Smi::FromInt(-1));
9565 Handle<Object> number = isolate->factory()->NewNumberFromUint(length); 9565 Handle<Object> number = isolate->factory()->NewNumberFromUint(length);
9566 single_interval->set(1, *number); 9566 single_interval->set(1, *number);
9567 return isolate->factory()->NewJSArrayWithElements(single_interval); 9567 return isolate->factory()->NewJSArrayWithElements(single_interval);
9568 } 9568 }
9569 9569
9570 9570
9571 // Returns an array that tells you where in the [0, length) interval an array 9571 // Returns an array that tells you where in the [0, length) interval an array
9572 // might have elements. Can either return keys (positive integers) or 9572 // might have elements. Can either return keys (positive integers or undefined)
9573 // intervals (pair of a negative integer (-start-1) followed by a 9573 // or a single interval (pair of -1, positive length).
9574 // positive (length)) or undefined values.
9575 // Intervals can span over some keys that are not in the object. 9574 // Intervals can span over some keys that are not in the object.
9576 RUNTIME_FUNCTION(MaybeObject*, Runtime_GetArrayKeys) { 9575 RUNTIME_FUNCTION(MaybeObject*, Runtime_GetArrayKeys) {
9577 HandleScope scope(isolate); 9576 HandleScope scope(isolate);
9578 ASSERT(args.length() == 2); 9577 ASSERT(args.length() == 2);
9579 CONVERT_ARG_HANDLE_CHECKED(JSObject, array, 0); 9578 CONVERT_ARG_HANDLE_CHECKED(JSObject, array, 0);
9580 CONVERT_NUMBER_CHECKED(uint32_t, length, Uint32, args[1]); 9579 CONVERT_NUMBER_CHECKED(uint32_t, length, Uint32, args[1]);
9581 if (array->elements()->IsDictionary()) { 9580 if (array->elements()->IsDictionary()) {
9582 Handle<FixedArray> keys = isolate->factory()->empty_fixed_array(); 9581 Handle<FixedArray> keys = isolate->factory()->empty_fixed_array();
9583 for (Handle<Object> p = array; 9582 for (Handle<Object> p = array;
9584 !p->IsNull(); 9583 !p->IsNull();
(...skipping 3417 matching lines...) Expand 10 before | Expand all | Expand 10 after
13002 // Handle last resort GC and make sure to allow future allocations 13001 // Handle last resort GC and make sure to allow future allocations
13003 // to grow the heap without causing GCs (if possible). 13002 // to grow the heap without causing GCs (if possible).
13004 isolate->counters()->gc_last_resort_from_js()->Increment(); 13003 isolate->counters()->gc_last_resort_from_js()->Increment();
13005 isolate->heap()->CollectAllGarbage(Heap::kNoGCFlags, 13004 isolate->heap()->CollectAllGarbage(Heap::kNoGCFlags,
13006 "Runtime::PerformGC"); 13005 "Runtime::PerformGC");
13007 } 13006 }
13008 } 13007 }
13009 13008
13010 13009
13011 } } // namespace v8::internal 13010 } } // namespace v8::internal
OLDNEW
« src/array.js ('K') | « src/array.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698