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

Side by Side Diff: src/objects.h

Issue 2868046: Fix crash: handle all flat string types in regexp replace. (Closed)
Patch Set: Review fixes Created 10 years, 5 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 | src/runtime.cc » ('j') | src/runtime.cc » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2006-2009 the V8 project authors. All rights reserved. 1 // Copyright 2006-2009 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 4395 matching lines...) Expand 10 before | Expand all | Expand 10 after
4406 4406
4407 private: 4407 private:
4408 DISALLOW_IMPLICIT_CONSTRUCTORS(SeqString); 4408 DISALLOW_IMPLICIT_CONSTRUCTORS(SeqString);
4409 }; 4409 };
4410 4410
4411 4411
4412 // The AsciiString class captures sequential ascii string objects. 4412 // The AsciiString class captures sequential ascii string objects.
4413 // Each character in the AsciiString is an ascii character. 4413 // Each character in the AsciiString is an ascii character.
4414 class SeqAsciiString: public SeqString { 4414 class SeqAsciiString: public SeqString {
4415 public: 4415 public:
4416 static const bool kHasAsciiEncoding = true;
4417
4416 // Dispatched behavior. 4418 // Dispatched behavior.
4417 inline uint16_t SeqAsciiStringGet(int index); 4419 inline uint16_t SeqAsciiStringGet(int index);
4418 inline void SeqAsciiStringSet(int index, uint16_t value); 4420 inline void SeqAsciiStringSet(int index, uint16_t value);
4419 4421
4420 // Get the address of the characters in this string. 4422 // Get the address of the characters in this string.
4421 inline Address GetCharsAddress(); 4423 inline Address GetCharsAddress();
4422 4424
4423 inline char* GetChars(); 4425 inline char* GetChars();
4424 4426
4425 // Casting 4427 // Casting
(...skipping 29 matching lines...) Expand all
4455 4457
4456 private: 4458 private:
4457 DISALLOW_IMPLICIT_CONSTRUCTORS(SeqAsciiString); 4459 DISALLOW_IMPLICIT_CONSTRUCTORS(SeqAsciiString);
4458 }; 4460 };
4459 4461
4460 4462
4461 // The TwoByteString class captures sequential unicode string objects. 4463 // The TwoByteString class captures sequential unicode string objects.
4462 // Each character in the TwoByteString is a two-byte uint16_t. 4464 // Each character in the TwoByteString is a two-byte uint16_t.
4463 class SeqTwoByteString: public SeqString { 4465 class SeqTwoByteString: public SeqString {
4464 public: 4466 public:
4467 static const bool kHasAsciiEncoding = false;
4468
4465 // Dispatched behavior. 4469 // Dispatched behavior.
4466 inline uint16_t SeqTwoByteStringGet(int index); 4470 inline uint16_t SeqTwoByteStringGet(int index);
4467 inline void SeqTwoByteStringSet(int index, uint16_t value); 4471 inline void SeqTwoByteStringSet(int index, uint16_t value);
4468 4472
4469 // Get the address of the characters in this string. 4473 // Get the address of the characters in this string.
4470 inline Address GetCharsAddress(); 4474 inline Address GetCharsAddress();
4471 4475
4472 inline uc16* GetChars(); 4476 inline uc16* GetChars();
4473 4477
4474 // For regexp code. 4478 // For regexp code.
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after
4587 4591
4588 private: 4592 private:
4589 DISALLOW_IMPLICIT_CONSTRUCTORS(ExternalString); 4593 DISALLOW_IMPLICIT_CONSTRUCTORS(ExternalString);
4590 }; 4594 };
4591 4595
4592 4596
4593 // The ExternalAsciiString class is an external string backed by an 4597 // The ExternalAsciiString class is an external string backed by an
4594 // ASCII string. 4598 // ASCII string.
4595 class ExternalAsciiString: public ExternalString { 4599 class ExternalAsciiString: public ExternalString {
4596 public: 4600 public:
4601 static const bool kHasAsciiEncoding = true;
4602
4597 typedef v8::String::ExternalAsciiStringResource Resource; 4603 typedef v8::String::ExternalAsciiStringResource Resource;
4598 4604
4599 // The underlying resource. 4605 // The underlying resource.
4600 inline Resource* resource(); 4606 inline Resource* resource();
4601 inline void set_resource(Resource* buffer); 4607 inline void set_resource(Resource* buffer);
4602 4608
4603 // Dispatched behavior. 4609 // Dispatched behavior.
4604 uint16_t ExternalAsciiStringGet(int index); 4610 uint16_t ExternalAsciiStringGet(int index);
4605 4611
4606 // Casting. 4612 // Casting.
(...skipping 12 matching lines...) Expand all
4619 4625
4620 private: 4626 private:
4621 DISALLOW_IMPLICIT_CONSTRUCTORS(ExternalAsciiString); 4627 DISALLOW_IMPLICIT_CONSTRUCTORS(ExternalAsciiString);
4622 }; 4628 };
4623 4629
4624 4630
4625 // The ExternalTwoByteString class is an external string backed by a UTF-16 4631 // The ExternalTwoByteString class is an external string backed by a UTF-16
4626 // encoded string. 4632 // encoded string.
4627 class ExternalTwoByteString: public ExternalString { 4633 class ExternalTwoByteString: public ExternalString {
4628 public: 4634 public:
4635 static const bool kHasAsciiEncoding = false;
4636
4629 typedef v8::String::ExternalStringResource Resource; 4637 typedef v8::String::ExternalStringResource Resource;
4630 4638
4631 // The underlying string resource. 4639 // The underlying string resource.
4632 inline Resource* resource(); 4640 inline Resource* resource();
4633 inline void set_resource(Resource* buffer); 4641 inline void set_resource(Resource* buffer);
4634 4642
4635 // Dispatched behavior. 4643 // Dispatched behavior.
4636 uint16_t ExternalTwoByteStringGet(int index); 4644 uint16_t ExternalTwoByteStringGet(int index);
4637 4645
4638 // For regexp code. 4646 // For regexp code.
(...skipping 710 matching lines...) Expand 10 before | Expand all | Expand 10 after
5349 } else { 5357 } else {
5350 value &= ~(1 << bit_position); 5358 value &= ~(1 << bit_position);
5351 } 5359 }
5352 return value; 5360 return value;
5353 } 5361 }
5354 }; 5362 };
5355 5363
5356 } } // namespace v8::internal 5364 } } // namespace v8::internal
5357 5365
5358 #endif // V8_OBJECTS_H_ 5366 #endif // V8_OBJECTS_H_
OLDNEW
« no previous file with comments | « no previous file | src/runtime.cc » ('j') | src/runtime.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698