OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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 1448 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1459 bool multiline, | 1459 bool multiline, |
1460 Handle<String> pattern, | 1460 Handle<String> pattern, |
1461 bool is_ascii); | 1461 bool is_ascii); |
1462 | 1462 |
1463 static void DotPrint(const char* label, RegExpNode* node, bool ignore_case); | 1463 static void DotPrint(const char* label, RegExpNode* node, bool ignore_case); |
1464 }; | 1464 }; |
1465 | 1465 |
1466 | 1466 |
1467 class OffsetsVector { | 1467 class OffsetsVector { |
1468 public: | 1468 public: |
1469 explicit inline OffsetsVector(int num_registers) | 1469 inline OffsetsVector(int num_registers, Isolate* isolate) |
1470 : offsets_vector_length_(num_registers) { | 1470 : offsets_vector_length_(num_registers) { |
1471 if (offsets_vector_length_ > Isolate::kJSRegexpStaticOffsetsVectorSize) { | 1471 if (offsets_vector_length_ > Isolate::kJSRegexpStaticOffsetsVectorSize) { |
1472 vector_ = NewArray<int>(offsets_vector_length_); | 1472 vector_ = NewArray<int>(offsets_vector_length_); |
1473 } else { | 1473 } else { |
1474 vector_ = Isolate::Current()->jsregexp_static_offsets_vector(); | 1474 vector_ = isolate->jsregexp_static_offsets_vector(); |
1475 } | 1475 } |
1476 } | 1476 } |
1477 inline ~OffsetsVector() { | 1477 inline ~OffsetsVector() { |
1478 if (offsets_vector_length_ > Isolate::kJSRegexpStaticOffsetsVectorSize) { | 1478 if (offsets_vector_length_ > Isolate::kJSRegexpStaticOffsetsVectorSize) { |
1479 DeleteArray(vector_); | 1479 DeleteArray(vector_); |
1480 vector_ = NULL; | 1480 vector_ = NULL; |
1481 } | 1481 } |
1482 } | 1482 } |
1483 inline int* vector() { return vector_; } | 1483 inline int* vector() { return vector_; } |
1484 inline int length() { return offsets_vector_length_; } | 1484 inline int length() { return offsets_vector_length_; } |
1485 | 1485 |
1486 static const int kStaticOffsetsVectorSize = 50; | 1486 static const int kStaticOffsetsVectorSize = 50; |
1487 | 1487 |
1488 private: | 1488 private: |
1489 static Address static_offsets_vector_address(Isolate* isolate) { | 1489 static Address static_offsets_vector_address(Isolate* isolate) { |
1490 return reinterpret_cast<Address>(isolate->jsregexp_static_offsets_vector()); | 1490 return reinterpret_cast<Address>(isolate->jsregexp_static_offsets_vector()); |
1491 } | 1491 } |
1492 | 1492 |
1493 int* vector_; | 1493 int* vector_; |
1494 int offsets_vector_length_; | 1494 int offsets_vector_length_; |
1495 | 1495 |
1496 friend class ExternalReference; | 1496 friend class ExternalReference; |
1497 }; | 1497 }; |
1498 | 1498 |
1499 | 1499 |
1500 } } // namespace v8::internal | 1500 } } // namespace v8::internal |
1501 | 1501 |
1502 #endif // V8_JSREGEXP_H_ | 1502 #endif // V8_JSREGEXP_H_ |
OLD | NEW |