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

Unified Diff: src/runtime.cc

Issue 209083005: Allow to neuter array buffer twice in tests. (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 | « no previous file | test/mjsunit/neuter-twice.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 1caaff05f8e0fc61018a6bd245f8c41ceef75d7b..e091c8fb5e3152a1cc39c2b9d89aa0aa2ceb353f 100644
--- a/src/runtime.cc
+++ b/src/runtime.cc
@@ -911,6 +911,10 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_ArrayBufferIsView) {
RUNTIME_FUNCTION(MaybeObject*, Runtime_ArrayBufferNeuter) {
HandleScope scope(isolate);
CONVERT_ARG_HANDLE_CHECKED(JSArrayBuffer, array_buffer, 0);
+ if (array_buffer->backing_store() == NULL) {
+ CHECK(Smi::FromInt(0) == array_buffer->byte_length());
+ return isolate->heap()->undefined_value();
+ }
Jarin 2014/03/25 10:59:42 How about keeping just one return statement? That
Dmitry Lomov (no reviews) 2014/03/25 11:04:25 I think that complicates code for the edge case.
Sven Panne 2014/03/25 11:30:35 Actually I like the initial version, too, a "comb-
ASSERT(!array_buffer->is_external());
void* backing_store = array_buffer->backing_store();
size_t byte_length = NumberToSize(isolate, array_buffer->byte_length());
« no previous file with comments | « no previous file | test/mjsunit/neuter-twice.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698