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

Side by Side Diff: src/runtime.cc

Issue 197793003: Use intrinsics for builtin ArrayBuffer property accesses (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
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 934 matching lines...) Expand 10 before | Expand all | Expand 10 after
945 v8::ArrayBufferView::kInternalFieldCount); 945 v8::ArrayBufferView::kInternalFieldCount);
946 for (int i = 0; i < v8::ArrayBufferView::kInternalFieldCount; i++) { 946 for (int i = 0; i < v8::ArrayBufferView::kInternalFieldCount; i++) {
947 holder->SetInternalField(i, Smi::FromInt(0)); 947 holder->SetInternalField(i, Smi::FromInt(0));
948 } 948 }
949 949
950 ExternalArrayType array_type = kExternalInt8Array; // Bogus initialization. 950 ExternalArrayType array_type = kExternalInt8Array; // Bogus initialization.
951 size_t element_size = 1; // Bogus initialization. 951 size_t element_size = 1; // Bogus initialization.
952 Runtime::ArrayIdToTypeAndSize(arrayId, &array_type, &element_size); 952 Runtime::ArrayIdToTypeAndSize(arrayId, &array_type, &element_size);
953 953
954 Handle<JSArrayBuffer> buffer = isolate->factory()->NewJSArrayBuffer(); 954 Handle<JSArrayBuffer> buffer = isolate->factory()->NewJSArrayBuffer();
955 if (source->IsJSTypedArray() &&
956 JSTypedArray::cast(*source)->type() == array_type) {
957 length_obj = Handle<Object>(JSTypedArray::cast(*source)->length(), isolate);
958 }
955 size_t length = NumberToSize(isolate, *length_obj); 959 size_t length = NumberToSize(isolate, *length_obj);
956 960
957 if ((length > static_cast<unsigned>(Smi::kMaxValue)) || 961 if ((length > static_cast<unsigned>(Smi::kMaxValue)) ||
958 (length > (kMaxInt / element_size))) { 962 (length > (kMaxInt / element_size))) {
959 return isolate->Throw(*isolate->factory()-> 963 return isolate->Throw(*isolate->factory()->
960 NewRangeError("invalid_typed_array_length", 964 NewRangeError("invalid_typed_array_length",
961 HandleVector<Object>(NULL, 0))); 965 HandleVector<Object>(NULL, 0)));
962 } 966 }
963 size_t byte_length = length * element_size; 967 size_t byte_length = length * element_size;
964 968
(...skipping 14006 matching lines...) Expand 10 before | Expand all | Expand 10 after
14971 // Handle last resort GC and make sure to allow future allocations 14975 // Handle last resort GC and make sure to allow future allocations
14972 // to grow the heap without causing GCs (if possible). 14976 // to grow the heap without causing GCs (if possible).
14973 isolate->counters()->gc_last_resort_from_js()->Increment(); 14977 isolate->counters()->gc_last_resort_from_js()->Increment();
14974 isolate->heap()->CollectAllGarbage(Heap::kNoGCFlags, 14978 isolate->heap()->CollectAllGarbage(Heap::kNoGCFlags,
14975 "Runtime::PerformGC"); 14979 "Runtime::PerformGC");
14976 } 14980 }
14977 } 14981 }
14978 14982
14979 14983
14980 } } // namespace v8::internal 14984 } } // 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