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

Side by Side Diff: src/parsing/scanner-character-streams.cc

Issue 2354683003: Fix BigE for Rework scanner-character-streams. (Closed)
Patch Set: Created 4 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
« no previous file with comments | « no previous file | 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 2011 the V8 project authors. All rights reserved. 1 // Copyright 2011 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/parsing/scanner-character-streams.h" 5 #include "src/parsing/scanner-character-streams.h"
6 6
7 #include "include/v8.h" 7 #include "include/v8.h"
8 #include "src/globals.h" 8 #include "src/globals.h"
9 #include "src/handles.h" 9 #include "src/handles.h"
10 #include "src/objects-inl.h" 10 #include "src/objects-inl.h"
(...skipping 556 matching lines...) Expand 10 before | Expand all | Expand 10 after
567 Chunk& current = chunks_[chunk_no]; 567 Chunk& current = chunks_[chunk_no];
568 568
569 // Annoying edge case: Chunks may not be 2-byte aligned, meaning that a 569 // Annoying edge case: Chunks may not be 2-byte aligned, meaning that a
570 // character may be split between the previous and the current chunk. 570 // character may be split between the previous and the current chunk.
571 // If we find such a lonely byte at the beginning of the chunk, we'll use 571 // If we find such a lonely byte at the beginning of the chunk, we'll use
572 // one_char_buffer_ to hold the full character. 572 // one_char_buffer_ to hold the full character.
573 bool lonely_byte = (chunks_[chunk_no].byte_pos == (2 * position + 1)); 573 bool lonely_byte = (chunks_[chunk_no].byte_pos == (2 * position + 1));
574 if (lonely_byte) { 574 if (lonely_byte) {
575 DCHECK_NE(chunk_no, 0); 575 DCHECK_NE(chunk_no, 0);
576 Chunk& previous_chunk = chunks_[chunk_no - 1]; 576 Chunk& previous_chunk = chunks_[chunk_no - 1];
577 #ifdef V8_TARGET_BIG_ENDIAN
578 uc16 character = current.data[0] |
579 previous_chunk.data[previous_chunk.byte_length - 1] << 8;
580 #else
577 uc16 character = previous_chunk.data[previous_chunk.byte_length - 1] | 581 uc16 character = previous_chunk.data[previous_chunk.byte_length - 1] |
578 current.data[0] << 8; 582 current.data[0] << 8;
583 #endif
579 584
580 one_char_buffer_ = character; 585 one_char_buffer_ = character;
581 buffer_pos_ = position; 586 buffer_pos_ = position;
582 buffer_start_ = &one_char_buffer_; 587 buffer_start_ = &one_char_buffer_;
583 buffer_cursor_ = &one_char_buffer_; 588 buffer_cursor_ = &one_char_buffer_;
584 buffer_end_ = &one_char_buffer_ + 1; 589 buffer_end_ = &one_char_buffer_ + 1;
585 return true; 590 return true;
586 } 591 }
587 592
588 // Common case: character is in current chunk. 593 // Common case: character is in current chunk.
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
649 return new OneByteExternalStreamingStream(source_stream); 654 return new OneByteExternalStreamingStream(source_stream);
650 case v8::ScriptCompiler::StreamedSource::UTF8: 655 case v8::ScriptCompiler::StreamedSource::UTF8:
651 return new Utf8ExternalStreamingStream(source_stream); 656 return new Utf8ExternalStreamingStream(source_stream);
652 } 657 }
653 UNREACHABLE(); 658 UNREACHABLE();
654 return nullptr; 659 return nullptr;
655 } 660 }
656 661
657 } // namespace internal 662 } // namespace internal
658 } // namespace v8 663 } // namespace v8
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698