OLD | NEW |
1 // Copyright 2016 the V8 project authors. All rights reserved. | 1 // Copyright 2016 the V8 project authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "src/snapshot/serializer.h" | 5 #include "src/snapshot/serializer.h" |
6 | 6 |
7 #include "src/macro-assembler.h" | 7 #include "src/macro-assembler.h" |
8 #include "src/snapshot/natives.h" | 8 #include "src/snapshot/natives.h" |
9 | 9 |
10 namespace v8 { | 10 namespace v8 { |
(...skipping 385 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
396 ExternalOneByteString::cast(string)->resource()->data()); | 396 ExternalOneByteString::cast(string)->resource()->data()); |
397 } else { | 397 } else { |
398 map = internalized ? isolate->heap()->internalized_string_map() | 398 map = internalized ? isolate->heap()->internalized_string_map() |
399 : isolate->heap()->string_map(); | 399 : isolate->heap()->string_map(); |
400 allocation_size = SeqTwoByteString::SizeFor(length); | 400 allocation_size = SeqTwoByteString::SizeFor(length); |
401 content_size = length * kShortSize; | 401 content_size = length * kShortSize; |
402 resource = reinterpret_cast<const byte*>( | 402 resource = reinterpret_cast<const byte*>( |
403 ExternalTwoByteString::cast(string)->resource()->data()); | 403 ExternalTwoByteString::cast(string)->resource()->data()); |
404 } | 404 } |
405 | 405 |
406 AllocationSpace space = (allocation_size > Page::kMaxRegularHeapObjectSize) | 406 AllocationSpace space = |
407 ? LO_SPACE | 407 (allocation_size > kMaxRegularHeapObjectSize) ? LO_SPACE : OLD_SPACE; |
408 : OLD_SPACE; | |
409 SerializePrologue(space, allocation_size, map); | 408 SerializePrologue(space, allocation_size, map); |
410 | 409 |
411 // Output the rest of the imaginary string. | 410 // Output the rest of the imaginary string. |
412 int bytes_to_output = allocation_size - HeapObject::kHeaderSize; | 411 int bytes_to_output = allocation_size - HeapObject::kHeaderSize; |
413 | 412 |
414 // Output raw data header. Do not bother with common raw length cases here. | 413 // Output raw data header. Do not bother with common raw length cases here. |
415 sink_->Put(kVariableRawData, "RawDataForString"); | 414 sink_->Put(kVariableRawData, "RawDataForString"); |
416 sink_->PutInt(bytes_to_output, "length"); | 415 sink_->PutInt(bytes_to_output, "length"); |
417 | 416 |
418 // Serialize string header (except for map). | 417 // Serialize string header (except for map). |
(...skipping 372 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
791 if (to_skip != 0 && return_skip == kIgnoringReturn) { | 790 if (to_skip != 0 && return_skip == kIgnoringReturn) { |
792 sink_->Put(kSkip, "Skip"); | 791 sink_->Put(kSkip, "Skip"); |
793 sink_->PutInt(to_skip, "SkipDistance"); | 792 sink_->PutInt(to_skip, "SkipDistance"); |
794 to_skip = 0; | 793 to_skip = 0; |
795 } | 794 } |
796 return to_skip; | 795 return to_skip; |
797 } | 796 } |
798 | 797 |
799 } // namespace internal | 798 } // namespace internal |
800 } // namespace v8 | 799 } // namespace v8 |
OLD | NEW |