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

Side by Side Diff: vm/snapshot_test.cc

Issue 10908185: Do not allocate a buffer of 64KB by default when writing a message out. Start (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/runtime/
Patch Set: Created 8 years, 3 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 | « vm/snapshot.h ('k') | no next file » | 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 "include/dart_debugger_api.h" 5 #include "include/dart_debugger_api.h"
6 #include "platform/assert.h" 6 #include "platform/assert.h"
7 #include "vm/bigint_operations.h" 7 #include "vm/bigint_operations.h"
8 #include "vm/class_finalizer.h" 8 #include "vm/class_finalizer.h"
9 #include "vm/dart_api_impl.h" 9 #include "vm/dart_api_impl.h"
10 #include "vm/dart_api_message.h" 10 #include "vm/dart_api_message.h"
(...skipping 645 matching lines...) Expand 10 before | Expand all | Expand 10 after
656 Dart_CObject* root = api_reader.ReadMessage(); 656 Dart_CObject* root = api_reader.ReadMessage();
657 EXPECT_EQ(Dart_CObject::kUint8Array, root->type); 657 EXPECT_EQ(Dart_CObject::kUint8Array, root->type);
658 EXPECT_EQ(kByteArrayLength, root->value.as_byte_array.length); 658 EXPECT_EQ(kByteArrayLength, root->value.as_byte_array.length);
659 EXPECT(root->value.as_byte_array.values == NULL); 659 EXPECT(root->value.as_byte_array.values == NULL);
660 CheckEncodeDecodeMessage(root); 660 CheckEncodeDecodeMessage(root);
661 } 661 }
662 662
663 663
664 class TestSnapshotWriter : public SnapshotWriter { 664 class TestSnapshotWriter : public SnapshotWriter {
665 public: 665 public:
666 static const intptr_t kIncrementSize = 64 * KB;
666 TestSnapshotWriter(uint8_t** buffer, ReAlloc alloc) 667 TestSnapshotWriter(uint8_t** buffer, ReAlloc alloc)
667 : SnapshotWriter(Snapshot::kScript, buffer, alloc) { 668 : SnapshotWriter(Snapshot::kScript, buffer, alloc, kIncrementSize) {
668 ASSERT(buffer != NULL); 669 ASSERT(buffer != NULL);
669 ASSERT(alloc != NULL); 670 ASSERT(alloc != NULL);
670 } 671 }
671 ~TestSnapshotWriter() { } 672 ~TestSnapshotWriter() { }
672 673
673 // Writes just a script object 674 // Writes just a script object
674 void WriteScript(const Script& script) { 675 void WriteScript(const Script& script) {
675 WriteObject(script.raw()); 676 WriteObject(script.raw());
676 UnmarkAll(); 677 UnmarkAll();
677 } 678 }
(...skipping 899 matching lines...) Expand 10 before | Expand all | Expand 10 after
1577 EXPECT(Dart_ErrorHasException(result)); 1578 EXPECT(Dart_ErrorHasException(result));
1578 EXPECT_SUBSTRING("Exception: nulltruefalse1234563.14[]100123456789\n", 1579 EXPECT_SUBSTRING("Exception: nulltruefalse1234563.14[]100123456789\n",
1579 Dart_GetError(result)); 1580 Dart_GetError(result));
1580 1581
1581 Dart_ExitScope(); 1582 Dart_ExitScope();
1582 } 1583 }
1583 1584
1584 #endif // defined(TARGET_ARCH_IA32) || defined(TARGET_ARCH_X64). 1585 #endif // defined(TARGET_ARCH_IA32) || defined(TARGET_ARCH_X64).
1585 1586
1586 } // namespace dart 1587 } // namespace dart
OLDNEW
« no previous file with comments | « vm/snapshot.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698