Revision: 18692
Author: [email protected]
Date: Mon Jan 20 14:46:43 2014 UTC
Log: Experimental lexer: add handling of sliced strings in SubStringKey
BUG=
[email protected]
Review URL: https://codereview.chromium.org/143303002
http://code.google.com/p/v8/source/detail?r=18692
Modified:
/branches/experimental/parser/src/objects-inl.h
=======================================
--- /branches/experimental/parser/src/objects-inl.h Mon Jan 20 09:25:23
2014 UTC
+++ /branches/experimental/parser/src/objects-inl.h Mon Jan 20 14:46:43
2014 UTC
@@ -503,7 +503,12 @@
class SubStringKey : public HashTableKey {
public:
SubStringKey(Handle<String> string, int from, int length)
- : string_(string), from_(from), length_(length) { }
+ : string_(string), from_(from), length_(length) {
+ if (string_->IsSlicedString()) {
+ string_ = Handle<String>(Unslice(*string_, &from_));
+ }
+ ASSERT(string_->IsSeqString() || string->IsExternalString());
+ }
virtual uint32_t Hash() {
ASSERT(length_ >= 0);
@@ -525,6 +530,14 @@
private:
const Char* GetChars();
+ String* Unslice(String* string, int* offset) {
+ while (string->IsSlicedString()) {
+ SlicedString* sliced = SlicedString::cast(string);
+ *offset += sliced->offset();
+ string = sliced->parent();
+ }
+ return string;
+ }
Handle<String> string_;
int from_;
--
--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev
---
You received this message because you are subscribed to the Google Groups "v8-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.