OLD | NEW |
1 // Copyright 2008 the V8 project authors. All rights reserved. | 1 // Copyright 2008 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 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
74 const byte* NativeRegExpMacroAssembler::StringCharacterPosition( | 74 const byte* NativeRegExpMacroAssembler::StringCharacterPosition( |
75 String* subject, | 75 String* subject, |
76 int start_index) { | 76 int start_index) { |
77 // Not just flat, but ultra flat. | 77 // Not just flat, but ultra flat. |
78 ASSERT(subject->IsExternalString() || subject->IsSeqString()); | 78 ASSERT(subject->IsExternalString() || subject->IsSeqString()); |
79 ASSERT(start_index >= 0); | 79 ASSERT(start_index >= 0); |
80 ASSERT(start_index <= subject->length()); | 80 ASSERT(start_index <= subject->length()); |
81 if (subject->IsAsciiRepresentation()) { | 81 if (subject->IsAsciiRepresentation()) { |
82 const byte* address; | 82 const byte* address; |
83 if (StringShape(subject).IsExternal()) { | 83 if (StringShape(subject).IsExternal()) { |
84 const char* data = ExternalAsciiString::cast(subject)->resource()->data(); | 84 const char* data = ExternalAsciiString::cast(subject)->GetChars(); |
85 address = reinterpret_cast<const byte*>(data); | 85 address = reinterpret_cast<const byte*>(data); |
86 } else { | 86 } else { |
87 ASSERT(subject->IsSeqAsciiString()); | 87 ASSERT(subject->IsSeqAsciiString()); |
88 char* data = SeqAsciiString::cast(subject)->GetChars(); | 88 char* data = SeqAsciiString::cast(subject)->GetChars(); |
89 address = reinterpret_cast<const byte*>(data); | 89 address = reinterpret_cast<const byte*>(data); |
90 } | 90 } |
91 return address + start_index; | 91 return address + start_index; |
92 } | 92 } |
93 const uc16* data; | 93 const uc16* data; |
94 if (StringShape(subject).IsExternal()) { | 94 if (StringShape(subject).IsExternal()) { |
95 data = ExternalTwoByteString::cast(subject)->resource()->data(); | 95 data = ExternalTwoByteString::cast(subject)->GetChars(); |
96 } else { | 96 } else { |
97 ASSERT(subject->IsSeqTwoByteString()); | 97 ASSERT(subject->IsSeqTwoByteString()); |
98 data = SeqTwoByteString::cast(subject)->GetChars(); | 98 data = SeqTwoByteString::cast(subject)->GetChars(); |
99 } | 99 } |
100 return reinterpret_cast<const byte*>(data + start_index); | 100 return reinterpret_cast<const byte*>(data + start_index); |
101 } | 101 } |
102 | 102 |
103 | 103 |
104 NativeRegExpMacroAssembler::Result NativeRegExpMacroAssembler::Match( | 104 NativeRegExpMacroAssembler::Result NativeRegExpMacroAssembler::Match( |
105 Handle<Code> regexp_code, | 105 Handle<Code> regexp_code, |
(...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
262 return NULL; | 262 return NULL; |
263 } | 263 } |
264 *stack_base = new_stack_base; | 264 *stack_base = new_stack_base; |
265 intptr_t stack_content_size = old_stack_base - stack_pointer; | 265 intptr_t stack_content_size = old_stack_base - stack_pointer; |
266 return new_stack_base - stack_content_size; | 266 return new_stack_base - stack_content_size; |
267 } | 267 } |
268 | 268 |
269 #endif // V8_INTERPRETED_REGEXP | 269 #endif // V8_INTERPRETED_REGEXP |
270 | 270 |
271 } } // namespace v8::internal | 271 } } // namespace v8::internal |
OLD | NEW |