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

Side by Side Diff: src/runtime.cc

Issue 197713004: Merged r19862 into 3.23 branch. (Closed) Base URL: https://v8.googlecode.com/svn/branches/3.23
Patch Set: Created 6 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
« no previous file with comments | « src/arraybuffer.js ('k') | src/typedarray.js » ('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 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 962 matching lines...) Expand 10 before | Expand all | Expand 10 after
973 v8::ArrayBufferView::kInternalFieldCount); 973 v8::ArrayBufferView::kInternalFieldCount);
974 for (int i = 0; i < v8::ArrayBufferView::kInternalFieldCount; i++) { 974 for (int i = 0; i < v8::ArrayBufferView::kInternalFieldCount; i++) {
975 holder->SetInternalField(i, Smi::FromInt(0)); 975 holder->SetInternalField(i, Smi::FromInt(0));
976 } 976 }
977 977
978 ExternalArrayType array_type = kExternalByteArray; // Bogus initialization. 978 ExternalArrayType array_type = kExternalByteArray; // Bogus initialization.
979 size_t element_size = 1; // Bogus initialization. 979 size_t element_size = 1; // Bogus initialization.
980 Runtime::ArrayIdToTypeAndSize(arrayId, &array_type, &element_size); 980 Runtime::ArrayIdToTypeAndSize(arrayId, &array_type, &element_size);
981 981
982 Handle<JSArrayBuffer> buffer = isolate->factory()->NewJSArrayBuffer(); 982 Handle<JSArrayBuffer> buffer = isolate->factory()->NewJSArrayBuffer();
983 if (source->IsJSTypedArray() &&
984 JSTypedArray::cast(*source)->type() == array_type) {
985 length_obj = Handle<Object>(JSTypedArray::cast(*source)->length(), isolate);
986 }
983 size_t length = NumberToSize(isolate, *length_obj); 987 size_t length = NumberToSize(isolate, *length_obj);
984 988
985 if ((length > static_cast<unsigned>(Smi::kMaxValue)) || 989 if ((length > static_cast<unsigned>(Smi::kMaxValue)) ||
986 (length > (kMaxInt / element_size))) { 990 (length > (kMaxInt / element_size))) {
987 return isolate->Throw(*isolate->factory()-> 991 return isolate->Throw(*isolate->factory()->
988 NewRangeError("invalid_typed_array_length", 992 NewRangeError("invalid_typed_array_length",
989 HandleVector<Object>(NULL, 0))); 993 HandleVector<Object>(NULL, 0)));
990 } 994 }
991 size_t byte_length = length * element_size; 995 size_t byte_length = length * element_size;
992 996
(...skipping 13932 matching lines...) Expand 10 before | Expand all | Expand 10 after
14925 // Handle last resort GC and make sure to allow future allocations 14929 // Handle last resort GC and make sure to allow future allocations
14926 // to grow the heap without causing GCs (if possible). 14930 // to grow the heap without causing GCs (if possible).
14927 isolate->counters()->gc_last_resort_from_js()->Increment(); 14931 isolate->counters()->gc_last_resort_from_js()->Increment();
14928 isolate->heap()->CollectAllGarbage(Heap::kNoGCFlags, 14932 isolate->heap()->CollectAllGarbage(Heap::kNoGCFlags,
14929 "Runtime::PerformGC"); 14933 "Runtime::PerformGC");
14930 } 14934 }
14931 } 14935 }
14932 14936
14933 14937
14934 } } // namespace v8::internal 14938 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/arraybuffer.js ('k') | src/typedarray.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698