| OLD | NEW |
| 1 // Copyright 2006-2008 the V8 project authors. All rights reserved. | 1 // Copyright 2006-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 1410 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1421 bool is_ascii); | 1421 bool is_ascii); |
| 1422 | 1422 |
| 1423 static void DotPrint(const char* label, RegExpNode* node, bool ignore_case); | 1423 static void DotPrint(const char* label, RegExpNode* node, bool ignore_case); |
| 1424 }; | 1424 }; |
| 1425 | 1425 |
| 1426 | 1426 |
| 1427 class OffsetsVector { | 1427 class OffsetsVector { |
| 1428 public: | 1428 public: |
| 1429 inline OffsetsVector(int num_registers) | 1429 inline OffsetsVector(int num_registers) |
| 1430 : offsets_vector_length_(num_registers) { | 1430 : offsets_vector_length_(num_registers) { |
| 1431 if (offsets_vector_length_ > kStaticOffsetsVectorSize) { | 1431 if (offsets_vector_length_ > Isolate::kJSRegexpStaticOffsetsVectorSize) { |
| 1432 vector_ = NewArray<int>(offsets_vector_length_); | 1432 vector_ = NewArray<int>(offsets_vector_length_); |
| 1433 } else { | 1433 } else { |
| 1434 vector_ = static_offsets_vector_; | 1434 vector_ = Isolate::Current()->jsregexp_static_offsets_vector(); |
| 1435 } | 1435 } |
| 1436 } | 1436 } |
| 1437 inline ~OffsetsVector() { | 1437 inline ~OffsetsVector() { |
| 1438 if (offsets_vector_length_ > kStaticOffsetsVectorSize) { | 1438 if (offsets_vector_length_ > Isolate::kJSRegexpStaticOffsetsVectorSize) { |
| 1439 DeleteArray(vector_); | 1439 DeleteArray(vector_); |
| 1440 vector_ = NULL; | 1440 vector_ = NULL; |
| 1441 } | 1441 } |
| 1442 } | 1442 } |
| 1443 inline int* vector() { return vector_; } | 1443 inline int* vector() { return vector_; } |
| 1444 inline int length() { return offsets_vector_length_; } | 1444 inline int length() { return offsets_vector_length_; } |
| 1445 | 1445 |
| 1446 static const int kStaticOffsetsVectorSize = 50; | |
| 1447 | |
| 1448 private: | 1446 private: |
| 1449 static Address static_offsets_vector_address() { | 1447 static Address static_offsets_vector_address(Isolate* isolate) { |
| 1450 return reinterpret_cast<Address>(&static_offsets_vector_); | 1448 return reinterpret_cast<Address>(isolate->jsregexp_static_offsets_vector()); |
| 1451 } | 1449 } |
| 1452 | 1450 |
| 1453 int* vector_; | 1451 int* vector_; |
| 1454 int offsets_vector_length_; | 1452 int offsets_vector_length_; |
| 1455 static int static_offsets_vector_[kStaticOffsetsVectorSize]; | |
| 1456 | 1453 |
| 1457 friend class ExternalReference; | 1454 friend class ExternalReference; |
| 1458 }; | 1455 }; |
| 1459 | 1456 |
| 1460 | 1457 |
| 1461 } } // namespace v8::internal | 1458 } } // namespace v8::internal |
| 1462 | 1459 |
| 1463 #endif // V8_JSREGEXP_H_ | 1460 #endif // V8_JSREGEXP_H_ |
| OLD | NEW |