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 693 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
704 typedef RegExpMacroAssemblerX64 ArchRegExpMacroAssembler; | 704 typedef RegExpMacroAssemblerX64 ArchRegExpMacroAssembler; |
705 #elif V8_TARGET_ARCH_ARM | 705 #elif V8_TARGET_ARCH_ARM |
706 typedef RegExpMacroAssemblerARM ArchRegExpMacroAssembler; | 706 typedef RegExpMacroAssemblerARM ArchRegExpMacroAssembler; |
707 #elif V8_TARGET_ARCH_MIPS | 707 #elif V8_TARGET_ARCH_MIPS |
708 typedef RegExpMacroAssemblerMIPS ArchRegExpMacroAssembler; | 708 typedef RegExpMacroAssemblerMIPS ArchRegExpMacroAssembler; |
709 #endif | 709 #endif |
710 | 710 |
711 class ContextInitializer { | 711 class ContextInitializer { |
712 public: | 712 public: |
713 ContextInitializer() | 713 ContextInitializer() |
714 : env_(), | 714 : scope_(v8::Isolate::GetCurrent()), |
715 scope_(v8::Isolate::GetCurrent()), | 715 env_(v8::Context::New(v8::Isolate::GetCurrent())), |
716 zone_(Isolate::Current()->runtime_zone(), DELETE_ON_EXIT) { | 716 zone_(Isolate::Current()->runtime_zone(), DELETE_ON_EXIT) { |
717 env_ = v8::Context::New(); | |
718 env_->Enter(); | 717 env_->Enter(); |
719 } | 718 } |
720 ~ContextInitializer() { | 719 ~ContextInitializer() { |
721 env_->Exit(); | 720 env_->Exit(); |
722 env_.Dispose(env_->GetIsolate()); | |
723 } | 721 } |
724 private: | 722 private: |
725 v8::Persistent<v8::Context> env_; | |
726 v8::HandleScope scope_; | 723 v8::HandleScope scope_; |
| 724 v8::Handle<v8::Context> env_; |
727 v8::internal::ZoneScope zone_; | 725 v8::internal::ZoneScope zone_; |
728 }; | 726 }; |
729 | 727 |
730 | 728 |
731 static ArchRegExpMacroAssembler::Result Execute(Code* code, | 729 static ArchRegExpMacroAssembler::Result Execute(Code* code, |
732 String* input, | 730 String* input, |
733 int start_offset, | 731 int start_offset, |
734 const byte* input_start, | 732 const byte* input_start, |
735 const byte* input_end, | 733 const byte* input_end, |
736 int* captures) { | 734 int* captures) { |
(...skipping 1068 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1805 ZoneList<CharacterRange> first_only(4, Isolate::Current()->runtime_zone()); | 1803 ZoneList<CharacterRange> first_only(4, Isolate::Current()->runtime_zone()); |
1806 ZoneList<CharacterRange> second_only(4, Isolate::Current()->runtime_zone()); | 1804 ZoneList<CharacterRange> second_only(4, Isolate::Current()->runtime_zone()); |
1807 ZoneList<CharacterRange> both(4, Isolate::Current()->runtime_zone()); | 1805 ZoneList<CharacterRange> both(4, Isolate::Current()->runtime_zone()); |
1808 } | 1806 } |
1809 | 1807 |
1810 | 1808 |
1811 TEST(Graph) { | 1809 TEST(Graph) { |
1812 V8::Initialize(NULL); | 1810 V8::Initialize(NULL); |
1813 Execute("\\b\\w+\\b", false, true, true); | 1811 Execute("\\b\\w+\\b", false, true, true); |
1814 } | 1812 } |
OLD | NEW |