| Index: src/lexer/experimental-scanner.cc
|
| diff --git a/src/icu_util.cc b/src/lexer/experimental-scanner.cc
|
| similarity index 62%
|
| copy from src/icu_util.cc
|
| copy to src/lexer/experimental-scanner.cc
|
| index b9bd65edc69ecb680a9cae4efc96ed3158543285..1e78a8e57283500ea24af0fd152e9b56c7d5ac37 100644
|
| --- a/src/icu_util.cc
|
| +++ b/src/lexer/experimental-scanner.cc
|
| @@ -25,38 +25,42 @@
|
| // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
| // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
|
| -#include "icu_util.h"
|
| +#include "experimental-scanner.h"
|
|
|
| -#if defined(_WIN32) && defined(V8_I18N_SUPPORT)
|
| -#include <windows.h>
|
| +namespace v8 {
|
| +namespace internal {
|
|
|
| -#include "unicode/putil.h"
|
| -#include "unicode/udata.h"
|
| +std::set<ScannerBase*>* ScannerBase::scanners_ = NULL;
|
|
|
| -#define ICU_UTIL_DATA_SYMBOL "icudt" U_ICU_VERSION_SHORT "_dat"
|
| -#define ICU_UTIL_DATA_SHARED_MODULE_NAME "icudt.dll"
|
| -#endif
|
| +void ScannerBase::UpdateBuffersAfterGC(v8::Isolate*, GCType, GCCallbackFlags) {
|
| + if (!scanners_) return;
|
| + for (std::set<ScannerBase*>::const_iterator it = scanners_->begin();
|
| + it != scanners_->end();
|
| + ++it)
|
| + (*it)->SetBufferBasedOnHandle();
|
| +}
|
|
|
| -namespace v8 {
|
|
|
| -namespace internal {
|
| +template<>
|
| +const uint8_t* ExperimentalScanner<uint8_t>::GetNewBufferBasedOnHandle() const {
|
| + String::FlatContent content = source_handle_->GetFlatContent();
|
| + return content.ToOneByteVector().start();
|
| +}
|
|
|
| -bool InitializeICU() {
|
| -#if defined(_WIN32) && defined(V8_I18N_SUPPORT)
|
| - // We expect to find the ICU data module alongside the current module.
|
| - HMODULE module = LoadLibraryA(ICU_UTIL_DATA_SHARED_MODULE_NAME);
|
| - if (!module) return false;
|
| -
|
| - FARPROC addr = GetProcAddress(module, ICU_UTIL_DATA_SYMBOL);
|
| - if (!addr) return false;
|
| -
|
| - UErrorCode err = U_ZERO_ERROR;
|
| - udata_setCommonData(reinterpret_cast<void*>(addr), &err);
|
| - return err == U_ZERO_ERROR;
|
| -#else
|
| - // Mac/Linux bundle the ICU data in.
|
| - return true;
|
| -#endif
|
| +
|
| +template <>
|
| +const uint16_t* ExperimentalScanner<uint16_t>::GetNewBufferBasedOnHandle()
|
| + const {
|
| + String::FlatContent content = source_handle_->GetFlatContent();
|
| + return content.ToUC16Vector().start();
|
| +}
|
| +
|
| +
|
| +template<>
|
| +const int8_t* ExperimentalScanner<int8_t>::GetNewBufferBasedOnHandle() const {
|
| + String::FlatContent content = source_handle_->GetFlatContent();
|
| + return reinterpret_cast<const int8_t*>(content.ToOneByteVector().start());
|
| }
|
|
|
| -} } // namespace v8::internal
|
| +}
|
| +}
|
|
|