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