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

Side by Side Diff: src/api.cc

Issue 15562008: Recording array buffer views. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: CR feedback Created 7 years, 6 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 | « include/v8.h ('k') | src/bootstrapper.cc » ('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 6103 matching lines...) Expand 10 before | Expand all | Expand 10 after
6114 i::Handle<i::JSTypedArray> obj = 6114 i::Handle<i::JSTypedArray> obj =
6115 isolate->factory()->NewJSTypedArray(array_type); 6115 isolate->factory()->NewJSTypedArray(array_type);
6116 i::Handle<i::JSArrayBuffer> buffer = Utils::OpenHandle(*array_buffer); 6116 i::Handle<i::JSArrayBuffer> buffer = Utils::OpenHandle(*array_buffer);
6117 6117
6118 ASSERT(byte_offset % sizeof(ElementType) == 0); 6118 ASSERT(byte_offset % sizeof(ElementType) == 0);
6119 ASSERT(byte_offset + length * sizeof(ElementType) <= 6119 ASSERT(byte_offset + length * sizeof(ElementType) <=
6120 static_cast<size_t>(buffer->byte_length()->Number())); 6120 static_cast<size_t>(buffer->byte_length()->Number()));
6121 6121
6122 obj->set_buffer(*buffer); 6122 obj->set_buffer(*buffer);
6123 6123
6124 obj->set_weak_next(buffer->weak_first_array());
6125 buffer->set_weak_first_array(*obj);
6126
6124 i::Handle<i::Object> byte_offset_object = isolate->factory()->NewNumber( 6127 i::Handle<i::Object> byte_offset_object = isolate->factory()->NewNumber(
6125 static_cast<double>(byte_offset)); 6128 static_cast<double>(byte_offset));
6126 obj->set_byte_offset(*byte_offset_object); 6129 obj->set_byte_offset(*byte_offset_object);
6127 6130
6128 i::Handle<i::Object> byte_length_object = isolate->factory()->NewNumber( 6131 i::Handle<i::Object> byte_length_object = isolate->factory()->NewNumber(
6129 static_cast<double>(length * sizeof(ElementType))); 6132 static_cast<double>(length * sizeof(ElementType)));
6130 obj->set_byte_length(*byte_length_object); 6133 obj->set_byte_length(*byte_length_object);
6131 6134
6132 i::Handle<i::Object> length_object = isolate->factory()->NewNumber( 6135 i::Handle<i::Object> length_object = isolate->factory()->NewNumber(
6133 static_cast<double>(length)); 6136 static_cast<double>(length));
(...skipping 1715 matching lines...) Expand 10 before | Expand all | Expand 10 after
7849 7852
7850 v->VisitPointers(blocks_.first(), first_block_limit_); 7853 v->VisitPointers(blocks_.first(), first_block_limit_);
7851 7854
7852 for (int i = 1; i < blocks_.length(); i++) { 7855 for (int i = 1; i < blocks_.length(); i++) {
7853 v->VisitPointers(blocks_[i], &blocks_[i][kHandleBlockSize]); 7856 v->VisitPointers(blocks_[i], &blocks_[i][kHandleBlockSize]);
7854 } 7857 }
7855 } 7858 }
7856 7859
7857 7860
7858 } } // namespace v8::internal 7861 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « include/v8.h ('k') | src/bootstrapper.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698