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

Unified Diff: src/runtime.cc

Issue 199523006: Revert "Apply numeric casts correctly in typed arrays and related code." (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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/runtime.h ('k') | src/typedarray.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/runtime.cc
diff --git a/src/runtime.cc b/src/runtime.cc
index 2873474b6dd86f060bf9fc4175eee30ce9555f4d..75b9f2ffdba65109984bf3cf05c040fc5e3e560e 100644
--- a/src/runtime.cc
+++ b/src/runtime.cc
@@ -791,24 +791,6 @@ bool Runtime::SetupArrayBufferAllocatingData(
}
-void Runtime::NeuterArrayBuffer(Handle<JSArrayBuffer> array_buffer) {
- Isolate* isolate = array_buffer->GetIsolate();
- for (Handle<Object> view_obj(array_buffer->weak_first_view(), isolate);
- !view_obj->IsUndefined();) {
- Handle<JSArrayBufferView> view(JSArrayBufferView::cast(*view_obj));
- if (view->IsJSTypedArray()) {
- JSTypedArray::cast(*view)->Neuter();
- } else if (view->IsJSDataView()) {
- JSDataView::cast(*view)->Neuter();
- } else {
- UNREACHABLE();
- }
- view_obj = handle(view->weak_next(), isolate);
- }
- array_buffer->Neuter();
-}
-
-
RUNTIME_FUNCTION(MaybeObject*, Runtime_ArrayBufferInitialize) {
HandleScope scope(isolate);
ASSERT(args.length() == 2);
@@ -862,9 +844,7 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_ArrayBufferSliceImpl) {
if (target_length == 0) return isolate->heap()->undefined_value();
- size_t source_byte_length = NumberToSize(isolate, source->byte_length());
- CHECK(start <= source_byte_length);
- CHECK(source_byte_length - start >= target_length);
+ ASSERT(NumberToSize(isolate, source->byte_length()) - target_length >= start);
uint8_t* source_data = reinterpret_cast<uint8_t*>(source->backing_store());
uint8_t* target_data = reinterpret_cast<uint8_t*>(target->backing_store());
CopyBytes(target_data, source_data + start, target_length);
@@ -882,19 +862,6 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_ArrayBufferIsView) {
}
-RUNTIME_FUNCTION(MaybeObject*, Runtime_ArrayBufferNeuter) {
- HandleScope scope(isolate);
- CONVERT_ARG_HANDLE_CHECKED(JSArrayBuffer, array_buffer, 0);
- ASSERT(!array_buffer->is_external());
- void* backing_store = array_buffer->backing_store();
- size_t byte_length = NumberToSize(isolate, array_buffer->byte_length());
- array_buffer->set_is_external(true);
- Runtime::NeuterArrayBuffer(array_buffer);
- V8::ArrayBufferAllocator()->Free(backing_store, byte_length);
- return isolate->heap()->undefined_value();
-}
-
-
void Runtime::ArrayIdToTypeAndSize(
int arrayId, ExternalArrayType* array_type, size_t* element_size) {
switch (arrayId) {
@@ -938,12 +905,7 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_TypedArrayInitialize) {
size_t byte_offset = NumberToSize(isolate, *byte_offset_object);
size_t byte_length = NumberToSize(isolate, *byte_length_object);
- size_t array_buffer_byte_length =
- NumberToSize(isolate, buffer->byte_length());
- CHECK(byte_offset <= array_buffer_byte_length);
- CHECK(array_buffer_byte_length - byte_offset >= byte_length);
-
- CHECK_EQ(0, byte_length % element_size);
+ ASSERT(byte_length % element_size == 0);
size_t length = byte_length / element_size;
if (length > static_cast<unsigned>(Smi::kMaxValue)) {
« no previous file with comments | « src/runtime.h ('k') | src/typedarray.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698