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

Side by Side Diff: runtime/vm/snapshot.cc

Issue 12093071: - Change the layout of external typed array objects to avoid the extra indirection when accessing e… (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 7 years, 10 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 | « runtime/vm/raw_object_snapshot.cc ('k') | runtime/vm/snapshot_test.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 (c) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 #include "vm/snapshot.h" 5 #include "vm/snapshot.h"
6 6
7 #include "platform/assert.h" 7 #include "platform/assert.h"
8 #include "vm/bigint_operations.h" 8 #include "vm/bigint_operations.h"
9 #include "vm/bootstrap.h" 9 #include "vm/bootstrap.h"
10 #include "vm/exceptions.h" 10 #include "vm/exceptions.h"
(...skipping 404 matching lines...) Expand 10 before | Expand all | Expand 10 after
415 RawTokenStream* SnapshotReader::NewTokenStream(intptr_t len) { 415 RawTokenStream* SnapshotReader::NewTokenStream(intptr_t len) {
416 ASSERT(kind_ == Snapshot::kFull); 416 ASSERT(kind_ == Snapshot::kFull);
417 ASSERT(isolate()->no_gc_scope_depth() != 0); 417 ASSERT(isolate()->no_gc_scope_depth() != 0);
418 cls_ = Object::token_stream_class(); 418 cls_ = Object::token_stream_class();
419 stream_ = reinterpret_cast<RawTokenStream*>( 419 stream_ = reinterpret_cast<RawTokenStream*>(
420 AllocateUninitialized(cls_, TokenStream::InstanceSize())); 420 AllocateUninitialized(cls_, TokenStream::InstanceSize()));
421 cls_ = object_store()->external_uint8_array_class(); 421 cls_ = object_store()->external_uint8_array_class();
422 uint8_t* array = const_cast<uint8_t*>(CurrentBufferAddress()); 422 uint8_t* array = const_cast<uint8_t*>(CurrentBufferAddress());
423 ASSERT(array != NULL); 423 ASSERT(array != NULL);
424 Advance(len); 424 Advance(len);
425 ExternalByteArrayData<uint8_t>* external_data =
426 new ExternalByteArrayData<uint8_t>(array, NULL, NULL);
427 ASSERT(external_data != NULL);
428 data_ = reinterpret_cast<RawExternalUint8Array*>( 425 data_ = reinterpret_cast<RawExternalUint8Array*>(
429 AllocateUninitialized(cls_, ExternalUint8Array::InstanceSize())); 426 AllocateUninitialized(cls_, ExternalUint8Array::InstanceSize()));
430 data_.SetExternalData(external_data); 427 data_.SetData(array);
431 data_.SetLength(len); 428 data_.SetLength(len);
432 stream_.SetStream(data_); 429 stream_.SetStream(data_);
433 return stream_.raw(); 430 return stream_.raw();
434 } 431 }
435 432
436 433
437 RawContext* SnapshotReader::NewContext(intptr_t num_variables) { 434 RawContext* SnapshotReader::NewContext(intptr_t num_variables) {
438 ASSERT(kind_ == Snapshot::kFull); 435 ASSERT(kind_ == Snapshot::kFull);
439 ASSERT(isolate()->no_gc_scope_depth() != 0); 436 ASSERT(isolate()->no_gc_scope_depth() != 0);
440 cls_ = Object::context_class(); 437 cls_ = Object::context_class();
(...skipping 874 matching lines...) Expand 10 before | Expand all | Expand 10 after
1315 UnmarkAll(); 1312 UnmarkAll();
1316 isolate->set_long_jump_base(base); 1313 isolate->set_long_jump_base(base);
1317 } else { 1314 } else {
1318 isolate->set_long_jump_base(base); 1315 isolate->set_long_jump_base(base);
1319 ThrowException(exception_type(), exception_msg()); 1316 ThrowException(exception_type(), exception_msg());
1320 } 1317 }
1321 } 1318 }
1322 1319
1323 1320
1324 } // namespace dart 1321 } // namespace dart
OLDNEW
« no previous file with comments | « runtime/vm/raw_object_snapshot.cc ('k') | runtime/vm/snapshot_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698